<x-app-layout>
    @section('title')
        Schedule
    @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.times.index') }}" class="btn btn-primary"><i class="fas fa-plus"
                        aria-hidden="true"></i>
                    Listing Schedule
                </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">
                        Edit Schedule
                    </h6>
                </div>
                <div class="card-body">
                    <form role="form" method="post" action="{{ route('admin.times.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">Doctor name <span class="text-danger">*</span></label>

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

                                <div class="col-sm-12">
                                    <div class="form-group">
                                        <label class="mb-0">Schedule name <span class="text-danger">*</span></label>
                                        <input type="text" name="name"
                                            class="form-control @error('name') is-invalid @enderror"
                                            placeholder="9:00am to 9:44am" 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">Schedule 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>
