JezK
Edit File: warehouse-grid.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"); $count_query="select count(*) from uflexit_master_warehouse "; $totalCount=$adminObj->db->get_row($count_query); //~ print_r($totalCount) //~ exit; $warehouse_list=$adminObj->getWarehouseList(); //~ print_r ($warehouse_list); $warehouseDetails=$adminObj->warehouseDetails(0,5); // print_r($warehouseDetails); // echo count($warehouseDetails);exit; // print_r($warehouseDetails); // exit; //~ echo "<pre>"; $warehouseStorage=$adminObj->warehouseStorageType(); $warehouseServices=$adminObj->warehouseServicesType(); $warehousefeatures=$adminObj->warehouseFeaturesType(); $warehouseDeals = $adminObj->getWareHouseDeals(); $storage=$services=$features=$eproductwareHouseDeals=$products=''; foreach($warehouseStorage as $storageType) { $storage.='<div class="form-check my-2"> <label class="ml-2"> '.$lang[$storageType['lang_variables']].' <input type="checkbox" class="form-check-input filterWareHouse storageTypeClass stortype'.$storageType['pricetype_id'].'" id="checkboxall" value='.$storageType['pricetype_id'].' > <span class="checkbox"></span> </label> </div>'; } if(count($warehousefeatures)>0){ $className=''; foreach($warehousefeatures as $featureType){ if($featureType['feature_id']==1){ $id='featuresCheckboxall'; $className='featuresTypeClass1'; }else{ $className='featuresTypeClass'; } if($featureType['feature_id'] != 4) { $features.='<div class="form-check my-2"> <label class="form-check-label ml-2" for="featureTypeRadio'.$featureType['feature_id'].'"> <input type="checkbox" class="form-check-input filterWareHouse '.$className.'" id="featureTypeRadio'.$featureType['feature_id'].'" name="optradio" value='.$featureType['feature_id'].'> '.$lang[$featureType['lang_variables']].' <span class="checkbox"></span> </label> </div>'; } } } if(count($warehousefeatures)>0){ $className=''; foreach($warehouseServices as $servicesType){ if($servicesType['service_id']==1){ $id='servicesCheckboxall'; $className='servicesTypeClass1'; }else{ $className='servicesTypeClass'; } $services.='<div class="form-check my-2"> <label class="form-check-label ml-2" for="servicesTypeRadio'.$servicesType['service_id'].'"> <input type="checkbox" class="form-check-input filterWareHouse '.$className.' " id="servicesTypeRadio'.$servicesType['service_id'].'" name="optradio" value='.$servicesType['service_id'].'>'.$lang[$servicesType['lang_variables']].' <span class="checkbox"></span> </label> </div>'; } } if(count($warehousefeatures)>0){ $className=''; foreach($warehouseDeals as $productsType){ if($productsType['deal_id']==1){ $id='productsCheckboxall'; $className='productsTypeClass1'; }else{ $className='productsTypeClass'; } $products.='<div class="form-check my-2"> <label class="form-check-label ml-2" for="productDealsTypeRadio'.$productsType['deal_id'].'"> <input type="checkbox" class="form-check-input filterWareHouse '.$className.'" id="productDealsTypeRadio'.$productsType['deal_id'].'" name="optradio" value='.$productsType['deal_id'].'> '.$lang[$productsType['lang_variables']].' <span class="checkbox"></span> </label> </div>'; } } ?> <!-- side block --> <link href="css/demo.css" type="text/css" rel="stylesheet"> <style> i.fa.fa-check-circle, i.fa.fa-circle.text-warning, i.fa.fa-ban.text-danger { font-size: 18px !important; color: green; } .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: blue !important; border-radius: 10px !important; } .round { /* width: 10px; */ height: 10px; border-radius: 50px; background: #ccc; } input[type="checkbox"]:checked~.checkbox { background-color: #2196F3; } .checkbox { position: absolute; top: 4px; left: 0px; height: 20px; width: 20px; background-color: #eee; border-radius: 12px; cursor: pointer; } input[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } :hover input~.checkbox { background-color: #ccc; } input[type="checkbox"]:checked~.checkbox:after { display: block; } .checkbox:after { left: 9px; top: 5px; width: 5px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .checkbox:after { content: ""; position: absolute; display: none; } .red:hover { color: red !important; font-weight: bold; } .green:hover { color: green !important; font-weight: bold; } .btn-blue{ background: #2f58c9; color:white; } .text-blue{ color:#2f58c9 !important; margin:0px !important; } /* pagination css */ #content { padding: 15px; border: solid 1px #eee; max-width: 660px; margin: auto; border-radius: 4px; } ul.pagination.bootpag { justify-content: center; border-radius: 1px solid; } .pagination.bootpag li { padding: 0px 10px; border-radius: 50%; margin: 0px 4px; display: flex; align-items: center; border: 1px solid white; } .pagination li.active { background-color: #3663c8; } .pagination li:hover { /* background-color: #fff; */ border: 1px solid #3663c8; } .pagination li:hover a { color: #000 !important; } li.prev,li.next { background: #fff; padding: 2px 8px !important; border-radius: 20px !important; box-shadow: 0px 1px 5px #3663c8; } .pagination li.active a { color: white; } .pagination li a { line-height: 1.6em; } ul.sub-menu.children.dropdown-menu.features.bg-list-color.mb-3.pl-md-0.show { height: 200px; overflow-y: auto; } ul.sub-menu.children.dropdown-menu.storage.bg-list-color.mb-3.pl-md-0.show { height: 100px; overflow-y: auto; } /* ul.sub-menu.children.dropdown-menu.storage.bg-list-color.mb-3.pl-md-0.show { height: 200px; overflow-y: auto; } */ ul.sub-menu.children.dropdown-menu.services.bg-list-color.mb-3.pl-md-0 { height: 200px; overflow-y: auto; } .detail { color: black; } body { overflow-x: hidden; } .col-sm-12.card.mt-1 { border: 0px; } .warehouse, .id, .type, .location { color: #2f58c9; } .card-horizontal { display: flex; flex: 1 1 auto; /* box-shadow: 0px 0px 2px; */ } .checked { content: "\f005"; color: #3663c8; } .uncheked { -webkit-text-fill-color: white; -webkit-text-stroke-width: 1px; -webkit-text-stroke-color: #3663c8; } .search::placeholder { /* padding-left:20px !important; margin-left:25px !important; */ } .search ,.palletSearch ,.spaceSearch,.searchDay{ background-image: url("../pictures/search.png"); background-repeat: no-repeat; height: 30px; /* padding-left:40px; */ background-position: right; background-origin: content-box; padding: 17px; padding-left: 10px; width: 300px; font-size: 13px; } .searchDay , .palletSearch ,.spaceSearch { padding: 8px !important; width:260px !important; } .spantag { position: absolute; } .et-app-sr { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important } .et-app-rating-stars { height: 4em; display: flex } .et-app-rating-star { background: none; border: none; box-shadow: none; font-size: 18px; cursor: pointer; } .et-app-rating-star .selected { display: none; color: #3663c8; } .book { cursor: pointer; } .et-app-rating-star.select i, .et-app-rating-star.highlight i { display: none } .et-app-rating-star.select .selected, .et-app-rating-star.highlight .selected { display: block } .et-app-rating-star:focus { outline: 1px solid #000 } .fa-star-o:before { color: #3663c8; } .actionCls { color: #000 !important } .actionCls:hover { color: #000; } .card h6 b { font-size: 14px; } .font-large { font-size: 26px; color: #000; } .font-large { font-size: 20px; color: #000; } .custom-template { transform: translateY(-45%); } .text-gray { color: #636363c7; font-size: 18px; font-family: 'Barlow', sans-serif; font-weight: 600; } .filterSubmit { background: #2f58c9; border: none; border-radius: 5px; color: #fff; padding: 6px 10px !important; } .fa-ban.text-danger, i.fa.fa-times-circle-o.text-danger, .fa.fa-ban.text-warning { color: red !important; } i.fa-times-circle-o .text-danger, i.fa-times-circle-o .text-waring { color: orange !important; } i.fa.fa-check-circle.text-primary, .fa.fa-check-circle.text-warning { color: green !important; } .warehouseGridView1 a.nav-link.active { background: #2f58c9; color: #fff; border-radius: 10px; padding: 4px 10px; } p#pagination-here { cursor: pointer; } table.dataTable thead .sorting { display: none; } .search_error, { font-size: 12px; } .filter_error { font-size: 15px; font-weight:normal !important; } .img-square-wrapper img { width: 500px !important; height: 200px !important; } @media(max-width:767px){ .tophead.pl-2.mb-3 { margin-top: 28px !important; } .padRes { padding: 0px 15px !important; margin-top:10px } .col-sm-6.text-right.status-btn { text-align: center !important; } .card-horizontal.book{ display:block; text-align:center; } .ipadWareRes { display: flex !important; justify-content: center !important; } } .navbar .navbar-nav li.menu-item-has-children.show .sub-menu { max-height: 145px !important; } .navbar { margin: 10px 0 25px 0 !important; } input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } /* Firefox */ input[type=number] { -moz-appearance: textfield; } .uflexitPercent { width: 35%; border: 1px solid #ced4da; border-radius: 0.25rem; } </style> <!-- side block --> <div class="container first-position "> <div class="container"> <div class="mb-2"> <div class="tophead pl-2 mb-3"> <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="row justify-content-left col-sm-9 mb-3 pl-4 grid" style="z-index:99"> <ul class="col-lg-6 col-md-12 nav nav-tabs pl-3 border-0 d-md-flex align-items-center mb-4 justify-content-left warehouseGridView1"> <li class="nav-item"> <a class="nav-link active show border-0" data-toggle="tab" href="#gridView"><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" href="warehouse.php"><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="form-inline col-lg-6 col-sm-12 row justify-content-end mb-3 pr-0 grid"> <div class="col-sm-9"> <input type="text" placeholder="<?php echo $lang['NAME_OR_LOCATION'] ?>" class=" search form-control w-100" id="searchValue" onkeyup="filterReset(this.value)"> </div> <div class="col-sm-3 px-0 padRes"> <button type="button" class=" btn btn-blue py-1 filterSearch w-100" value="Search"><?php echo $lang['SEARCH'] ?></button> </div> <div class="error search_error col-sm-12 pt-2"></div> </div> <div class="form-inline col-lg-6 col-sm-12 row justify-content-end mb-1 pr-0 grid mobileFilter"> <div class="col-sm-6 filterIcon"> <h4 class="text-center">Filter</h4> <img src="./images/filter.png" alt="filter" class="mt-2" onclick="ShowFilter()"> </div> </div> </div> <div class=" col-sm-9"> <!-- <div class="table-width"> --> <div class="table-responsive1 table-width myquotation-table"> <?php $hrefHTML = ""; $color =""; if(is_array($warehouseDetails)){ foreach($warehouseDetails as $wrow) { // echo "Test"; if ($wrow['warehouse_status'] == 0){ $status = $lang['PENDING']; $hrefHTML ='<a class="p-2 actionCls green" href="warehouseActive.php?type=2&id='.$wrow["warehouse_id"].'"><i title="Active" class="fa fa-check-circle text-primary" aria-hidden="true"></i>'.$lang['ACTIVE'].'</a> <a class="p-2 actionCls red" href="warehouseReject.php?type=2&id='.$wrow["warehouse_id"].'"><i title="Reject" class="fa fa-times-circle-o text-danger" aria-hidden="true"></i> '.$lang['REJECT'].'</a>'; $color = 'text-warning'; }else if($wrow['warehouse_status'] == 1){ $status = $lang['ACTIVE']; $hrefHTML ='href="warehouseActive.php?id='.$wrow["warehouse_id"].'"'; $hrefHTML ='<a class="p-2 actionCls red" href="warehouseInactive.php?type=2&id='.$wrow["warehouse_id"].'"><i title="Block" class="fa fa-ban text-danger" aria-hidden="true"></i>'.$lang['BLOCK'].'</a>'; $color = 'text-success'; }else if($wrow['warehouse_status'] == 2){ $status = $lang['REJECTED']; $hrefHTML =''; $color = 'text-danger'; }else if($wrow['warehouse_status'] == 3){ $status = $lang['BLOCK']; $hrefHTML ='<a class="p-2 actionCls green" href="warehouseActive.php?type=2&id='.$wrow["warehouse_id"].'"><i title="Active" class="fa fa-check-circle text-warning" aria-hidden="true"></i>'.$lang['ACTIVE'].'</a>'; $color = 'text-danger'; } if(isset($wrow['warehouse_logo']) && isset($wrow['warehouse_logo'])!='') { $imgPath = "./../uploads/warehouse_imgs/".$wrow['warehouse_logo']; // echo $imgPath;exit; if(file_exists($imgPath)) { $image='<img src="./../uploads/warehouse_imgs/'.$wrow['warehouse_logo'].'" alt="image1" height="200px" width="200%">'; } else{ $image='<img src="./../pictures/img1.png" alt="image1" class="h" height="200px" width="200%"/>'; } } else { $image='<img src="./../pictures/img1.png" alt="image1" class="hew" height="200px" width="200%"/>'; } // 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> // '; // } ?> <!-- <a href="warehouseDetails.php"> --> <div class="card" onclick="location.href='warehouseDetails.php?id=<?php echo $wrow['warehouse_id'];?>';"> <div class="card-horizontal book"> <div class="img-square-wrapper pt-4 pb-3 pl-3 align-self-right col-sm-5"> <?php echo $image; ?> </div> <div class="card-body"> <div class="row"> <div class="col-sm-6"> <p class="text-dark font-weight-bold m-0 pb-4"><?php echo $lang['STATUS'] ?>: <span class="<?php echo $color; ?>"> <?php echo $status; ?> </span> </p> </div> <div class="col-sm-6 text-right status-btn"> <?php echo $hrefHTML; ?> </div> <div class="col-md-6"> <h6 class="warehouse pt-3"><b><?php echo $lang['WAREHOUSE_NAME'] ?></b></h6> <p class="pt-2 text-dark 20px"><?php echo $wrow['warehouse_name'] ?></p> </div> <div class="col-md-6"> <h6 class="location pt-3"><b><?php echo $lang['LOCATION'] ?></b></h6> <img src="../pictures/location.png" alt="" height="15px"> <label> <p class="pt-2 text-dark 20px"><?php echo $lang[$wrow['city_lang_variable']].', '.$lang[$wrow['lang_variables']] ?></p> </label> </div> <div class="col-md-6"> <h6 class="type pt-2"><b><?php echo $lang['WAREHOUSE_ID'] ?></b></h6> <p class="pt-2 text-dark 20px"><?php echo $wrow['warehouse_id'] ?></p> </div> <div class="col-md-6"> <h6 class="type pt-2"><b><?php echo $lang['WAREHOUSE_TYPE'] ?></b></h6> <p class="pt-2 text-dark 20px"><?php echo $lang[$wrow['lang_variable']] ?></p> </div> <div class="col-md-5"> <?php if($wrow['uflexit_percent'] == "") { $uflexit_percent = 0; } else{ $uflexit_percent = $wrow['uflexit_percent']; } ?> <h6 class="warehouse pb-2"><b><?php echo $lang['UFLEXIT_%'] ?></b></h6> <div id="percentage<?php echo $wrow['warehouse_id'] ?>" class=""> <?php echo $uflexit_percent; ?> <img src="./images/edit.svg" alt="" height="25px" class="pl-2 editPercent" onClick="editPercent(<?php echo $wrow['warehouse_id'] ?>);"> </div> <div id="updatePercent<?php echo $wrow['warehouse_id'] ?>" class="d-none"> <input type="text" class="uflexitPercent" id="uflexitPercent<?php echo $wrow['warehouse_id'] ?>" value="<?php echo $uflexit_percent; ?>"> <img src="./images/accept.svg" alt="" height="25px" class="pl-2 submitPercent" onClick="submitUflexitPercent(<?php echo $wrow['warehouse_id'] ?>);"> </div> </div> <input type="hidden" id="uflexit_percent<?php echo $wrow['warehouse_id']; ?>" value="<?php echo $wrow['uflexit_percent']; ?>"> </div> <div class="col-md-12 text-right d-flex justify-content-end"> </div> </div> </div> </div> <!-- </a> --> </td> </tr> <?php }} else{?> <h3 class="text-center pb-5 "><?php echo $lang['NO_WAREHOUSES_DATA'] ?>...</h3> <?php }?> </tbody> </table> </div> <div class="row"> <div class="col-sm-12 "> <p id="pagination-here" class="" style="display:none;"></p> <!-- <p id="content" class="pagination">Dynamic page content</p> --> </div> </div> </div> <form method="post" class="font-small"> <div class="custom-template col-sm-3 pr-0 " id="filterContent"> <div class="custom-content"> <nav class="navbar navbar-expand-sm navbar-default nav-side mb-4 mt-3"> <ul class="nav navbar-nav w-100"> <li class="menu-item-has-children dropdown bg-list-color px-3 mb-1 show"> <a href="#" class="dropdown-toggle text-blue font-weight-bold " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php echo $lang['STORAGE_TYPE'] ?></a> <ul class="sub-menu children dropdown-menu storage bg-list-color pl-md-0 show"> <form action="" class="font-small"> <?php echo $storage ?> </form> </ul> </li> <div class="daysCount1 bg-list-color w-100"> <input type="number" class="form-control pb-1 searchDay" placeholder="Search Days" id="searchDays" onkeyup="filterReset(this.value)"> </div> <div class="palletData1 bg-list-color w-100"> <input type="number" class="form-control pb-1 palletSearch mt-2" placeholder="Pallet" id="palletSearch" onkeyup="filterReset(this.value)"> </div> <div class="searchData1 bg-list-color w-100"> <input type="number" class="form-control pb-1 spaceSearch mt-2" placeholder="Space" id="spaceSearch" onkeyup="filterReset(this.value)"> </div> <li class="menu-item-has-children dropdown bg-list-color px-3 mb-1"> <a href="#" class="dropdown-toggle text-blue font-weight-bold" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php echo $lang['FEATURES'] ?></a> <ul class="sub-menu children dropdown-menu features bg-list-color mb-3 pl-md-0"> <form action="" class="font-small"> <?php echo $features ?> </form> </ul> </li> <li class="menu-item-has-children dropdown bg-list-color px-3 mb-1"> <a href="#" class="dropdown-toggle text-blue font-weight-bold" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php echo $lang['SERVICES'] ?></a> <ul class="sub-menu children dropdown-menu services bg-list-color mb-3 pl-md-0"> <form action="" class="font-small"> <?php echo $services ?> </form> </ul> </li> <li class="menu-item-has-children dropdown bg-list-color px-3 mb-1"> <a href="#" class="dropdown-toggle text-blue font-weight-bold" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php echo $lang['PRODUCT_WE_DEAL_WITH'] ?></a> <ul class="sub-menu children dropdown-menu features bg-list-color mb-3 pl-md-0"> <form action="" class="font-small"> <?php echo $products ?> </form> </ul> </li> </ul> <div class="error filter_error"></div> </nav> <div class="text-center mx-auto"> <input class="btn btn-primary filterSubmit" type="button" value="<?php echo $lang["FILTER"] ?>"> </div> </div> </div> </form> <!-- <div class="custom-toggle d-md-none d-block"> <i class="fa fa-bars mt-2 pt-1 btn btn-primary">Button</i> </div> --> </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 src="https://cdn.rawgit.com/botmonster/jquery-bootpag/master/lib/jquery.bootpag.min.js"></script> <script> //~ $('#example').DataTable( { //~ language: { search: "",searchPlaceholder: "Name or Location" }, //~ "processing": true, //~ "dataSrc": "", //~ "sorting": false, //~ dom: 'frtlip' //~ }); var filterInput = 1; var total_count; total_count = <?php echo $totalCount['count'] ?>; // alert(total_count); var page_count = Math.ceil(total_count / 5); // alert(page_count); function initPagination() { //~ alert(page_count) if (page_count > 0) { $("#pagination-here").show() } $('#pagination-here').bootpag({ total:page_count, page: 1, maxVisible: 5, leaps: true, // href: "#result-page-{{number}}", }) var prev='<?php echo $lang['PREV']; ?>'; var next='<?php echo $lang['NEXT']; ?>'; $( ".prev a" ).replaceWith(prev); $( ".next a" ).replaceWith(next); } $(document).ready(function () { $('.daysCount1').hide(); $('.palletData1').hide(); $('.searchData1').hide(); }); $(document).on('click', '.stortype2', function() { if( $(".stortype2").prop('checked') == true ) { // $('.daysCount1').show(); $('.palletData1').show(); $('.palletSearch').val(''); $('.searchDay').val(''); } else if($(".stortype2").prop('checked') == false) { // $('.daysCount1').hide(); $('.palletData1').hide(); $('.palletSearch').val(''); $('.searchDay').val(''); } }); $(document).on('click', '.stortype3', function() { if( $(".stortype3").prop('checked') == true ) { // $('.daysCount1').show(); $('.searchData1').show(); $('.spaceSearch').val(''); $('.searchDay').val(''); } else if($(".stortype3").prop('checked') == false ) { // $('.daysCount1').hide(); $('.searchData1').hide(); $('.spaceSearch').val(''); $('.searchDay').val(''); } }); $(".stortype2, .stortype3").click(function(){ if( ($(".stortype2").prop('checked') == true) || ($(".stortype3").prop('checked') == true)) { $('.daysCount1').show(); } else { $('.daysCount1').hide(); } }); $('.filterSubmit').click(function() { var checkboxLength = $('.filterWareHouse:checked').length; var days = $('#searchDays').val(); var pallet = $('#palletSearch').val(); var storageLength = $('.storageTypeClass:checked').length; var storageValue = $('.storageTypeClass:checked').val(); if (checkboxLength == 0 ) { $('.filter_error').html('<?php echo $lang['PLEASE_PROVIDE_INPUT']; ?>') } else { Filter() $('.filter_error').html('') var x = document.getElementById("filterContent"); if (window.matchMedia("(max-device-width: 767px)").matches) { x.style.display="none"; } // x.style.display="none"; } }) $('.filterSearch').click(function() { var searchInput = document.getElementById('searchValue').value; if (searchInput == '') { $('.search_error').html('<?php echo $lang['PLEASE_ENTER_NAME_LOCATION_TO_PROCEED_FURTHER']; ?>'); $('#searchValue').focus(); } else { Filter() $('.search_error').html(''); $('#searchValue').focus(); } }) $(document).ready(function() { $("#featureTypeRadio1").click(function() { $(".featuresTypeClass").prop('checked', $(this).prop('checked')); filterInput = 0; }); $('.featuresTypeClass').click(function() { if ($(this).prop('checked') == false) { $('#featureTypeRadio1').prop('checked', false); filterInput = 1; } if ($('.featuresTypeClass:checked').length == $('.featuresTypeClass').length) { $('#featureTypeRadio1').prop('checked', true); filterInput = 0; } }) }); //product deals checkboxes $(document).ready(function () { $("#productDealsTypeRadio1").click(function () { $(".productsTypeClass").prop('checked', $(this).prop('checked')); filterInput = 0; }); $('.productsTypeClass').click(function (){ if($(this).prop('checked')==false){ $('#productDealsTypeRadio1').prop('checked', false); filterInput = 1; } if($('.productsTypeClass:checked').length==$('.productsTypeClass').length){ $('#productDealsTypeRadio1').prop('checked', true); filterInput = 0; } }) }); $(window).resize(function() { var width = $(window).width(); if (width < 1200){ $('body').addClass('open'); } }); function filterReset(e) { if (e == '') { Filter() initPagination() } } function Filter() { var searchInput = document.getElementById('searchValue').value; var searchDays = document.getElementById('searchDays').value; var palletNum = document.getElementById('palletSearch').value; var spaceNum = document.getElementById('spaceSearch').value; if(searchInput == "" && searchDays == "" && palletNum == "") { filterInput = 1; } else { filterInput = 0; } jQuery.ajax({ type: "POST", url: 'ajax.php', data: ({ action: 'get_warehouses', feature_ids: featuresArray.toString(), storage_ids: storageArray.toString(), services_ids: servicesArray.toString(), deals_ids: productsArray.toString(), searchKey: searchInput, searchData:searchDays, palletData:palletNum, spaceData:spaceNum, minValue: 0, maxValue: 5, filterInput:filterInput }), success: function(data) { // console.log( JSON.parse(data)) data = JSON.parse(data) jQuery('.table-width').html(data.warehoseData); // console.log(data.count); total_count = data.totalCount; page_count = Math.ceil(total_count / 5); $("#pagination-here").show() if (total_count == 0 && page_count == 0) { $("#pagination-here").hide() } $('.uflexitPercent,.submitPercent,.editPercent').on('click',function(e){ e.stopPropagation(); }) initPagination() } }) } $(document).on('keypress', function(e) { if (e.which == 13) { Filter() } }); // services checkboxes $(document).ready(function() { $("#servicesTypeRadio1").click(function() { $(".servicesTypeClass").prop('checked', $(this).prop('checked')); filterInput=0; }); $('.servicesTypeClass').click(function() { if ($(this).prop('checked') == false) { $('#servicesTypeRadio1').prop('checked', false); filterInput=1; } if ($('.servicesTypeClass:checked').length == $('.servicesTypeClass').length) { $('#servicesTypeRadio1').prop('checked', true); filterInput=0; } }) }) $(document).ready(function() { // alert($("#searchValue").val()); setTimeout(() => { $("#searchValue").val(""); }, 200); 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'); } }); }); initPagination(); //page click action $('#pagination-here').on("page", function(event, num) { //show / hide content or pull via ajax etc // $("#content").html("Page " + num); // alert(num); var searchInput = document.getElementById('searchValue').value; var searchDays = document.getElementById('searchDays').value; var palletNum = document.getElementById('palletSearch').value; var spaceNum = document.getElementById('spaceSearch').value; if(searchInput == "" && searchDays == "" && palletNum == "") { filterInput = 1; } else { filterInput = 0; } var min = num * 5 - 5; jQuery.ajax({ type: 'post', url: 'ajax.php', data: ({ action: 'get_warehouses', feature_ids: featuresArray.toString(), storage_ids: storageArray.toString(), services_ids: servicesArray.toString(), deals_ids: productsArray.toString(), searchKey: searchInput, searchData:searchDays, palletData:palletNum, spaceData:spaceNum, minValue: min, maxValue: 5, filterInput:filterInput }), success: function(data1) { data1 = JSON.parse(data1) // console.log(data1.warehoseData, 'data1') jQuery('.table-width').html(data1.warehoseData); } }) }); // to hide filter div intially if (window.matchMedia("(max-device-width: 767px)").matches) { // modify dom // alert("hello") var x = document.getElementById("filterContent"); x.style.display="none"; } }); //findwarehouse function // function filterWareHouse(id){ var featuresArray = []; var servicesArray = []; var storageArray = []; var productsArray=[]; $('.filterWareHouse').change(function() { if ($(".filterWareHouse:checked").length == 0) { featuresArray = [] servicesArray = [] storageArray = [] productsArray=[] Filter() initPagination() } if ($(this).hasClass('featuresTypeClass') || $(this).hasClass('featuresTypeClass1')) { if ($(this).prop('checked') == true && $(this).val() == 1) { featuresArray.push("'" + 1 + "'") $('.featuresTypeClass').each(function() { featuresArray.push("'" + $(this).val() + "'") }) } else if ($(this).prop('checked') == false && $(this).val() == 1) { featuresArray = [] } else if ($(this).prop('checked') == true) { featuresArray.push("'" + $(this).val() + "'") } else if ($(this).prop('checked') == false) { var indexVal = featuresArray.findIndex(element => { return element == "'" + $(this).val() + "'" }) featuresArray.splice(indexVal, 1) } // console.log(featuresArray,"featuresArray") } else if ($(this).hasClass('servicesTypeClass') || $(this).hasClass('servicesTypeClass1')) { if ($(this).prop('checked') == true && $(this).val() == 1) { servicesArray.push("'" + 1 + "'") $('.servicesTypeClass').each(function() { servicesArray.push("'" + $(this).val() + "'") }) } else if ($(this).prop('checked') == false && $(this).val() == 1) { servicesArray = [] } else if ($(this).prop('checked') == true) { servicesArray.push("'" + $(this).val() + "'") } else if ($(this).prop('checked') == false) { var indexVal1 = servicesArray.findIndex(element => { return element == "'" + $(this).val() + "'" }) servicesArray.splice(indexVal1, 1) } // console.log(servicesArray,"servicesArray123") } else if ($(this).hasClass('storageTypeClass')) { if ($(this).prop('checked') == true) { storageArray.push("'" + $(this).val() + "'") } else if ($(this).prop('checked') == false) { var indexVal1 = storageArray.findIndex(element => { return element == "'" + $(this).val() + "'" }) storageArray.splice(indexVal1, 1) } // console.log(storageArray,"storageArray") } else if ($(this).hasClass('productsTypeClass') || $(this).hasClass('productsTypeClass')) { if ($(this).prop('checked') == true && $(this).val() == 1) { productsArray.push("'" + 1 + "'") $('.productsTypeClass').each(function() { productsArray.push("'" + $(this).val() + "'") }) } else if ($(this).prop('checked') == false && $(this).val() == 1) { productsArray = [] } else if ($(this).prop('checked') == true) { productsArray.push("'" + $(this).val() + "'") } else if ($(this).prop('checked') == false) { var indexVal1 = productsArray.findIndex(element => { return element == "'" + $(this).val() + "'" }) productsArray.splice(indexVal1, 1) } // console.log(servicesArray,"servicesArray123") } }) // $('.filterSearch').click(function(){ // var searchInput= document.getElementById('searchValue').value; // jQuery.ajax({ // type:"POST", // url:'ajax.php', // data:({action:'filterSearch',searchKey:searchInput}), // success:function(data){ // jQuery('.table-width').html(data); // } // }) // }) // } $('[data-star]').on('click', function(e) { e.preventDefault(); $(this).addClass('select'); $(this).prevAll('[data-star]').addClass('select'); $(this).nextAll('[data-star]').removeClass('select'); $(this).parent().find('input').val($(this).data('star')); }); $('[data-star]').on('mouseover', function(e) { e.preventDefault(); $(this).addClass('highlight'); $(this).prevAll('[data-star]').addClass('highlight'); $(this).nextAll('[data-star]').removeClass('highlight'); }); $('[data-star]').on('mouseout', function(e) { e.preventDefault(); $(this).removeClass('highlight'); $(this).prevAll('[data-star]').removeClass('highlight'); }); function ShowFilter(){ var x = document.getElementById("filterContent"); // console.log(x.style.display,"style") if (x.style.display ==="none") { x.style.display = "block"; } else { x.style.display = "none"; } } $('.uflexitPercent,.submitPercent,.editPercent').on('click',function(e){ e.stopPropagation(); }) function editPercent(id){ var percent = $('#uflexit_percent'+id).val(); // alert(percent); $('#percentage'+id).addClass('d-none'); $('#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>