JezK
Edit File: dashboard.php
<?php include("app/checkSession.php"); // include("app/adminObj.php"); // print_r($_SESSION); if(!isset($_SESSION['customer_user_id'])){ $customerObj->redirect('login.php'); } include("header.php"); // print_r($_SESSION); $stock = $customerObj->db->get_row("SELECT COUNT(*) as count FROM uflexit_onhand_stock WHERE user_id=".(int)$_SESSION['customer_user_id']." and available_quantity !=0"); $count = $customerObj->db->get_row("SELECT COUNT(*) as count FROM uflexit_invoice WHERE user_id=".(int)$_SESSION['customer_user_id']); $shipment = $customerObj->db->get_row("SELECT COUNT(*) as count FROM uflexit_asn_request WHERE user_id=".(int)$_SESSION['customer_user_id']); // print_r($count); ?> <style> div#example1_length:first-child,div#example2_length:first-child { display: none; } /* .currency tbody td:nth-child(5){ max-width: 100% !important; display: grid !important; grid-template-columns: 40% 20% !important; padding-left: 20% !important; } */ .priceValue { overflow: hidden !important; text-overflow: ellipsis !important; /* display: inline-block; */ } table.dataTable tbody td { padding: 15px 20px !important; } </style> <div class="container"> <div class="container my-3"> <div class="row px-md-4"> <div class="tophead col-md-4"> <h6> <?php echo $lang['DASHBOARD']; ?></h6> </div> <div class="col-md-4"> </div> <!-- <div class="col-md-4"> <div class="input-group search-button mb-2" style="margin-right:10px;"> <input class="form-control border-right-0 border align-self-right border-rad-left" type="text" value="" id="myInput"> <span class="input-group-append"> <button class="btn btn-outline-secondary border-left-0 border border-rad-right" type="button"> <i class="fa fa-search"></i> </button> </span> </div> </div> --> </div> </div> <div class="container "> <div class="row px-md-4"> <div class="col-lg-4 col-sm-6 mb-2"> <div class="content selected"> <div class="row pt-4" id="your_stock"> <div class="col-sm-6 text-center"> <img src="images/Customer_croppings/YourStock.png"> </div> <div class="col-sm-6 text-left mobile-view"> <p class="item_name"><?php echo $lang['TOTAL_STOCK']; ?></p> <h1 class="stock_no mb-0 green-text"><?php if($stock) echo (int)$stock['count']; else echo '0';?></h1> </div> <div class="col-sm-12 text-md-left text-center"> <div class="col-sm-10 offset-sm-1 col-offset-sm-1 pl-md-0 mt-md-0 mt-3"> <p class="item_name mb-0"> <?php echo $lang['YOUR_STOCK']; ?></p> </div> </div> </div> <div class="row"> <div class="col-sm-3 offset-sm-9 view-row"><a href="yourstock.php" style="z-index:99; position:relative;" ><span class="view text-primary" id="stock"><?php echo $lang['VIEW'] ?> </span></a> </div> </div> </div> </div> <div class="col-lg-4 col-sm-6 mb-2"> <div class="content"> <div class="row pt-4" id="invoice"> <div class="col-sm-6 text-center"> <img src="images/Customer_croppings/YourInvoice.png"> </div> <div class="col-sm-6 text-left mobile-view"> <p class="item_name"> <?php echo $lang['TOTAL_INVOICE']; ?></p> <h1 class="invoice_no mb-0 blue-text"><?php if($count) echo (int)$count['count']; else echo '0';?></h1> </div> <div class="col-sm-12 text-md-left text-center"> <div class="col-sm-10 offset-sm-1 col-offset-sm-1 pl-md-0 mt-md-0 mt-3"> <p class="item_name mb-0"> <?php echo $lang['YOUR_INVOICES']; ?></p> </div> </div> </div> <div class="row "> <div class="col-sm-3 offset-sm-9 view-row"><a href="invoice.php" style="z-index:99; position:relative;"><span class="view text-primary" id="invoices"><?php echo $lang['VIEW'] ?></span></a></div> </div> </div> </div> <div class="col-lg-4 col-sm-6 mb-2"> <div class="content "> <div class="row pt-4" id="bookings"> <div class="col-sm-6 text-center"> <img src="images/Customer_croppings/YourShipmentstatus.png"> </div> <div class="col-sm-6 text-left mobile-view"> <p class="item_name text-nowrap"> <?php echo $lang['TOTAL_SHIPMENT']; ?></p> <h1 class="shift_no mb-0 orange-text"><?php if($shipment) echo (int)$shipment['count']; else echo '0';?></h1> </div> <div class="col-sm-12 text-md-left text-center"> <div class="col-sm-10 offset-sm-1 col-offset-sm-1 pl-md-0 mt-md-0 mt-3"> <p class="item_name mb-0"> <?php echo $lang['YOUR_SHIPMENT_STATUS']; ?></p> </div> </div> </div> <div class="row "> <div class="col-sm-3 offset-sm-9 view-row"><a href="shipment.php" style="z-index:99; position:relative;"><span class="view text-primary" id="shipment"><?php echo $lang['VIEW'] ?></span></a> </div> </div> </div> </div> </div> </div> <div id="table"> <div class="container "> <div class="table-responsive p-md-4 myquotation-table"> <table id="example" class="display bg-white tbl-border table-borderless yourStockTable" style="width:100%"> <thead> <tr><th col="1" style="color: blue;"> <?php echo $lang['YOUR_STOCK']; ?></th></tr> <tr> <th> <?php echo $lang['QUOTATION_ID']; ?></th> <th><?php echo $lang['WAREHOUSE_ID']; ?></th> <th> <?php echo $lang['WAREHOUSE_NAME']; ?></th> <th><?php echo $lang['ITEM_NO']; ?></th> <th><?php echo $lang['TOTAL_QTY']; ?></th> <th><?php echo $lang['BALLANCE_QTY']; ?></th> <th> <?php echo $lang['TRANSACTION_DATE']; ?></th> <th> <?php echo $lang['STATUS']; ?></th> </tr> </thead> </table> </div> </div> <div class="container position-relative"> <div class="row export_csv"> <div class="col-md-3 offset-md-11 button-alignment"> <a href="export_total_stock.php" id="export" class="btn btn-primary"><i class="fa fa-download"></i><span class="pl-2"><?php echo $lang['EXPORT_XLSX']; ?></span></a> </div> </div> </div> </div> <div id="table1"> <div class="container"> <div class="table-responsive p-md-4 myquotation-table"> <table id="example1" class="display bg-white tbl-border table-borderless invoiceTable" style="width:100%"> <thead> <tr><th col="1" style="color: blue;"> <?php echo $lang['YOUR_INVOICES']; ?></th></tr> <tr> <th> <?php echo $lang['INVOICE_NUMBER']; ?></th> <th> <?php echo $lang['QUOTATION_ID']; ?></th> <th> <?php echo $lang['WAREHOUSE_NUMBER']; ?></th> <th> <?php echo $lang['WAREHOUSE_NAME']; ?></th> <th> <?php echo $lang['INVOICE_DATE']; ?></th> <th> <?php echo $lang['ACTION']; ?></th> </tr> </thead> </table> </div> </div> <div class="container position-relative"> <div class="row export_csv"> <div class="col-md-3 offset-md-11 button-alignment"> <a href="export_invoices.php" id="export" class="btn btn-primary"><i class="fa fa-download"></i><span class="pl-2"><?php echo $lang['EXPORT_XLSX']; ?></span></a> </div> </div> </div> </div> <div id ="table2"> <div class="container " > <div class="table-responsive p-md-4 myquotation-table"> <table id="example2" class="display bg-white tbl-border table-borderless currency shipmentTable" style="width:100%"> <thead> <tr><th col="1" style="color: blue;"> <?php echo $lang['YOUR_SHIPMENT_STATUS']; ?></th></tr> <tr> <th><?php echo $lang['WAREHOUSE_ID']; ?></th> <th><?php echo $lang['WAREHOUSE_NAME']; ?></th> <!-- <th><?php echo $lang['REQUEST_TYPE']; ?></th> --> <th><?php echo $lang['CUSTOMER_NAME']; ?></th> <th><?php echo $lang['QUOTATION_VALUE']; ?></th> <th><?php echo $lang['CURRENCY']; ?></th> <th><?php echo $lang['ASN_DATE']; ?></th> <th><?php echo $lang['STATUS']; ?></th> <th><?php echo $lang['ACTION']; ?></th> </tr> </thead> </table> </div> </div> <div class="container position-relative"> <div class="row export_csv"> <div class="col-md-3 offset-md-11 button-alignment"> <a href="export_shipment.php" id="export" class="btn btn-primary"><i class="fa fa-download"></i><span class="pl-2"><?php echo $lang['EXPORT_XLSX']; ?></span></a> </div> </div> </div> </div> </div> <!-- footer --> <?php include("footer.php"); ?> <!-- <script src="js/jquery.min.js"></script> --> <!-- <script src="js/jquery.pagination.min.js"></script> --> <!----> <style> </style> <script> let $ =jQuery; $(document).ready(function(){ $("#table1,#table2").hide(); $("#your_stock,#invoice,#bookings").on("click",function(){ // alert("hello") $("#table,#table1,#table2").hide(); if($(this).attr('id')=='your_stock'){ $("#table").show(); } else if($(this).attr('id')=='invoice'){ $('#table1').show(); } else{ $("#table2").show(); } }) }); $(document).ready(function() { /* for keeping the tab active while clicking on back button*/ var last=document.referrer; // alert(last); const lastSegment1 = last.split("/").pop(); const lastSegment=lastSegment1.split('?')[0]; if(lastSegment=="invoice.php"||lastSegment=="invoicesView.php"){ $("#invoice").parent().addClass("selected"); $("#your_stock").parent().removeClass("selected"); $('#table1').show(); $("#table,#table2").hide(); } if(lastSegment=="shipment.php"||lastSegment=="view_shipment_status.php"){ $("#bookings").parent().addClass("selected"); $("#your_stock").parent().removeClass("selected"); $('#table2').show(); $("#table,#table1").hide(); } jQuery('#example').DataTable({ "processing": true, "dataSrc": "", "dom": 'Bfrtip', "dom": 'Rlfrtlip', language: { search: '', searchPlaceholder: "<?php echo $lang['SEARCH'] ?>", paginate: {previous: '<?php echo $lang['PREV'];?>',next:'<?php echo $lang['NEXT'];?>'}}, "pagingType": "full_numbers", "bProcessing": true, "bServerSide": true, "sAjaxSource": "app/total_stock_ajax.php", "ordering": false, "fnDrawCallback": function( oSettings ) { rowCount=oSettings.json.iTotalRecords; if(rowCount<1){ $("#export").addClass("d-none") } }, "aoColumns": [ { mData: 'quotation_id' }, { mData: 'warehouse_id' } , { mData: 'warehouse_name' }, { mData: 'itemcode' }, { mData: 'qty' }, { mData: 'available_quantity' } , { mData: 'created_date' } , { mData: 'action' } ] }); jQuery('#example1').DataTable( { "processing": true, "dataSrc": "", "dom": 'Bfrtip', "dom": 'Rlfrtlip', language: { search: '', searchPlaceholder: "<?php echo $lang['SEARCH'] ?>", paginate: {previous: '<?php echo $lang['PREV'];?>',next:'<?php echo $lang['NEXT'];?>'}}, "pagingType": "full_numbers", "bProcessing": true, "bServerSide": true, "sAjaxSource": "app/invoices_ajax.php", "ordering": false, "fnDrawCallback": function( oSettings ) { rowCount=oSettings.json.iTotalRecords; if(rowCount<1){ $("div#table1 a#export").addClass("d-none") } }, "aoColumns": [ { mData: 'invoice_number' }, { mData: 'quotation_id' }, { mData: 'warehouse_id' } , { mData: 'warehouse_name' } , { mData: 'created_date' } , { mData: 'action' } ] } ); } ); $('#example2').DataTable({ "processing": true, "dataSrc": "", "dom": 'Bfrtip', "dom": 'Rlfrtlip', language: { search: '', searchPlaceholder: "<?php echo $lang['SEARCH'] ?>", paginate: {previous: '<?php echo $lang['PREV'];?>',next:'<?php echo $lang['NEXT'];?>'}}, "pagingType": "full_numbers", "bProcessing": true, "bServerSide": true, "sAjaxSource": "./app/shipmentStatus-ajax-list.php", "ordering": false, "fnDrawCallback": function( oSettings ) { rowCount=oSettings.json.iTotalRecords; if(rowCount<1){ $("div#table2 button#export").addClass("d-none") } }, "aoColumns": [{ mData: 'warehouse_id' } , { mData: 'warehouse_name' } , { mData: 'name' } , { mData: 'price' }, { mData: 'currency' }, { mData: 'date' } , { mData: 'asn_status' }, { mData: 'action' } ] }); $('.content').click(function(e) { e.preventDefault(); $('.content').removeClass('selected'); $(this).addClass('selected'); }); $('#stock').click(function(){ window.location= 'yourstock.php'; }); $('#invoices').click(function(){ window.location= 'invoice.php'; }); $('#shipment').click(function(){ window.location= 'shipment.php'; }); </script>