지정판매소 주소·지도 연동과 관련 설정을 반영
지정판매소 등록/수정/목록에 카카오 주소 검색 및 지도 연동 컴포넌트를 적용하고, 관련 모델·SQL 스크립트·테스트 설정을 함께 정리해 기능 동작 기반을 맞췄다. Made-with: Cursor
This commit is contained in:
@@ -1,19 +1,186 @@
|
||||
<?= view('components/print_header', ['printTitle' => '지정판매소 목록']) ?>
|
||||
<?php $readOnly = ! empty($readOnly); ?>
|
||||
<?= view('components/print_header', ['printTitle' => $readOnly ? '지정판매소 조회 목록' : '지정판매소 목록']) ?>
|
||||
<style>
|
||||
/* 목록 위 → 지정판매소 정보 아래 (가로 2열 없음) */
|
||||
.ds-split {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
min-height: 0;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.ds-list-panel {
|
||||
flex: 0 1 auto;
|
||||
width: 100%;
|
||||
max-height: 42vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
border: 1px solid #ccc;
|
||||
background: #fff;
|
||||
}
|
||||
.ds-detail-panel {
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
min-height: 12rem;
|
||||
border: 1px solid #ccc;
|
||||
background: #f5f5f5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.ds-panel-title {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
background: linear-gradient(180deg, #fafafa 0%, #e9ecef 100%);
|
||||
border-bottom: 1px solid #ccc;
|
||||
color: #333;
|
||||
}
|
||||
.ds-summary-bar {
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
background: #fff3cd;
|
||||
border: 1px solid #ffc107;
|
||||
color: #333;
|
||||
}
|
||||
.ds-row-selected td { background-color: #cce5ff !important; }
|
||||
.ds-detail-inner { padding: 10px; overflow: auto; flex: 1; }
|
||||
/* 원본 지정판매소 정보: 라벨 고정폭 + 2열 값(우측 값이 더 넓음), 주소·개인전화는 전폭 */
|
||||
.ds-detail-form {
|
||||
font-size: 12px;
|
||||
border: 1px solid #bbb;
|
||||
background: #fff;
|
||||
}
|
||||
.ds-row {
|
||||
display: grid;
|
||||
gap: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
.ds-detail-form > .ds-row:last-child { border-bottom: none; }
|
||||
/* 그 외 2+2 동일 비율 (상호명 | 우편번호 등) */
|
||||
.ds-row-4-even {
|
||||
grid-template-columns: 5.5rem minmax(0, 1fr) 5.5rem minmax(0, 1fr);
|
||||
}
|
||||
/* 판매소번호 전폭 행 — 값을 우편·주소 필드처럼 넓게 */
|
||||
.ds-value-shop-wide {
|
||||
font-weight: 600;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: 0.04em;
|
||||
font-size: 13px;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
/* 라벨 | 값(나머지 전체) — 도로명·지번·개인전화·이메일 */
|
||||
.ds-row-wide {
|
||||
grid-template-columns: 5.5rem minmax(0, 1fr);
|
||||
}
|
||||
.ds-row-wide-tall .ds-field-value {
|
||||
min-height: 3.25rem;
|
||||
align-content: start;
|
||||
}
|
||||
/* 도로명주소 + 카카오맵 버튼 */
|
||||
.ds-field-value-with-map {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
.ds-field-value-with-map .ds-addr-text {
|
||||
flex: 1 1 12rem;
|
||||
min-width: 0;
|
||||
word-break: break-word;
|
||||
}
|
||||
.ds-field-label {
|
||||
background: #eef2f5;
|
||||
border-right: 1px solid #ccc;
|
||||
padding: 5px 8px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.ds-field-value {
|
||||
padding: 5px 8px;
|
||||
background: #fff;
|
||||
word-break: break-word;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
.ds-row-4-even > *:nth-child(4n) { border-right: none; }
|
||||
.ds-row-wide > .ds-field-value { border-right: none; }
|
||||
.ds-field-hint {
|
||||
font-size: 11px;
|
||||
color: #b91c1c;
|
||||
margin-top: 4px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.ds-row-4-even { grid-template-columns: 5rem 1fr; }
|
||||
}
|
||||
.ds-detail-actions { padding: 10px; border-top: 1px solid #ccc; background: #eee; }
|
||||
.ds-detail-info-wrap { overflow-x: auto; }
|
||||
.ds-detail-info-wrap .data-table th { white-space: nowrap; }
|
||||
.ds-detail-info-wrap th.ds-col-tight-head,
|
||||
.ds-detail-info-wrap td.ds-col-tight-cell {
|
||||
max-width: 6.5rem;
|
||||
width: 6.5rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ds-list-panel .ds-col-tight {
|
||||
max-width: 6rem;
|
||||
width: 6rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ds-list-panel .ds-col-zip {
|
||||
width: 4.5rem;
|
||||
max-width: 5rem;
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ds-list-panel .ds-col-addr-list {
|
||||
max-width: 11rem;
|
||||
min-width: 6rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ds-list-panel .ds-col-detail-list {
|
||||
max-width: 8rem;
|
||||
min-width: 4rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ds-ro-road-btn { margin-left: 6px; vertical-align: middle; }
|
||||
</style>
|
||||
|
||||
<?php
|
||||
$listBasePath = $readOnly ? 'designated-shops/browse' : 'designated-shops';
|
||||
?>
|
||||
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
||||
<div class="flex flex-wrap items-center justify-between gap-y-2">
|
||||
<span class="text-sm font-bold text-gray-700">지정판매소 목록</span>
|
||||
<span class="text-sm font-bold text-gray-700"><?= $readOnly ? '지정판매소 조회' : '지정판매소 관리' ?></span>
|
||||
<div class="flex items-center gap-2">
|
||||
<?php if ($readOnly): ?>
|
||||
<a href="<?= mgmt_url('designated-shops/export') ?>" class="no-print border border-btn-excel-border text-btn-excel-text px-3 py-1 rounded-sm text-sm hover:bg-green-50 transition">엑셀저장</a>
|
||||
<button onclick="window.print()" class="no-print border border-btn-print-border text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50 transition">인쇄</button>
|
||||
<button type="button" onclick="window.print()" class="no-print border border-btn-print-border text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50 transition">인쇄</button>
|
||||
<?php endif; ?>
|
||||
<?php if (! $readOnly): ?>
|
||||
<a href="<?= mgmt_url('designated-shops/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">지정판매소 등록</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- P2-15: 다조건 검색 -->
|
||||
|
||||
<section class="p-2 bg-white border-b border-gray-200 no-print">
|
||||
<form method="GET" action="<?= mgmt_url('designated-shops') ?>" class="flex flex-wrap items-center gap-2">
|
||||
<form method="GET" action="<?= mgmt_url($listBasePath) ?>" class="flex flex-wrap items-center gap-2">
|
||||
<span class="text-sm font-semibold text-gray-700 mr-1">지정판매소 검색</span>
|
||||
<label class="text-sm text-gray-600">상호명</label>
|
||||
<input type="text" name="ds_name" value="<?= esc($dsName ?? '') ?>" placeholder="상호명 검색" class="border border-gray-300 rounded px-2 py-1 text-sm w-40"/>
|
||||
<input type="text" name="ds_name" value="<?= esc($dsName ?? '') ?>" placeholder="상호명" class="border border-gray-300 rounded px-2 py-1 text-sm w-36"/>
|
||||
<label class="text-sm text-gray-600">구군코드</label>
|
||||
<select name="ds_gugun_code" class="border border-gray-300 rounded px-2 py-1 text-sm">
|
||||
<option value="">전체</option>
|
||||
@@ -29,48 +196,351 @@
|
||||
<option value="3" <?= ($dsState ?? '') === '3' ? 'selected' : '' ?>>직권해지</option>
|
||||
</select>
|
||||
<button type="submit" class="bg-btn-search text-white px-4 py-1 rounded-sm text-sm">조회</button>
|
||||
<a href="<?= mgmt_url('designated-shops') ?>" class="border border-gray-300 text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50">초기화</a>
|
||||
<a href="<?= mgmt_url($listBasePath) ?>" class="border border-gray-300 text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50">초기화</a>
|
||||
</form>
|
||||
</section>
|
||||
<div class="border border-gray-300 overflow-auto mt-2">
|
||||
<table class="w-full data-table">
|
||||
|
||||
<?php
|
||||
$sc = $stateCounts ?? ['total' => 0, 1 => 0, 2 => 0, 3 => 0];
|
||||
?>
|
||||
<div class="ds-summary-bar no-print mx-2 mt-2 rounded-sm">
|
||||
건수 : <?= (int) ($sc['total'] ?? 0) ?>
|
||||
(정상 : <?= (int) ($sc[1] ?? 0) ?> / 폐업 : <?= (int) ($sc[2] ?? 0) ?> / 해지 : <?= (int) ($sc[3] ?? 0) ?>)
|
||||
</div>
|
||||
|
||||
<div class="ds-split no-print mx-2 mb-2 mt-2 flex-1 min-h-0">
|
||||
<div class="ds-list-panel">
|
||||
<div class="ds-panel-title shrink-0">지정판매소 리스트</div>
|
||||
<div class="overflow-auto flex-1 min-h-0">
|
||||
<table class="w-full data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-14">번호</th>
|
||||
<th class="w-24">구·군</th>
|
||||
<th class="w-24">지정일</th>
|
||||
<th class="w-24">구역</th>
|
||||
<th class="ds-col-tight">대표자명</th>
|
||||
<th class="ds-col-tight">상호명</th>
|
||||
<th class="ds-col-zip">우편번호</th>
|
||||
<th class="text-left">주소</th>
|
||||
<th class="text-left">상세주소</th>
|
||||
<th class="w-28">사업자번호</th>
|
||||
<th class="w-28">전화</th>
|
||||
<th class="w-16">상태</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="ds-list-body" class="text-right">
|
||||
<?php foreach ($list as $i => $row): ?>
|
||||
<?php
|
||||
$sn = (string) ($row->ds_shop_no ?? '');
|
||||
if (preg_match('/(\d{3})$/', $sn, $m)) {
|
||||
$shortNo = $m[1];
|
||||
} elseif ($sn !== '' && strlen($sn) >= 3) {
|
||||
$shortNo = substr($sn, -3);
|
||||
} else {
|
||||
$shortNo = $sn;
|
||||
}
|
||||
$st = (int) ($row->ds_state ?? 1);
|
||||
$stLabel = $st === 1 ? '' : ($st === 2 ? '폐업' : '해지');
|
||||
$ggLabel = (string) ($row->ds_gugun_code ?? '');
|
||||
$da = $row->ds_designated_at ?? null;
|
||||
$daDisp = ($da !== null && $da !== '' && (string) $da !== '0000-00-00') ? substr((string) $da, 0, 10) : '';
|
||||
$zone = (string) ($row->ds_zone_code ?? '');
|
||||
$zipList = trim((string) ($row->ds_zip ?? ''));
|
||||
$roadL = trim((string) ($row->ds_addr ?? ''));
|
||||
$jibunL = trim((string) ($row->ds_addr_jibun ?? ''));
|
||||
$addrMainList = $roadL !== '' ? $roadL : $jibunL;
|
||||
$addrDetailList = trim((string) ($row->ds_addr_detail ?? ''));
|
||||
?>
|
||||
<tr class="ds-list-row cursor-pointer" data-row-index="<?= (int) $i ?>" role="button" tabindex="0">
|
||||
<td class="text-center"><?= esc($shortNo) ?></td>
|
||||
<td class="text-left pl-1 text-xs"><?= esc($ggLabel) ?></td>
|
||||
<td class="text-center text-xs"><?= esc($daDisp) ?></td>
|
||||
<td class="text-left pl-1 text-xs"><?= esc($zone) ?></td>
|
||||
<td class="text-left pl-1 text-xs ds-col-tight" title="<?= esc($row->ds_rep_name ?? '') ?>"><?= esc($row->ds_rep_name ?? '') ?></td>
|
||||
<td class="text-left pl-1 text-xs ds-col-tight" title="<?= esc($row->ds_name ?? '') ?>"><?= esc($row->ds_name ?? '') ?></td>
|
||||
<td class="text-center text-xs ds-col-zip" title="<?= esc($zipList) ?>"><?= esc($zipList) ?></td>
|
||||
<td class="text-left pl-1 text-xs ds-col-addr-list" title="<?= esc($addrMainList) ?>"><?= esc($addrMainList) ?></td>
|
||||
<td class="text-left pl-1 text-xs ds-col-detail-list" title="<?= esc($addrDetailList) ?>"><?= esc($addrDetailList) ?></td>
|
||||
<td class="text-left pl-1 text-xs"><?= esc($row->ds_biz_no ?? '') ?></td>
|
||||
<td class="text-left pl-1 text-xs"><?= esc($row->ds_tel ?? '') ?></td>
|
||||
<td class="text-center <?= $st === 2 ? 'text-pink-600 font-medium' : ($st === 3 ? 'text-orange-700' : '') ?>"><?= esc($stLabel) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ds-detail-panel">
|
||||
<div class="ds-panel-title shrink-0">지정판매소 정보</div>
|
||||
<div class="ds-detail-inner" id="ds-detail-box">
|
||||
<p id="ds-detail-placeholder" class="text-sm text-gray-500 py-6 text-center">위 목록에서 행을 선택하세요.</p>
|
||||
<div id="ds-detail-fields" class="hidden">
|
||||
<div class="ds-detail-info-wrap">
|
||||
<table class="w-full data-table text-sm" id="ds-detail-info-table" aria-label="지정판매소 상세">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>판매소번호</th>
|
||||
<th class="ds-col-tight-head">상호명</th>
|
||||
<th>우편번호</th>
|
||||
<th>사업자번호</th>
|
||||
<th>일반전화</th>
|
||||
<th class="ds-col-tight-head">대표자명</th>
|
||||
<th>이메일</th>
|
||||
<th>업태</th>
|
||||
<th>업종</th>
|
||||
<th>지정일자</th>
|
||||
<th>지자체</th>
|
||||
<th>도로명주소</th>
|
||||
<th>지번주소</th>
|
||||
<th>상세주소</th>
|
||||
<th>개인전화</th>
|
||||
<th>구코드</th>
|
||||
<th>구역</th>
|
||||
<th>가상계좌(은행)</th>
|
||||
<th>계좌번호</th>
|
||||
<th>종사업장번호</th>
|
||||
<th>변경일자</th>
|
||||
<th>영업상태</th>
|
||||
<th>등록일시</th>
|
||||
<th>변경사유</th>
|
||||
<th class="no-print w-14">지도</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-left" data-ro="ds_shop_no">—</td>
|
||||
<td class="text-left ds-col-tight-cell" data-ro="ds_name">—</td>
|
||||
<td class="text-left" data-ro="ds_zip">—</td>
|
||||
<td class="text-left" data-ro="ds_biz_no">—</td>
|
||||
<td class="text-left" data-ro="ds_tel">—</td>
|
||||
<td class="text-left ds-col-tight-cell" data-ro="ds_rep_name">—</td>
|
||||
<td class="text-left" data-ro="ds_email">—</td>
|
||||
<td class="text-left" data-ro="ds_biz_type">—</td>
|
||||
<td class="text-left" data-ro="ds_biz_kind">—</td>
|
||||
<td class="text-left" data-ro="ds_designated_at">—</td>
|
||||
<td class="text-left" data-ro="lg_name">—</td>
|
||||
<td class="text-left min-w-[10rem]"><span data-ro="ds_addr">—</span></td>
|
||||
<td class="text-left" data-ro="ds_addr_jibun">—</td>
|
||||
<td class="text-left" data-ro="ds_addr_detail">—</td>
|
||||
<td class="text-left" data-ro="ds_rep_phone">—</td>
|
||||
<td class="text-left" data-ro="ds_gugun_code">—</td>
|
||||
<td class="text-left" data-ro="ds_zone_code">—</td>
|
||||
<td class="text-left" data-ro="ds_va_bank">—</td>
|
||||
<td class="text-left" data-ro="ds_va_account">—</td>
|
||||
<td class="text-left" data-ro="ds_branch_no">—</td>
|
||||
<td class="text-left" data-ro="ds_state_changed_at">—</td>
|
||||
<td class="text-left" data-ro="state_label">—</td>
|
||||
<td class="text-left" data-ro="ds_regdate">—</td>
|
||||
<td class="text-left min-w-[8rem]" data-ro="ds_change_reason">—</td>
|
||||
<td class="text-center no-print">
|
||||
<button type="button" class="border border-btn-print-border text-gray-700 px-2 py-0.5 rounded-sm text-xs hover:bg-gray-50" id="ds-ro-map-btn">지도</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (! $readOnly): ?>
|
||||
<div class="ds-detail-actions no-print flex flex-wrap items-center gap-3 shrink-0">
|
||||
<a id="ds-edit-link" href="#" class="text-blue-700 hover:underline text-sm font-medium pointer-events-none opacity-40">수정</a>
|
||||
<form id="ds-delete-form" method="POST" action="" class="inline" onsubmit="return confirm('이 지정판매소를 삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" id="ds-delete-btn" class="text-red-600 hover:underline text-sm pointer-events-none opacity-40" disabled>삭제</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($pager)): ?>
|
||||
<div class="mt-2 mb-2 mx-2 no-print"><?= $pager->links() ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= view('components/kakao_map_modal', ['kakaoJavascriptKey' => $kakaoJavascriptKey ?? '']) ?>
|
||||
|
||||
<script type="application/json" id="ds-detail-json"><?= $detailRowsJson ?? '[]' ?></script>
|
||||
<script>
|
||||
(function () {
|
||||
var raw = document.getElementById('ds-detail-json');
|
||||
var rows = [];
|
||||
try {
|
||||
rows = JSON.parse(raw.textContent || '[]');
|
||||
} catch (e) {
|
||||
rows = [];
|
||||
}
|
||||
var readOnly = <?= json_encode($readOnly) ?>;
|
||||
var body = document.getElementById('ds-list-body');
|
||||
var placeholder = document.getElementById('ds-detail-placeholder');
|
||||
var fieldsWrap = document.getElementById('ds-detail-fields');
|
||||
var infoTable = document.getElementById('ds-detail-info-table');
|
||||
var editLink = readOnly ? null : document.getElementById('ds-edit-link');
|
||||
var delForm = readOnly ? null : document.getElementById('ds-delete-form');
|
||||
var delBtn = readOnly ? null : document.getElementById('ds-delete-btn');
|
||||
// mgmt_url() 이 path 를 trim 하므로 'edit/33' 이 아니라 'edit33' 로 붙지 않게 슬래시를 넣음
|
||||
var editBase = <?= json_encode(mgmt_url('designated-shops/edit')) ?>;
|
||||
var delBase = <?= json_encode(mgmt_url('designated-shops/delete')) ?>;
|
||||
|
||||
function textVal(v) {
|
||||
return (v === '' || v == null) ? '—' : String(v);
|
||||
}
|
||||
function buildKakaoMapSearchQuery(d) {
|
||||
var road = String(d.ds_addr || '').trim();
|
||||
var jibun = String(d.ds_addr_jibun || '').trim();
|
||||
var detail = String(d.ds_addr_detail || '').trim();
|
||||
var q = road || jibun;
|
||||
if (detail) {
|
||||
q = q ? (q + ' ' + detail) : detail;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
function fillDetailInfoTable(d) {
|
||||
if (!infoTable) return;
|
||||
infoTable.querySelectorAll('[data-ro]').forEach(function (el) {
|
||||
var k = el.getAttribute('data-ro');
|
||||
var v = d[k];
|
||||
if (k === 'ds_va_account') {
|
||||
v = d.ds_va_account || d.ds_va_number || '';
|
||||
}
|
||||
el.textContent = textVal(v);
|
||||
});
|
||||
window.__dsDetailForMap = d;
|
||||
}
|
||||
|
||||
function selectIndex(idx) {
|
||||
if (!rows.length || idx < 0 || idx >= rows.length) return;
|
||||
var d = rows[idx];
|
||||
Array.prototype.forEach.call(body.querySelectorAll('tr.ds-list-row'), function (tr) {
|
||||
tr.classList.remove('ds-row-selected');
|
||||
});
|
||||
var tr = body.querySelector('tr[data-row-index="' + idx + '"]');
|
||||
if (tr) tr.classList.add('ds-row-selected');
|
||||
|
||||
placeholder.classList.add('hidden');
|
||||
fieldsWrap.classList.remove('hidden');
|
||||
fillDetailInfoTable(d);
|
||||
|
||||
if (!readOnly && editLink && delForm && delBtn) {
|
||||
var id = d.ds_idx;
|
||||
editLink.href = editBase + '/' + id;
|
||||
editLink.classList.remove('pointer-events-none', 'opacity-40');
|
||||
delForm.action = delBase + '/' + id;
|
||||
delBtn.disabled = false;
|
||||
delBtn.classList.remove('pointer-events-none', 'opacity-40');
|
||||
}
|
||||
}
|
||||
|
||||
if (body) {
|
||||
body.addEventListener('click', function (e) {
|
||||
var tr = e.target.closest('tr.ds-list-row');
|
||||
if (!tr) return;
|
||||
var idx = parseInt(tr.getAttribute('data-row-index'), 10);
|
||||
if (!isNaN(idx)) selectIndex(idx);
|
||||
});
|
||||
body.addEventListener('keydown', function (e) {
|
||||
if (e.key !== 'Enter' && e.key !== ' ') return;
|
||||
var tr = e.target.closest('tr.ds-list-row');
|
||||
if (!tr) return;
|
||||
e.preventDefault();
|
||||
var idx = parseInt(tr.getAttribute('data-row-index'), 10);
|
||||
if (!isNaN(idx)) selectIndex(idx);
|
||||
});
|
||||
}
|
||||
|
||||
var mapBtnRo = document.getElementById('ds-ro-map-btn');
|
||||
if (mapBtnRo) {
|
||||
mapBtnRo.addEventListener('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
var d = window.__dsDetailForMap;
|
||||
if (!d) return;
|
||||
var q = buildKakaoMapSearchQuery(d);
|
||||
if (!q) {
|
||||
window.alert('표시할 주소 정보가 없습니다.');
|
||||
return;
|
||||
}
|
||||
if (typeof window.openDesignatedShopKakaoMap === 'function') {
|
||||
window.openDesignatedShopKakaoMap(q);
|
||||
} else {
|
||||
window.open('https://map.kakao.com/link/search/' + encodeURIComponent(q), '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (rows.length > 0) {
|
||||
selectIndex(0);
|
||||
} else if (!readOnly && editLink && delBtn) {
|
||||
editLink.classList.add('pointer-events-none', 'opacity-40');
|
||||
delBtn.disabled = true;
|
||||
delBtn.classList.add('pointer-events-none', 'opacity-40');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- 인쇄용: 전체 테이블 -->
|
||||
<div class="hidden print:block print:p-4">
|
||||
<table class="w-full data-table text-xs">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-16">번호</th>
|
||||
<th>번호</th>
|
||||
<th>지자체</th>
|
||||
<th>판매소번호</th>
|
||||
<th>구·군</th>
|
||||
<th>지정일</th>
|
||||
<th>구역</th>
|
||||
<th>대표자명</th>
|
||||
<th>상호명</th>
|
||||
<th>대표자</th>
|
||||
<th>우편번호</th>
|
||||
<th>주소</th>
|
||||
<th>상세주소</th>
|
||||
<th>사업자번호</th>
|
||||
<th>전화</th>
|
||||
<th>판매소번호</th>
|
||||
<th>가상계좌</th>
|
||||
<th>상태</th>
|
||||
<th>등록일</th>
|
||||
<th class="w-28">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-right">
|
||||
<tbody>
|
||||
<?php foreach ($list as $row): ?>
|
||||
<?php
|
||||
$snP = (string) ($row->ds_shop_no ?? '');
|
||||
if (preg_match('/(\d{3})$/', $snP, $mP)) {
|
||||
$shortNoP = $mP[1];
|
||||
} elseif ($snP !== '' && strlen($snP) >= 3) {
|
||||
$shortNoP = substr($snP, -3);
|
||||
} else {
|
||||
$shortNoP = $snP;
|
||||
}
|
||||
$daP = $row->ds_designated_at ?? null;
|
||||
$daDispP = ($daP !== null && $daP !== '' && (string) $daP !== '0000-00-00') ? substr((string) $daP, 0, 10) : '';
|
||||
$stP = (int) ($row->ds_state ?? 1);
|
||||
$stLabP = $stP === 1 ? '정상' : ($stP === 2 ? '폐업' : '직권해지');
|
||||
$zipP = trim((string) ($row->ds_zip ?? ''));
|
||||
$roadP = trim((string) ($row->ds_addr ?? ''));
|
||||
$jibP = trim((string) ($row->ds_addr_jibun ?? ''));
|
||||
$addrP = $roadP !== '' ? $roadP : $jibP;
|
||||
$detP = trim((string) ($row->ds_addr_detail ?? ''));
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-center"><?= esc($row->ds_idx) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($lgMap[$row->ds_lg_idx] ?? '') ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ds_shop_no) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ds_name) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ds_rep_name) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ds_biz_no) ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ds_va_number) ?></td>
|
||||
<td class="text-center"><?= (int) $row->ds_state === 1 ? '정상' : ((int) $row->ds_state === 2 ? '폐업' : '직권해지') ?></td>
|
||||
<td class="text-left pl-2"><?= esc($row->ds_regdate ?? '') ?></td>
|
||||
<td class="text-center">
|
||||
<a href="<?= mgmt_url('designated-shops/edit/' . (int) $row->ds_idx) ?>" class="text-blue-600 hover:underline text-sm">수정</a>
|
||||
<form action="<?= mgmt_url('designated-shops/delete/' . (int) $row->ds_idx) ?>" method="POST" class="inline ml-1" onsubmit="return confirm('이 지정판매소를 삭제하시겠습니까?');">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
|
||||
</form>
|
||||
</td>
|
||||
<td class="text-center"><?= esc($shortNoP) ?></td>
|
||||
<td class="text-left"><?= esc($lgMap[$row->ds_lg_idx] ?? '') ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_gugun_code ?? '') ?></td>
|
||||
<td class="text-center"><?= esc($daDispP) ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_zone_code ?? '') ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_rep_name ?? '') ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_name ?? '') ?></td>
|
||||
<td class="text-left"><?= esc($zipP) ?></td>
|
||||
<td class="text-left"><?= esc($addrP) ?></td>
|
||||
<td class="text-left"><?= esc($detP) ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_biz_no ?? '') ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_tel ?? '') ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_shop_no) ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_va_number) ?></td>
|
||||
<td class="text-center"><?= esc($stLabP) ?></td>
|
||||
<td class="text-left"><?= esc($row->ds_regdate ?? '') ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php if (isset($pager)): ?><div class="mt-3"><?= $pager->links() ?></div><?php endif; ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user