feat: enhance order sales inventory workflows

This commit is contained in:
taekyoungc
2026-04-08 00:20:09 +09:00
parent 984ddb403e
commit c2dc2fd38a
42 changed files with 764 additions and 459 deletions

View File

@@ -1,70 +1,17 @@
<div class="space-y-6">
<p class="text-sm text-gray-600">
기본코드 종류·세부코드는 상단 메뉴 <strong class="font-medium text-gray-800">기본정보관리</strong>
<a href="<?= base_url('bag/code-kinds') ?>" class="text-blue-600 hover:underline">기본코드관리</a>에서 확인할 있습니다.
</p>
<!-- 봉투 단가 -->
<section>
<div class="flex items-center justify-between mb-2 border-b pb-1">
<h3 class="text-base font-bold text-gray-700">봉투 단가</h3>
<a href="<?= base_url('admin/bag-prices') ?>" class="text-blue-600 hover:underline text-sm">관리 &rarr;</a>
</div>
<table class="data-table">
<thead><tr>
<th class="w-16">번호</th><th>봉투코드</th><th>봉투명</th><th>발주단가</th><th>도매가</th><th>소비자가</th><th>적용시작</th><th>적용종료</th><th>상태</th>
</tr></thead>
<tbody>
<?php if (! empty($bagPrices)): ?>
<?php foreach ($bagPrices as $i => $row): ?>
<tr>
<td class="text-center"><?= $i + 1 ?></td>
<td class="text-center"><?= esc($row->bp_bag_code) ?></td>
<td><?= esc($row->bp_bag_name ?? '') ?></td>
<td class="text-right"><?= number_format((float)($row->bp_order_price ?? 0)) ?></td>
<td class="text-right"><?= number_format((float)($row->bp_wholesale_price ?? 0)) ?></td>
<td class="text-right"><?= number_format((float)($row->bp_consumer_price ?? 0)) ?></td>
<td class="text-center"><?= esc($row->bp_start_date ?? '') ?></td>
<td class="text-center"><?= ($row->bp_end_date ?? '') ?: '현재' ?></td>
<td class="text-center"><?= ($row->bp_status ?? 'active') === 'active' ? '사용' : '만료' ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="9" class="text-center text-gray-400 py-4">등록된 단가 정보가 없습니다.</td></tr>
<?php endif; ?>
</tbody>
</table>
</section>
<!-- 포장 단위 -->
<section>
<div class="flex items-center justify-between mb-2 border-b pb-1">
<h3 class="text-base font-bold text-gray-700">포장 단위</h3>
<a href="<?= base_url('admin/packaging-units') ?>" class="text-blue-600 hover:underline text-sm">관리 &rarr;</a>
</div>
<table class="data-table">
<thead><tr>
<th class="w-16">번호</th><th>봉투코드</th><th>봉투명</th><th>박스당 팩 수</th><th>팩당 낱장 수</th><th>1박스 총 낱장</th><th>적용시작</th><th>적용종료</th><th>상태</th>
</tr></thead>
<tbody>
<?php if (! empty($packagingUnits)): ?>
<?php foreach ($packagingUnits as $i => $row): ?>
<tr>
<td class="text-center"><?= $i + 1 ?></td>
<td class="text-center"><?= esc($row->pu_bag_code) ?></td>
<td><?= esc($row->pu_bag_name ?? '') ?></td>
<td class="text-right"><?= number_format((int)($row->pu_packs_per_box ?? 0)) ?></td>
<td class="text-right"><?= number_format((int)($row->pu_sheets_per_pack ?? 0)) ?></td>
<td class="text-right"><?= number_format((int)($row->pu_packs_per_box ?? 0) * (int)($row->pu_sheets_per_pack ?? 0)) ?></td>
<td class="text-center"><?= esc($row->pu_start_date ?? '') ?></td>
<td class="text-center"><?= ($row->pu_end_date ?? '') ?: '현재' ?></td>
<td class="text-center"><?= ($row->pu_status ?? 'active') === 'active' ? '사용' : '만료' ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="9" class="text-center text-gray-400 py-4">등록된 포장 단위가 없습니다.</td></tr>
<?php endif; ?>
</tbody>
</table>
</section>
<div class="space-y-6 max-w-lg">
<p class="text-sm text-gray-600">기본 정보 조회 메뉴입니다. 항목을 선택하세요.</p>
<ul class="space-y-2 border border-gray-200 rounded-lg bg-white divide-y divide-gray-100">
<li>
<a href="<?= base_url('bag/prices') ?>" class="flex items-center justify-between px-4 py-3 text-sm font-medium text-gray-800 hover:bg-blue-50">
봉투 단가
<span class="text-gray-400">&rarr;</span>
</a>
</li>
<li>
<a href="<?= base_url('bag/packaging-units') ?>" class="flex items-center justify-between px-4 py-3 text-sm font-medium text-gray-800 hover:bg-blue-50">
포장 단위
<span class="text-gray-400">&rarr;</span>
</a>
</li>
</ul>
</div>

