<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    @include('layout.header')
    <style>
        #test-sample-table .dropdown .dropdown-toggle:after {
            display: none;
        }
        #test-sample-table .dropdown .dropdown-menu{
            left: -90px !important;
            top: -45px !important;
            background: #fbfbfb !important;
        }
        .btn-equation{
            width: 40px !important;
            font-size: 20px;
            font-weight: 600;
            height: 40px !important;
            margin-right: 3px;
        }
        .btn-ins-test{
            font-size: 20px;
            font-weight: 600;
            height: 40px !important;
        }

        .select2-container--default .select2-selection--multiple {
            margin-bottom: 0px !important;
            border-radius: 0px !important;
            height: 36px !important;
            min-height: 36px !important;
            max-height: 36px !important;
        }
        .select2-container--default .select2-selection--multiple .select2-selection__choice {
            background-color: #e4e4e4;
            border: 0px !important;
            border-radius: 0;
            cursor: default;
            float: left;
            margin-right: 3px;
            margin-top: 3px;
            padding: 0 3px;
            font-size: 11px !important;
        }
        .dropdown .dropdown-menu {
            box-shadow: 0px 1px 5px 1px rgb(133 135 139 / 35%);
            border-radius: 15px !important;
            border:1px solid #dbdada;
        }
</style>
</head>
<body>
<div class="container-scroller">
@include('layout.navbar')
<!-- partial -->
    @include('layout.breadscrum')
    <div class="container-fluid page-body-wrapper">

    @include('layout.sidebar')

    <!-- partial -->
        <div class="main-panel">
            <div class="content-wrapper">
                <div class="row">
                    <div class="col-md-12 grid-margin stretch-card">
                        <div class="card">
                            <div class="card-body">
                                <h4 class="card-title"><i class="mdi mdi-dots-vertical menu-icon"></i> {{__('test_sample.table_title')}}</h4>
                                <div class="row">
                                    <div class="col-sm-12">

                                        <form method="get" action="{{url('test/search')}}">
                                            <div class="row">
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        <div class="input-group">
                                                            <input type="text" class="form-control rounded-top-left-25 rounded-bottom-left-25 rounded-right-0" value="{{isset($_GET['kword']) ? $_GET['kword'] : ''}}" name="kword" id="kword" placeholder="{{__('test_sample.search_placeholder')}}">
                                                            <div class="input-group-append">
                                                                <button class="btn btn-sm btn-inverse-secondary px-3 rounded-0" type="submit"><i class="fa fa-search"></i> {{__('general.btn_search')}}</button>
                                                                <button class="btn btn-sm btn-inverse-secondary dropdown show pl-0 ml-0 rounded-top-right-25 rounded-bottom-right-25" type="button">
                                                                    <span style="padding-left: 9px !important; padding-right: 9px !important;" class="count-indicator dropdown-toggle d-flex justify-content-center align-items-center rounded-0" data-toggle="dropdown" aria-expanded="true">
                                                                        {{__('test_sample.table_department')}}
                                                                    </span>
                                                                    <div class="dropdown-menu dropdown-menu-right navbar-dropdown preview-list" aria-labelledby="messageDropdown">
                                                                        @foreach($departments as $department)
                                                                            <a class="dropdown-item preview-item" href="{{ url('test/search?department='.$department->id) }}">
                                                                                <div class="preview-item-content flex-grow">
                                                                                    <p class="font-weight-light small-text text-black font-14 mb-0 pr-5">{{ $department->name  }}</p>
                                                                                </div>
                                                                            </a>
                                                                        @endforeach
                                                                    </div>
                                                                </button>

                                                                @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['create_test_sample']))
                                                                <button class="btn btn-inverse-success rounded-25 waves-effect px-3 ml-3" type="button" data-action="new" data-toggle="modal" data-target="#modal-test" data-backdrop="static"><i class="typcn typcn-plus"></i> {{__('general.btn_add_new')}}</button>
                                                                @endif
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                        </form>

                                        <hr class="my-3 d-none">
                                        <div class="col-sm-12 p-0 mb-1 mt-3">
                                            <div class="table-responsive">
                                                <table class="table table-bordered table-hover" id="test-sample-table">
                                                    <thead>
                                                        <tr class="bg-gradient-light">
                                                            <th class="py-2" width="50px">{{__('test_sample.table_no')}}</th>
                                                            <th class="py-2" width="100px">{{__('test_sample.table_action')}}</th>
                                                            <th class="text-center py-2" width="80px">{{__('test_sample.code')}}</th>
                                                            <th class="py-2">{{__('test_sample.table_name')}}</th>
                                                            <th class="py-2">{{__('test_sample.table_sample_type')}}</th>
                                                            <th class="py-2">{{__('test_sample.table_sign')}}</th>
{{--                                                            <th class="py-2">{{__('test_sample.table_group_result')}}</th>--}}
                                                            <th class="py-2">{{__('test_sample.table_field_type')}}</th>
                                                            <th class="py-2">{{__('test_sample.table_price')}} ($)</th>
                                                            <th class="text-center py-2" width="100px">{{__('test_sample.table_sort')}}</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                    @foreach($testSamples as $k=>$testSample)
                                                        <tr>
                                                            <td class="py-1 text-center">{{($k+1) + (($_GET['page'] ?? 1) * 20) - 20}}</td>
                                                            <td class="py-1 text-center">
                                                                <div class="btn-group" role="group">
                                                                    <button type="button" class="btn btn-sm btn-inverse-success mr-2 btnCommission py-1" title="{{__('test_sample.table_btn_pc')}}" data-action="add_commission" data-uid="{{$testSample->id}}" data-toggle="modal" data-target="#modal-physician-commission" data-backdrop="static"><i class="mdi mdi-percent"></i></button>
                                                                    @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_test_sample']))
                                                                    <button type="button" class="btn btn-sm btn-inverse-info mr-2 py-1" title="{{__('test_sample.form_edit_tittle')}}" data-action="edit" data-uid="{{$testSample->id}}" data-toggle="modal" data-target="#modal-test" data-backdrop="static"><i class="typcn typcn-edit"></i></button>
                                                                    @endif
                                                                    @if($testSample->record_status_id==0)
                                                                        <button type="button" class="btn btn-sm btn-light" disabled><i class="mdi mdi-close-circle"></i></button>
                                                                    @else
                                                                        @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['delete_test_sample']))
                                                                        <button type="button" class="btn btn-sm btn-inverse-danger py-1" title="{{__('general.btn_delete')}}" onclick="delete_data({{$testSample->id}})"><i class="mdi mdi-close-circle"></i></button>
                                                                        @endif
                                                                    @endif
                                                                </div>
                                                            </td>
                                                            <td class="py-1 text-center">{{$testSample->code}}</td>
                                                            <td class="py-1">{{$testSample->test_name}}</td>
                                                            <td class="py-1">{{$testSample->sample_type_name . ' : ' . $testSample->department_name}}</td>
                                                            <td class="py-1">{{$testSample->unit_sign}}</td>
{{--                                                            <td class="py-1">{{$testSample->group_result}}</td>--}}
                                                            <td class="py-1">
                                                                <label class="badge badge-outline-info rounded-25">
                                                                {{$testSample->field_type == 1 ? __('test_sample.numeric') : ( $testSample->field_type == 2 ? __('test_sample.single') : ( $testSample->field_type == 3 ? __('test_sample.multiple') : ($testSample->field_type==4 ? __('test_sample.calculate') : ( $testSample->field_type==6 ? __('test_sample.text') :($testSample->field_type==5 ? __('test_sample.attachment') : __('test_sample.heading'))))))}}
                                                                </label>
                                                            </td>
                                                            <td class="py-1 text-right"><span class="float-left {{$testSample->group_result=='' ? 'd-none':''}}">$</span> {{$testSample->usd_price}}</td>
                                                            <td class="py-1 text-right" id="tr-{{$testSample->id}}">
                                                                <div class="dropdown float-right">
                                                                    <span class=" dropdown-toggle" type="button" id="dropdownMenuSizeButton2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                                        {{$testSample->weight}} <button class="btn btn-sm btn-inverse-warning ml-3 py-1"><i class="mdi mdi-unfold-more-horizontal"></i></button>
                                                                    </span>
                                                                    <div class="dropdown-menu p-3 bg-inverse-light">
                                                                        <form method="post" action="{{url('test-sample.reorder')}}">
                                                                            @csrf
                                                                            <div class="form-group">
                                                                                <div class="input-group">
                                                                                    <input type="hidden" name="id" value="{{$testSample->id}}" required>
                                                                                    <input type="number" name="order_number" min="1" step="1" value="{{$testSample->weight}}" class="form-control rounded-top-left-25 rounded-bottom-left-25 rounded-right-0 form-control-sm">
                                                                                    <div class="input-group-append">
                                                                                        <button class="btn btn-xs btn-inverse-info rounded-top-right-25 rounded-bottom-right-25" type="submit"><i class="mdi mdi-content-save"></i></button>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </form>
                                                                    </div>
                                                                </div>

                                                            </td>

                                                        </tr>
                                                    @endforeach
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>

                                        <div class="float-right mt-3">
                                            {!! $testSamples->appends($_GET)->links('pagination.custom') !!}
                                        </div>

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

                </div>
            </div>

            <!-- Modal Test Sample -->
            <div class="modal fade modal-primary" id="modal-test">
                <div class="modal-dialog modal-semi-xxl">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h6 class="modal-title new">{{__('test_sample.form_add_tittle')}}</h6>
                            <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" style="padding-bottom: 0px !important;">
                            <form method="post" class="p-2" action="#" id="form-test-sample">
                                @csrf
                                <input type="hidden" class="form-control" name="uid" id="data-id" value="0" />
                                <div class="form-vertical">

                                    <div class="row">
                                        <div class="col-sm-4">
                                            <div class="form-group">
                                                <label for="lab-name-en">{{__('test_sample.form_test_name')}} <span class="text-danger">*</span></label>
                                                <div class="input-group" id="testItem">
                                                    <div class="form-group" style="flex: 1 !important;">
                                                        <select class="form-control rounded-0 rounded-right-0 select2" name="test_item" id="test-item" style=" width: 100% !important;">
                                                            <option></option>
                                                            @foreach($testItems as $testItem)
                                                                <option value="{{$testItem->id}}">{{$testItem->name_en}}</option>
                                                            @endforeach
                                                        </select>
                                                    </div>
                                                    <div class="input-group-append">
                                                        @if(Auth::id()==1)<button class="btn btn-sm btn-inverse-warning px-3" type="button" onclick="editTest()"><i class="mdi mdi-table-edit"></i>&nbsp;</button> @endif
                                                        <button class="btn btn-sm rounded-0 btn-inverse-info px-3" type="button" onclick="addNewTest('test-item')"><i class="typcn typcn-plus"></i>&nbsp;</button>
                                                    </div>
                                                </div>
                                                <br>
                                            </div>
                                        </div>

                                        <div class="col-sm-2">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.code')}}</label>
                                                <input type="text" class="form-control rounded-0" name="code" id="code" placeholder="{{__('test_sample.code')}}">
                                            </div>
                                        </div>

                                        <div class="col-sm-2">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.form_unit_sign')}}</label>
                                                <input type="text" class="form-control rounded-0" name="unit_sign" id="unit-sign" placeholder="{{__('test_sample.form_unit_sign')}}">
                                            </div>
                                        </div>

                                        <div class="col-sm-4">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.form_field_type')}} <span class="text-danger">*</span></label>
                                                <select class="form-control rounded-0" name="filed_type_id" id="field-type-id" style=" width: 100% !important;">
                                                    <option value=""> - {{__('general.choose_option')}} - </option>
                                                    <option value="0">{{__('test_sample.heading')}}</option>
                                                    <option value="1">{{__('test_sample.numeric')}}</option>
                                                    <option value="2">{{__('test_sample.single')}}</option>
                                                    <option value="3">{{__('test_sample.multiple')}}</option>
                                                    <option value="4">{{__('test_sample.calculate')}}</option>
                                                    <option value="5">{{__('test_sample.attachment')}}</option>
                                                    <option value="6">{{__('test_sample.text')}}</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">

                                        <div class="col-sm-4">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.table_department')}} <span class="text-danger">*</span></label>
                                                <select class="form-control rounded-0 select2" name="department_id" id="department-id" style=" width: 100% !important;">
                                                    <option></option>
                                                    @foreach($departments as $department)
                                                        <option value="{{$department->id}}">{{$department->name_en}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.table_sample_type')}} <span class="text-danger">*</span></label>
                                                <select class="form-control rounded-0 select2" name="sample_type_id" id="sample-type-id" style=" width: 100% !important;">
                                                    <option></option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.table_sort')}} </label>
                                                <input type="number" class="form-control rounded-0" value="0" name="weight" id="weight" placeholder="{{__('test_sample.table_sort')}}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-12 col-md-4">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.heading')}}</label>
                                                <select class="form-control rounded-0 select2" name="heading_id" id="heading-id" style=" width: 100% !important;">
                                                    <option value="0">No Heading</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.table_group_result')}}</label>
                                                <input type="text" class="form-control rounded-0" name="group_result" id="group-result" placeholder="{{__('test_sample.table_group_result')}}">
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.table_price')}} ($)</label>
                                                <input type="number" value="0" min="0" step="0.5" class="form-control rounded-0" name="usd_price" id="usd-price" placeholder="{{__('test_sample.table_price')}}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-4" id="formula-input-area" style="display: none;">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.form_formula')}}</label>
                                                <div class="input-group">
                                                    <div class="input-group-append">
                                                        <button class="btn btn-sm btn-inverse-warning rounded dropdown-toggle rounded-right-0" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-bs-toggle="dropdown" data-bs-auto-close="false"><i class="mdi mdi-contrast"></i> {{__('test_sample.formula_equation')}}</button>
                                                        <div class="dropdown-menu border w-100 p-3">
                                                            <p class="dropdown-item-">
                                                                <button onclick="insertEquation('+', 'formula')" class="btn btn-xs btn-equation btn-inverse-secondary" type="button">+</button>
                                                                <button onclick="insertEquation('-', 'formula')" class="btn btn-sm btn-equation btn-inverse-secondary" type="button">-</button>
                                                                <button onclick="insertEquation('*', 'formula')" class="btn btn-sm btn-equation btn-inverse-secondary" type="button">x</button>
                                                                <button onclick="insertEquation('^', 'formula')" class="btn btn-sm btn-equation btn-inverse-secondary" type="button">^</button>
                                                                <button onclick="insertEquation('/', 'formula')" class="btn btn-sm btn-equation btn-inverse-secondary" type="button">/</button>
                                                                <button onclick="insertEquation('(', 'formula')" class="btn btn-sm btn-equation btn-inverse-secondary" type="button">(</button>
                                                                <button onclick="insertEquation(')', 'formula')" class="btn btn-sm btn-equation btn-inverse-secondary" type="button">)</button>
                                                                <button onclick="insertEquation('T0', 'formula')" class="btn btn-sm btn-ins-test btn-inverse-secondary" type="button">AGE (y)</button>
                                                                <button onclick="insertEquation('T00', 'formula')" class="btn mt-2 btn-sm btn-ins-test btn-inverse-secondary" type="button">SEXVal- eGFR (M=1, F=0.742)</button>
                                                                <button data-toggle="modal" data-backdrop="static" data-target="#modal-test-sample-formula" class="btn mt-2 ml-1 btn-sm btn-ins-test btn-inverse-secondary" type="button">[{{__('test_sample.table_title')}}]</button>
                                                            </p>
                                                        </div>
                                                    </div>
                                                    <input type="text" class="form-control rounded rounded-left-0" name="formula" id="formula" placeholder="{{__('test_sample.form_formula')}}">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4" id="format-input-area" style="display: none">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.form_format')}}</label>
                                                <select class="form-control rounded-0" name="format_value" id="format">
                                                    <option value="">-</option>
                                                    <option value="0">0</option>
                                                    <option value="1">0.0</option>
                                                    <option value="2">0.00</option>
                                                    <option value="3">0.000</option>
													<option value="4">00</option>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="col-sm-12" id="description-input-area">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('test_sample.form_description')}}</label>
                                                <textarea style="height: 46px !important; font-size: 13px; line-height: 20px;" class="form-control rounded-0" name="description" id="description" placeholder="{{__('test_sample.form_description')}}"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-3">
                                            <div class="form-check" style="width: 250px !important;">
                                                <label class="form-check-label">
                                                    <input type="checkbox" name="is_bold" id="is-bold" class="form-check-input">
                                                    {{__('test_sample.result_highlight_with_bold_text')}}
                                                </label>
                                            </div>
                                        </div>

                                        <div class="col-sm-3">
                                            <div class="form-check" style="width: 250px !important;">
                                                <label class="form-check-label">
                                                    <input type="checkbox" name="autocomplete_bind" id="autocomplete_bind" class="form-check-input">
                                                    {{__('test_sample.auto_suggest_results')}}
                                                </label>
                                            </div>
                                        </div>

                                    </div>

                                    <div class="row" id="reference-range" style="display: none;">
                                        <div class="col-sm-12 mt-2">
                                            <div class="form-group mb-1 table-responsive">
                                                <h6 for="reference-range">{{__('test_sample.form_ref_range')}}</h6>
                                                <table class="table table-bordered" style="font-size: 12px !important;" id="reference-range-table">
                                                    <thead>
                                                        <tr class="bg-gradient-light">
                                                            <td class="py-2">{{__('test_sample.form_ref_patient_type')}}</td>
                                                            <td class="py-2">{{__('test_sample.form_ref_min')}}</td>
                                                            <td class="py-2">{{__('test_sample.form_ref_sign')}}</td>
                                                            <td class="py-2">{{__('test_sample.form_ref_max')}}</td>
                                                            <td class="py-2 text-center" width="90px">
                                                                <button type="button" class="btn btn-sm btn-inverse-primary" id="reference-range-add"><i class="typcn typcn-plus"></i></button>
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row" id="options" style="display: none;">
                                        <div class="col-sm-12 mt-2">
                                            <div class="form-group table-responsive mb-1">
                                                <h6 for="reference-range" style="line-height: inherit ">{{__('test_sample.form_organism')}}</h6>
                                                <table class="table" style="font-size: 10px !important;">
                                                    <tbody>
                                                        <tr>
                                                            <td>
                                                                <div class="row">
                                                                    <div class="col-sm-4 p-0">
                                                                        <input type="text" id="search-organism" class="form-control form-control-sm rounded-0" placeholder="{{__('test_sample.organism_input_placeholder')}}">
                                                                        {{--                                                                <div class="group-check-box mt-1" style="border: 1px solid #eee;">--}}
                                                                        <div id="organism-box" class="form-group overflow-auto py-2 px-3" style="height: 120px; border: 1px solid #eee;" >
                                                                        </div>
                                                                        {{--                                                                </div>--}}
                                                                    </div>
                                                                    <div class="col-sm-1 p-0 text-center m-auto">
                                                                        <button type="button" id="btnSelectOrg" onclick="selectedOrganismRow()" class="btn btn-sm btn-info m-1"><i class="mdi mdi-chevron-right"></i></button><br>
                                                                        <button type="button" onclick="removeSelectedOrganism()" class="btn btn-sm btn-info mt-3"><i class="mdi mdi-chevron-left"></i></button>
                                                                    </div>
                                                                    <div class="col-sm-7 p-0 table-responsive">
                                                                        <div class="font-13" style="height: 160px; "  >
                                                                            <table class="table font-13 table-bordered">
                                                                                <thead>
                                                                                <tr class="bg-light">
                                                                                    <td class="py-0 font-13">{{__('test_sample.select_organism')}}</td>
                                                                                    <td width="85px" class="py-0 font-13">Default</td>
                                                                                </tr>
                                                                                </thead>
                                                                                <tbody id="selected-organism">
                                                                                </tbody>
                                                                            </table>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-info rounded-25" id="btnSave"><i class="fa fa-floppy-o"></i>&nbsp;&nbsp;<span class="save">{{__('lang.save')}}</span><span class="update" style="display: none">{{__('lang.update')}}</span></button>
                            <button type="button" class="btn btn-secondary rounded-25 mx-3" data-dismiss='modal'>{{__('lang.cancel')}}</button>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Modal Physician Commission -->
            <div class="modal fade modal-primary" id="modal-physician-commission">
                <div class="modal-dialog modal-lg modal-dialog-scrollable">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h6 class="modal-title new">{{__('test_sample.table_btn_pc')}}</h6>
                            <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" style="padding-bottom: 0px !important;">
                            <form method="post" class="p-2" action="{{url('test-sample/physician-commission')}}" enctype="multipart/form-data">
                                @csrf
                                <input type="hidden" class="form-control" name="test_sample_id" id="data-id" value="0" />
                                <div class="form-vertical">
                                    <p id="physician-test-sample-name"></p>
                                    <input type="hidden" name="test_sample_id" id="physician-test-sample-id" value="" />
                                    <table class="table table-bordered">
                                        <thead>
                                            <tr class="bg-gradient-light">
                                                <th class="py-1">{{__('test_sample.pc_physician')}}</th>
                                                <th class="py-1">{{__('test_sample.table_price')}}</th>
												<th class="py-1">{{__('test_sample.pc_rate')}} <span class="text-danger">{{$labSetting->discount_type == 1 ? '(%)' : '($)'}}</span></th>
                                                <th class="py-1 text-center" width="110px">{{__('test_sample.table_action')}}</th>
                                            </tr>
                                        </thead>
                                        <tbody id="tb-physician">
                                        </tbody>
                                    </table>
                                </div>
                                <button type="submit" class="d-none" id="btn-submit-physician-commission"></button>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-info rounded-25" onclick="$('#btn-submit-physician-commission').click()"><i class="fa fa-floppy-o"></i>&nbsp;&nbsp;<span class="save">{{__('lang.save')}}</span></button>
                            <button type="button" class="btn btn-secondary rounded-25 mx-3" data-dismiss='modal'>{{__('lang.cancel')}}</button>
                        </div>
                    </div>
                </div>
            </div>

            @include('modal.test_sample_formula')

            @include('layout.footer')
        </div>
    </div>
