<div id="modify_modal" x-data="{modal: null}">
    <dialog class="modal" x-ref="modal" x-init="$refs.modal.showModal()" @close="$refs.modal.remove()">
        <div class="modal-box">
            <h3 class="text-lg font-bold pb-2">Modify RSS Feed subscription</h3>
            <form method="dialog">
                <button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
            </form>
            <form id="modify_form" hx-put="/feed/{{feed.id}}" hx-target="#feed_{{feed.id}}" hx-swap="outerHTML"
                  hx-indicator="#mod_indicator"
                  @htmx:after-on-load="$refs.modal.close()">
                <fieldset class="fieldset gap-2">
                    <label class="floating-label">
                        <span>Name</span>
                        <input type="text" name="name" value="{{feed.name}}" class="input input-md w-full" placeholder="Name">
                    </label>
                    <label class="floating-label">
                        <span>Feed URL</span>
                        <input type="url" name="feed_url" value="{{feed.feed_url}}" class="input input-md w-full" placeholder="Feed URL">
                    </label>
                </fieldset>
                <div class="modal-action">
                    <button class="btn btn-primary" form="modify_form" type="submit">
                        Submit
                        <img id="mod_indicator" class="htmx-inline htmx-indicator" src="/assets/oval.svg"
                             style="height: 1rem; margin-left: 2px" alt="...">
                    </button>
                </div>
            </form>
        </div>
        <form method="dialog" class="modal-backdrop">
            <button>close</button>
        </form>
    </dialog>
</div>