302 lines
12 KiB
PHP
302 lines
12 KiB
PHP
<?php
|
|
include_once('./_common.php');
|
|
|
|
if(!$is_member) {
|
|
alert('로그인 후 이용해주세요.');
|
|
}
|
|
|
|
|
|
$g5['title'] = '이용권 현황';
|
|
include_once('./_head.php');
|
|
?>
|
|
|
|
<!-- 주문 내역 시작 { -->
|
|
|
|
<?php if($is_admin) { ?>
|
|
<style>
|
|
.sr {margin-bottom: 10px;}
|
|
.sr_ul1 {width: 400px; position: relative; float:left;}
|
|
.sr_ul2 {float:right;}
|
|
.sr_ul2 button {border:1px solid #ddd; height:40px; padding-left: 10px; padding-right: 10px;}
|
|
.sr_ul1 select {width: 28%; border:1px solid #ddd; height:40px; border-radius: 0px;}
|
|
.sr_ul1 input {border:1px solid #ddd; height:40px; padding: 10px; width: 40%; border-radius: 0px;}
|
|
.sr_ul1 button {position: absolute; top:8px; right:20px;}
|
|
.is-complete {opacity: 0.3;}
|
|
|
|
button:disabled {
|
|
color: #999;
|
|
border-color: #ddd !important;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
|
|
@media all and (max-width:1024px) {
|
|
.sr_ul1 {float:none; width: 100%;}
|
|
.sr_ul2 {float:none; margin-top: 5px;}
|
|
.sr {padding-left: 20px; padding-right: 20px;}
|
|
.sr_ul1 input {display: block; width: 100%; margin-top: 5px;}
|
|
.sr_ul1 button {top:52px; right:10px;}
|
|
|
|
}
|
|
</style>
|
|
|
|
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
|
<div class="sr">
|
|
<ul class="sr_ul1">
|
|
<div>
|
|
<select name="ca_id" class="select" onchange="this.form.submit();">
|
|
<option value="">전체</option>
|
|
<option value="10" <?php echo ($_GET['ca_id'] ?? '') == '10' ? 'selected' : ''; ?>>연간이용권</option>
|
|
<option value="20" <?php echo ($_GET['ca_id'] ?? '') == '20' ? 'selected' : ''; ?>>일반이용권</option>
|
|
</select>
|
|
<select name="stx" class="select">
|
|
<option value="">검색옵션</option>
|
|
<option value="od_b_name||od_names" <?php echo ($_GET['stx'] ?? '') == 'od_b_name||od_names' ? 'selected' : ''; ?>>이름</option>
|
|
<option value="od_b_hp||od_hps" <?php echo ($_GET['stx'] ?? '') == 'od_b_hp||od_hps' ? 'selected' : ''; ?>>연락처</option>
|
|
</select>
|
|
<input type="text" name="names" value="<?php echo get_text($_GET['names'] ?? ''); ?>">
|
|
<button type="submit">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
|
|
</button>
|
|
</div>
|
|
</ul>
|
|
<ul class="sr_ul2">
|
|
<button type="button" onclick="location.href='<?php echo G5_SHOP_URL ?>/tkinquiry.php';">전체</button>
|
|
</ul>
|
|
<div class="cb"></div>
|
|
</div>
|
|
</form>
|
|
<?php } ?>
|
|
<div id="sod_v">
|
|
|
|
<?php
|
|
$st_count1 = $st_count2 = 0;
|
|
$custom_cancel = false;
|
|
|
|
$where = $is_admin ? " WHERE c.ct_id != '' " : " WHERE c.mb_id = '{$member['mb_id']}' ";
|
|
|
|
if (!empty($ca_id)) {
|
|
// ca_id가 숫자일 때만 보안상 허용
|
|
$ca_id = preg_replace('/[^0-9]/', '', $ca_id);
|
|
$where .= " AND i.ca_id = '{$ca_id}' ";
|
|
}
|
|
|
|
if (!empty($_GET['stx']) && !empty($_GET['names'])) {
|
|
$search_fields = explode('||', $_GET['stx']);
|
|
$search_value = trim($_GET['names']);
|
|
$search_sql = [];
|
|
|
|
foreach ($search_fields as $field) {
|
|
$field = preg_replace('/[^a-zA-Z0-9_]/', '', $field);
|
|
$search_sql[] = "o.{$field} LIKE '%{$search_value}%'";
|
|
}
|
|
|
|
if ($search_sql) {
|
|
$where .= " AND (" . implode(' OR ', $search_sql) . ")";
|
|
}
|
|
}
|
|
|
|
|
|
$sql = "
|
|
SELECT c.*
|
|
FROM {$g5['g5_shop_cart_table']} c
|
|
LEFT JOIN {$g5['g5_shop_order_table']} o ON c.od_id = o.od_id
|
|
LEFT JOIN {$g5['g5_shop_item_table']} i ON c.it_id = i.it_id
|
|
{$where}
|
|
GROUP BY c.it_id
|
|
ORDER BY c.ct_id
|
|
";
|
|
$result = sql_query($sql);
|
|
|
|
?>
|
|
|
|
<div class="tbl_head03 tbl_wrap">
|
|
<table>
|
|
<thead>
|
|
<tr class="th_line">
|
|
<th scope="col" id="th_itname">이용권</th>
|
|
<th scope="col" id="th_itname">정보</th>
|
|
|
|
<th scope="col" id="th_itst">상태</th>
|
|
<?php if($is_admin) { ?>
|
|
<th scope="col" id="">처리</th>
|
|
<th scope="col" id="">입장횟수</th>
|
|
<?php } ?>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
for($i=0; $row=sql_fetch_array($result); $i++) {
|
|
$image = rb_it_image($row['it_id'], 55, 55);
|
|
|
|
|
|
$sql = "
|
|
SELECT c.*
|
|
FROM {$g5['g5_shop_cart_table']} c
|
|
LEFT JOIN {$g5['g5_shop_order_table']} o ON c.od_id = o.od_id
|
|
LEFT JOIN {$g5['g5_shop_item_table']} i ON c.it_id = i.it_id
|
|
WHERE c.it_id = '{$row['it_id']}'
|
|
AND c.ct_status IN ('입금', '완료')
|
|
";
|
|
|
|
if (!$is_admin) {
|
|
$sql .= " AND c.mb_id = '{$member['mb_id']}' ";
|
|
}
|
|
|
|
if (!empty($_GET['ca_id'])) {
|
|
$ca_id = preg_replace('/[^0-9]/', '', $_GET['ca_id']);
|
|
$sql .= " AND i.ca_id = '{$ca_id}' ";
|
|
}
|
|
|
|
if (!empty($_GET['stx']) && !empty($_GET['names'])) {
|
|
$search_fields = explode('||', $_GET['stx']);
|
|
$search_value = trim($_GET['names']);
|
|
$search_sql = [];
|
|
|
|
foreach ($search_fields as $field) {
|
|
$field = preg_replace('/[^a-zA-Z0-9_]/', '', $field);
|
|
$search_sql[] = "o.{$field} LIKE '%{$search_value}%'";
|
|
}
|
|
|
|
if ($search_sql) {
|
|
$sql .= " AND (" . implode(' OR ', $search_sql) . ")";
|
|
}
|
|
}
|
|
|
|
$sql .= " ORDER BY c.io_type ASC, c.ct_id ASC";
|
|
|
|
$res = sql_query($sql);
|
|
$rowspan = sql_num_rows($res);
|
|
|
|
|
|
|
|
for($k=0; $opt=sql_fetch_array($res); $k++) {
|
|
|
|
if($opt['io_type']) {
|
|
$opt_price = $opt['io_price'];
|
|
} else {
|
|
$opt_price = $opt['ct_price'] + $opt['io_price'];
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
<tr class="<?php echo $opt['ct_status'] === '완료' ? 'is-complete' : ''; ?>">
|
|
<?php if($k == 0) { ?>
|
|
<td rowspan="<?php echo $rowspan ?>" style="border-right:1px solid #eee;">
|
|
|
|
<a href="<?php echo shop_item_url($row['it_id']); ?>" class="font-B"><?php echo $row['it_name']; ?></a><br>
|
|
|
|
</td>
|
|
<?php } ?>
|
|
<td headers="th_itopt" class="td_prd" style="text-align:left;">
|
|
<div class="sod_name">
|
|
|
|
<div class="sod_opt"><?php echo get_text($opt['ct_option']); ?></div>
|
|
</div>
|
|
<?php
|
|
//예약정보 로드
|
|
if(isset($rb_item_res['res_is']) && $rb_item_res['res_is'] == 1) {
|
|
if(isset($opt['ct_types']) && $opt['ct_types'] == 1) {
|
|
$resv = sql_fetch ( " select * from {$g5['g5_shop_cart_table']} where ct_id = '{$opt['ct_id']}' and io_type = '0' " );
|
|
include (G5_PATH.'/rb/rb.mod/reservation/info2.inc.php');
|
|
}
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
$sql2 = " select * from {$g5['g5_shop_order_table']} where od_id = '{$opt['od_id']}' ";
|
|
$res2 = sql_query($sql2);
|
|
|
|
// 출력 여부를 확인하기 위한 변수
|
|
$has_data = false;
|
|
$buffer = '';
|
|
|
|
for ($j = 0; $row2 = sql_fetch_array($res2); $j++) {
|
|
$names = explode('|', $row2['od_names']);
|
|
$hps = explode('|', $row2['od_hps']);
|
|
|
|
$count = max(count($names), count($hps)); // 최대 길이만큼 반복
|
|
for ($i = 0; $i < $count; $i++) {
|
|
$name = isset($names[$i]) ? $names[$i] : '';
|
|
$hp = isset($hps[$i]) ? $hps[$i] : '';
|
|
|
|
// 내용이 있을 때만 버퍼에 추가
|
|
if (trim($name) || trim($hp)) {
|
|
$has_data = true;
|
|
$buffer .= "<ul>추가 사용자 : {$name} ({$hp})</ul>";
|
|
}
|
|
}
|
|
|
|
echo "<ul class='font-12 mt-10 font-B' style='background-color:#f9f9f9; border-radius:0px; margin-top:2px; padding:5px 10px 5px 10px;'>사용자 정보 : ".$row2['od_b_name']." (".$row2['od_b_hp'].")</ul>";
|
|
}
|
|
|
|
|
|
|
|
// 실제 출력
|
|
if ($has_data) {
|
|
echo '<div class="font-12" style="background-color:#f9f9f9; border-radius:0px; margin-top:2px; padding:5px 10px 5px 10px;">';
|
|
echo $buffer;
|
|
echo '</div>';
|
|
}
|
|
?>
|
|
</td>
|
|
|
|
<td headers="th_itst" class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
|
|
<?php if($is_admin) { ?>
|
|
<td headers="th_itst" class="">
|
|
<button type="button" class="btn-enter" style="border:1px solid #000; padding:5px 10px 5px 10px" data-ct-id="<?php echo $opt['ct_id']; ?>" <?php echo $opt['ct_status'] === '완료' ? 'disabled' : ''; ?>>입장</button>
|
|
<button type="button" class="btn-complete" style="border:1px solid #000; padding:5px 10px 5px 10px" data-ct-id="<?php echo $opt['ct_id']; ?>" <?php echo $opt['ct_status'] === '완료' ? 'disabled' : ''; ?>>완료</button>
|
|
</td>
|
|
<td headers="th_itst" class=""><?php echo $opt['ct_in_cnt']; ?></td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
|
|
}
|
|
}
|
|
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- } 주문 내역 끝 -->
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
// 입장 처리
|
|
$('.btn-enter').on('click', function () {
|
|
if (confirm("입장 카운트가 1 증가 합니다. 계속하시겠습니까?")) {
|
|
const ct_id = $(this).data('ct-id');
|
|
|
|
$.post('<?php echo G5_URL; ?>/shop/ajax.tkinquiry.php', {
|
|
mode: 'enter',
|
|
ct_id: ct_id
|
|
}, function (res) {
|
|
alert(res.message);
|
|
if (res.status === 'ok') location.reload();
|
|
}, 'json');
|
|
}
|
|
});
|
|
|
|
// 완료 처리
|
|
$('.btn-complete').on('click', function () {
|
|
if (confirm("선택하신 이용권이 사용처리 됩니다. 계속하시겠습니까?")) {
|
|
const ct_id = $(this).data('ct-id');
|
|
|
|
$.post('<?php echo G5_URL; ?>/shop/ajax.tkinquiry.php', {
|
|
mode: 'complete',
|
|
ct_id: ct_id
|
|
}, function (res) {
|
|
alert(res.message);
|
|
if (res.status === 'ok') location.reload();
|
|
}, 'json');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<?php
|
|
include_once('./_tail.php');
|