Files
jongryangje/app/Views/bag/code_details.php
taekyoungc ec3119799c gov-portal 디자인을 시스템 전체에 적용한다.
- 사이트 업무 페이지: 공통 셸 bag/layout/portal(헤더+대메뉴 클릭+좌측 사이드바 소메뉴)
- 관리자 페이지: admin/layout 을 동일 포털 셸로 재작성(관리자 메뉴 트리, 폴백)
- 메인(/): gov-portal 대시보드, 종량제 실데이터만(재고/주문/승인/활동로그)
- 로그인/회원가입/2차인증/TOTP: 공통 auth/_shell 로 통일, 사이트 공통 로고
- 버튼색 통일: btn-search 등 주요 버튼을 #243a5e(메뉴바 네이비보다 살짝 밝게),
  밝은 파랑 채움 버튼(#2b4c8c/#1e548a)도 동일 색으로
- gov_portal_nav_context() 임의 메뉴 트리 수용, 업무 셸은 실제 bag/* 링크 유지
- Admin\Menu 권한거부 리다이렉트 admin/dashboard(404) → admin 수정
- E2E redesign.spec.js 추가, 기능 무변경

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 09:47:36 +09:00

84 lines
3.8 KiB
PHP

<?php
/** @var object $kind */
/** @var list<object> $list */
/** @var bool $canManage */
/** @var array<int,bool> $rowCanEdit */
$canManage = ! empty($canManage);
$rowCanEdit = $rowCanEdit ?? [];
$showActionsCol = $canManage;
$rowStartNo = 1;
if (isset($pager) && $pager !== null) {
$rowStartNo = (int) ($pager->getCurrentPage() - 1) * (int) $pager->getPerPage() + 1;
}
?>
<div class="space-y-3">
<?= view('components/print_header', ['printTitle' => '세부코드 - ' . esc($kind->ck_name)]) ?>
<section class="border border-gray-300 rounded bg-control-panel p-2">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<div class="flex flex-wrap items-center gap-2 text-sm">
<a href="<?= base_url('bag/code-kinds') ?>" class="text-blue-600 hover:underline">&larr; 기본코드 종류</a>
<span class="text-gray-400">|</span>
<span class="font-bold text-gray-700"><?= $canManage ? '세부코드 관리' : '세부코드 조회' ?> — <?= esc($kind->ck_name) ?> (<?= esc($kind->ck_code) ?>)</span>
</div>
<div class="flex items-center gap-2">
<button type="button" onclick="window.print()" class="no-print rounded border border-gray-300 px-3 py-1 text-sm text-gray-600 hover:bg-gray-50">인쇄</button>
<?php if ($canManage): ?>
<a href="<?= base_url('admin/code-details/' . (int) $kind->ck_idx . '/create') ?>" class="rounded border border-transparent bg-[#243a5e] px-3 py-1.5 text-sm text-white shadow hover:opacity-90">세부코드 등록</a>
<?php endif; ?>
</div>
</div>
</section>
<div class="border border-gray-300 overflow-auto">
<table class="data-table w-full">
<thead>
<tr>
<th class="w-16">번호</th>
<th class="w-24">코드</th>
<th>코드명</th>
<th class="w-24">범위</th>
<th class="w-20">정렬순서</th>
<th class="w-20">상태</th>
<th>등록일</th>
<?php if ($showActionsCol): ?>
<th class="w-28">작업</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php $rowNo = $rowStartNo; foreach ($list as $row): ?>
<?php
$isPlatform = (($row->cd_source ?? 'platform') === 'platform' && (int) ($row->cd_lg_idx ?? 0) === 0);
$scopeLabel = $isPlatform ? '공통' : '지자체';
?>
<tr>
<td class="text-center"><?= (string) $rowNo ?></td>
<td class="text-center font-mono"><?= esc($row->cd_code) ?></td>
<td><?= esc($row->cd_name) ?></td>
<td class="text-center text-xs"><?= esc($scopeLabel) ?></td>
<td class="text-center"><?= (int) $row->cd_sort ?></td>
<td class="text-center"><?= (int) $row->cd_state === 1 ? '사용' : '미사용' ?></td>
<td class="text-left"><?= esc($row->cd_regdate ?? '') ?></td>
<?php if ($showActionsCol): ?>
<td class="text-center text-sm">
<?php if (! empty($rowCanEdit[$row->cd_idx])): ?>
<a href="<?= base_url('admin/code-details/edit/' . (int) $row->cd_idx) ?>" class="text-blue-600 hover:underline">수정</a>
<form action="<?= base_url('admin/code-details/delete/' . (int) $row->cd_idx) ?>" method="POST" class="ml-1 inline" onsubmit="return confirm('이 세부코드를 삭제하시겠습니까?');">
<?= csrf_field() ?>
<button type="submit" class="text-red-600 hover:underline">삭제</button>
</form>
<?php else: ?>
<span class="text-gray-400">—</span>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php $rowNo++; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if (isset($pager) && $pager !== null): ?>
<div class="mt-3"><?= $pager->links() ?></div>
<?php endif; ?>
</div>