
@extends('layouts.admin')
@section('pageTitle', 'Vega Soft')
@section('page-content')



<style>
#dynamic_ajax_table_length ,.dt-buttons ,#dynamic_ajax_table_filter{
    //float: left;
}
.custom-design-modal{
max-width:70%;
}
.dt-buttons{
    height: 34px;
}

.fc td:hover{
    cusror:pointer;
}
  
#mg{

background-color: #b3f4eb;
width: 100%;
}
#sg{
background-color: #e2f4af;
    width: 100%;
}
#grand_total{
background-color: #b8ffc9;
    width: 100%;
    font-weight: bold;
}

#rec-table tr td{
    padding: 4px;
}#rec-table tr th{
    padding: 6px;
}
.page-header{
    margin-bottom:6px !important;
}


#rec-table_length{


margin-bottom:-66px;

}



</style>


<div class="page-header">
<div class="row align-items-center">
<div class="col">
<h3 class="page-title"><?= $rows->menu_name;?></h3>
</div>
<div class="col-auto float-end ms-auto">
<!-- <a href="#" class="btn add-btn" data-bs-toggle="modal" data-bs-target="#add_employee"><i class="fa fa-plus"></i>Add Holiday</a> -->

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


<div class="row filter-row" style="margin-bottom: 57px;">
    <div class="col-sm-6 col-md-2">
<div class="form-group form-focus select-focus">
<select class="select floating" disabled id="branch_id">
<option value="0">All branch </option>
  @foreach($brn as  $z=>$det) 
    @if(Session::get('b_id')==$det->BranchID)
         <option value="{{$det->BranchID}}" selected>{{$det->BranchName}}</option>
    @else
        <option value="{{$det->BranchID}}">{{$det->BranchName}}</option>
    @endif
  @endforeach
</select>
<label class="focus-label">Designation</label>
</div>
</div>
<div class="col-sm-6 col-md-2">
<div class="form-group form-focus">
<input type="text" class="form-control floating" id="this_month">
<input type="hidden" id="serverValue2">
<label class="focus-label">Month</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus">
<select class="select floating" id="cat_id">
<option value="0">All Category </option>
  @foreach($cat  as $z=>$catdata)  
           <option   value="{{$catdata->emp_cat_id}}"  >{{$catdata->Category}}</option>
           @endforeach
</select>
<label class="focus-label">Category</label>
</div>
</div>
<div class="col-sm-6 col-md-2"></div>
<div class="col-sm-6 col-md-2">
<div class="d-grid">
<a href="javascript:void(0);" class="btn btn-success w-100" onclick="load_data();"> Search </a>
</div>
</div>
</div>

<div class="row">

<div class="col-lg-12 ScrollStyle" id="td" >
    
</div>


</div>
<div class="row"></div>
<input type="hidden" id="hidden_status" value="0">
<input type="hidden" id="row_id" value="0">


<div id="printTable" style=""></div>


@endsection




@section('page-script')
<script src="{{ asset('project-js\vega-front-scripts.js')}}"></script>
<script type="text/javascript">


/* $('#example').DataTable({
        scrollX: true,
    });*/
    
   $(function() {

set_mn();
set_month();


});
    $('#this_month').MonthPicker({ Button: false , MonthFormat: 'M, yy', AltFormat: 'yy-mm-dd', // ODBC time stamp.
        AltField: '#serverValue2',
 OnAfterChooseMonth: function() { 
    
    } 
    });
function set_month() {
  var date = new Date();
  $('#this_month').val(moment(date).format('MMM,YYYY'));
  $('#serverValue2').val(moment(date).format('YYYY-MM')+'-01');
       // calc_sal_details();
}



function load_data(){
   arr={
               
               'cat_id': $('#cat_id').val(),
                     'row_id': $('#serverValue2').val(),
};
 $.ajax({
              type: 'POST',
               async: false,
                url: '/get_data',
                  data: {
                     '_token': "{{ csrf_token() }}",
                    'cid':"{{ Session::get('cid')}}",
                    'CID': "{{ Session::get('CID')}}",
                    'b_id':  $('#branch_id').val()   ,
                     'row_id':JSON.stringify(arr),
              url1:'prl_fetch_sal_rep.php'
                },
                error: function (request, error) {
                    alert("Please Wait, Loading...");
                },
                success: function (response) {

build_report(response.data)

/*$("#tot_emp").text(response.emp_cnt)
$("#p_tdy").text(response.p_tdy)
$("#p_lev").text(response.p_lev)*/
var table = $('#rec-table').DataTable({
     scrollX: true,
        dom: 'lBfrtip',
        'autoWidth':false,
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'colvis'
        ],
        "bLengthChange": true,
        "bSort" : true,
         "lengthMenu": [[ 20, 50,75,100, -1], [ 20, 50,75,100, "All"]],
         "pagingType": "full_numbers",
        columnDefs: [ {
            visible: false
        } ]
        
        
    });   
            
        }
          
     });




}





















</script>



@endsection