JezK
Edit File: warehouse.php
<?php include("./app/checkSession.php"); if(empty($_SESSION['admin_name'])&&$_SESSION['admin_name']==""){ echo "<script>window.location.href='index.php'</script>"; } include("header.php"); include_once("../master_admin/app/adminObj.php"); $warehouse_list=$adminObj->getWarehouseList(); //~ print_r ($warehouse_list); ?> <!-- side block --> <link href="css/demo.css" type="text/css" rel="stylesheet"> <style> /* .fa-check-circle.text-primary, .fa-ban.text-warning, .fa-ban.text-danger, .fa-times-circle-o.text-warning,.fa-times-circle-o.text-danger { color: gray !important; } */ .text-primary:hover { color: green !important; } .text-warning:hover, .fa-times-circle-o.text-warning:hover, .fa-ban.text-danger:hover,.fa-times-circle-o.text-danger:hover { color: red !important; } i.fa.fa-check-circle, i.fa.fa-circle.text-warning, i.fa.fa-ban.text-danger { font-size: 18px !important; color: green; } .warehouseGridView a.nav-link.active { background: #2f58c9; color: #fff !important; border-radius: 10px; padding: 4px 10px; } .table-width .nav .nav-item .nav-link{background:#fff;color:#198afa ;} .table-width .nav .nav-item a.nav-link.border-0.active.show{color:#fff !important;background:#2f58c9 !important;border-radius: 10px !important;} /* .p-2.actionCls .fa-check-circle.text-primary{color:green !important;} */ /* i.fa.fa-times-circle-o.text-warning,.fa.fa-ban.text-danger{color:red !important;} */ @media(max-width:767px){ .tophead { margin-top: 42px; } .warehouseGridView{ position :unset !important; } /* #example_filter label:after { right:48px; } */ td.actionsCls { display: flex; } } </style> <!-- side block --> <div class="container first-position d-inline1"> <div class="container"> <div class="row px-md-2 px-0"> <div class="tophead col-md-2"> <h6><?php echo $lang['WAREHOUSES']; ?></h6> </div> <!-- <div class="tophead col-md-1"> <button type="submit" class="btn btn-primary pointer">Grid View</button> </div> <div class="tophead col-md-2 ml-5"> <button type="submit" class="btn btn-primary pointer ">List View</button> </div>--> </div> </div> <div class="table-width col-sm-12"> <ul class="nav nav-tabs mt-4 border-0 d-md-flex justify-content-left warehouseGridView"> <li class="nav-item ml-3 mr-3"> <a class="nav-link border-0" href="warehouse-grid.php"><img src="images/grid.png" class="blueImages"><img class="whiteImages" src="images/grid-white.png"> <?php echo $lang['GRID_VIEW'] ?></a> </li> <li class="nav-item ml-3 mr-3"> <a class="nav-link border-0 active show" data-toggle="tab" href="#listView"><img src="images/list.png" class="blueImages"><img class="whiteImages" src="images/list-white.png"> <?php echo $lang['LIST_VIEW'] ?></a> </li> </ul> <div class="tab-content"> <div id="listView" class="container tab-pane active p-0"><br> <div class="table-responsive p-0 myquotation-table"> <table id="example" class="display bg-white tbl-border table-borderless" style="width:100%"> <thead> <tr> <th><?php echo $lang['SNO'] ?></th> <th><?php echo $lang['WAREHOUSE_NUMBER'] ?></th> <th><?php echo $lang['WAREHOUSE_NAME'] ?></th> <!-- <th>Country</th> --> <th><?php echo $lang['CITY'] ?></th> <th><?php echo $lang['UFLEXIT_%'] ?></th> <th><?php echo $lang['STATUS'] ?></th> <th><?php echo $lang['ACTION'] ?></th> </tr> </thead> <tbody> </tbody> </table> <!-- <table id="example" class="display bg-white tbl-border table-borderless" style="width:100%"> <thead> <tr> <th>Sno</th> <th>Warehouse Name</th> <th>Warehouse Number</th> <th>Warehouse Country</th> <th>Warehouse Address</th> <th>State</th> <th>Action</th> </tr> </thead> <tbody> <?php $sql= "select * from uflexit_master_wareHouse"; $rows = $adminObj->db->get_results($sql); $totalRecord = count($rows); if($totalRecord>0) { $j=1; foreach($rows as $fetch) { // print_r($fetch); // exit; // echo $fetch['warehouse_status']; if ($fetch['warehouse_status'] == 0){ $status = "Pending"; $color = 'text-warning'; }else if($fetch['warehouse_status'] == 1){ $status = "Active"; $color = 'text-success'; }else if($fetch['warehouse_status'] == 2){ $status = "Block"; $color = 'text-danger'; } $query="select * from uflexit_countries where country_id='".$fetch['warehouse_country_id']."'"; $row=$adminObj->db->get_row($query); if ($fetch['warehouse_status'] == 0){ $statusHTML = ' <a class="p-2" href="warehouseActive.php?id='.$fetch["warehouse_id"].'"><i title="Pending" class="fa fa-check-circle text-warning" aria-hidden="true"></i></a> <a class="p-2" href="warehouseInactive.php?id='.$fetch["warehouse_id"].'><i title="Inactive" class="fa fa-circle text-warning" aria-hidden="true"></i></a>'; } else if ($fetch['warehouse_status'] == 2){ $statusHTML = ' <a class="p-2" href="warehouseActive.php?id='.$fetch["warehouse_id"].'"><i title="Block" class="fa fa-ban text-danger" aria-hidden="true"></i></a>'; } else{ $statusHTML = ' <a class="p-2" href="warehouseReject.php?id='.$fetch["warehouse_id"].'"><i title="Active" class="fa fa-check-circle text-success" aria-hidden="true"></i></a> '; } // print_r($row); ?> <tr> <td><?php echo $j++; ?></td> <td><?php echo $fetch['warehouse_name'] ?></td> <td><?php echo $fetch['warehouse_number'] ?></td> <td><?php echo $row['country_name'] ?></td> <td><?php echo $fetch['warehouse_address'] ?></td> <td><?php echo $status ?></td> <td class="d-flex"> <?php echo $statusHTML; ?> </td> </tr> <?php } } ?> </tbody> </table> --> </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> --> <!----> <script> $(document).ready(function() { $('td').click(function() { window.open('warehouseDetails.php'); }); $('#data').DataTable({ language: { search: "", searchPlaceholder: "Search " }, "processing": true, "dataSrc": "", dom: 'frtlip', buttons: [ ], }); //~ $('#example').DataTable({ //~ language: { //~ search: "", //~ searchPlaceholder: "Search " }, //~ "processing": true, //~ "dataSrc": "", //~ "sDom": 'Bfrtip', //~ buttons: [ //~ { //~ extend: 'csvHtml5', //~ text: '<i class="fa fa-download p-1"></i>Export to csv', //~ titleAttr: 'CSV' //~ }, //~ ], //~ }); }); var toggle_customSidebar = false, custom_open = 0; if (!toggle_customSidebar) { var toggle = $('.custom-template .custom-toggle'); toggle.on('click', (function() { if (custom_open == 1) { $('.custom-template').removeClass('open'); toggle.removeClass('toggled'); custom_open = 0; } else { $('.custom-template').addClass('open'); toggle.addClass('toggled'); custom_open = 1; } })); toggle_customSidebar = true; } $('.nav-toggle').click(function() { var collapse_content_selector = $(this).attr('href'); var toggle_switch = $(this); $(collapse_content_selector).toggle(function() { if ($(this).css('display') == 'none') { toggle_switch.html('View All'); } else { toggle_switch.html('Hide'); } }); }); jQuery(document).ready(function() { // alert('hello') jQuery('#example').DataTable({ "processing": true, "dataSrc": "", // "dom": 'Bfrtip', // "dom": 'frtlip', // "sDom": 'Bfrtip', "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/mywarehouse-ajax.php", // "ordering": false, "buttons": [{ "extend": 'csvHtml5', "text": '<i class="fa fa-download p-1"></i>Export to csv', "titleAttr": 'CSV', "action": function(e, dt, node, config) { window.location.href = './export-warehouses.php?ExportToCSV=Yes'; } }, ], "aoColumns": [{ mData: 'id', sClass: 'warehouseCls' }, { mData: 'warehouse_number', sClass: 'warehouseCls' }, { mData: 'warehouse_name', sClass: 'warehouseCls' }, // { // mData: 'country_name' // }, { mData: 'warehouse_city', sClass: 'warehouseCls' }, { mData: 'percent', sClass: ' percentCls' }, { mData: 'warehouse_status', sClass: 'warehouseCls' }, { mData: 'action', sClass: 'actionsCls' } ] }); }); $(document).on("click",".warehouseCls",function(){ //~ alert($(this).closest('tr').find(".warehouseId").val()) let warehouseId = $(this).closest('tr').find(".warehouseId").val(); window.location.href="./warehouseDetails.php?id="+warehouseId }) function editPercent(id){ var percent = $('#uflexit_percent'+id).val(); // alert(percent); $('#percentage'+id).addClass('d-none'); $('#uflexitPercent'+id).prop('readonly', false); $('#updatePercent'+id).removeClass('d-none'); } function submitUflexitPercent(id) { var uflexitPercent = $('#uflexitPercent'+id).val(); // alert(uflexitPercent);return; if(uflexitPercent == "" || uflexitPercent == 0 || uflexitPercent == undefined) { alert("Please enter uflexit percentage"); return false; } jQuery.ajax({ type: "POST", url: './ajax.php', data: ({ action: 'update_percentage', percentage : uflexitPercent, warehouseId : id }), success: function(data) { // console.log(data);return; if(data == 1) { alert("Uflexit percentage updated successfully"); location.reload(); } else{ alert("Updation failed"); location.reload(); } } }) } </script>