
<!-- Modal Assign Test -->
<div class="modal fade modal-primary" id="modal-invoice">

    <style>
         #modal-invoice .form-group label {
            line-height: 0.1rem !important;
        }
    </style>

    <div class="modal-dialog modal-xxl p-5">
        <div class="modal-content border border-light shadow">
            <div class="modal-header">
                <h6 class="modal-title">{{__('invoice.form_new_title')}}</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">
                <form method="post" class="p-2" action="{{route('invoice.save')}}" id="form-test-sample">
                    @csrf
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="form-vertical sample-creation-form">
                                        <div class="row">
                                            <div class="col-sm-12 col-md-6 col-lg-4 pl-0">
                                                @if($sample)
                                                    <div class="form-group mb-1">
                                                        <label for="lab-name-en">{{__('invoice.table_patient_name')}} <span class="text-danger">*</span></label>
                                                        <select class="form-control form-control-sm rounded-0 select2_" name="sample_id" id="inv-sample-id" style=" width: 100% !important;">
                                                            <option value="{{$sample->id}}">{{$sample->sample_number . ' - ' . $sample->patient->name_en}}</option>
                                                        </select>
                                                    </div>

                                                    @else
                                                    <div class="form-group mb-1">
                                                        <label for="lab-name-en">{{__('invoice.table_patient_name')}} <span class="text-danger">*</span></label>
                                                        <select class="form-control select2" name="sample_id" id="inv-sample-id" style=" width: 100% !important;">
                                                            <option></option>
                                                        </select>
                                                    </div>
                                                @endif

                                            </div>

                                            <div class="col-sm-12 col-md-6 col-lg-4">
                                                <div class="form-group mb-1">
                                                    <label for="lab-name-en">{{__('invoice.form_invoice_date')}} <span class="text-danger">*</span></label>
                                                    <input type="datetime-local" value="{{date('Y-m-d\TH:i:s')}}" class="form-control form-control-sm rounded-0" name="invoice_date" id="invoice_date" placeholder="Invoice Date">
                                                </div>
                                            </div>

                                            <div class="col-sm-12 col-md-6 col-lg-4 pr-0">
                                                <div class="form-group mb-1">
                                                    <label for="lab-name-en">{{__('sample.physician_name')}} <span class="text-danger"></span></label>
                                                    <input type="text" value="{{@$sample->physician->name_en}}" class="form-control form-control-sm rounded-0" disabled>
                                                </div>
                                            </div>

                                        </div>
                                        <div class="row border p-0">
                                            <div class="col-sm-7 p-0" style="max-height: 350px; overflow: auto;">
                                                <table class="table">
                                                    <thead>
                                                    <tr class="bg-light">
                                                        <th class="py-2">{{__('invoice.form_description')}}</th>
                                                        <th width="150px" class="py-2 text-right" id="discount-type">{{__('invoice.form_discount')}} {{$labSettings->discount_type == 2 ? ($labSettings->currency==1?'៛':'$') : '(%)'}}</th>
                                                        <th width="150px" class="py-2 text-right">{{__('invoice.form_net_amount')}}({{$labSettings->currency==1?'៛':'$'}})</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="invoice-item">
                                                    </tbody>
                                                </table>
                                                <div class="form-group py-5 px-3">
                                                    <label class="font-weight-medium" for="lab-name-en">{{__('invoice.form_description')}}</label>
                                                    <textarea class="form-control" name="invoice_note" id="invoice-note" rows="3"></textarea>
                                                </div>
                                            </div>
                                            <div class="col-sm-5 p-4 border-left">
                                                <div class="row">
                                                    <div class="col-sm-12">
                                                        <div class="form-group row">
                                                            <label for="total-amount" class="col-sm-5 col-form-label">{{__('invoice.form_total_amount')}} <span class="text-danger">({{$labSettings->currency==1?'៛':'$'}})</span></label>
                                                            <div class="col-sm-7">
                                                                <input type="number" min="0.00" step="any" readonly required class="form-control form-control-xxs bg-white form-control-sm rounded-0" name="total" id="total-amount" value="0.00">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-12">
                                                        <div class="form-group row">
                                                            <label for="discount-amount" class="col-sm-5 col-form-label">{{__('invoice.form_discount')}} <span class="text-danger">({{$labSettings->discount_type == 2 ? ($labSettings->currency==1?'៛':'$') : '%'}})</span></label>
                                                            <div class="col-sm-7">
                                                                <input type="hidden" name="discount_type" value="{{$labSettings->discount_type}}" id="discount_type" />
                                                                <input type="number" min="0.00" step="any" required value="0.00" class="form-control form-control-xxs rounded-0" name="discount" id="discount-amount" placeholder="0.00">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-12">
                                                        <div class="form-group row">
                                                            <label for="net-amount" class="col-sm-5 col-form-label">{{__('invoice.form_net_amount')}} <span class="text-danger">({{$labSettings->currency==1?'៛':'$'}})</span></label>
                                                            <div class="col-sm-7">
                                                                <input type="number" min="0.00" step="any" readonly required value="0.00" class="form-control form-control-xxs rounded-0" name="gross_total" id="net-amount" placeholder="0.00">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-12 bg-light px-0 pt-2">
                                                        <div class="col-sm-12">
                                                            <div class="form-group row">
                                                                <label for="paid-amount" class="col-sm-5 col-form-label">{{__('invoice.pay_type')}} <span class="text-danger">*</span></label>
                                                                <div class="col-sm-7">
                                                                    <select class="form-control form-control-xxs select2_ rounded-0 py-0" name="pay_type" id="pay_type" style=" width: 100% !important;">
                                                                        <option value="1">{{__('invoice.cash_paid')}}</option>
                                                                        <option value="2">{{__('invoice.bank_paid')}}</option>
                                                                        <option value="3">{{__('invoice.cash_paid')}} + {{__('invoice.bank_paid')}}</option>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-12">
                                                            <div class="form-group row">
                                                                <label for="paid-amount" class="col-sm-5 col-form-label">{{__('invoice.form_paid_amount')}} <small class="text-info">({{__('invoice.cash_paid')}})</small></label>
                                                                <div class="col-sm-7">
                                                                    <input type="number" min="0.00" step="any" required value="0.00" class="form-control form-control-xxs rounded-0" name="deposit" id="paid-amount" placeholder="0.00">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-12">
                                                            <div class="form-group row">
                                                                <label for="paid-amount" class="col-sm-5 col-form-label">{{__('invoice.form_paid_amount')}} <small class="text-info">({{__('invoice.bank_paid')}})</small></label>
                                                                <div class="col-sm-7">
                                                                    <input type="number" min="0.00" step="any" required value="0.00" class="form-control form-control-xxs rounded-0" name="bank_deposit" id="bank-amount" placeholder="0.00">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-12">
                                                            <div class="form-group row">
                                                                <label for="paid-amount" class="col-sm-5 col-form-label">{{__('invoice.form_paid_date')}} <span class="text-danger">*</span></label>
                                                                <div class="col-sm-7">
                                                                    <input type="date" value="{{date('Y-m-d')}}" class="form-control form-control-xxs rounded-0" name="first_paid_date" id="paid-date" placeholder="DD-MM-YYYY">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-12">
                                                            <div class="form-group row">
                                                                <label for="paid-amount" class="col-sm-5 col-form-label">{{__('invoice.bank_name')}}</label>
                                                                <div class="col-sm-7">
                                                                    <input type="text" value="" class="form-control form-control-xxs rounded-0" name="bank_name" id="bank_name">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-12">
                                                            <div class="form-group row">
                                                                <label for="paid-amount" class="col-sm-5 col-form-label">{{__('invoice.transaction_no')}}</label>
                                                                <div class="col-sm-7">
                                                                    <input type="text" value="" class="form-control form-control-xxs rounded-0" name="transaction_ref" id="transaction_ref">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-12">
                                                            <div class="form-group row">
                                                                <label for="owe-amount" class="col-sm-5 col-form-label">{{__('invoice.form_owe_amount')}} ({{$labSettings->currency==1?'៛':'$'}})<span class="text-danger">*</span></label>
                                                                <div class="col-sm-7">
                                                                    <input type="number" min="0.00" step="any" readonly class="form-control bg-white form-control-xxs rounded-0" name="balance" id="owe-amount" placeholder="0.00">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="form-check" style="width: 250px !important;">
                                                    <label class="form-check-label">
                                                        <input type="checkbox" {{($labSettings->is_hide_inv_discount==1)? 'checked':''}}  name="is_hide_discount" class="form-check-input" id="select-all-lab">
                                                        {{__('invoice.hide_discount')}}
                                                    </label>
                                                </div>

                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-12 pt-4 text-right">
                                                <button class="btn btn-inverse-info btn-sm mr-2 rounded-25" name="save_print_invoice" type="submit" value="save_preview_invoice"><i class="mdi mdi-printer"></i> {{__('invoice.form_btn_save_preview')}}</button>
                                                <button class="btn btn-info btn-sm rounded-25" type="submit"><i class="mdi mdi-check-all"></i> {{__('invoice.form_btn_save')}}</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>

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