@include('header')
@php
$UserId = Session::get('UserId');
@endphp
<div class="container-fluid flex-grow-1 container-p-y">
    <h4 class="font-weight-bold py-3 mb-0">OT Notes List </h4>
    <div class="card mb-4">
        <div class="card-body">
            <div id="alert_message"></div>
            <form id="validation-form" method="post" enctype="multipart/form-data">
                <div class="form-row">
                    
                    <div class="form-group col-md-2">
                        <label class="form-label">Date </label>
                        <input type="date" name="FromDate" id="FromDate" class="form-control" value="{{date('Y-m-d')}}"
                            autocomplete="off">
                    </div>
                    <!-- <div class="form-group col-md-2">
                        <label class="form-label">Bill Date To</label>
                        <input type="date" name="ToDate" id="ToDate" class="form-control" value="{{date('Y-m-d')}}" autocomplete="off">
                    </div> -->
                    <input type="hidden" name="Search" value="Search">
                    <div class="form-group col-md-2" style="padding-top:20px;">
                    <button type="button" class="btn btn-primary btn-finish"
                            id="filter">Search</button>
                    </div>
                </div>

            </form>

            <div class="table-responsive" id="custresult">


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




</div>

@include('footerscript')
@include('excelscript')
<script type="text/javascript">
$(document).ready(function() {
    var FromDate = $('#FromDate').val();
    queueList(FromDate);

    $('#filter').click(function(){
  var FromDate = $('#FromDate').val();
  if(FromDate != '')
  {
   //$('.yajra-datatable').DataTable().destroy();
   //load_data(FromDate, ToDate);
   queueList(FromDate);
  }
  else
  {
   alert('Date is required');
  }
 });

 $('#refresh').click(function(){
  $('#FromDate').val('');
  //$('.yajra-datatable').DataTable().destroy();
  //load_data();
  queueList();
 });


});

function queueList(FromDate = '') {
    //alert(FromDate);alert(MrdNo);
    $.ajax({
        url: "{{ url('otNoteLists') }}",
        method: "POST",
        data: {
            _token: '{{csrf_token()}}',
            FromDate: FromDate
        },
        success: function(data) {
            console.log(data);
            $('#custresult').html(data);
        }
    });
}


</script>
</script>
