<div data-te-modal-init class="fixed left-0 top-0 z-[1055] hidden h-full w-full overflow-y-auto overflow-x-hidden outline-none" id="modalEditEpisode" tabindex="-1" aria-labelledby="Upload" aria-modal="true" role="dialog">
    <div data-te-modal-dialog-ref class="pointer-events-none relative flex min-h-[calc(100%-1rem)] w-auto translate-y-[-50px] items-center opacity-0 transition-all duration-300 ease-in-out min-[576px]:mx-auto min-[576px]:mt-7 min-[576px]:min-h-[calc(100%-3.5rem)] min-[576px]:max-w-[95%] md:min-[576px]:max-w-[90%] lg:min-[576px]:max-w-[80%] xl:min-[576px]:max-w-[70%]  2xl:min-[576px]:max-w-[50%]">
        <div class="flex relative flex-col w-full text-current bg-clip-padding bg-white rounded-md border-none shadow-lg outline-none pointer-events-auto dark:bg-neutral-800">
            <x-modal-header :title="__('Edit Episode')"/>

            <!--Modal body-->
            <div class="relative p-4 pt-0">
                <form method="POST" action="{{ route('admin.edit') }}" enctype="multipart/form-data">
                    @csrf
                    <div class="grid grid-cols-3">
                        <div class="col-span-2">
                                <!-- Tags -->
                                <div class="row-span-2 p-0">
                                    <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="tags">Tags:</label>
                                    <x-text-input id="tags" class="block w-full" type="text" name="tags" required />
                                </div>
                        </div>

                        <div class="grid grid-rows-2">
                            <!-- Studio -->
                            <div class="p-2 pt-0">
                                <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="studio">Studio:</label>
                                <x-text-input id="studio" class="block w-full" type="text" name="studio" value="{{ $episode->studio->name }}" required />
                            </div>

                            <div class="grid grid-cols-3">
                                <!-- Interpolation -->
                                <div class="p-2 pt-0">
                                    <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="interpolated">Interpolated:</label>
                                    <select class="block w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900" name="interpolated" id="interpolated" required>
                                        <option value="yes" @if ($episode->interpolated == true) selected @endif>Yes</option>
                                        <option value="no" @if ($episode->interpolated == false) selected @endif>No</option>
                                    </select>
                                </div>
                                <!-- DVD -->
                                <div class="p-2 pt-0">
                                    <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="dvd">DVD Aspect:</label>
                                    <select class="block w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900" name="dvd" id="dvd" required>
                                        <option value="yes" @if ($episode->is_dvd_aspect == true) selected @endif>Yes</option>
                                        <option value="no" @if ($episode->is_dvd_aspect == false) selected @endif>No</option>
                                    </select>
                                </div>
                                <!-- Date -->
                                <div class="p-2 pt-0">
                                    <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="releasedate">Release Date:</label>
                                    <input class="block w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900" type="date" name="releasedate" id="releasedate" value="{{ $episode->release_date }}" required>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Stream URL -->
                    <div class="p-2 pt-0">
                        <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="baseurl">Stream:</label>
                        <x-text-input id="baseurl" class="block w-full" type="text" name="baseurl" value="{{ $episode->url }}" required />
                    </div>

                    <input name="episode_id" id="episode_id" type="hidden" value="{{ $episode->id }}" />

                    <div class="p-2 pt-0">
                        <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="description">Description:</label>
                        <textarea rows="4" cols="50" id="description" name="description" class="block mt-1 w-full rounded-md border-gray-300 shadow-sm dark:border-gray-700 dark:bg-neutral-900 dark:text-gray-300 focus:border-rose-500 dark:focus:border-rose-600 focus:ring-rose-500 dark:focus:ring-rose-600" required>{{ $episode->description }}</textarea>
                    </div>

                    <!-- Episodes -->
                    <div class="grid grid-cols-2">
                        <!-- Cover -->
                        <div class="p-2 pt-0">
                            <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="episodecover1">Cover 1:</label>
                            <input class="block w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900" type="file" name="episodecover1" id="episodecover1">
                        </div>
                        <!-- Thumbs -->
                        <div class="p-2 pt-0">
                            <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="episodegallery1">Gallery 1:</label>
                            <input class="block w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900" type="file" name="episodegallery1[]" id="episodegallery1" multiple="">
                        </div>
                    </div>

                    <div class="p-2 pt-0">
                        <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="episodedlurl1">Download 1080p:</label>
                        <x-text-input id="episodedlurl1" class="block w-full" type="text" name="episodedlurl1" value="{{ $episode->getDownloadByType('FHD')->url ?? '' }}" required />
                    </div>

                    <div class="p-2 pt-0">
                        <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="episodedlurlinterpolated1">Download 1080p Interpolated:</label>
                        <x-text-input id="episodedlurlinterpolated1" class="block w-full" type="text" name="episodedlurlinterpolated1" value="{{ $episode->getDownloadByType('FHDi')->url ?? '' }}" />
                    </div>

                    <div class="p-2 pt-0">
                        <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="episodedlurl4k1">Download 4k:</label>
                        <x-text-input id="episodedlurl4k1" class="block w-full" type="text" name="episodedlurl4k1" value="{{ $episode->getDownloadByType('UHD')->url ?? '' }}" />
                    </div>

                    <div class="p-2 pt-0">
                        <label class="w-full leading-tight text-gray-800 dark:text-gray-200" for="downloadUHDi1">Download 4k Interpolated:</label>
                        <x-text-input id="downloadUHDi1" class="block w-full" type="text" name="downloadUHDi1" value="{{ $episode->getDownloadByType('UHDi')->url ?? '' }}" />
                    </div>

                    <div class="flex flex-wrap flex-shrink-0 justify-end items-center p-4 rounded-b-md">
                        <button type="button" class="inline-block px-6 pt-2.5 pb-2 text-xs font-medium leading-normal uppercase rounded transition duration-150 ease-in-out bg-primary-100 text-primary-700 hover:bg-primary-accent-100 focus:bg-primary-accent-100 focus:outline-none focus:ring-0 active:bg-primary-accent-200" data-te-modal-dismiss data-te-ripple-init data-te-ripple-color="light">
                            Cancel
                        </button>
                        <button type="submit" class="inline-block px-6 pt-2.5 pb-2 ml-1 text-xs font-medium leading-normal text-white uppercase bg-rose-600 rounded transition duration-150 ease-in-out hover:bg-rose-700 focus:bg-rose-600" data-te-ripple-init data-te-ripple-color="light">
                            Edit
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- Modals JS -->
    @vite(['resources/js/admin-edit.js'])
</div>
