Customer: add rank column and filters

This commit is contained in:
Jaeeun.Cho 2025-12-08 14:45:45 -05:00
parent 002e9088bf
commit d7499ed1f7
2 changed files with 143 additions and 67 deletions

View File

@ -10,18 +10,29 @@ if (in_array($_SESSION['ss_LEVEL'], $permit)) {
} }
else $setTag = "DISABLED"; else $setTag = "DISABLED";
if ($cstatus == 'T') $status_query = " AND (tbl_customer.c_status = 'A' OR tbl_customer.c_status = 'I') "; if ($cstatus == 'T')
else if ($cstatus == 'I') $status_query = " AND (tbl_customer.c_status = 'I') "; $status_query = " AND (tbl_customer.c_status = 'A' OR tbl_customer.c_status = 'I') ";
else if ($cstatus == 'I')
$status_query = " AND (tbl_customer.c_status = 'I') ";
else { else {
$cstatus = 'A'; $cstatus = 'A';
$status_query = " AND (tbl_customer.c_status = 'A') "; $status_query = " AND (tbl_customer.c_status = 'A') ";
} }
if ($cistop == 'A') {
$cistop_query = " AND tbl_customer.c_is_top = 'A' ";
} else if ($cistop == 'G') {
$cistop_query = " AND tbl_customer.c_is_top = 'G' ";
} else {
$cistop = 'T';
$cistop_query = "";
}
if ($_SESSION['ss_LEVEL'] == 9) { if ($_SESSION['ss_LEVEL'] == 9) {
$add_allquery = $status_query. " AND c_driveruid = '".$_SESSION['ss_UID']."' "; $add_allquery = $status_query . $cistop_query . " AND c_driveruid = '".$_SESSION['ss_UID']."' ";
} else {
$add_allquery = $status_query . $cistop_query;
} }
else $add_allquery = $status_query. "";
//$add_query .= "tbl_groups INNER JOIN naloxca_bbs.tbl_customer ON (tbl_groups.g_uid = tbl_customer.m_gid) "; //$add_query .= "tbl_groups INNER JOIN naloxca_bbs.tbl_customer ON (tbl_groups.g_uid = tbl_customer.m_gid) ";
$add_srchquery = ""; $add_srchquery = "";
@ -118,6 +129,7 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$c_addressSTR = str_replace("\\", "", $c_address); $c_addressSTR = str_replace("\\", "", $c_address);
$c_containerSTR = str_replace("\\", "", $c_container); $c_containerSTR = str_replace("\\", "", $c_container);
$c_statusSTR = $arrStatus[$c_status]; $c_statusSTR = $arrStatus[$c_status];
$c_istopSTR = ($c_is_top === 'A') ? 'A Rank' : (($c_is_top === 'G') ? 'Ghost' : '');
$todayQty = number_format(round(floatval($c_fullquantity - $c_fullquantitydaily))); $todayQty = number_format(round(floatval($c_fullquantity - $c_fullquantitydaily)));
//$qry_driver = "SELECT m_firstname, m_lastname FROM tbl_member WHERE m_uid = '$c_driveruid' "; //$qry_driver = "SELECT m_firstname, m_lastname FROM tbl_member WHERE m_uid = '$c_driveruid' ";
@ -154,6 +166,7 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
<td>$m_initial </td> <td>$m_initial </td>
<td>$c_phoneSTR </td> <td>$c_phoneSTR </td>
<td>$c_statusSTR </td> <td>$c_statusSTR </td>
<td style=\"min-width:70px;\">$c_istopSTR </td>
</tr> </tr>
"; ";
@ -193,11 +206,18 @@ function goSearch(f){
$(document).ready(function(){ $(document).ready(function(){
$("#form_cstatus").change(function(){ // $("#cstatus").change(function(){
//$(this).css("background-color", "#FFD2A6"); // //$(this).css("background-color", "#FFD2A6");
$('#form_cstatus').submit(); // $('#customerFilterForm').submit();
// });
$("input[name='cstatus']").change(function () {
$('#customerFilterForm').submit();
}); });
$("input[name='cistop']").change(function () {
$('#customerFilterForm').submit();
});
$('.customerShortInfo').click(function(){ $('.customerShortInfo').click(function(){
@ -301,7 +321,14 @@ $(document).ready(function(){
<div class="container" data-aos="fade-up"> <div class="container" data-aos="fade-up">
<div class="wrap-border"> <div class="wrap-border">
<form action="" class="form-customer"> <form method="post" name="customerFilterForm" id="customerFilterForm" action="<?=$_SERVER['PHP_SELF']?>" class="form-customer">
<input type="hidden" name="view" value="customer_list">
<input type="hidden" name="switched" value="<?=$getSWHStr?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="column" value="<?=$column?>">
<input type="hidden" name="sorting_type" value="<?=$sorting_type?>">
<input type="hidden" name="switch" value="<?=$switch?>">
<table class="table-search-customer"> <table class="table-search-customer">
<tr> <tr>
<!--td class="td-title"> <!--td class="td-title">
@ -312,55 +339,57 @@ $(document).ready(function(){
</select> </select>
</td--> </td-->
<td class="td-title"> <td class="td-title">
<div class="search-container">
<div class="search-container">
<FORM METHOD=POST NAME=form1 ONSUBMIT='return goSearch(this)' action='<?=$_SERVER["PHP_SELF"]?>'>
<INPUT TYPE=HIDDEN NAME=view VALUE='customer_list'>
<input type=hidden name=cstatus value="<?=$cstatus?>">
<input class="" type="text" placeholder="Search.." name="key_word" value='<?=htmlspecialchars($key_word, ENT_QUOTES)?>'> <input class="" type="text" placeholder="Search.." name="key_word" value='<?=htmlspecialchars($key_word, ENT_QUOTES)?>'>
<button type="submit"><i class="bi-search"></i></button> <button type="submit"><i class="bi-search"></i></button>
</FORM> </div>
</div>
</td> </td>
<td style="text-align:right;">
<div class="cstatus-segment">
<label>
<input type="radio" name="cstatus" value="A" <?=($cstatus == "A")?"checked":"";?>>
<span>&nbsp;Active&nbsp;</span>
</label>
<td style="text-align:left;padding-left:80px;"> <label>
<input type="radio" name="cstatus" value="I" <?=($cstatus == "I")?"checked":"";?>>
<span>Inactive</span>
</label>
<div class="search-container"> <label>
<FORM method=post id="form_cstatus" name="form_cstatus" action='<?=$_SERVER["PHP_SELF"]?>' class="form-forecast-search"> <input type="radio" name="cstatus" value="T" <?=($cstatus == "T")?"checked":"";?>>
<input type=hidden name=view value='customer_list'> <span>&nbsp;All&nbsp;</span>
<input type=hidden name=switched value="<?=$getSWHStr?>"> </label>
<input type=hidden name=page value="<?=$page?>"> </div>
<input type=hidden name=key_word value="<?=$key_wordStr?>">
<input type=hidden name=column value="<?=$column?>">
<input type=hidden name=sorting_type value="<?=$sorting_type?>">
<input type=hidden name=switch value="<?=$switch?>">
<select name="cstatus" id="cstatus" class="custom-select1" required='required'>
<option value='A' <?=($cstatus == "A")?"selected":"";?>>Active Account</option>
<option value='I' <?=($cstatus == "I")?"selected":"";?>>Inactive Account</option>
<option value='T' <?=($cstatus == "T")?"selected":"";?>>All Account</option>
</select>
<!--label class='container-chk'>Include Inactive Account
<input type='checkbox' name='cstatus' id='cstatus' value="1" <? if($cstatus==1)echo"checked";?>>
<span class='checkmark'></span>
</label-->
</div>
</td> </td>
<td style="text-align:left; padding-left:10px;">
<div class="cistop-segment">
<label>
<input type="radio" name="cistop" value="A" <?=($cistop == "A")?"checked":"";?>>
<span>&nbsp;Top&nbsp;</span>
</label>
<label>
<input type="radio" name="cistop" value="G" <?=($cistop == "G")?"checked":"";?>>
<span>&nbsp;Ghost&nbsp;</span>
</label>
<label>
<input type="radio" name="cistop" value="T" <?=($cistop == "T")?"checked":"";?>>
<span>&nbsp;All&nbsp;</span>
</label>
</div>
</td>
<td align="right"> <td align="right">
<? if ($setTag == "ENABLED") { ?>
<? if ($setTag == "ENABLED") { ?>
<a href="/index_intranet.php?view=customer_detail&mode=create&page=<?=$page?>&key_word=<?=$key_wordStr?>&column=<?=$column?>&switched=<?=$getSWHStr?>&sorting_type=<?=$sorting_type?>&switch=<?=$switch?>&cstatus=<?=$cstatus?>" class="btn-add">ADD</a> <a href="/index_intranet.php?view=customer_detail&mode=create&page=<?=$page?>&key_word=<?=$key_wordStr?>&column=<?=$column?>&switched=<?=$getSWHStr?>&sorting_type=<?=$sorting_type?>&switch=<?=$switch?>&cstatus=<?=$cstatus?>" class="btn-add">ADD</a>
<? } ?> <? } ?>
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
</div><!--wrap-border--> </div><!--wrap-border-->
@ -371,19 +400,19 @@ $(document).ready(function(){
<th>No</th> <th>No</th>
<th class="col-rate">Option</th> <th class="col-rate">Option</th>
<th class="col-liter">Liter</th> <th class="col-liter">Liter</th>
<th class="td-restaurant"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_name">Restaurant Name</a></th> <th class="td-restaurant"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_name">Restaurant Name</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_accountno">Account</a></th> <th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_accountno">Account</a></th>
<th class="col-address"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_address">Address</a></th> <th class="col-address"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_address">Address</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_word?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_city">City</a></th> <th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_word?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_city">City</a></th>
<th class="col-postal-code"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_postal">Postal Code</a></th> <th class="col-postal-code"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_postal">Postal Code</a></th>
<th class="col-payment"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_paymenttype">Payment</a></th> <th class="col-payment"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_paymenttype">Payment</a></th>
<th class="col-rate"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_rate">Rate</a></th> <th class="col-rate"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_rate">Rate</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_maincontainer">Container</a></th> <th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_maincontainer">Container</a></th>
<th class="col-detail"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_container">Detail</a></th> <th class="col-detail"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_container">Detail</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=m_initial">Driver</a></th> <th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=m_initial">Driver</a></th>
<th class="th-width-phone"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_phone">Phone</a></th> <th class="th-width-phone"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_phone">Phone</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&switch=c_status">Status</a></th> <th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_status">Status</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_is_top">Rank</a></th>
</tr> </tr>
<?=$strList?> <?=$strList?>
@ -586,7 +615,7 @@ $(document).ready(function(){
<a href="#"><i class="bi bi-arrow-right"></i></a--> <a href="#"><i class="bi bi-arrow-right"></i></a-->
<? <?
$page_string = "view=$view&key_word=$key_wordStr&key_CTGSEQ=$key_CTGSEQ&column=$column&mode=$mode&cstatus=$cstatus&switched=$getSWHStr"; $page_string = "view=$view&key_word=$key_wordStr&key_CTGSEQ=$key_CTGSEQ&column=$column&mode=$mode&cstatus=$cstatus&cistop=$cistop&switched=$getSWHStr";
$paging = new PAGE('page',$total_count,$list_count,$page_count,$page,$page_string,'#c71930','','','#c71930',''); $paging = new PAGE('page',$total_count,$list_count,$page_count,$page,$page_string,'#c71930','','','#c71930','');
?> ?>
@ -627,3 +656,50 @@ $(document).ready(function(){
</div> </div>
<!-- End of Modal --> <!-- End of Modal -->
<style>
.cstatus-segment,
.cistop-segment {
display: inline-flex;
border: 1px solid #ccc;
border-radius: 10px;
overflow: hidden;
}
.cstatus-segment label,
.cistop-segment label {
margin: 0;
cursor: pointer;
}
.cstatus-segment input[type="radio"],
.cistop-segment input[type="radio"] {
display: none;
}
.cstatus-segment span,
.cistop-segment span {
display: inline-block;
padding: 8px 23px;
background: #e7e7e7;
color: #333;
font-weight: 500;
}
.cstatus-segment input[type="radio"]:checked + span,
.cistop-segment input[type="radio"]:checked + span {
background: #5a8dee;
color: white;
}
.cstatus-segment label:first-child span,
.cistop-segment label:first-child span {
border-radius: 5px 0 0 5px;
}
.cstatus-segment label:last-child span,
.cistop-segment label:last-child span {
border-radius: 0 5px 5px 0;
}
</style>

View File

@ -363,7 +363,7 @@ $(document).ready(function(){
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title">&nbsp;&nbsp;<?=$d_nameSTR?></h4> <h4 class="modal-title">CUSTOMER INFORMATION</h4>
<button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button> <button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">