<div class="table-responsive">
    <table class="table table-bordered table-hover" id="department_dt">
        <thead>
        <tr class="bg-gradient-light">
            <th class="py-2 text-center" width="50px">{{__('patient.table_no')}}</th>
            <th class="py-2 text-center" width="220px">{{__('patient.table_action')}}</th>
            <th class="py-2 text-center" width="250px">{{__('patient.table_code')}}</th>
            <th class="py-2">{{__('patient.table_name')}}</th>
            <th class="py-2 text-right" width="120px">{{__('patient.form_age')}}</th>
            <th class="py-2 text-center" width="120px">{{__('patient.table_sex')}}</th>
            <th class="py-2" width="200px">{{__('patient.table_phon')}}</th>
            <th class="py-2 text-center" width="100px">Sample</th>

        <!--<th class="py-2 text-center" width="100px">{{__('patient.table_status')}}</th>-->
        </tr>
        </thead>
        <tbody id="dynamic-patient-search-area__" >
        @foreach($patients as $k=>$patient)
            <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" aria-label="Basic example" >
                        <input type="text" class="d-none" id="ivt-{{$patient->id}}" value="{{\App\Helpers\Helpers::generatePatientBotLink('patient',$patient->lab_id, $patient->id)}}"><button type="button" onclick="copyTgBotInviteLink('ivt-{{$patient->id}}')" class="btn btn-sm btn-inverse-warning mr-2 py-1"><i title="Copy {{\App\Helpers\Helpers::generatePatientBotLink('patient',$patient->lab_id, $patient->id)}} to clipboard" class="fa fa-telegram"></i></button>
                        @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_patient']))
                            <button type="button" class="btn btn-sm btn-inverse-info mr-2 py-1" title="{{__('general.btn_edit')}}" data-action="edit" data-uid="{{$patient->id}}" data-toggle="modal" data-target="#modal-patient" data-backdrop="static">
                                <i class="typcn typcn-edit"></i>
                            </button>
                        @endif
                        @if($patient->record_status_id==0)
                            @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['create_patient']))
                                <button type="button" class="btn btn-sm btn-inverse-primary py-1" title="Restore"  onclick="restore_data({{$patient->id}})"><i class="typcn typcn-plus"></i></button>
                            @endif
                        @else
                            @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['create_patient']))
                                <a href="{{url('sample/patient/'.$patient->id.'/new')}}" class="btn btn-sm btn-inverse-success mr-2 py-1" title="{{__('sample.form_btn_new_sample')}}">
                                    <i class="mdi mdi-test-tube"></i> <i class="mdi mdi-plus" style="margin-left: -10px;"></i>
                                </a>
                            @endif
                            @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['delete_patient']))
                                <button type="button" class="btn btn-sm btn-inverse-danger py-1" title="{{__('general.btn_delete')}}" onclick="delete_data({{$patient->id}})"><i class="mdi mdi-close-circle"></i></button>
                            @endif
                        @endif
                    </div>
                </td>
                <td class="py-1 text-center">{{$patient->patient_uuid}}</td>
                <td class="py-1">{{$patient->name_en}}</td>
                <td class="py-2 text-right" width="100px">{{\App\Helpers\Helpers::getAge($patient->dob, date('Y-m-d'))}}</td>
                <td class="py-1 text-center">{{$patient->gender == 1 ? 'M' : 'F'}}</td>
                <td class="py-1 text-left">{{$patient->phone_number}}</td>
                <td class="py-1 text-right">
                    <label class="badge badge-outline-info rounded-25">
                        {{$patient->samples->count()}} Sample{{$patient->samples->count()>=2?'s':''}}
                    </label>
                </td>
                {{--                                                            <td class="py-1 text-center"><input type="text" class="d-none" id="ivt-{{$patient->id}}" value="{{\App\Helpers\Helpers::generatePatientBotLink('patient',$patient->lab_id, $patient->id)}}"><button type="button" onclick="copyTgBotInviteLink('ivt-{{$patient->id}}')" class="btn btn-sm btn-light"><i title="Copy {{\App\Helpers\Helpers::generatePatientBotLink('patient',$patient->lab_id, $patient->id)}} to clipboard" class="mdi mdi-content-copy"></i></button> </td>--}}

            </tr>
        @endforeach
        </tbody>
    </table>
</div>
<div class="float-right mt-3">
    {!! $patients->appends($_GET)->links('pagination.custom') !!}
</div>
