@if ($company)
	<div class="box" id="address-residence-form">
		<div class="box-header">
			<h5 class="box-title">{{ __('forms.BusinessAddress') }}</h5>
		</div>
		<div class="box-body pb-2">
			{{-- Update the action route accordingly, e.g., route('addresses.store') --}}
			<form action="{{ route('crm.companies.addresses.storeResidence', $company) }}" method="POST">
				@csrf

				{{-- Hidden field for the Address type --}}
				<input type="hidden" name="type" value="Residence">

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

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

				@if (!$readonly)
					<div class="flex justify-between">
						<div>
							@if (session()->has('message'))
								<div class="mt-4 text-green-600">
									{{ session('message') }}
								</div>
							@endif
						</div>
						<button type="submit" class="ti-btn ti-btn-outline-success py-1 px-3 mr-0">
							<span>{{ __('forms.Save') }}</span>
						</button>
					</div>
				@endif
			</form>

		</div>
	</div>
@endif
