<div id="subFormModal" class="modal modal-lg fade" data-bs-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content rounded-1">
            <form id="subForm" class="mb-0" novalidate>
                <div class="modal-header">
                    <h5 class="modal-title ms-2">
                        <span class="form-create">Add</span>
                        <span class="form-edit">Edit</span>
                        Subscription
                    </h5>
                </div>
                <div class="modal-body p-4">
                    <input type="hidden" id="subId" name="subId">
                    <div class="row">
                        <div class="col-lg-6 pe-lg-4">
                            <div class="mb-4">
                                <label for="subName" class="form-label">Name</label>
                                <input type="text" id="subName" name="subName" class="form-control rounded-1" placeholder="My News Feed" tabindex="1">
                                <div class="form-text">Use a unique name to refer to this subscription.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 ps-lg-4">
                            <div class="mb-4">
                                <label for="subUrl" class="form-label">URL</label>
                                <input type="url" id="subUrl" name="subUrl" class="form-control rounded-1" placeholder="http://example.com/rss.xml" tabindex="2">
                                <div class="form-text">Must point to a valid <a href="https://en.wikipedia.org/wiki/RSS" class="text-decoration-none">RSS</a> feed.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 pe-lg-4">
                            <div class="mb-4">
                                <label for="subChannels" class="form-label">Channels</label>
                                <select name="subChannels" id="subChannels" class="select-2" multiple data-dropdownparent="#subFormModal" tabindex="3"></select>
                                <div class="form-text">Subscription content will be sent to these channels.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 ps-lg-4">
                            <div class="mb-4">
                                <label for="subFilters" class="form-label">Filters</label>
                                <select name="subFilters" id="subFilters" class="select-2" multiple data-dropdownparent="#subFormModal" tabindex="4"></select>
                                <div class="form-text">Filters to apply to this subscription's content.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 pe-lg-4">
                            <div class="mb-4 mb-lg-0">
                                <label for="subExtraNotes" class="form-label">Extra Notes</label>   
                                <textarea id="subExtraNotes" name="subExtraNotes" class="form-control rounded-1" placeholder="" tabindex="5" style="resize: none; height: 7rem"></textarea>
                            </div>
                        </div>
                        <div class="col-lg-6 ps-lg-4">
                            <div class="form-switch mb-4 ps-0">
                                <label for="subActive" class="form-check-label mb-2">Active</label>
                                <br>
                                <input type="checkbox" id="subActive" name="subActive" class="form-check-input ms-0 mt-0" tabindex="6">
                                <br>
                                <div class="form-text">Inactive subscriptions wont be processed.</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer px-4">
                    <!-- form-create -->
                    <button type="button" id="devGenerateSub" class="btn btn-outline-info rounded-1 me-3 ms-0 d-none" tabindex="7">&#40;Dev&#41; Generate</button>
                    <button type="button" id="deleteEditSub" class="btn btn-danger rounded-1 me-3 ms-0 form-edit" tabindex="8">Delete</button>
                    <button type="button" class="btn btn-outline-primary rounded-1 me-auto ms-0" data-bs-toggle="modal" data-bs-target="#subAdvancedModal" tabindex="9">Advanced</button>
                    <button type="submit" class="btn btn-primary rounded-1 me-0" tabindex="9">
                        <span class="form-create">Create</span>
                        <span class="form-edit">Confirm Edit</span>
                    </button>
                    <button type="button" class="btn btn-secondary rounded-1 me-0 ms-3" data-bs-dismiss="modal" tabindex="10">Cancel</button>
                </div>
            </form>
        </div>
    </div>
</div>

<div id="subAdvancedModal" class="modal modal-lg fade" data-bs-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content rounded-1">
            <form id="subAdvancedForm" class="mb-0" novalidate>
                <div class="modal-header">
                    <h5 class="modal-title ms-2">
                        <span class="form-create">Add</span>
                        <span class="form-edit">Edit</span>
                        Subscription · Advanced
                    </h5>
                </div>
                <div class="modal-body p-4">
                    <div class="row">
                        <div class="col-lg-6 pe-lg-4">
                            <div class="mb-4">
                                <label for="subTitleMutators" class="form-label">Title Mutators</label>
                                <select name="subTitleMutators" id="subTitleMutators" class="select-2 sub-mutators-field" multiple data-dropdownparent="#subAdvancedModal" tabindex="6"></select>
                                <div class="form-text">Apply mutators to article titles.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 ps-lg-4">
                            <div class="mb-4">
                                <label for="subDescMutators" class="form-label">Description Mutators</label>
                                <select name="subDescMutators" id="subDescMutators" class="select-2 sub-mutators-field" multiple data-dropdownparent="#subAdvancedModal" tabindex="6"></select>
                                <div class="form-text">Apply mutators to article descriptions.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 pe-lg-4 d-none">
                            <div class="mb-4">
                                <label for="" class="form-label">Article Fetch Limit</label>
                                <input type="number" id="subFetchLimit" class="form-control rounded-1" max="10" min="1">
                                <div class="form-text">Limit the number of articles fetched every cycle.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 ps-lg-4 d-none">
                            <div class="form-switch ps-0 mb-4">
                                <label for="subResetFetchLimit" class="form-check-label mb-2">Max Fetch Limit after the First Cycle</label>
                                <br>
                                <input type="checkbox" id="subResetFetchLimit" name="subResetFetchLimit" class="form-check-input ms-0 mt-0" tabindex="6">
                                <br>
                                <div class="form-text">Sets the Fetch Limit to 10 after the first cycle. Helps with initial spam.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 pe-lg-4">
                            <div class="mb-4">
                                <label for="subEmbedColour" class="form-label">Embed Colour</label>
                                <div class="input-group">
                                    <input type="color" name="subEmbedColour" id="subEmbedColour" class="form-control-color input-group-text">
                                    <input type="text" name="subEmbedColourText" id="subEmbedColourText" class="form-control">
                                    <button type="button" id="subResetEmbedColour" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-title="Reset Colour">
                                        <i class="bi bi-arrow-clockwise"></i>
                                    </button>
                                    <button type="button" id="subRandomEmbedColour" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-title="Random Colour">
                                        <i class="bi bi-dice-5"></i>
                                    </button>
                                </div>
                                <div class="form-text">Colour of each embed in Discord.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 ps-lg-4">
                            <div class="mb-4">
                                <label for="subPubThreshold" class="form-label">Publish Datetime Threshold</label>
                                <input type="datetime-local" name="subPubThreshold" id="subPubThreshold" class="form-control">
                                <div class="form-text">RSS content older than this datetime will be skipped.</div>
                            </div>
                        </div>
                        <div class="col-lg-6 pe-lg-4">
                            <div class="form-switch ps-0">
                                <label for="subArticleFetchImage" class="form-check-label mb-2">Show Images on Embed?</label>
                                <br>
                                <input type="checkbox" id="subArticleFetchImage" name="subArticleFetchImage" class="form-check-input ms-0 mt-0" tabindex="6">
                                <br>
                                <div class="form-text">Show images on the discord embed?</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer px-4">
                    <button type="button" class="btn btn-primary rounded-1 me-0 ms-3" data-bs-toggle="modal" data-bs-target="#subFormModal">Back</button>                    
                </div>
            </form>
        </div>
    </div>
</div>