</div>


@include('layout.common_script')

<script src="{{url(env("APP_URL").'storage/assets/js/admin/calculation_results/underscore-min.js')}}"></script>
<script>

    var test_base_url = "{{url('test')}}";

    var test_sample_base_url = "{{url('test-sample')}}";

    let patientTypes = <?php echo json_encode($patientTypes);?>;

    let btn_apply_to_all_tests = "{{__('general.apply_to_all_test')}}";

</script>
<script src="{{url(env("APP_URL").'storage/assets/js/admin/test.js?time='.time())}}"></script>
<script>

    $('#formula-input-area').on('hide.bs.dropdown', function (e) {
        if (e.clickEvent) {
            e.preventDefault();
        }
    });

    function insertEquation(equation, inputElementId) {
        let curVal = $('#'+inputElementId).val()
        curVal+=equation
        $('#'+inputElementId).val(curVal)
    }

    function editTest(){
        let selectedOption = $('#test-item option:selected');
        let selectedText = selectedOption.text();
        let selectedVal = selectedOption.val();
        if(selectedVal>0){
            editTestName(selectedVal, selectedText, 'test-item')
        }
    }

    function getSelectedOrgAnt(control_state_id, handler_item_class) {
        var checkedState = $('#'+control_state_id).is(':checked');
        var checkboxes = document.getElementsByClassName(handler_item_class);

        for (var i = 0; i < checkboxes.length; i++) {
            if(!checkedState){
                checkboxes[i].closest('label').classList.remove('d-none')
            }else{
                if(!checkboxes[i].checked){
                    checkboxes[i].closest('label').classList.add('d-none')
                }
            }
        }
    }

    $('#department-id-search-form').change(function () {
        window.location = test_base_url + '/search?department='+$(this).val()
    })

    $('#sample-type-id-search-form').change(function () {
        window.location = test_base_url + '/search?department='+$('#department-id-search-form').val()+'&sample_type='+$(this).val()
    })

    getSampleTypeByDepartmentId('<?php echo @$_GET['department'] ?>', 'sample-type-id-search-form','<?php echo @$_GET['sample_type'] ?>');



</script>

</body>

</html>

