<?php
session_start();
if(!isset ($_SESSION['user_id'])){
    header("Location:../login.php?msg=Log in first");
    exit();
}else{
	include('../Server/connection.php');
	include('includes/session.php');	
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <?php
  include 'title.php';
  ?>
	
	<link type = "image/png" rel="icon" href="images/brvision.png" />
	
	<!-- Datatable CSS -->
    <link href='DataTables/datatables.min.css' rel='stylesheet' type='text/css'>
    <link rel='stylesheet' href='https://cdn.datatables.net/buttons/1.2.2/css/buttons.dataTables.min.css'>
    <!--<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">-->
	
	<!-- must-->
	<script src="assests/jquery/jquery.min.js"></script>
	
	<!-- jQuery Library -->
    <!--<script src="jquery-3.3.1.min.js"></script>-->
	
	<!-- Datatable JS -->
    <script src="DataTables/datatables.min.js"></script>
    <script src='https://cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js'></script>
    <script src='https://cdn.datatables.net/buttons/1.2.2/js/buttons.flash.min.js'></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js'></script>
    <script src='https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js'></script>
    <script src='https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js'></script>
    <script src='https://cdn.datatables.net/buttons/1.2.2/js/buttons.html5.min.js'></script>
    <script src='https://cdn.datatables.net/buttons/1.2.2/js/buttons.print.min.js'></script>
	
	
	

    <!-- Bootstrap must-->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
	
    <!-- Font Awesome must-->
    <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	
	<!-- custom css -->
    <link rel="stylesheet" href="custom/css/custom.css">
	
    <!-- NProgress must-->
    <link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
	
    <!-- Custom Theme Style must-->
    <link href="../build/css/custom.min.css" rel="stylesheet">
	
	
	
  <!-- jquery ui -->  
  <link rel="stylesheet" href="assests/jquery-ui/jquery-ui.min.css">
  <script src="assests/jquery-ui/jquery-ui.min.js"></script>
	
  <!-- Must Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	
	
    
	
  </head>

  <body class="nav-md">
  
    <div class="container body">
	
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
		  
             <?php  
		include 'includes/role.php';
               ?>

            <div class="clearfix"></div>
            
			<?php
            include 'includes/profile.php';
			print '</br></br>';
			include 'includes/menu.php';
			?>

           

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
		  
			
			
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
				  
                    <a href="dashboard.php">  <h2><span class="glyphicon glyphicon-step-backward"></span> Back</h2></a>
					</br></br>
					<font color="green">List Of Quotations </font>
					
					
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      
                      
                    </ul>
                    <div class="clearfix"></div>
                  </div>
				  
				
				  
                 <div class="x_content" style="overflow: auto;">
				 
			    <div class="remove-messages"></div>
				
				 <?php if (isset($_SESSION['success_message']) && !empty($_SESSION['success_message'])) { ?>
                        <div class="success-message" style="margin-bottom: 20px;font-size: 20px;color: green;"><?php echo $_SESSION['success_message']; ?></div>
                        <?php
                        unset($_SESSION['success_message']);
                    }
                    ?>	
				
				
				
		    <table Style="width:100%; padding:10px;">
			
			<tr><th>Search Quotation </th><th>Filter By Customer Name</th><th>Filter By Currency Type</th></tr>
			
			
			
			<tr> 
                <td width="30%">
                    <input type='text' id="searchByQuotation"  class="form-control " placeholder='Enter Quotation No'>
				</td>
				
				
                <td width="40%">
                    
					<select id='searchByClientName' class="form-control ">

                        <option value="">All</option>
						
						<?php
			  			$productSql126 = "SELECT * FROM clients ORDER BY client_fname";
			  			$productData126 = $conn->query($productSql126);
			  			while($row126 = $productData126->fetch_array()){									 		
			  			  echo "<option value='".$row126['client_id']."'>".$row126['client_fname'].'&nbsp&nbsp'.$row126['client_mname'].'&nbsp&nbsp'.$row126['client_lname']."</option>";
										 	} // /while 

			  			?>
						
						
                    </select> 

                </td>
				
				<td width="30%">
                    
					<select id='searchByCurrencyStatus' class="form-control ">

                        <option value="">All</option>
						
						<?php
			  			$productSql1261 = "SELECT * FROM currency ORDER BY currencyName";
			  			$productData1261 = $conn->query($productSql1261);
			  			while($row1261 = $productData1261->fetch_array()){									 		
			  			  echo "<option value='".$row1261['currency_id']."'>".$row1261['currencyName']."</option>";
										 	} // /while 

			  			?>
						
                    </select> 

                </td>
				
				
				
            </tr>
			
			
		
			
        </table>

                  
				   
					<br/>
        <div id="buttons"></div>
		
		<!-- Table -->
        <table id='manageCategoriesTable' class='display dataTable hoverable  table-striped'>
            <thead>
                <tr>
                    <th>S/No:</th>
					<th>Quotation No</th>
					<th>Customer Name</th>
					<th>Edit Quotation</th>
					<!--<th></th>-->
					<th>PDF Quotation</th>
					<!--<th>Quotation</th>-->
					<th>Delete</th>
                </tr>
            </thead>

        </table>
		
		  <!-- Script -->
    <script>
        $(document).ready(function () {
            var dataTable = $('#manageCategoriesTable').DataTable({
                'processing': true,
                'serverSide': true,
                'serverMethod': 'post',
                "lengthMenu": [[10, 25, 50, 100,500,1000], [10, 25, 50,100,500,1000]],
                'dom': 'Blfrtip',
        'buttons': [

									{
										"extend": 'pdf',
										"text": 'Export PDF',
										"className": 'btn btn-primary btn-sm ml-1'
									},
									{
										"extend": 'csv',
										"text": 'Export CSV',
										"className": 'btn btn-primary btn-sm ml-1'
									},


									{
										'extend': 'excel',
										"text": 'Export  Excel',
										'className': 'btn btn-primary btn-sm ml-1'
									}, {
										'extend': 'print',
										"text": 'Print',
										'className': 'btn btn-primary btn-sm ml-1'
									}

								], "language": 
{          
"processing": "<img style='width:300px; height:200px;' src='load.gif' />",
},
                
                'ajax': {
                    'url': 'php_action/quotations.php',
                    'data': function (data) {
                        
                        
						var searchByQuotation=$('#searchByQuotation').val();
						var searchByClientName=$('#searchByClientName').val();
						var searchByCurrencyStatus=$('#searchByCurrencyStatus').val();
						
						
						data.searchByQuotation = searchByQuotation;
						data.searchByClientName = searchByClientName;
						data.searchByCurrencyStatus = searchByCurrencyStatus;
						
						
						
						
						
                    }
                },
                'columns': [
                    { data: 'quot_id'},
					{ data: 'quotNo'},
                    { data: 'clientName'},
					{ data: 'edit'},
					//{ data: 'issue'},
                    { data: 'pdfFile'},
					//{ data: 'ClientFile'},
					{ data: 'delete'},
                ]
                
            });

          
		   $('#searchByQuotation').keyup(function () {
                dataTable.draw();
            }); 
			
           
           
			
			$('#searchByClientName').change(function () {
                dataTable.draw();
            });
			
			$('#searchByCurrencyStatus').change(function () {
                dataTable.draw();
            });
			
			
			
			
        });
       
    </script>
					
					
				</div>
                </div>
              </div>
            </div>
			
			<?php
			include 'deleteInvModal.php';
			?>
		
          </div>
        </div>
        <!-- /page content -->
		
		
		<?php
		include 'includes/footer.php';
		?>
		
        
      </div>
    </div>

    <!-- Must -->
    <script src="custom/js/invoices.js"></script>
  
	
    <!-- Must Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
	
	<!-- file input -->
	<script src="assests/plugins/fileinput/js/plugins/canvas-to-blob.min.js'); ?>" type="text/javascript"></script>	
	<script src="assests/plugins/fileinput/js/plugins/sortable.min.js" type="text/javascript"></script>	
	<script src="assests/plugins/fileinput/js/plugins/purify.min.js" type="text/javascript"></script>
	<script src="assests/plugins/fileinput/js/fileinput.min.js"></script>	
	
  </body>
</html>



<?php
}
?>