@php($title = 'Жилой комплекс «' . $complex->name . '»')
@php($backUrl = route('admin.complexes'))
@extends('layouts.admin')
@section('content')
    <div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 p-3">
        <h4 class="fw-bold my-3">
            Редактирование
        </h4>
        <form action="{{ route('admin.complexes.update', ['complex' => $complex]) }}" method="post"
            enctype="multipart/form-data">
            @csrf
            <div class="mb-3">
                <label for="nameFormControl" class="form-label">Название</label>
                <input type="text" class="form-control" id="nameFormControl" name="name" value="{{ $complex->name }}">
                @error('name')
                    <div class="text-danger">{{ $message }}</div>
                @enderror
            </div>
            <div class="mb-3">
                <label for="cityFormControl" class="form-label">Город</label>
                <select class="form-select" name="city_id" id="cityFormControl">
                    @foreach ($cities as $city)
                        <option value="{{ $city->id }}" @if ($city->id == $complex->city_id) selected @endif>
                            {{ $city->name }}</option>
                    @endforeach
                </select>
                @error('city_id')
                    <div class="text-danger">{{ $message }}</div>
                @enderror
            </div>

            <button type="submit" class="btn btn-primary">Сохранить</button>
            <a class="btn btn-secondary" href="{{ route('admin.complexes') }}">Отмена</a>

        </form>
    </div>
@endsection
