331 lines
18 KiB
PHP
331 lines
18 KiB
PHP
<?php
|
|
// 방문객리스트
|
|
include_once "_common.php";
|
|
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
|
include_once FG_MANAGER_PATH."/head.php";
|
|
|
|
$table = "{$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_group_table']} AS b ON a.gr_id = b.gr_id LEFT JOIN {$fg['team_table']} AS c ON a.rec_team = c.tid ";
|
|
|
|
// 검색 변수 초기화, 검색 관련
|
|
$search_word = isset($_REQUEST["search_word"]) ? $_REQUEST["search_word"] : "";
|
|
$search_group = isset($_REQUEST["search_group"]) ? $_REQUEST["search_group"] : "";
|
|
$search = $where = $search_count = "";
|
|
if (!empty($search_word)) $search .= " (vip_name LIKE '%$search_word%' OR vip_tel LIKE '%$search_word%' OR vip_card_no LIKE '%$search_word%') ";
|
|
if (!empty($search_group)) {
|
|
if (!empty($search_word)) $search .= "AND";
|
|
$search .= " a.gr_id = $search_group";
|
|
}
|
|
if (!empty($search)) {
|
|
$where = "WHERE {$search}";
|
|
$search_count = get_num_rows($table, $where);
|
|
}
|
|
// 검색 쿼리 끝
|
|
|
|
$record_count = get_num_rows($table); // 전체 갯수 구하기
|
|
$ord_by = "ORDER BY join_datetime DESC"; // 회원 가입일 기준 정렬
|
|
$R = get_result($table, $ord_by, $query_limit, $where);
|
|
?>
|
|
<!-- 검색폼 시작 -->
|
|
<div class="d-flex flex-column mb-3">
|
|
<p>검색은 구분/성명/연락처/회원번호로만 가능합니다.</p>
|
|
<form class="vipsearch" method="post" action="">
|
|
<div class="d-flex flex-row flex-wrap gap-2 mb-3">
|
|
<input type="radio" name="search_group" id="search_group_all" class="btn-check" value="" <?php if (empty($search_group)) echo "checked" ?>>
|
|
<label class="btn btn-outline-primary" for="search_group_all">전체</label>
|
|
<?php
|
|
$annual_group = getAnnualGroup();
|
|
foreach ($annual_group as $row) { // 회원구분 가져와서 뿌리기
|
|
?>
|
|
<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" for="search_group_<?=$row['gr_id']?>"><?=$row['gr_name']?></label>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="input-group col-md-6">
|
|
<span class="input-group-text" id="search_word">회원검색</span>
|
|
<input type="text" name="search_word" class="form-control" id="search_word" aria-describedby="search_word" placeholder="검색어를 입력하세요" autofocus value="<?=$search_word ?>">
|
|
<button type="submit" class="btn btn-secondary">검색</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<!-- 검색폼 끝 -->
|
|
<div class="d-flex justify-content-between my-1">
|
|
<div>
|
|
<p>전체 회원 수 : <b><?=$record_count?></b> | 검색 회원 수 : <?=$search_count ? $search_count : $record_count?></p>
|
|
</div>
|
|
<div class="d-flex flex-row-reverse column-gap-2">
|
|
<form method="post" action="inc/annual_member_list_excel.php">
|
|
<button type="submit" class="btn btn-secondary" >엑셀저장</button>
|
|
</form>
|
|
|
|
<?php // 추가
|
|
if($_SESSION['user_lv'] > "1"){
|
|
?>
|
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#add_modal">추가</button>
|
|
<!-- 추가 버튼을 누르면 출력한다. -->
|
|
<div id="add_modal" class="modal fade">
|
|
<div class="modal-dialog" style="width:800px;">
|
|
<div class="modal-content">
|
|
<form class="signup" > <!-- 폼 이름을 알려줌 -->
|
|
<input type="hidden" name="rec_name" class="form-control" readonly value="<?=$_SESSION['user_name']?>">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">VIP 추가</h4>
|
|
</div>
|
|
<div class="modal-body text-left">
|
|
<h5 class="modal-title my-3">발급정보</h5>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="gr_id">구분</span>
|
|
<?php foreach($group_name as $row){
|
|
if ($row['gr_used'] == 0) continue ?>
|
|
<input type="radio" class="btn-check" name="gr_id" id="gr_id_<?=$row['gr_id']?>" value="<?=$row['gr_id']?>"<?php if ($row['gr_id'] == 2) echo "checked" ?> required>
|
|
<label class="btn btn-outline-info" for="gr_id_<?=$row['gr_id']?>"><?=$row['gr_name']?></label>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="rec_team">부서</span>
|
|
<?php
|
|
$team_name = getTeamName(1);
|
|
foreach($team_name as $row){
|
|
?>
|
|
<input type="radio" class="btn-check" name="rec_team" id="rec_team_<?=$row['tid']?>" value="<?=$row['tid']?>" <?php /*if($_SESSION['user_team'] == $row['tname']) if ($row['tid'] === "1") */echo "checked" ?> required>
|
|
<label class="btn btn-outline-info" for="rec_team_<?=$row['tid']?>"><?=$row['tname']?></label>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="app_name">접수자</span>
|
|
<input type="text" class="form-control" id="app_name" name="app_name" placeholder="서류 접수자 성명" value="" required>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_card_no">번호</span>
|
|
<input type="number" class="form-control" oninput="checkDupNo(this.value)" id="vip_card_no" name="vip_card_no" maxlength="6" placeholder="발급한 VIP카드 번호" value="" required>
|
|
</div>
|
|
<div class="input-group mb-1 checkdup">
|
|
<span id="duplicate-no-warning"></span>
|
|
</div>
|
|
<h5 class="modal-title my-3">고객정보</h5>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_name">성명</span>
|
|
<input type="text" class="form-control" id="vip_name" name="vip_name" value="" required>
|
|
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_male" value="남" <?php if($gender ==="남") echo "checked" ?>>
|
|
<label class="btn btn-outline-primary" for="vip_gender_male">남</label>
|
|
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_female" value="여" <?php if($gender ==="여") echo "checked" ?>>
|
|
<label class="btn btn-outline-primary" for="vip_gender_female">여</label>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_tel">연락처</span>
|
|
<input type="number" class="form-control" oninput="checkDupTel(this.value)" name="vip_tel" name="vip_tel" maxlength="11" value="" required>
|
|
</div>
|
|
<div class="input-group mb-1 checkdup">
|
|
<span id="duplicate-tel-warning"></span>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_birth">생일</span>
|
|
<input type="date" class="form-control" name="vip_birth" id="vip_birth" value="" required>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_email">이메일</span>
|
|
<input type="text" class="form-control" name="vip_email" id="vip_email" value="" >
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_addr">주소</span>
|
|
<input type="text" class="form-control" name="vip_addr" id="vip_addr" value="" >
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_memo">메모</span>
|
|
<textarea class="form-control" name="vip_memo" id="vip_memo"></textarea>
|
|
</div>
|
|
<div id="vip_memo" class="form-text">
|
|
기타 메모 및 발급사유를 입력합니다.
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="submit" id="add_submit" class="btn btn-primary">추가</button>
|
|
<button type="button" class="btn btn-default" data-bs-dismiss="modal">닫기</button>
|
|
</div>
|
|
</form>
|
|
</div><!-- /.modal-content -->
|
|
</div><!-- /.modal-dialog -->
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="text-center">
|
|
<table class="table table-striped align-middle">
|
|
<colgroup>
|
|
<col width="70px">
|
|
<col width="70px">
|
|
<col width="100px">
|
|
<col width="130px">
|
|
<col width="100px">
|
|
<col width="90px">
|
|
<col width="100px">
|
|
</colgroup>
|
|
<thead>
|
|
<tr class="align-middle">
|
|
<th class="text-center">카드번호</th>
|
|
<th class="text-center">상태</th>
|
|
<th class="text-center">성명</th>
|
|
<th class="text-center">연락처</th>
|
|
<th class="text-center">생년월일</th>
|
|
<th class="text-center">최종이용일</th>
|
|
<?php if($_SESSION['user_lv'] > "1"){ ?>
|
|
<th class="text-center">작업</th>
|
|
<?php } ?>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="table-group-divider">
|
|
<?php foreach($R as $R) {?>
|
|
<tr>
|
|
<td class="text-center"><?=$R['vip_card_no']?></td>
|
|
<td class="text-center"><?=$R['status']?></td>
|
|
<td class="text-center"><?=$R['vip_name']?></td>
|
|
<td class="text-center"><?=$R['vip_tel']?></td>
|
|
<td class="text-center"><?=$R['vip_birth']?></td>
|
|
<td class="text-center">
|
|
<?php
|
|
$edate = $R['last_ent_date'];
|
|
echo ($edate == '0000-00-00 00:00:00')? '미이용' : date('Y-m-d',strtotime($edate));
|
|
?></td>
|
|
<td class="text-center d-flex justify-content-center gap-1">
|
|
<?php if($_SESSION['user_lv'] > "1"){ ?>
|
|
<!-- 수정 모달 -->
|
|
<div id="modify_modal_<?=$R['idx']?>" class="modal fade" tabindex="-1" aria-labelledby="modify_modal_<?=$R['idx']?>" aria-hidden="true">
|
|
<div class="modal-dialog modal modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form class="modify" id="modify_<?=$R['idx']?>">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">정보 보기/수정</h5>
|
|
</div>
|
|
<div class="modal-body text-start">
|
|
<input type="hidden" id="idx_<?=$R['idx']?>" name="idx" value="<?=$R['idx']?>" readonly>
|
|
<input type="hidden" id="last_edit_name" name="last_edit_name" value="<?=$_SESSION['user_name']?>" readonly>
|
|
<?php
|
|
// 폐기된 카드의 경우 수정을 하면 안되므로 수정할 수 없게 함
|
|
$ro = "";
|
|
if($R['status'] != "정상") {
|
|
$ro = "disabled";
|
|
echo "<p>폐기된 카드는 수정할 수 없습니다.</p>";
|
|
;
|
|
}
|
|
?>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_card_no_<?=$R['idx']?>">번호</span>
|
|
<input type="text" class="form-control" id="vip_card_no_<?=$R['idx']?>" name="vip_card_no" value="<?=$R['vip_card_no'] ?>" disabled>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="team_name_<?=$R['idx']?>">부서</span>
|
|
<input type="text" class="form-control" id="team_name_<?=$R['idx']?>" name="team_name" value="<?=$R['tname'] ?>" disabled >
|
|
<span class="input-group-text col-md-2" id="gr_name_<?=$R['idx']?>">사유</span>
|
|
<input type="text" class="form-control" id="gr_name_<?=$R['idx']?>" name="gr_name_" value="<?=$R['gr_name'] ?>" disabled>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="app_name_<?=$R['idx']?>">접수</span>
|
|
<input type="text" class="form-control" id="app_name_<?=$R['idx']?>" name="app_name" value="<?=$R['app_name'] ?>" disabled>
|
|
<span class="input-group-text col-md-2" id="rec_name_<?=$R['idx']?>">등록</span>
|
|
<input type="text" class="form-control" id="rec_name_<?=$R['idx']?>" name="rec_name" value="<?=$R['rec_name'] ?>" disabled>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="join_datetime_<?=$R['idx']?>">등록일</span>
|
|
<input type="text" class="form-control" id="join_datetime_<?=$R['idx']?>" name="join_datetime" value="<?=$R['join_datetime'] ?>" disabled>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_date_<?=$R['idx']?>">만료일</span>
|
|
<input type="text" class="form-control" id="vip_date_<?=$R['idx']?>" name="vip_date" value="<?=$R['vip_date']?>" <?php echo ($_SESSION['user_lv'] != "4") ? "disabled" : "" ?>>
|
|
</div>
|
|
<?php if($R['last_edit_name']) { ?>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="last_edit_date_<?=$R['idx']?>">수정일</span>
|
|
<input type="text" class="form-control" id="last_edit_date_<?=$R['idx']?>" name="last_edit_date" value="<?=$R['last_edit_date'] ?>" disabled>
|
|
<span class="input-group-text col-md-2" id="last_edit_name_<?=$R['idx']?>">수정</span>
|
|
<input type="text" class="form-control" id="last_edit_name_<?=$R['idx']?>" name="last_edit_name" value="<?=$R['last_edit_name'] ?>" disabled>
|
|
</div>
|
|
<?php } ?>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_name_<?=$R['idx']?>">고객명</span>
|
|
<input type="text" class="form-control" id="vip_name_<?=$R['idx']?>" name="vip_name" value="<?=$R['vip_name']?>" required <?=$ro?>>
|
|
<? // DB에서 성별값을 불러온다.
|
|
if($R['status'] == "정상") { // 정상 상태가 아니면 성별도 필요없음
|
|
$gender = $R['vip_gender']
|
|
?>
|
|
<!-- 불러온 성별에 따라 라디오버튼 선택하도록 -->
|
|
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_<?=$R['idx']?>_male" value="남" <?php if($gender == "남") echo "checked" ?> required>
|
|
<label class="btn btn-outline-primary" for="vip_gender_<?=$R['idx']?>_male">남</label>
|
|
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_<?=$R['idx']?>_female" value="여" <?php if($gender =="여") echo "checked" ?> required>
|
|
<label class="btn btn-outline-primary" for="vip_gender_<?=$R['idx']?>_female">여</label>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_tel_<?=$R['idx']?>">연락처</span>
|
|
<input type="text" onkeydown='return onlyNumber(event)' onkeyup='removeChar(event)' class="form-control" id="vip_tel_<?=$R['idx']?>" name="vip_tel" value="<?=$R['vip_tel'] ?>" required <?=$ro?>>
|
|
<span class="input-group-text col-md-2" id="vip_birth_<?=$R['idx']?>">생일</span>
|
|
<input type="date" class="form-control" id="vip_birth_<?=$R['idx']?>" name="vip_birth" value="<?=$R['vip_birth']?>" <?=$ro?>>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_email_<?=$R['idx']?>">E-Mail</span>
|
|
<input type="text" class="form-control" id="vip_email_<?=$R['idx']?>" name="vip_email" value="<?=$R['vip_email'] ?>" <?=$ro?>>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_addr_<?=$R['idx']?>">주소</span>
|
|
<input type="text" class="form-control" id="vip_addr_<?=$R['idx']?>" name="vip_addr" value="<?=$R['vip_addr']?>" <?=$ro?>>
|
|
</div>
|
|
<div class="input-group mb-1">
|
|
<span class="input-group-text col-md-2" id="vip_memo_<?=$R['idx']?>">메모</span>
|
|
<textarea class="form-control" id="vip_memo_<?=$R['idx']?>" name="vip_memo" <?=$ro?>><?=$R['vip_memo']?></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="submit" class="btn btn-primary">수정</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Close" data-bs-target="#modify_modal_<?=$R['idx']?>">닫기</button>
|
|
</div>
|
|
</form>
|
|
</div><!-- /.modal-content -->
|
|
</div><!-- /.modal-dialog -->
|
|
</div>
|
|
<!-- 수정 모달 끝 -->
|
|
<!-- 수정 버튼 -->
|
|
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['idx']?>"><i class="fa-solid fa-pen-to-square"></i></button>
|
|
<!-- 재발급 버튼 -->
|
|
<?php if ( $R['status'] === "정상" ) { ?>
|
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#renew_modal_<?=$R['idx']?>"><i class="fa-solid fa-repeat"></i></button>
|
|
<div id="renew_modal_<?=$R['idx']?>" class="modal fade text-center ">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<form class="renew" id="renew_<?=$R['idx']?>">
|
|
<input type="hidden" id="idx_<?=$R['idx']?>" name="idx" value="<?=$R['idx']?>" readonly>
|
|
<input type="hidden" id="last_edit_name_<?=$R['idx']?>" name="last_edit_name" value="<?=$_SESSION['user_name']?>" readonly>
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">재발급</h4>
|
|
</div>
|
|
<div class="modal-body text-start">
|
|
<div class="input-group">
|
|
<span class="input-group-text col-md-4" id="re_no_<?=$R['idx']?>">재발급 카드번호</span>
|
|
<input type="number" class="form-control" oninput="checkDupRc(this.value)" id="rc_no_<?=$R['idx']?>" name="rc_no" maxlength="6" value="" required>
|
|
</div>
|
|
<div class="input-group checkdup">
|
|
<span id="duplicate-rc-warning"></span>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="submit" id="renew_submit" class="btn btn-primary">확인</button>
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Close" data-bs-target="#renew_modal_<?=$R['idx']?>">닫기</button>
|
|
</div>
|
|
</form>
|
|
</div><!-- /.modal-content -->
|
|
</div><!-- /.modal-dialog -->
|
|
</div>
|
|
<?php } ?>
|
|
<!-- 폐기는 관리자만 -->
|
|
<?php if($_SESSION['user_lv'] === "4" && $R['status'] != "재발급"){ ?>
|
|
<a class="btn btn-danger" href="javascript:deleteItem('<?=$R['idx']?>')" role="button"><?=($R['status'] == '정상')? '<i class="fa-solid fa-trash-can"></i>' : '<i class="fa-solid fa-trash-can-arrow-up"></i>'?></a>
|
|
<?php }
|
|
} ?>
|
|
</td>
|
|
</tr>
|
|
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<?php include_once FG_MANAGER_PATH."/tail.php";
|