<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
  @include('layout.header')
    <style>

</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 min-vh-70">
                    <div class="card-body">
                        <h4 class="card-title"><i class="mdi mdi-dots-vertical menu-icon"></i> {{__('invoice.form_new_title')}}</h4>
                        <hr>
                        <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 bg-light mb-3 pt-2">
                                                    <div class="col-sm-12 col-md-6 col-lg-4">
                                                        <div class="form-group mb-1">
                                                            <label for="lab-name-en">{{__('invoice.form_patient')}} <span class="text-danger">*</span></label>
                                                            <div class="input-group">
                                                                <div class="form-group" style="flex: 1">
                                                                    <select class="form-control select2" name="sample_id" id="sample-id" style=" width: 100% !important;">
                                                                        <option></option>
                                                                        @foreach($samples as $sample)
                                                                            <option {{$sample_id == $sample->id ? 'selected':''}} value="{{$sample->id}}">{{$sample->sample_number . ' - ' . $sample->patient->name_en}}</option>
                                                                        @endforeach
                                                                    </select>
                                                                </div>
                                                                <div class="input-group-append">
                                                                    {{--<button class="btn btn-sm btn-info px-3 shadow-none rounded-0" title="Auto generate patient code" type="button" onclick="generate_invoice()"><i class="mdi mdi-plus"></i>{{__('invoice.form_new_title')}}</button>--}}
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </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_number')}} <span class="text-danger">*</span></label>-->
                                                    <!--        <input type="text" class="form-control bg-white rounded-0" name="invoice_code" readonly id="invoice-number" placeholder="Invoice Number">-->
                                                    <!--    </div>-->
                                                    <!--</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 rounded-0" name="invoice_date" id="invoice_date" placeholder="Invoice Date">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="row border p-0">
                                                        <div class="col-sm-8 p-0">
                                                            <table class="table">
                                                                <thead>
                                                                    <tr class="bg-light">
                                                                        <th class="py-2">{{__('invoice.table_no')}}</th>
                                                                        <th class="py-2">{{__('invoice.form_description')}}</th>
                                                                        <th class="py-2 text-center">{{__('invoice.form_qty')}}</th>
                                                                        <th class="py-2 text-right">{{__('invoice.form_qty')}}</th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody id="invoice-item">

                                                                </tbody>
                                                            </table>
                                                        </div>
                                                        <div class="col-sm-4 p-4 border-left">
                                                            <div class="row">
                                                                <div class="col-sm-12">
                                                                    <div class="form-group mb-1">
                                                                        <label for="lab-name-en">{{__('invoice.table_total_cost')}} <span class="text-danger">($)</span></label>
                                                                        <input type="number" readonly required step="any" class="form-control bg-white form-control-sm rounded-0" name="total" id="total-amount" placeholder="0.00">
                                                                    </div>
                                                                </div>
                                                                <div class="col-sm-12">
                                                                    <div class="form-group mb-1">
                                                                        <label for="lab-name-en">{{__('invoice.table_discount')}} <span class="text-danger">($)</span></label>
                                                                        <input type="number" required value="0.00" step="any" class="form-control form-control-sm rounded-0" name="discount" id="discount-amount" placeholder="0.00">
                                                                    </div>
                                                                </div>
                                                                <div class="col-sm-12">
                                                                    <div class="form-group mb-1">
                                                                        <label for="lab-name-en">{{__('invoice.table_net_cost')}} <span class="text-danger">($)</span></label>
                                                                        <input type="number" required step="any" class="form-control form-control-sm rounded-0" name="gross_total" id="net-amount" placeholder="0.00">
                                                                    </div>
                                                                </div>
                                                                <div class="col-sm-12 bg-light px-0 pt-3">
                                                                    <div class="col-sm-12">
                                                                        <div class="form-group mb-1">
                                                                            <label for="lab-name-en">{{__('invoice.table_paid')}} <span class="text-danger">($)</span></label>
                                                                            <input type="number" required step="any" value="0.00" class="form-control form-control-sm rounded-0" name="deposit" id="paid-amount" placeholder="0.00">
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-sm-12">
                                                                        <div class="form-group mb-1">
                                                                            <label for="lab-name-en">{{__('invoice.form_paid_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="first_paid_date" id="paid-date" placeholder="DD-MM-YYYY">
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-sm-12">
                                                                        <div class="form-group mb-1">
                                                                            <label for="lab-name-en">{{__('invoice.form_owe_amount')}} <span class="text-danger">*</span></label>
                                                                            <input type="number" readonly step="any" class="form-control bg-white form-control-sm rounded-0" name="balance" id="owe-amount" placeholder="0.00">
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-12 pt-4 text-right">
                                                        <button class="btn btn-info" 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>
      </div>

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


        var base_url = "{{url('invoice')}}";
        var get_refs_base_url = "{{url('refs')}}";
        var invoice_id = 0;

    </script>

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

</body>

</html>

