<?php    include_once('../config/db.php');  include_once('../config/check.php'); 



?>

<!DOCTYPE html>
<html>
<head>
<?php include_once('../inc/slink.php');   ?>  
</head>
<body <?php include_once('../inc/snav.php');  ?>>
<div class="wrapper">

  <!-- Main Header -->
    <header class="main-header">

    <!-- Logo -->
       <?php include_once('../inc/sbrand.php');   ?>

    <!-- Header Navbar -->
    <?php include_once('../inc/snavbar.php');   ?>

  </header>
 
  <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">

    <!-- sidebar: style can be found in sidebar.less -->
     <?php include_once('../inc/smenu.php');   ?>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
  <section class="content-header">
      <h1> <i class="fa fa-bars "></i> Sales Order List  </h1>
        <ol class="breadcrumb">
          <li><a href="#"><i class="fa fa-dashboard"></i> </a></li>
          <li><a href="#"> </a></li>
          <li class="active"> </li>
        </ol>
      </section>

  <!-- Main content -->
  <section class="content container-fluid">
    <div class="row">        
        <div class="col-md-12">
        <div class="box box-success box-xs">
          <div class="box-body">
                            
                    <div class="col-sm-8"> 
                     <div class="col-sm-3">
                        <!-- <label> Start Date </label> -->
                        <input type="text" name="" class="form-control datepicker " required="" >
                      </div>
                     <div class="col-sm-3">
                        <!-- <label> Start Date </label> -->
                        <input type="text" name="" class="form-control datepicker " required="" >
                      </div>

                      <div class="col-sm-4">
                        <!-- <label> Gender </label> -->
                        <select class="form-control  js-example-basic-single " name="type" id="type"  style="" >
                          <?php $stmt = $conn->prepare("SELECT * FROM bppartnertype ");
                                $stmt->execute(); foreach ($stmt as $row) {?>
                                    <option> </option>
                                  <option value="<?php echo $row['id']; ?>"><?php
                                      echo $row['name']; ?></option> <?php } ?>
                        </select> 

                      </div>
                    </div> 
                    <div class="col-sm-4 ">
                       <button  class="btn btn-default btn-sm " type="button" name="filter" id="filter" > <i class="fa fa-search"></i> Find </button>
                       
                       <a class="btn btn-default btn-sm" href="crmsorder.php"> <i class="fa fa-plus-circle"></i> Add S.Order </a> 
                       <a class="btn btn-default btn-sm" href="#"> <i class="fa fa-user-plus"></i> Edit  </a> 
                       <a class="btn btn-default btn-sm" href="#"> <i class="fa fa-user-plus"></i> Delete  </a> 
                       <!-- <a class="btn btn-default btn-sm" href="bppartnerl.php"> <i class="fa fa-bars"></i> View All Partner  </a>  -->
                    </div> 
                

            
                <!-- Filter END -->


                <div class="col-xs-12">
                <table id="customer_data" class="table table-small table-responsive ">
                  <thead>
                    <tr style="height: 0px;">

                   
                    <th > Start Date </th>
                    <th > Due Date  </th>
                    <th > Customer  </th>
                    <th > Memo  </th>
                    <th > Description  </th>
                    <th > subtotal  </th>
                    <th > Tax  </th>
                    <th > Total  </th>
                    <!-- <th > Website  </th>
                    <th > Address  </th>
                    <th > Location </th>
                    <th > Country</th> -->
                    </tr>
                  </thead>
                  </table>
            </div>
          </div>
        </div>
         
        </div>
        <!-- /.col -->
      </div>
  </section>
  
</div>
  <!-- /.content-wrapper -->
  
  <!-- Main Footer -->
  <footer class="main-footer">
    <?php  include_once('../inc/footer.php'); ?>
  </footer>
  
</div>
                         
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->
<?php include_once('../inc/slinkjs.php') ?>

</body>
</html>

<!-- dynamic rows start here -->
<!-- DYANAMIC ROWS LISTING HERE --->
<script type="text/javascript" language="javascript" >
 $(document).ready(function(){

   
  
  fill_datatable();
  
  function fill_datatable(type = '', filter_country = '')
  {
   var dataTable = $('#customer_data').DataTable({
    "processing" : true,
     dom: 'Bfrtip',
     buttons: ['excel', 'pdf', 'print'  ],
    "serverSide" : true,
    "order" : [],
    "searching" : false,
    "bInfo" : false,
    colReorder: true,
    "paging": false,
    "scrollY":        "350px",
        "scrollCollapse": true,
    "ajax" : {
     url:"filter/sorder.php",
     type:"POST",
     data:{
      type:type, filter_country:filter_country
     }
    }
   });
  }
  
  $('#filter').click(function(){
   var type = $('#type').val();
   var filter_country = $('#filter_country').val();
   if(type != '' && filter_country != '')
        {
            $('#customer_data').DataTable().destroy();
            fill_datatable(type, filter_country);
        }
   else
   {
    alert('Select Both filter option');
    $('#customer_data').DataTable().destroy();
    fill_datatable();
   }
  });
  
  
 });
 
</script>
 
<!-- DYNAMIC ROWS ENDS HERE --->