<?php 
  
require_once("config/configDB.php"); 
//session_start();
require "userPermission.php";

require "homeFetchData.php";

?>
<!DOCTYPE html>
<html>
  <head>
    <?php require 'meta.php';  ?>   
    <?php require 'header.php';  ?>
  </head>
  <body>
    <?php require 'menu.php';  ?>

    <?php 
      $time = $_SERVER['REQUEST_TIME'];
      $timeout_duration = 1800;
      $_SESSION['LAST_ACTIVITY'] = $time;
      require 'financial_year_calculation.php';
    ?>
    

  

    
    

<div class="col-sm-12"><br></div> 

<div class="col-sm-6 text-center"> </div>
    <div class="col-sm-6 text-center"> 
        <div class="panel-group" id="accordion1">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    <a data-toggle="collapse" class="input-lg" data-parent="#accordion1" href="#collapse3"><strong> Insurance  Renewals Last Date <button type="button" class="btn btn-danger" id="sparestock"><?php echo $totalData_INS; ?></button>  </strong></a>
                    </h4>
                </div>
                <div id="collapse3" class="panel-collapse text-left collapse out">
                    <div class="datatable-header ">
                        <div class="col-sm-12 box-title"><strong>Manage your Insurance Renewals</strong></div>

                        <table id="homeInsuranceRenewalsDashboard" class="table table-striped table-bordered dt-responsive wrap" cellspacing="0" style="width:100%" >
                            <thead>
                                <tr>
                                    <th>Vehicle No</th>
                                    <th>Insurance Policy</th>
                                    <th>Last Date</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                        </table>  
                    </div>
                    
                </div>
            </div>
        </div>
    </div>

    <div class="col-sm-12"><br></div> 

<div class="col-sm-6 text-center"> </div>
    <div class="col-sm-6 text-center"> 
        <div class="panel-group" id="accordion2">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    <a data-toggle="collapse" class="input-lg" data-parent="#accordion2" href="#collapse4"><strong> FC  Renewals Last Date <button type="button" class="btn btn-danger" id="sparestock"><?php echo $totalData_fc; ?></button>  </strong></a>
                    </h4>
                </div>
                <div id="collapse4" class="panel-collapse text-left collapse out">
                    <div class="datatable-header ">
                        <div class="col-sm-12 box-title"><strong>Manage your FC Renewals</strong></div>

                        <table id="homefcRenewalsDashboard" class="table table-striped table-bordered dt-responsive wrap" cellspacing="0" style="width:100%" >
                            <thead>
                                <tr>
                                    <th>Vehicle No</th>
                                    <th>FC</th>
                                    <th>Last Date</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                        </table>  
                    </div>
                    
                </div>
            </div>
        </div>
    </div>

    <div class="col-sm-6 text-center"> </div>
    <div class="col-sm-6 text-center"> 
        <div class="panel-group" id="accordion2">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    <a data-toggle="collapse" class="input-lg" data-parent="#accordion2" href="#collapse5"><strong> Permit Renewals Last Date <button type="button" class="btn btn-danger" id="sparestock"><?php echo $totalData_permit; ?></button>  </strong></a>
                    </h4>
                </div>
                <div id="collapse5" class="panel-collapse text-left collapse out">
                    <div class="datatable-header ">
                        <div class="col-sm-12 box-title"><strong>Manage your Permit Renewals</strong></div>

                        <table id="homepermitRenewalsDashboard" class="table table-striped table-bordered dt-responsive wrap" cellspacing="0" style="width:100%" >
                            <thead>
                                <tr>
                                    <th>Vehicle No</th>
                                    <th>Permit</th>
                                    <th>Last Date</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                        </table>  
                    </div>
                    
                </div>
            </div>
        </div>
    </div>

    <div class="col-sm-6 text-center"> </div>
    <div class="col-sm-6 text-center"> 
        <div class="panel-group" id="accordion3">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    <a data-toggle="collapse" class="input-lg" data-parent="#accordion3" href="#collapse6"><strong> Tax Renewals Last Date <button type="button" class="btn btn-danger" id="sparestock"><?php echo $totalData_tax; ?></button>  </strong></a>
                    </h4>
                </div>
                <div id="collapse6" class="panel-collapse text-left collapse out">
                    <div class="datatable-header ">
                        <div class="col-sm-12 box-title"><strong>Manage your Tax Renewals</strong></div>

                        <table id="hometaxRenewalsDashboard" class="table table-striped table-bordered dt-responsive wrap" cellspacing="0" style="width:100%" >
                            <thead>
                                <tr>
                                    <th>Vehicle No</th>
                                    <th>Tax</th>
                                    <th>Last Date</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                        </table>  
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
    
    
    
     <div class="col-sm-6 text-center"> </div>
    <div class="col-sm-6 text-center"> 
        <div class="panel-group" id="accordion3">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    <a data-toggle="collapse" class="input-lg" data-parent="#accordion3" href="#collapse7"><strong> Polution Renewals Last Date <button type="button" class="btn btn-danger" id="sparestock"><?php echo $totalData_polution; ?></button>  </strong></a>
                    </h4>
                </div>
                <div id="collapse7" class="panel-collapse text-left collapse out">
                    <div class="datatable-header ">
                        <div class="col-sm-12 box-title"><strong>Manage your Polution Certificate Renewals</strong></div>

                        <table id="polutionRenewalsDashboard" class="table table-striped table-bordered dt-responsive wrap" cellspacing="0" style="width:100%" >
                            <thead>
                                <tr>
                                    <th>Vehicle No</th>
                                    <th>Tax</th>
                                    <th>Last Date</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                        </table>  
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
 

    <?php require 'footer.php'; ?>
    <script>
    