View File

@@ -2,7 +2,10 @@
/** @var object $kind */
/** @var list<object> $list */
/** @var bool $canManage */
/** @var array<int,bool> $rowCanEdit */
$canManage = ! empty($canManage);
$rowCanEdit = $rowCanEdit ?? [];
$showActionsCol = $canManage;
?>
<div class="space-y-3">
<?= view('components/print_header', ['printTitle' => '세부코드 - ' . esc($kind->ck_name)]) ?>
@@ -28,30 +31,40 @@ $canManage = ! empty($canManage);
<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 ($canManage): ?>
<?php if ($showActionsCol): ?>
<th class="w-28">작업</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php 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"><?= esc((string) $row->cd_idx) ?></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 ($canManage): ?>
<?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>

View File

@@ -1,31 +1,32 @@
<?php
/** @var list<object> $codeKinds */
/** @var array<int,int> $countMap */
/** @var bool $canManage */
$canManage = ! empty($canManage);
$colCount = $canManage ? 7 : 6;
/** @var bool $canManageKinds */
$canManageKinds = ! empty($canManageKinds);
$showKindActions = $canManageKinds;
$colCount = 6 + ($showKindActions ? 1 : 0);
?>
<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">
<?php if ($canManage): ?>
<?php if ($canManageKinds): ?>
<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>
<?php else: ?>
<span class="text-gray-500">세부코드는 행의 링크에서 조회할 수 있습니다.</span>
<?php elseif (! $canManageKinds): ?>
<span class="text-gray-500">코드 종류 등록·수정은 super admin·본부 관리자만 가능합니다. 세부코드는 행의 링크에서 조회할 수 있습니다.</span>
<?php endif; ?>
</div>
</div>
<table class="data-table">
<thead><tr>
<th class="w-14"><?= $canManage ? 'PK' : '번호' ?></th>
<th class="w-14"><?= $showKindActions ? 'PK' : '번호' ?></th>
<th class="w-24">코드</th>
<th>코드명</th>
<th class="w-28">세부코드</th>
<th class="w-20">상태</th>
<th class="w-40">등록일</th>
<?php if ($canManage): ?>
<?php if ($showKindActions): ?>
<th class="w-44">작업</th>
<?php endif; ?>
</tr></thead>
@@ -33,7 +34,7 @@ $colCount = $canManage ? 7 : 6;
<?php if (! empty($codeKinds)): ?>
<?php $i = 0; foreach ($codeKinds as $row): $i++; ?>
<tr>
<td class="text-center"><?= $canManage ? esc((string) $row->ck_idx) : (string) $i ?></td>
<td class="text-center"><?= $showKindActions ? esc((string) $row->ck_idx) : (string) $i ?></td>
<td class="text-center font-mono"><?= esc($row->ck_code) ?></td>
<td><?= esc($row->ck_name) ?></td>
<td class="text-center">
@@ -41,7 +42,7 @@ $colCount = $canManage ? 7 : 6;
</td>
<td class="text-center"><?= (int) ($row->ck_state ?? 0) === 1 ? '사용' : '미사용' ?></td>
<td class="text-left"><?= esc($row->ck_regdate ?? '') ?></td>
<?php if ($canManage): ?>
<?php if ($showKindActions): ?>
<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>

View File

@@ -34,7 +34,7 @@
<option value="">선택</option>
<?php foreach ($agencies as $ag): ?>
<option value="<?= esc($ag->sa_idx) ?>" <?= (int) old('bo_agency_idx') === (int) $ag->sa_idx ? 'selected' : '' ?>>
<?= esc($ag->sa_name) ?>
[<?= esc($ag->sa_kind ?? '') ?>] <?= esc($ag->sa_code ?? '') ?> — <?= esc($ag->sa_name) ?>
</option>
<?php endforeach; ?>
</select>

View File

