사이트 메뉴 /bag/* 10개 페이지 구현 + E2E 테스트 timeout 보강

- Bag 컨트롤러 신규 (기본정보/발주입고/불출/재고/판매/판매현황/수불/통계/창/도움말)
- 사이트 공통 레이아웃 bag/layout/main.php 추출
- /bag/* 라우트 10개 등록 (Routes.php)
- bag-site.spec.js E2E 테스트 11개 추가
- Playwright timeout 30s→60s, waitForURL 15s→30s
- P4 지자체관리자 접근 테스트 3개로 분리

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
javamon1174
2026-03-26 14:30:45 +09:00
parent 466f6fe085
commit a0103eb95d
27 changed files with 951 additions and 18 deletions

88
app/Views/bag/flow.php Normal file
View File

@@ -0,0 +1,88 @@
<div class="space-y-1">
<form method="get" class="flex items-center gap-3 text-sm mb-3">
<label class="font-bold text-gray-700">조회기간</label>
<input type="date" name="start_date" value="<?= esc($startDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
<span>~</span>
<input type="date" name="end_date" value="<?= esc($endDate ?? '') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm">조회</button>
<a href="<?= base_url('bag/flow') ?>" class="text-sm text-gray-500 hover:text-gray-700">초기화</a>
</form>
<!-- 수불 요약 -->
<table class="data-table">
<thead>
<tr>
<th rowspan="2">봉투코드</th>
<th rowspan="2">봉투명</th>
<th rowspan="2">현재재고</th>
<th colspan="2">입고</th>
<th colspan="2">출고</th>
</tr>
<tr>
<th>입고수량</th><th>반품수량</th>
<th>판매수량</th><th>불출수량</th>
</tr>
</thead>
<tbody>
<?php
// 봉투코드별 수불 집계
$summary = [];
// 재고
foreach ($inventory as $inv) {
$code = $inv->bi_bag_code ?? '';
if (! isset($summary[$code])) {
$summary[$code] = ['name' => $inv->bi_bag_name ?? '', 'stock' => 0, 'recv' => 0, 'return' => 0, 'sale' => 0, 'issue' => 0];
}
$summary[$code]['stock'] += (int)($inv->bi_qty_sheet ?? 0);
}
// 입고
foreach ($receiving as $r) {
$code = $r->br_bag_code ?? '';
if (! isset($summary[$code])) {
$summary[$code] = ['name' => $r->br_bag_name ?? '', 'stock' => 0, 'recv' => 0, 'return' => 0, 'sale' => 0, 'issue' => 0];
}
$summary[$code]['recv'] += (int)($r->br_qty_sheet ?? 0);
}
// 판매/반품
foreach ($sales as $s) {
$code = $s->bs_bag_code ?? '';
if (! isset($summary[$code])) {
$summary[$code] = ['name' => $s->bs_bag_name ?? '', 'stock' => 0, 'recv' => 0, 'return' => 0, 'sale' => 0, 'issue' => 0];
}
$type = $s->bs_type ?? 'sale';
if ($type === 'return') {
$summary[$code]['return'] += (int)($s->bs_qty ?? 0);
} else {
$summary[$code]['sale'] += (int)($s->bs_qty ?? 0);
}
}
// 불출
foreach ($issues as $iss) {
$code = $iss->bi2_bag_code ?? '';
if (! isset($summary[$code])) {
$summary[$code] = ['name' => $iss->bi2_bag_name ?? '', 'stock' => 0, 'recv' => 0, 'return' => 0, 'sale' => 0, 'issue' => 0];
}
if (($iss->bi2_status ?? 'normal') === 'normal') {
$summary[$code]['issue'] += (int)($iss->bi2_qty ?? 0);
}
}
ksort($summary);
?>
<?php if (! empty($summary)): ?>
<?php $idx = 0; foreach ($summary as $code => $s): $idx++; ?>
<tr>
<td class="text-center"><?= esc($code) ?></td>
<td><?= esc($s['name']) ?></td>
<td class="text-right"><?= number_format($s['stock']) ?></td>
<td class="text-right"><?= number_format($s['recv']) ?></td>
<td class="text-right"><?= number_format($s['return']) ?></td>
<td class="text-right"><?= number_format($s['sale']) ?></td>
<td class="text-right"><?= number_format($s['issue']) ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="7" class="text-center text-gray-400 py-4">수불 데이터가 없습니다.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>