@props(['employee' => null, 'countryOptions' => []])

@php
    $addr = $employee?->address;
@endphp

<div class="row g-3" data-geo-cascade>
    <div class="col-md-4">
        <x-ui.form.search-select
            name="address_country_id"
            lookup="countries"
            :label="__('employees.fields.address_country')"
            :options="$countryOptions"
            :selected="old('address_country_id', $addr?->country_id)"
            :placeholder="__('employees.placeholders.address_country')"
            optional
        />
    </div>
    <div class="col-md-4">
        <x-ui.form.search-select
            name="address_region_id"
            lookup="regions"
            lookup-parent="address_country_id"
            :label="__('employees.fields.address_state')"
            :options="[]"
            :selected="old('address_region_id', $addr?->region_id)"
            :placeholder="__('employees.placeholders.address_state')"
            optional
        />
    </div>
    <div class="col-md-4">
        <x-ui.form.search-select
            name="address_city_id"
            lookup="cities"
            lookup-parent="address_region_id"
            :label="__('employees.fields.address_city')"
            :options="[]"
            :selected="old('address_city_id', $addr?->city_id)"
            :placeholder="__('employees.placeholders.address_city')"
            optional
        />
    </div>
    <div class="col-12">
        <x-ui.form.input
            name="address_street"
            :label="__('employees.fields.address_street')"
            :value="$addr?->street"
            :placeholder="__('employees.placeholders.address_street')"
        />
    </div>
    <div class="col-md-6">
        <x-ui.form.input
            name="address_postal_code"
            :label="__('employees.fields.address_postal_code')"
            :value="$addr?->postal_code"
        />
    </div>
    <div class="col-md-6">
        <x-ui.form.input
            name="address_building_number"
            :label="__('employees.fields.address_building_number')"
            :value="$addr?->building_number"
            :placeholder="__('employees.placeholders.address_building_number')"
        />
    </div>
    <div class="col-md-6">
        <x-ui.form.input
            name="address_location_link"
            :label="__('employees.fields.address_location_link')"
            :value="$addr?->location_link"
            :placeholder="__('employees.placeholders.address_location_link')"
        />
    </div>
</div>

@once
    @push('scripts')
        <script src="{{ asset('assets/admin/js/erp-geo-cascade.js') }}"></script>
    @endpush
@endonce
