@extends('admin.layouts.app')
@section('container', 'dashboard-container-sm')
@section('section', d_trans('Countries'))
@section('title', d_trans('Cities'))
@section('header_title', d_trans('Edit City'))
@section('back', route('admin.settings.countries.cities.index'))
@section('form', true)
@section('content')
    <form id="submittedForm" action="{{ route('admin.settings.countries.cities.update', $city->id) }}" method="POST">
        @csrf
        @method('PUT')
        <div class="card p-2">
            <div class="card-body">
                <div class="row g-3 row-cols-1 mb-2">
                    <div class="col">
                        <label class="form-label">{{ d_trans('Name') }} </label>
                        <input type="text" name="name" class="form-control form-control-md" value="{{ $city->name }}"
                            required />
                    </div>
                    <div class="col">
                        <label class="form-label">{{ d_trans('State') }} </label>
                        <select name="state" class="selectpicker selectpicker-md" title="{{ d_trans('State') }}"
                            data-live-search="true">
                            @foreach ($states as $state)
                                <option value="{{ $state->id }}" @selected($state->id == $city->state_id)>
                                    {{ $state->name }}
                                </option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
        </div>
    </form>
    @push('styles_libs')
        <link rel="stylesheet" href="{{ asset('vendor/libs/bootstrap/select/bootstrap-select.min.css') }}">
    @endpush
    @push('scripts_libs')
        <script src="{{ asset('vendor/libs/bootstrap/select/bootstrap-select.min.js') }}"></script>
    @endpush
@endsection
