Fix: VIP 리스트 모달 표시 문제 해결, 카테고리 필터 페이지 리로드 제거
This commit is contained in:
@ -40,11 +40,12 @@ $table = "{$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_category_table']} AS
|
||||
// 비활성 카테고리 숨김
|
||||
if ($row['gr_used'] == 0 && !$show_all) continue;
|
||||
$inactive_class = ($row['gr_used'] == 0) ? ' inactive-cat' : '';
|
||||
$display_style = ($row['gr_used'] == 0 && !$show_all) ? 'display: none;' : '';
|
||||
?>
|
||||
<input type="radio" name="search_group" id="search_group_<?=$row['gr_id']?>" class="btn-check" value="<?=$row['gr_id']?>" <?php if ($search_group === $row['gr_id']) echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary<?=$inactive_class?>" for="search_group_<?=$row['gr_id']?>" style="<?=($row['gr_used'] == 0) ? 'opacity: 0.5;' : ''?>"><?=$row['gr_name']?></label>
|
||||
<label class="btn btn-outline-primary category-label<?=$inactive_class?>" for="search_group_<?=$row['gr_id']?>" style="<?=($row['gr_used'] == 0) ? 'opacity: 0.5;' : ''?><?=$display_style?>"><?=$row['gr_name']?></label>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" onclick="toggleShowAllCat()">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" onclick="toggleShowAllCat()" data-show-all="<?=($show_all) ? 'true' : 'false'?>">
|
||||
<?=($show_all) ? '활성만 보기' : '모두보기'?>
|
||||
</button>
|
||||
</div>
|
||||
@ -190,7 +191,7 @@ $table = "{$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_category_table']} AS
|
||||
$is_expired = ($expire_date != '9999-12-31' && strtotime($expire_date) < strtotime($today)) ? true : false;
|
||||
$expired_class = $is_expired ? 'expired-vip' : '';
|
||||
?>
|
||||
<tr class="<?=($R['status'] != '정상') ? "unused" : "" ?> vip-row <?=$expired_class?>" style="cursor: pointer;" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['idx']?>">
|
||||
<tr class="<?=($R['status'] != '정상') ? "unused" : "" ?> vip-row <?=$expired_class?>" style="cursor: pointer;" onclick="openVipModal(<?=$R['idx']?>)">
|
||||
<td class="text-center"><?=$R['vip_card_no']?></td>
|
||||
<td class="text-center"><?=$R['status']?></td>
|
||||
<td class="text-center"><?=$R['vip_name']?></td>
|
||||
@ -371,13 +372,37 @@ $table = "{$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_category_table']} AS
|
||||
|
||||
<script>
|
||||
function toggleShowAllCat() {
|
||||
const btn = event.target;
|
||||
const showAll = !btn.getAttribute('data-show-all') || btn.getAttribute('data-show-all') === 'false';
|
||||
|
||||
// UI 즉시 업데이트
|
||||
const categoryLabels = document.querySelectorAll('.category-label');
|
||||
categoryLabels.forEach(label => {
|
||||
if (label.classList.contains('inactive-cat')) {
|
||||
label.style.display = showAll ? 'inline-block' : 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// 버튼 텍스트 업데이트
|
||||
btn.textContent = showAll ? '활성만 보기' : '모두보기';
|
||||
btn.setAttribute('data-show-all', showAll ? 'true' : 'false');
|
||||
|
||||
// URL 업데이트 (새로고침 없음)
|
||||
const url = new URL(window.location);
|
||||
if (url.searchParams.has('show_all_cat')) {
|
||||
url.searchParams.delete('show_all_cat');
|
||||
} else {
|
||||
if (showAll) {
|
||||
url.searchParams.set('show_all_cat', '1');
|
||||
} else {
|
||||
url.searchParams.delete('show_all_cat');
|
||||
}
|
||||
window.history.pushState({}, '', url.toString());
|
||||
}
|
||||
|
||||
function openVipModal(idx) {
|
||||
const modal = document.getElementById('modify_modal_' + idx);
|
||||
if (modal) {
|
||||
const bsModal = new bootstrap.Modal(modal);
|
||||
bsModal.show();
|
||||
}
|
||||
window.location = url.toString();
|
||||
}
|
||||
|
||||
function entMemWithConfirm(idx, isExpired) {
|
||||
|
||||
Reference in New Issue
Block a user