@@ -1,13 +1,20 @@
<?php
helper('admin');
$siteNavTree = get_site_nav_tree();
$effectiveLgIdx = admin_effective_lg_idx();
$effectiveLgName = null;
if ($effectiveLgIdx) {
$lgRow = model(\App\Models\LocalGovernmentModel::class)->find($effectiveLgIdx);
$effectiveLgName = $lgRow ? $lgRow->lg_name : null;
}
$userNav = session_user_nav_display();
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>쓰레기봉투 물류시스템</title>
<title>종량제 시스템</title>
<!-- Tailwind CSS v3 with Plugins -->
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<!-- Font: Noto Sans KR -->
@@ -90,16 +97,8 @@ $siteNavTree = get_site_nav_tree();
<!-- BEGIN: Top Navigation -->
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0 z-20">
<div class="flex items-center gap-4">
<!-- Logo: 파란색 사각형에 흰색 사각형 두 개 겹친 형태 (데스크톱 앱 아이콘 스타일) -->
<div class="flex items-center gap-2">
<div class="w-6 h-6 flex items-center justify-center shrink-0">
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<rect width="16" height="16" fill="#2563eb"/>
<rect x="2" y="2" width="7" height="7" fill="white"/>
<rect x="5" y="5" width="9" height="9" fill="white"/>
</svg>
</div>
<a href="<?= base_url() ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
<?= view('components/header_brand') ?>
</div>
</div>
<!-- Nav Links -->
@@ -113,20 +112,42 @@ $siteNavTree = get_site_nav_tree();
}
?>
<?php foreach ($siteNavTree as $navItem): ?>
<?php $isActive = ($currentPath === trim((string) $navItem->mm_link, '/')); ?>
<?php
$dashboardPathAliases = ['dashboard', 'dashboard/blend'];
$navLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
$isActive = site_nav_link_matches_current($navItem->mm_link ?? null, $currentPath, $dashboardPathAliases);
if (! $isActive && ! empty($navItem->children)) {
foreach ($navItem->children as $ch) {
if (site_nav_link_matches_current($ch->mm_link ?? null, $currentPath, $dashboardPathAliases)) {
$isActive = true;
break;
}
}
}
?>
<div class="relative group">
<a class="<?= $isActive ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
href="<?= base_url($navItem->mm_link) ?>">
href="<?= $navLink !== '' ? base_url($navLink) : '#' ?>">
<?= esc($navItem->mm_name) ?>
</a>
<?php if (! empty($navItem->children)): ?>
<div class="absolute left-0 top-full hidden group-hover:block bg-white border border-gray-200 rounded shadow-lg min-w-[10rem] z-30">
<div class="absolute left-0 top-full z-[200] -mt-1 pt-2 hidden group-hover:block group-focus-within:block min-w-[12rem]">
<div class="bg-white border border-gray-200 rounded shadow-lg py-1">
<?php foreach ($navItem->children as $child): ?>
<a href="<?= base_url($child->mm_link) ?>"
class="block px-3 py-1.5 text-sm text-gray-700 hover:bg-blue-50 whitespace-nowrap">
<?php
$childLink = site_nav_resolved_link_path($child->mm_link ?? null, $child->mm_name ?? null);
$childCurrent = menu_link_matches_request($child->mm_link ?? null, $currentPath, $dashboardPathAliases);
?>
<?php if ($childLink !== ''): ?>
<a href="<?= base_url($childLink) ?>"
class="block px-3 py-1.5 text-sm hover:bg-blue-50 whitespace-nowrap <?= $childCurrent ? 'text-blue-700 font-semibold bg-blue-50' : 'text-gray-700' ?>">
<?= esc($child->mm_name) ?>
</a>
<?php else: ?>
<span class="block px-3 py-1.5 text-sm text-gray-400 cursor-default whitespace-nowrap" title="경로 미매핑 — 메뉴 관리에서 링크를 넣어 주세요"><?= esc($child->mm_name) ?></span>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
@@ -148,18 +169,13 @@ $siteNavTree = get_site_nav_tree();
<?php
$mbLevel = (int) session()->get('mb_level');
$isAdmin = (\Config\Roles::isSuperAdminEquivalent($mbLevel) || $mbLevel === \Config\Roles::LEVEL_LOCAL_ADMIN);
echo view('components/header_user_tools', [
'userNav' => $userNav,
'effectiveLgName' => $effectiveLgName,
'showSiteLink' => false,
'showAdminLink' => $isAdmin,
]);
?>
<!-- 관리자 이동 버튼(관리자만) · 종료 -->
<div class="flex items-center gap-2">
<?php if ($isAdmin): ?>
<a href="<?= base_url('admin') ?>" class="bg-btn-search text-white px-3 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent" title="관리자">관리자</a>
<?php endif; ?>
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-red-600 transition-colors inline-block p-1 rounded hover:bg-red-50" title="로그아웃">
<svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M6 18L18 6M6 6l12 12" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</a>
</div>
</header>
<!-- END: Top Navigation -->
<?php if (session()->getFlashdata('success')): ?>

