@extends('layouts.layouts_ipad.layouts_Newipad')

@section('tophead')
    Booking List
@endsection

@section('style')
    <style>
        body {
            overflow-x: hidden;
        }

        .img-pos {
            padding: 20px !important;
        }
        .bg-create {
            background: #FEF2DF;
            height: 12em;
            margin-left: -2em;
            margin-right: -2em;

        }

        .text-register {
            color: #878A99;
            font-size: 16.5px;
            font-weight: 400;
        }

        .text-register2 {
            color: #325684;
            font-size: 19px;
            font-weight: bold;
        }

        .select2-container--default .select2-selection--multiple {
            background: #2B2F34 !important;
        }
        .select2-container--default .select2-selection--multiple .select2-selection__choice{
            background-color: #9da6b15d !important;
            border: 1px solid #2B2F34 !important;
        }
    </style>
@endsection
@section('content')
<form action="{{ url('tablet/book') }}" method="post">
    @csrf
    <input type="hidden" name="event" value="edit_booking">
    <input type="hidden" name="id" value="{{ @$booking->_id }}">
    <div class="row">
        <div class="col-12">
            <span class="text-muted ms-5">Please fill in the field click "Confirm"</span>
        </div>
    </div>
    <div class="row">
        <div class="col-12">
            <hr class="border-bottom">
        </div>
    </div>
    <div class="card">
        <div class="card-body">
            <div class="row">
                <div class="col-6">
                    <div class="row">
                        <div class="col-12 m-2">
                            <h5>Booking Date :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <input type="date" class="form-control" name="date" value="{{ @$booking->date }}" style="color-scheme: dark;">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 m-2">
                            <h5>Procedure :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <select class="js-example-basic-multiple" name="procedure[]" multiple="multiple">
                                @foreach ($procedure as $proc)
                                    <option value="{{ $proc['code'] }}" {{ in_array($proc['code'], @$booking->procedure ?? []) ? 'selected' : '' }}>{{ $proc['name'] }}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 m-2">
                            <h5>Physician :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <select class="form-select" name="physician">
                        @foreach ($doctor as $doc)
                            <option value="{{ $doc['id'] }}" {{ @$booking->physician == $doc['id'] ? 'selected' : '' }}>{{ fullname($doc) }}</option>
                        @endforeach
                    </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 m-2">
                            <h5>Type of patient case :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <select class="form-select" name="type_of_patient_care" >
                                <option value="">Select</option>
                                <option value="IPD" {{ @$booking->patient_type == 'IPD' ? 'selected' : '' }}>IPD</option>
                                <option value="OPD" {{ @$booking->patient_type == 'OPD' ? 'selected' : '' }}>OPD</option>
                                <option value="rpc" {{ @$booking->patient_type == 'rpc' ? 'selected' : '' }}>รพช.</option>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12 m-2">
                            <h5>Treatment coverage :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <select class="form-select" name="treatment_coverage">
                                <option value="">Select</option>
                                @foreach ($treatment as $treatment)
                                    <option value="{{ $treatment['code'] }}" {{ @$booking->treatment == $treatment['code'] ? 'selected' : '' }}>{{ $treatment['name'] }}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-6">
                    <div class="row">
                        <div class="col-12 m-2">
                            <h5>Period :</h5>
                        </div>
                        <div class="col-12 m-2 mt-3">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="period" id="service" value="am"
                                    {{ @$booking->period == 'am' ? 'checked' : '' }}>
                                <label class="form-check-label" for="service">Service</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="period" id="special" value="pm"
                                    {{ @$booking->period == 'pm' ? 'checked' : '' }}>
                                <label class="form-check-label" for="special">Special</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="period" id="premium" value="ot"
                                    {{ @$booking->period == 'ot' ? 'checked' : '' }}>
                                <label class="form-check-label" for="premium">Premium</label>
                            </div>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12 m-2 ">
                            <h5>Anesthesia :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="checkbox" name="anesthesia[]" id="ga"
                                    value="GA" {{ in_array('GA', @$booking->anesthesia ?? []) ? 'checked' : '' }}>
                                <label class="form-check-label" for="ga">GA</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="checkbox" name="anesthesia[]" id="sedation"
                                    value="Sedation" {{ in_array('Sedation', @$booking->anesthesia ?? []) ? 'checked' : '' }}>
                                <label class="form-check-label" for="sedation">Sedation</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="checkbox" name="anesthesia[]" id="la"
                                    value="LA" {{ in_array('LA', @$booking->anesthesia ?? []) ? 'checked' : '' }}>
                                <label class="form-check-label" for="la">LA</label>
                            </div>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12 m-2">
                            <h5>Special :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="checkbox" name="special[]" id="flu"
                                    value="Flu" {{ in_array('Flu', @$booking->special ?? []) ? 'checked' : '' }}
                                    >
                                <label class="form-check-label" for="flu">Flu</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="checkbox" name="special[]" id="spyglass"
                                    value="Spyglass" {{ in_array('Spyglass', @$booking->special ?? []) ? 'checked' : '' }}>
                                <label class="form-check-label" for="spyglass">Spyglass</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="checkbox" name="special[]" id="laser"
                                    value="Laser" {{in_array('Laser', @$booking->special ?? []) ? 'checked' : ''}}>
                                <label class="form-check-label" for="laser">Laser</label>
                            </div>
                        </div>
                    </div>
                    <div class="row mt-3">
                        <div class="col-12 m-2 ">
                            <h5>Urgent :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="urgent" id="elective" value="elective"
                                    {{ @$booking->urgent == 'elective' ? 'checked' : '' }}>
                                <label class="form-check-label" for="elective">Elective</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="urgent" id="urgency" value="urgency"
                                    {{ @$booking->urgent == 'urgency' ? 'checked' : '' }}>
                                <label class="form-check-label" for="urgency">Urgency</label>
                            </div>
                            <div class="form-check form-check-inline">
                                <input class="form-check-input" type="radio" name="urgent" id="emergency" value="emergency"
                                    {{ @$booking->urgent == 'emergency' ? 'checked' : '' }}>
                                <label class="form-check-label" for="emergency">Emergency</label>
                            </div>
                        </div>
                    </div>
                    <div class="row mt-3">
                        <div class="col-12 m-2">
                            <h5>Description :</h5>
                        </div>
                        <div class="col-8 m-2">
                            <textarea class="form-control" name="description" id="description" rows="1">{{ @$booking->description }}</textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row text-end">
        <div class="col-12 mt-4">
            <button type="submit" class="btn btn-primary btn-label waves-effect right waves-light btn-md"><i class=" ri-check-double-line label-icon align-middle fs-16 ms-2"></i>Confirm </button>
        </div>
    </div>
</form>
@endsection

@section('script')
<script>
    $(document).ready(function() {
        $('.js-example-basic-multiple').select2();
    });
</script>
@endsection
