@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();
        var ToDate = $('#FromDate').val();
        queueList(FromDate, ToDate);
    $('#filter').click(function() {
        var FromDate = $('#FromDate').val();
        var ToDate = $('#FromDate').val();
        if (FromDate != '' && ToDate != '') {
            queueList(FromDate, ToDate);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh').click(function() {
        $('#FromDate').val('');
        $('#ToDate').val('');
        queueList();
    });

    function queueList(FromDate = '', ToDate = '') {
        $.ajax({
            url: "{{ url('viewOtScheduleList') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate
            },
            success: function(data) {
                //console.log(data);
                $('#custresult').html(data);
            }
        });
    }
});
</script>