View File

@@ -4,7 +4,7 @@
<div class="space-y-4 text-sm text-gray-600">
<section>
<h3 class="font-bold text-gray-700 mb-1">시스템 개요</h3>
<p>쓰레기봉투 물류시스템은 지자체 종량제 쓰레기봉투의 발주, 입고, 재고, 판매, 불출 전체 물류 프로세스를 관리합니다.</p>
<p>종량제 시스템은 지자체 종량제 쓰레기봉투의 발주, 입고, 재고, 판매, 불출 전체 물류 프로세스를 관리합니다.</p>
</section>
<section>

View File

@@ -43,10 +43,11 @@ $mbName = session()->get('mb_name') ?? '담당자';
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-4 py-2 gap-4 flex-wrap">
<div class="flex items-center gap-3 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-lg">
<i class="fa-solid fa-recycle text-xl"></i>
<span>종량제 시스템</span>
</div>
<?= view('components/header_brand', [
'href' => base_url(),
'linkClass' => 'flex items-center gap-2 text-green-700 font-bold text-lg hover:opacity-90',
'svgClass' => 'h-7 w-7 shrink-0',
]) ?>
<span class="hidden sm:inline text-xs text-gray-500 border-l border-gray-300 pl-3">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>

View File

@@ -58,10 +58,11 @@ $dashBlend = base_url('dashboard/blend');
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-3 py-1.5 gap-3 flex-wrap">
<div class="flex items-center gap-2 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-base">
<i class="fa-solid fa-recycle text-lg"></i>
<span>종량제 시스템</span>
</div>
<?= view('components/header_brand', [
'href' => base_url(),
'linkClass' => 'flex items-center gap-2 text-green-700 font-bold text-base hover:opacity-90',
'svgClass' => 'h-6 w-6 shrink-0',
]) ?>
<span class="hidden sm:inline text-[11px] text-gray-500 border-l border-gray-300 pl-2">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>

View File

@@ -100,10 +100,11 @@ $notices = [
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-3 py-1.5 gap-3 flex-wrap">
<div class="flex items-center gap-2 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-base">
<i class="fa-solid fa-recycle text-lg"></i>
<span>종량제 시스템</span>
</div>
<?= view('components/header_brand', [
'href' => base_url(),
'linkClass' => 'flex items-center gap-2 text-green-700 font-bold text-base hover:opacity-90',
'svgClass' => 'h-6 w-6 shrink-0',
]) ?>
<span class="hidden sm:inline text-[11px] text-gray-500 border-l border-gray-300 pl-2">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>

View File

@@ -44,10 +44,11 @@ $dashBlend = base_url('dashboard/blend');
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-4 py-2 gap-4 flex-wrap">
<div class="flex items-center gap-3 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-lg">
<i class="fa-solid fa-recycle text-xl"></i>
<span>종량제 시스템</span>
</div>
<?= view('components/header_brand', [
'href' => base_url(),
'linkClass' => 'flex items-center gap-2 text-green-700 font-bold text-lg hover:opacity-90',
'svgClass' => 'h-7 w-7 shrink-0',
]) ?>
<span class="hidden sm:inline text-xs text-gray-500 border-l border-gray-300 pl-3">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>

View File

@@ -44,9 +44,12 @@
<body class="bg-white flex flex-col min-h-screen">
<header class="border-b border-gray-300 bg-white shadow-sm" data-purpose="top-navigation">
<div class="flex items-center justify-between px-4 py-2 gap-4 flex-wrap">
<div class="flex items-center gap-2 text-green-700 font-bold text-lg shrink-0">
<i class="fa-solid fa-recycle text-xl"></i>
<span>종량제 시스템</span>
<div class="shrink-0">
<?= view('components/header_brand', [
'href' => base_url(),
'linkClass' => 'flex items-center gap-2 text-green-700 font-bold text-lg hover:opacity-90',
'svgClass' => 'h-7 w-7 shrink-0',
]) ?>
</div>
<nav class="hidden lg:flex flex-wrap items-center gap-4 xl:gap-6 text-sm font-medium text-gray-700">
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-regular fa-file-lines"></i> 문서 관리</a>