

<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-body">
        <h4 class="card-title">GST REPORT</h4>
        <div class="row input-daterange">
                <div class="col-md-4">
                    <input type="text" name="from_date" id="from_date" class="form-control" placeholder="From Date" readonly />
                </div>
                <div class="col-md-4">
                    <input type="text" name="to_date" id="to_date" class="form-control" placeholder="To Date" readonly />
                </div>
                <div class="col-md-4">
                    <button type="button" name="filter" id="filter" class="btn btn-primary">Filter</button>
                    <button type="button" name="refresh" id="refresh" class="btn btn-default">Refresh</button>
                </div>
            </div>
        <div class="table-responsive">
            <table class="table table-bordered" id="users-table">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Username</th>
                            <th>Name</th>
                            <th>Pan no.</th>
                            <th>total_tds</th>
                            <th>Created At</th>
                            <!-- <th>Action</th> -->
                        </tr>
                    </thead>
                </table>
        </div>
    </div>
</div>
<!-- The Modal -->
<div class="modal fade" id="loadModalAjax" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="display: none;" aria-hidden="true">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">Affiliate</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
        Modal body..
      </div>

      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
      </div>

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

<?php $__env->stopSection(); ?>

<?php $__env->startSection('javascript'); ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.js"></script>
<script>
$(document).ready(function(){
 $('.input-daterange').datepicker({
  todayBtn:'linked',
  format:'yyyy-mm-dd',
  autoclose:true
 });

 load_data();


 $('#filter').click(function(){
  var from_date = $('#from_date').val();
  var to_date = $('#to_date').val();
  if(from_date != '' &&  to_date != '')
  {
   $('#users-table').DataTable().destroy();
   load_data(from_date, to_date);
  }
  else
  {
   alert('Both Date is required');
  }
 });

 $('#refresh').click(function(){
  $('#from_date').val('');
  $('#to_date').val('');
  $('#users-table').DataTable().destroy();
  load_data();
 });


});        

 function load_data(from_date = '', to_date = '')
 {

            $('#users-table').DataTable({
                processing: true,
                serverSide: true,
                ajax: {
                    url: '<?php echo url('/'); ?>/admin/users/userMonthlyGSTReportanyData',
                    data:{from_date:from_date, to_date:to_date}
                },
                dom: 'Blfrtip',
                'pageLength': 30,
                'lengthMenu': [ [10, 30, 50, -1], [10, 30, 50, "All"] ],
                'buttons': [
                            'copy', 'csv', 'excel', 'pdf', 'print'
                        ],
                'columns': [
                    { data: 'id', name: 'id' },
                    { data: 'username', name: 'username' },
                    { data: 'full_name', name: 'full_name' },
                    { data: 'panno', name: 'panno' },
                    { data: 'total_tds', name: 'total_tds' },
                    { data: 'created_at', name: 'created_at' },
                    // { data: 'action', name: 'action' }
                ],
                'order': [[5, 'asc']],

                initComplete: function() {
                    
                }
            });

 }



function mark_tds_paid(ele, id){
        ele.hide();
        var from_date = $('#from_date').val();
        var to_date = $('#to_date').val();

        $.ajax({
           url: '<?php echo e(url('/')); ?>/admin/users/userMonthlyGSTReportMarkPaid/' + id,
           type: 'POST',
           data: { "_token": "<?php echo e(csrf_token()); ?>", id : id, from_date : from_date, to_date: to_date },
           success: function(response) {
            $('#users-table').DataTable().destroy();
            load_data(from_date, to_date);
           }
        });
}



        
            function openModal(){
                $('.openModal').click(function(){
                 $('#loadModalAjax .modal-body').load('<?php echo e(url('/')); ?>/admin/users/' + $(this).attr('data-id') + '/edit',function(result){
                    $('#loadModalAjax').modal({show:true});
                  //init_validation('#updateStudentForm', rules, messages);
                   });
                });
                
                

                $('.openModalInvoices').click(function(){
                 $('#loadModalAjax .modal-content').load('/student_invoices_modal.php?id=' + $(this).attr('data-id'),function(result){
                    $('#loadModalAjax').modal({show:true});
                  //init_validation('#updateStudentForm', rules, messages);
                   });
              });
            }

    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH G:\xampp\htdocs\yeselectricv.loc\resources\views/admin/users/userMonthlyGSTReport.blade.php ENDPATH**/ ?>