{{--<x-dialog-modal wire:model.live="confirmingLocationCreation">--}}
{{--    <x-slot name="title">{{ $parentLocation ? 'افزودن اتاق' : 'ایجاد ساختمان جدید' }}</x-slot>--}}
{{--    <x-slot name="content">--}}
{{--        <div class="space-y-4">--}}
{{--            <div>--}}
{{--                <x-label for="newLocationType" value="نوع مکان" />--}}
{{--                <select id="newLocationType" wire:model.live="newLocationType" class="mt-1 block w-full form-select" disabled>--}}
{{--                    <option value="">{{ $parentLocation ? 'اتاق' : 'ساختمان' }}</option>--}}
{{--                </select>--}}
{{--            </div>--}}
{{--            <div>--}}
{{--                <x-label for="newLocationName" value="نام" />--}}
{{--                <x-input id="newLocationName" type="text" class="mt-1 block w-full" wire:model.defer="newLocationName" />--}}
{{--                <x-input-error for="newLocationName" class="mt-2" />--}}
{{--            </div>--}}
{{--        </div>--}}
{{--    </x-slot>--}}
{{--    <x-slot name="footer">--}}
{{--        <x-secondary-button wire:click="$set('confirmingLocationCreation', false)">انصراف</x-secondary-button>--}}
{{--        <x-button class="ms-3" wire:click="saveLocation">ذخیره</x-button>--}}
{{--    </x-slot>--}}
{{--</x-dialog-modal>--}}
{{--<x-dialog-modal wire:model.live="confirmingLocationCreation">--}}
{{--    <x-slot name="title">{{ $parentLocation ? 'افزودن اتاق به ' . $parentLocation->name : 'ایجاد ساختمان جدید' }}</x-slot>--}}
{{--    <x-slot name="content">--}}
{{--        <div class="space-y-4">--}}
{{--            --}}{{-- [FIXED] Show Team Selector only when creating a new Building --}}
{{--            @if(!$parentLocation)--}}
{{--                <div>--}}
{{--                    <x-label for="locationTeamId" value="تیم تحقیقاتی" />--}}
{{--                    <select id="locationTeamId" wire:model.defer="locationTeamId" class="mt-1 block w-full form-select">--}}
{{--                        <option value="">انتخاب کنید...</option>--}}
{{--                        @foreach($managedTeams as $team)--}}
{{--                            <option value="{{ $team->id }}">{{ $team->name }}</option>--}}
{{--                        @endforeach--}}
{{--                    </select>--}}
{{--                    <x-input-error for="locationTeamId" class="mt-2" />--}}
{{--                </div>--}}
{{--            @endif--}}

{{--            <div>--}}
{{--                <x-label for="newLocationType" value="نوع مکان" />--}}
{{--                <select id="newLocationType" wire:model.defer="newLocationType" class="mt-1 block w-full form-select bg-gray-100 dark:bg-gray-700" disabled>--}}
{{--                    --}}{{-- The component logic sets the correct type automatically --}}
{{--                    <option value="{{ $parentLocation ? 'room' : 'building' }}">{{ $parentLocation ? 'اتاق' : 'ساختمان' }}</option>--}}
{{--                </select>--}}
{{--            </div>--}}
{{--            <div>--}}
{{--                <x-label for="newLocationName" value="نام" />--}}
{{--                <x-input id="newLocationName" type="text" class="mt-1 block w-full" wire:model.defer="newLocationName" />--}}
{{--                <x-input-error for="newLocationName" class="mt-2" />--}}
{{--            </div>--}}
{{--        </div>--}}
{{--    </x-slot>--}}
{{--    <x-slot name="footer">--}}
{{--        <x-secondary-button wire:click="$set('confirmingLocationCreation', false)">انصراف</x-secondary-button>--}}
{{--        <x-button class="ms-3" wire:click="saveLocation">ذخیره</x-button>--}}
{{--    </x-slot>--}}
{{--</x-dialog-modal>--}}
{{-- modal-location-form.blade.php --}}
<x-dialog-modal wire:model.live="confirmingLocationCreation">
    <x-slot name="title">
        <h3 class="text-xl font-bold text-gray-800 dark:text-gray-200">
            @if($parentLocation)
                افزودن اتاق به: <span class="text-blue-600">{{ $parentLocation->name }}</span>
            @else
                ایجاد ساختمان جدید
            @endif
        </h3>
    </x-slot>

    <x-slot name="content">
        <div class="space-y-5">
            {{-- Show Team Selector only when creating a new Building --}}
            @if(!$parentLocation)
                <div>
                    <x-label for="locationTeamId" value="تیم تحقیقاتی" />
                    <select id="locationTeamId" wire:model.defer="locationTeamId" class="mt-1 block w-full form-select">
                        <option value="">انتخاب کنید...</option>
                        @foreach($managedTeams as $team)
                            <option value="{{ $team->id }}">{{ $team->name }}</option>
                        @endforeach
                    </select>
                    <x-input-error for="locationTeamId" class="mt-2" />
                </div>
            @endif

            <div>
                <x-label for="newLocationType" value="نوع مکان" />
                {{-- This field is disabled but styled to look clean --}}
                <div class="mt-1 block w-full px-3 py-2 bg-gray-100 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-gray-500 dark:text-gray-400">
                    {{ $parentLocation ? 'اتاق' : 'ساختمان' }}
                </div>
                <input type="hidden" wire:model.defer="newLocationType" value="{{ $parentLocation ? 'room' : 'building' }}">
            </div>
            <div>
                <x-label for="newLocationName" value="نام مکان" />
                <x-input id="newLocationName" type="text" class="mt-1 block w-full" wire:model.defer="newLocationName" placeholder="{{ $parentLocation ? 'مثلا: یخچال شماره ۱' : 'مثلا: ساختمان آزمایشگاه مرکزی' }}" />
                <x-input-error for="newLocationName" class="mt-2" />
            </div>
        </div>
    </x-slot>

    <x-slot name="footer">
        <div class="flex justify-start gap-4">
            <x-button class="ms-3" wire:click="saveLocation">ذخیره</x-button>
            <x-secondary-button wire:click="$set('confirmingLocationCreation', false)">انصراف</x-secondary-button>
        </div>
    </x-slot>
</x-dialog-modal>
