<h2 class="sec_title text-uppercase color-primary fw-bold text-center mb-5">
    {{ isset($location) ? __('web.edit_address') : __('web.create_address') }}
    <img src="{{url('')}}/assets/web/images/title_line.svg" class="d-block m-auto" alt=""/>
</h2>
<form method="post" action="{{$action}}" onsubmit="formAction(this)">
    @CSRF
    <div class="row col-md-10 m-auto">
        <div class="col-md-12">
            <div class="form-group  mb-3">
                <label class="label fw-bold"> {{ __('web.country_id') }} </label>
                <select name="country_id" target-id="cities" onchange="fetchCities(this)" class="form-control form-select">
                    <option>{{__('web.select')}}</option>
                    @foreach($countries as $row)
                        <option {{ (isset($location) ? $location->country_id : '') == $row->id ? 'selected' : ''}} value="{{$row->id}}">{{$row->name}}</option>
                    @endforeach
                </select>
            </div>
        </div>
        <div class="col-md-12">
            <div class="form-group  mb-3">
                <label class="label fw-bold"> {{ __('web.city_id') }} </label>
                <select id="cities" name="city_id" class="form-control form-select">
                    <option>{{__('web.select')}}</option>
                    @if(isset($cities))
                        @foreach($cities as $row)
                            <option {{ (isset($location) ? $location->city_id : '') == $row->id ? 'selected' : ''}} value="{{$row->id}}">{{$row->name}}</option>
                        @endforeach
                    @endif
                </select>
            </div>
        </div>
        <div class="col-md-12">
            <div class="form-group  mb-3">
                <label class="label fw-bold"> {{ __('web.address') }} </label>
                <textarea rows="6" name="address" class="form-control" placeholder="{{ __('web.address') }} " >{{isset($location) ? $location->address : ''}}</textarea>
            </div>
        </div>

    </div>
    <div class="d-flex justify-content-center mt-5">
        <button type="button" class="butn btn-secondary mx-1" data-bs-dismiss="modal">{{ __('web.close') }}</button>
        <button type="submit" class="butn primary_butn mx-1">{{ isset($location) ? __('web.edit_address') : __('web.create_address') }}  </button>
    </div>
</form>
