@if ($individual->lastActiveIdCard() || $individual->lastActivePassport())
    <div class="box" id="address-mailing-form">
        <div class="box-header">
            <h5 class="box-title">{{ __('forms.MailingAddress') }}</h5>
        </div>
        <div class="box-body pb-2">
            {{-- We are updating an existing Mailing address --}}
            <form
                action="{{ route('crm.individuals.addresses.update', [$individual, $individual->lastActiveMailing->id]) }}"
                method="POST">
                @csrf
                @method('put')

                <input type="hidden" name="type" value="Mailing">

                {{-- line_1 --}}
                <div class="mb-6">
                    <label for="mailing_line_1" class="ti-form-label @error('mailing.line_1') error @enderror">
                        @error('mailing.line_1')
                            {{ $message }}
                        @else
                            {{ __('forms.Address') }}
                        @enderror
                    </label>
                    <input id="mailing_line_1" type="text" name="mailing[line_1]"
                        value="{{ old('mailing.line_1') ?? $individual->lastActiveMailing?->line_1 }}"
                        class="ti-form-input shadow-sm @error('mailing.line_1') border-red-500 @enderror"
                        placeholder="{{ __('forms.Address') }}" {{ $readonly ? 'disabled' : '' }}>
                </div>

                {{-- city_id --}}
                <div class="mb-6">
                    <label for="mailing_city_id_update" class="ti-form-label @error('mailing.city_id') error @enderror">
                        @error('mailing.city_id')
                            {{ $message }}
                        @else
                            {{ __('forms.Town') }}
                        @enderror
                    </label>
                    <select id="mailing_city_id_update"
                        class="ti-form-select py-1 @error('mailing.city_id') border-red-500 @enderror"
                        name="mailing[city_id]" {{ $readonly ? 'disabled' : '' }}>
                        <!-- Populated by Choices.js -->
                    </select>
                </div>

                @if (!$readonly)
                    <div class="flex justify-between">
                        <div></div>
                        <button type="submit" class="ti-btn ti-btn-outline-success py-1 px-3 mr-0">
                            {{ __('forms.Update') }}
                        </button>
                    </div>
                @endif
            </form>

        </div>
    </div>
@endif
