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

167 lines
7.7 KiB
PHP

<?php
$sub_menu = "800860";
include_once('./_common.php');
auth_check($auth[$sub_menu], 'r');
$g5['title'] = '창호 브랜드 관리';
include_once(G5_ADMIN_PATH.'/admin.head.php');
$sql_common = " FROM `order_window_brands` ";
$sql_search = " WHERE is_deleted = 0 ";
// 검색어 처리
$stx = isset($_GET['stx']) ? clean_xss_tags(trim($_GET['stx'])) : '';
if ($stx) {
$sql_search .= " AND ( brand_name LIKE '%{$stx}%' OR brand_code LIKE '%{$stx}%' OR manufacturer LIKE '%{$stx}%' ) ";
}
$sql_order = " ORDER BY sort_order ASC, brand_name ASC ";
$sql = " SELECT COUNT(*) AS cnt {$sql_common} {$sql_search} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows);
if ($page < 1) $page = 1;
$from_record = ($page - 1) * $rows;
$sql = " SELECT * {$sql_common} {$sql_search} {$sql_order} LIMIT {$from_record}, {$rows} ";
$result = sql_query($sql);
$list_num = $total_count - ($page - 1) * $rows;
?>
<div class="local_desc01 local_desc">
<p>
대리점이 견적서 작성 시 선택할 수 있는 창호 브랜드를 관리합니다.<br>
정렬 숫자가 낮을수록 목록 상단에 표시됩니다.
</p>
</div>
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
<label for="stx" class="sound_only">검색어</label>
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" class="frm_input" placeholder="브랜드명, 코드, 제조사">
<input type="submit" value="검색" class="btn_submit">
</form>
<form name="fbrandlist" id="fbrandlist" method="post" action="./brand_manager_update.php" autocomplete="off">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">브랜드 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">브랜드명</th>
<th scope="col">브랜드 코드</th>
<th scope="col">제조사</th>
<th scope="col">정렬</th>
<th scope="col">사용</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_chk">
<input type="hidden" name="id[<?php echo $i ?>]" value="<?php echo $row['id'] ?>">
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['brand_name']); ?> 브랜드</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<td>
<input type="text" name="brand_name[<?php echo $i ?>]" value="<?php echo get_text($row['brand_name']) ?>" class="frm_input" size="15" required>
</td>
<td>
<input type="text" name="brand_code[<?php echo $i ?>]" value="<?php echo get_text($row['brand_code']) ?>" class="frm_input" size="10">
</td>
<td>
<input type="text" name="manufacturer[<?php echo $i ?>]" value="<?php echo get_text($row['manufacturer']) ?>" class="frm_input" size="15">
</td>
<td class="td_num">
<input type="number" name="sort_order[<?php echo $i ?>]" value="<?php echo get_text($row['sort_order']) ?>" class="frm_input" size="3">
</td>
<td class="td_chk">
<input type="checkbox" name="is_used[<?php echo $i ?>]" value="1" id="is_used_<?php echo $i ?>" <?php echo $row['is_used']?'checked':''; ?>>
<label for="is_used_<?php echo $i; ?>" class="sound_only">사용</label>
</td>
<td class="td_mng td_mng_s">
<a href="./brand_manager_update.php?w=d&amp;id=<?php echo $row['id']; ?>&amp;page=<?php echo $page; ?>&amp;stx=<?php echo $stx; ?>&amp;token=<?php echo $token; ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
</td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="7" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
<div class="btn_fixed_top">
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value" class="btn btn_02">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
</div>
</form>
<form name="fbrandadd" id="fbrandadd" method="post" action="./brand_manager_update.php" autocomplete="off" class="form_01">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<h2>브랜드 추가</h2>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>브랜드 추가</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="brand_name">브랜드명<strong class="sound_only">필수</strong></label></th>
<td><input type="text" name="brand_name" id="brand_name" required class="required frm_input" size="30"></td>
</tr>
<tr>
<th scope="row"><label for="brand_code">브랜드 코드</label></th>
<td><input type="text" name="brand_code" id="brand_code" class="frm_input" size="15"></td>
</tr>
<tr>
<th scope="row"><label for="manufacturer">제조사</label></th>
<td><input type="text" name="manufacturer" id="manufacturer" class="frm_input" size="30"></td>
</tr>
<tr>
<th scope="row"><label for="sort_order">정렬</label></th>
<td><input type="number" name="sort_order" value="0" id="sort_order" class="frm_input" size="5"></td>
</tr>
<tr>
<th scope="row"><label for="is_used">사용여부</label></th>
<td>
<input type="checkbox" name="is_used" value="1" id="is_used" checked>
<label for="is_used">사용</label>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" name="act_button" value="추가" class="btn_submit">
</div>
</form>
<?php
echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page=");
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>