Files
2026-06-11 18:47:38 +09:00

176 lines
6.8 KiB
PHP

<?php
$sub_menu = '800700';
include_once('./_common.php');
if ($is_admin != 'super') {
alert('최고관리자만 접근 가능합니다.');
}
// 상태명 저장 처리
if ($_POST['mode'] == 'update_status_names') {
foreach ($_POST['status'] as $code => $name) {
$code = sql_real_escape_string($code);
$name = sql_real_escape_string($name);
$config_key = 'status_' . $code;
sql_query("UPDATE order_config SET config_value = '{$name}' WHERE config_key = '{$config_key}'");
}
alert('상태명이 저장되었습니다.', './status_manager.php');
}
// 현재 상태 설정 조회
$status_configs = [];
$result = sql_query("SELECT config_key, config_value, config_desc FROM order_config WHERE config_key LIKE 'status_%' ORDER BY config_key");
while ($row = sql_fetch_array($result)) {
$status_code = str_replace('status_', '', $row['config_key']);
$status_configs[$status_code] = $row;
}
$customer_statuses = ['견적신청중', '작성완료', '계약금입금예정', '계약금입금완료', '중도금입금예정', '중도금입금완료', '잔금입금예정', '잔금처리완료', '시공완료'];
$agent_statuses = ['견적제안', '견적채택', '견적취소', '시공완료'];
$g5['title'] = '상태 관리';
include_once(G5_ADMIN_PATH . '/admin.head.php');
?>
<div class="local_desc01 local_desc">
<p>견적 상태 코드는 변경하지 않고, 화면에 표시되는 이름만 수정할 수 있습니다.</p>
</div>
<form name="fstatusform" method="post" action="./status_manager.php">
<input type="hidden" name="mode" value="update_status_names">
<section id="anc_status_manager">
<h2>고객 상태 관리</h2>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>고객 견적 상태 표시명 설정</caption>
<colgroup>
<col class="grid_3">
<col class="grid_3">
<col>
<col class="grid_2">
</colgroup>
<thead>
<tr>
<th scope="col">상태 코드</th>
<th scope="col">현재 표시명</th>
<th scope="col">새 표시명</th>
<th scope="col">설명</th>
</tr>
</thead>
<tbody>
<?php
// $customer_statuses = ['견적신청중', '작성완료', '계약금입금예정', '계약금입금완료', '중도금입금예정', '중도금입금완료', '잔금입금예정', '잔금처리완료', '시공완료'];
foreach ($customer_statuses as $code) {
if (isset($status_configs[$code])) {
$config = $status_configs[$code];
?>
<tr>
<td><strong><?php echo $code; ?></strong></td>
<td><?php echo htmlspecialchars($config['config_value']); ?></td>
<td>
<input type="text" name="status[<?php echo $code; ?>]"
value="<?php echo htmlspecialchars($config['config_value']); ?>" class="frm_input"
size="20">
</td>
<td><?php echo $config['config_desc']; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<h2 style="margin-top:30px;">대리점 상태 관리</h2>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>대리점 견적 상태 표시명 설정</caption>
<colgroup>
<col class="grid_3">
<col class="grid_3">
<col>
<col class="grid_2">
</colgroup>
<thead>
<tr>
<th scope="col">상태 코드</th>
<th scope="col">현재 표시명</th>
<th scope="col">새 표시명</th>
<th scope="col">설명</th>
</tr>
</thead>
<tbody>
<?php
// $agent_statuses = ['견적제안', '견적채택', '견적취소', '시공완료'];
foreach ($agent_statuses as $code) {
if (isset($status_configs[$code])) {
$config = $status_configs[$code];
?>
<tr>
<td><strong><?php echo $code; ?></strong></td>
<td><?php echo htmlspecialchars($config['config_value']); ?></td>
<td>
<input type="text" name="status[<?php echo $code; ?>]"
value="<?php echo htmlspecialchars($config['config_value']); ?>" class="frm_input"
size="20">
</td>
<td><?php echo $config['config_desc']; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<h2 style="margin-top:30px;">상태 전환 규칙</h2>
<div class="local_desc02">
<h3>고객 상태 전환:</h3>
<p><strong>견적신청중</strong> → 작성완료 → 견적채택 → 입금예정 → 입금확인 → 다운로드</p>
<h3>대리점 상태 전환:</h3>
<p><strong>견적제안</strong> → 견적채택 또는 견적취소</p>
<h3>관리자 권한:</h3>
<p>- 모든 상태 변경 가능<br>
- 작성완료 → 견적신청중 (되돌리기)<br>
- 견적취소 → 견적제안 (되돌리기)<br>
- 다운로드 → 견적신청중 (루프백)</p>
</div>
</section>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="상태명 저장" class="btn_submit">
</div>
</form>
<style>
.local_desc02 {
background: #f8f9fa;
border: 1px solid #dee2e6;
padding: 20px;
margin-top: 20px;
}
.local_desc02 h3 {
color: #495057;
margin-top: 15px;
margin-bottom: 8px;
}
.local_desc02 p {
margin-bottom: 10px;
line-height: 1.6;
}
</style>
<?php
include_once(G5_ADMIN_PATH . '/admin.tail.php');
?>