<x-app-layout>
    @section('title')
        Doctors
    @endsection

    <div class="row">
        <div class="col-lg-12 m-auto">
            <!-- Page Heading -->
            <h1 class="h3 mb-2 text-gray-800">
                <a href="{{ route('admin.doctors.index') }}" class="btn btn-primary"><i class="fas fa-plus"
                        aria-hidden="true"></i>
                    Listing Doctors
                </a>
            </h1>
            <!-- DataTales Example -->
            <div class="card shadow mb-4">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">
                        Listing Doctors Table
                    </h6>
                </div>
                <div class="card-body">
                    <form role="form" method="post" action="{{ route('admin.doctors.update', $data->id) }}"
                        class="needs-validation" novalidate>
                        {{ csrf_field() }}
                        @method('PUT')
                        <div class="box-body">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="form-group">
                                        <label class="mb-0">Service name <span class="text-danger">*</span></label>

                                        <select name="service_id" id="service_id" class="form-control" required>
                                            @foreach ($services as $service)
                                                <option value="{{ $service->id }}"
                                                    {{ $data->service_id == $service->id ? 'selected' : '' }}>
                                                    {{ $service->name }}</option>
                                            @endforeach
                                        </select>
                                        @error('service_id')
                                            <span class="text-danger">{{ $message }}</span>
                                        @enderror
                                    </div>
                                </div>

                                <div class="col-sm-12">
                                    <div class="form-group">
                                        <label class="mb-0">Doctor name <span class="text-danger">*</span></label>
                                        <input type="text" name="name"
                                            class="form-control @error('name') is-invalid @enderror"
                                            placeholder="Services name" value="{{ $data->name }}" required />
                                        @error('name')
                                            <span class="text-danger">{{ $message }}</span>
                                        @enderror
                                    </div>
                                </div>

                                <div class="col-sm-12">
                                    <div class="form-group">
                                        <label for="status" class="mb-0">Services Status <span
                                                class="text-danger">*</span></label>
                                        <select name="status" id="status"
                                            class="form-control @error('status') is-invalid @enderror">
                                            <option value="1" {{ @$data->status == 1 ? 'selected' : '' }}>
                                                Active
                                            </option>
                                            <option value="0" {{ @$data->status == 0 ? 'selected' : '' }}>
                                                Inactive
                                            </option>
                                        </select>
                                        @error('status')
                                            <span class="text-danger">{{ $message }}</span>
                                        @enderror
                                    </div>
                                </div>

                            </div>
                        </div>
                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary">Update</button>

                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</x-app-layout>
