2026-03-30 15:07:09 +09:00
< ? php
/** @var list<object> $codeKinds */
/** @var array<int,int> $countMap */
2026-04-08 00:20:09 +09:00
/** @var bool $canManageKinds */
$canManageKinds = ! empty ( $canManageKinds );
$showKindActions = $canManageKinds ;
$colCount = 6 + ( $showKindActions ? 1 : 0 );
2026-03-30 15:07:09 +09:00
?>
< div class = " space-y-4 " >
< section >
< div class = " flex flex-wrap items-center justify-between gap-2 mb-2 border-b pb-1 " >
< h3 class = " text-base font-bold text-gray-700 " > 기본코드 종류 </ h3 >
< div class = " flex flex-wrap items-center gap-2 text-xs sm:text-sm " >
2026-04-08 00:20:09 +09:00
< ? php if ( $canManageKinds ) : ?>
2026-03-30 15:07:09 +09:00
< a href = " <?= base_url('admin/code-kinds/create') ?> " class = " inline-flex items-center rounded bg-[#1c4e80] px-3 py-1.5 text-white shadow hover:opacity-90 " > 코드 종류 등록 </ a >
2026-04-08 00:20:09 +09:00
< ? php elseif ( ! $canManageKinds ) : ?>
< span class = " text-gray-500 " > 코드 종류 등록·수정은 super admin·본부 관리자만 가능합니다 . 세부코드는 행의 링크에서 조회할 수 있습니다 .</ span >
2026-03-30 15:07:09 +09:00
< ? php endif ; ?>
</ div >
</ div >
< table class = " data-table " >
< thead >< tr >
2026-04-08 00:20:09 +09:00
< th class = " w-14 " >< ? = $showKindActions ? 'PK' : '번호' ?> </th>
2026-03-30 15:07:09 +09:00
< th class = " w-24 " > 코드 </ th >
< th > 코드명 </ th >
< th class = " w-28 " > 세부코드 </ th >
< th class = " w-20 " > 상태 </ th >
< th class = " w-40 " > 등록일 </ th >
2026-04-08 00:20:09 +09:00
< ? php if ( $showKindActions ) : ?>
2026-03-30 15:07:09 +09:00
< th class = " w-44 " > 작업 </ th >
< ? php endif ; ?>
</ tr ></ thead >
< tbody >
< ? php if ( ! empty ( $codeKinds )) : ?>
< ? php $i = 0 ; foreach ( $codeKinds as $row ) : $i ++ ; ?>
< tr >
2026-04-08 00:20:09 +09:00
< td class = " text-center " >< ? = $showKindActions ? esc (( string ) $row -> ck_idx ) : ( string ) $i ?> </td>
2026-03-30 15:07:09 +09:00
< td class = " text-center font-mono " >< ? = esc ( $row -> ck_code ) ?> </td>
< td >< ? = esc ( $row -> ck_name ) ?> </td>
< td class = " text-center " >
< a href = " <?= base_url('bag/code-details/' . (int) $row->ck_idx ) ?> " class = " text-blue-600 hover:underline " >< ? = ( int ) ( $countMap [ $row -> ck_idx ] ? ? 0 ) ?> 개 보기</a>
</ td >
< td class = " text-center " >< ? = ( int ) ( $row -> ck_state ? ? 0 ) === 1 ? '사용' : '미사용' ?> </td>
< td class = " text-left " >< ? = esc ( $row -> ck_regdate ? ? '' ) ?> </td>
2026-04-08 00:20:09 +09:00
< ? php if ( $showKindActions ) : ?>
2026-03-30 15:07:09 +09:00
< td class = " text-center text-sm " >
< a href = " <?= base_url('bag/code-details/' . (int) $row->ck_idx ) ?> " class = " text-green-600 hover:underline mr-1 " > 세부코드 </ a >
< a href = " <?= base_url('admin/code-kinds/edit/' . (int) $row->ck_idx ) ?> " class = " text-blue-600 hover:underline mr-1 " > 수정 </ a >
< form action = " <?= base_url('admin/code-kinds/delete/' . (int) $row->ck_idx ) ?> " method = " POST " class = " inline " onsubmit = " return confirm('이 코드 종류를 삭제하시겠습니까?'); " >
< ? = csrf_field () ?>
< button type = " submit " class = " text-red-600 hover:underline " > 삭제 </ button >
</ form >
</ td >
< ? php endif ; ?>
</ tr >
< ? php endforeach ; ?>
< ? php else : ?>
< tr >< td colspan = " <?= (string) $colCount ?> " class = " text-center text-gray-400 py-4 " > 등록된 코드 종류가 없습니다 .</ td ></ tr >
< ? php endif ; ?>
</ tbody >
</ table >
</ section >
</ div >