$(document).ready(function() {

    $("#sparestock").val(0);
    //$("#StockSpareDashboard_length")

    var dataTable =  $('#StockSpareDashboard').DataTable( {
                
                responsive: {
             details: {
                 renderer: function ( api, rowIdx ) {
                 var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
                     var header = $( api.column( cell.column ).header() );
                     return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
                 } ).toArray().join('');

                 return data ?    $('<table/>').append( data ) :    false;
                 }
             }
             },
            processing: true,
            serverSide: true,				
            aaSorting: [[0, 'desc']],
         //ajax: "test.js", // json datasource
         ajax: {
             url : "homelesserSparegriddata.php",
             type: 'POST',
             data:  {
               
                selectspare  : ''
               
            }
            // ,
            // success: function(data) {
            //     //should create datatable from data
            //     console.log(data.recordsTotal);
            //     $("#sparestock").html(data.recordsTotal);
 
            // }
         }
    });


		var dataTable =  $('#homeInsuranceRenewalsDashboard').DataTable( {                
			   	responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 						return data ?    $('<table/>').append( data ) :    false;
				    }
					}
				    },
			   	processing: true,
        serverSide: true,				
        aaSorting: [[0, 'desc']],
				ajax: {
                    url : "homeInsuranceRenewalsgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : '',userpermissionDelete : ''
                }
              }
    });
    var dataTable =  $('#homefcRenewalsDashboard').DataTable( {                
			   	responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 						return data ?    $('<table/>').append( data ) :    false;
				    }
					}
				    },
			   	processing: true,
        serverSide: true,				
        aaSorting: [[0, 'desc']],
				ajax: {
                    url : "homefcRenewalsgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : '',userpermissionDelete : ''
                }
              }
    });
    var dataTable =  $('#homepermitRenewalsDashboard').DataTable( {                
			   	responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 						return data ?    $('<table/>').append( data ) :    false;
				    }
					}
				    },
			   	processing: true,
        serverSide: true,				
        aaSorting: [[0, 'desc']],
				ajax: {
                    url : "homepermitRenewalsgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : '',userpermissionDelete : ''
                }
              }
    });
    var dataTable =  $('#hometaxRenewalsDashboard').DataTable( {                
			   	responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 						return data ?    $('<table/>').append( data ) :    false;
				    }
					}
				    },
			   	processing: true,
        serverSide: true,				
        aaSorting: [[0, 'desc']],
				ajax: {
                    url : "hometaxRenewalsgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : '',userpermissionDelete : ''
                }
              }
    });
    var dataTable =  $('#polutionRenewalsDashboard').DataTable( {                
			   	responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 						return data ?    $('<table/>').append( data ) :    false;
				    }
					}
				    },
			   	processing: true,
        serverSide: true,				
        aaSorting: [[0, 'desc']],
				ajax: {
                    url : "homepolutionRenewalsgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : '',userpermissionDelete : ''
                }
              }
    });
});

</script>
  </body>
</html>