
<!-- Modal Add Test Result -->
<div class="modal fade modal-primary" id="modal-add-test-result" >
    <div class="modal-dialog modal-dialog-scrollable m-auto modal-xxl">
        <div class="modal-content vh-100__" style="height:calc(100vh - 80px)" role="document">
            <div class="modal-header">
                <h6 class="modal-title">{{__('sample.add_result_title')}}</h6>
                <span class="pl-4 text-muted text-uppercase">{{__('sample.form_sample_number')}}: <b class="pl-1 sample-number text-info">-</b></span>
                <span class="pl-3 text-muted text-uppercase">{{__('sample.form_patient_name')}}: <b class="pl-1 patient-name text-info">-</b></span>
                <span class="pl-4 text-muted text-uppercase">{{__('sample.form_patient_code')}}: <b class="pl-1 patient-code text-info">-</b></span>
                <span class="pl-3 text-muted text-uppercase">{{__('sample.physician_name')}}: <b class="pl-1 sample-source text-info">-</b></span>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" class="mdi mdi-close"></span></button>
            </div>

            <div class="modal-body bg-white">
                <form id="form-add-test-result" method="post" action="{{url('sample/add-test-result')}}" onkeydown="return (event.key != 'Enter' || (event.target.matches('textarea')));" class="mb-5">
                    @csrf
                    <input type="hidden" class="form-control" name="sample_id" id="sample-id" value="0" />
                    <div class="form-vertical table-responsive">
                        <div class="row_">
                            <table class="table table-striped table-bordered border">
                                <thead>
                                    <tr class="bg-success text-white result-item">
                                        <th class="py-2">{{__('sample.add_result_test')}}
                                            <input type="hidden" id="result-0" class="T0" value="{{$agedy}}">
                                            <input type="hidden" id="result-00" class="T-00" value="{{($sample->patient->gender==1 ? 1 : 0.742)}}">
                                        </th>
                                        <th width="15%" class="py-2 text-center">{{__('sample.add_result_result')}}</th>
                                        <th width="5%" class="py-2 text-center">{{__('sample.add_result_unit_sign')}}</th>
                                        <th width="6%" class="py-2 text-center">{{__('sample.add_result_ref_range')}}</th>
                                        <th width="10%" class="py-2 text-center">{{__('sample.add_result_test_date')}}</th>
                                        <th width="10%" class="py-2 text-center">{{__('sample.add_result_performed_by')}}</th>
                                        <th width="15%" class="py-2 text-center">{{__('comment.table_name')}}</th>
                                        <th width="3%" class="py-2">{{__('sample.add_result_hide')}}</th>
                                    </tr>
                                </thead>
                                <tbody id="test-item-result">
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <button type="submit" id="btn-add-test-result" style="display: none"></button>
                </form>
            </div>
            <div class="modal-footer">
                <div class="row footer_fixed">
                    <div class="col-sm-12 " >
                        <div class="row">

                            <div class="col-lg-12 text-right pr-4">

                                <button type="button" class="btn btn-secondary float-right rounded-25 ml-2 mr-5" data-dismiss='modal'>{{__('lang.cancel')}}</button>

                                <button type="button" class="btn btn-inverse-warning ml-5 rounded-25 float-left" id="edit-test" value="edit-test"><i class="fa fa-edit"></i>
                                    {{__('sample.add_result_btn_edit_test')}}</button>


                                <div class="input-group float-right mx-2" style="width: 370px !important;">
                                    <select class="rounded-right-0 rounded-top-left-25 rounded-bottom-left-25" id="previous_sample" name="previous_sample" style="width: 140px; border: 1px solid #e9e9e9; padding-left: 10px; font-size:12.5px">
                                        <option value="">{{__('sample.previous_result')}}</option>
                                        @foreach($previous_samples as $previous_sample)
                                            <option value="{{$previous_sample->id}}">{{date('d-m-Y', strtotime($previous_sample->admission_date)) . ' - ' . $previous_sample->sample_number}}</option>
                                        @endforeach
                                    </select>
                                    @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['view_result']))
                                        <button type="button" class="btn btn-inverse-info btnAddTestResult rounded-left-0 rounded-top-right-25 rounded-bottom-right-25" value="save-result-preview"><i class="fa fa-floppy-o"></i>&nbsp;&nbsp;<span class="save">{{__('sample.add_result_btn_save_preview')}}</span></button>
                                    @endif
                                </div>

                                @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['add_result','update_result']))
                                    <button type="button" class="btn btn-info rounded-25 mx-2 float-right btnAddTestResult" id="add-test-result" value="save-result"><i class="fa fa-floppy-o"></i>&nbsp;&nbsp;<span class="save">{{__('sample.add_result_btn_save')}}</span></button>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
