|
|
|
|
@@ -1,10 +1,10 @@
|
|
|
|
|
<?php $startDate = (string) ($startDate ?? ''); $endDate = (string) ($endDate ?? ''); ?>
|
|
|
|
|
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
|
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
|
|
|
<span class="text-sm font-bold text-gray-700">전화 주문 접수 관리</span>
|
|
|
|
|
<span class="text-sm font-bold text-gray-700">주문접수 관리</span>
|
|
|
|
|
</div>
|
|
|
|
|
<form method="get" action="<?= base_url('bag/order/phone/manage') ?>" class="mt-2 flex flex-wrap items-center gap-2 text-sm">
|
|
|
|
|
<label class="font-bold text-gray-700">배달일</label>
|
|
|
|
|
<label class="font-bold text-gray-700">접수일</label>
|
|
|
|
|
<input type="date" lang="ko" name="start_date" value="<?= esc($startDate, 'attr') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
|
|
|
|
<span class="text-gray-400">~</span>
|
|
|
|
|
<input type="date" lang="ko" name="end_date" value="<?= esc($endDate, 'attr') ?>" class="border border-gray-300 rounded px-2 py-1 text-sm"/>
|
|
|
|
|
@@ -37,6 +37,10 @@
|
|
|
|
|
<tbody id="order-list-body"></tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="list-summary" class="px-3 py-2 border-t border-gray-200 bg-gray-50 text-sm font-semibold text-gray-700 flex flex-wrap items-center justify-between gap-2">
|
|
|
|
|
<span>건수 <span id="list-sum-count" class="text-blue-700">0</span>건</span>
|
|
|
|
|
<span>금액 <span id="list-sum-amount" class="text-blue-700">0</span>원</span>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section id="detail-card" class="xl:col-span-4 border border-gray-300 rounded-lg bg-white overflow-hidden">
|
|
|
|
|
@@ -63,7 +67,14 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="px-1 text-sm font-semibold text-gray-700">접수 품목 내역</div>
|
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2 px-1">
|
|
|
|
|
<span class="text-sm font-semibold text-gray-700">접수 품목 내역</span>
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
<button type="submit" id="btn-save" class="bg-btn-search text-white px-3 py-1 rounded-sm text-sm shadow hover:opacity-90" disabled>주문 수정 저장</button>
|
|
|
|
|
<button type="button" id="btn-receipt" class="border border-gray-300 text-gray-700 px-3 py-1 rounded-sm text-sm hover:bg-gray-50" disabled>입금자 영수증 출력</button>
|
|
|
|
|
<button type="submit" id="btn-cancel-order" form="order-cancel-form" class="border border-red-300 text-red-600 px-3 py-1 rounded-sm text-sm hover:bg-red-50" disabled>주문 취소</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="border border-gray-300 rounded-lg overflow-auto max-h-[179px]">
|
|
|
|
|
<table class="w-full data-table text-sm">
|
|
|
|
|
<thead>
|
|
|
|
|
@@ -104,10 +115,10 @@
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th class="w-12 text-center sticky top-0 z-10" style="background:#fff;box-shadow:inset 0 -1px 0 #e5e7eb;">No</th>
|
|
|
|
|
<th class="text-left sticky top-0 z-10" style="background:#fff;box-shadow:inset 0 -1px 0 #e5e7eb;">봉투종류</th>
|
|
|
|
|
<th class="w-64 text-left sticky top-0 z-10" style="background:#fff;box-shadow:inset 0 -1px 0 #e5e7eb;">봉투종류</th>
|
|
|
|
|
<th class="w-28 text-center sticky top-0 z-10" style="background:#fff;box-shadow:inset 0 -1px 0 #e5e7eb;">봉투코드</th>
|
|
|
|
|
<th class="w-20 text-right sticky top-0 z-10" style="background:#fff;box-shadow:inset 0 -1px 0 #e5e7eb;">수량</th>
|
|
|
|
|
<th class="w-16 text-center sticky top-0 z-10" style="background:#fff;box-shadow:inset 0 -1px 0 #e5e7eb;">포장</th>
|
|
|
|
|
<th class="text-left sticky top-0 z-10" style="background:#fff;box-shadow:inset 0 -1px 0 #e5e7eb;">포장</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody id="packing-body">
|
|
|
|
|
@@ -116,16 +127,11 @@
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div><!-- /포장 명세 -->
|
|
|
|
|
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
<button type="submit" id="btn-save" class="bg-btn-search text-white px-5 py-1.5 rounded-sm text-sm shadow hover:opacity-90" disabled>주문 수정 저장</button>
|
|
|
|
|
<button type="button" id="btn-receipt" class="border border-gray-300 text-gray-700 px-5 py-1.5 rounded-sm text-sm hover:bg-gray-50" disabled>입금자 영수증 출력</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<form id="order-cancel-form" method="POST" class="px-3 pb-3">
|
|
|
|
|
<!-- 주문 취소 폼 — 버튼은 접수 품목 내역 타이틀 옆(form 속성으로 연결) -->
|
|
|
|
|
<form id="order-cancel-form" method="POST" class="hidden">
|
|
|
|
|
<?= csrf_field() ?>
|
|
|
|
|
<button type="submit" id="btn-cancel-order" class="border border-red-300 text-red-600 px-5 py-1.5 rounded-sm text-sm hover:bg-red-50" disabled>주문 취소</button>
|
|
|
|
|
</form>
|
|
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
@@ -174,6 +180,9 @@
|
|
|
|
|
var v = order && order.so_delivery_date ? String(order.so_delivery_date) : '';
|
|
|
|
|
dd.value = /^\d{4}-\d{2}-\d{2}/.test(v) ? v.slice(0, 10) : '';
|
|
|
|
|
dd.disabled = !order || order.so_status === 'cancelled';
|
|
|
|
|
// 배달일은 접수일 이후로만 선택 가능
|
|
|
|
|
var od = order && order.so_order_date ? String(order.so_order_date).slice(0, 10) : '';
|
|
|
|
|
if (/^\d{4}-\d{2}-\d{2}$/.test(od)) { dd.min = od; } else { dd.removeAttribute('min'); }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -300,8 +309,11 @@
|
|
|
|
|
if (!listScrollEl || !detailCardEl) return;
|
|
|
|
|
const listCard = listScrollEl.closest('section');
|
|
|
|
|
const header = listCard ? listCard.firstElementChild : null;
|
|
|
|
|
const summary = document.getElementById('list-summary');
|
|
|
|
|
listScrollEl.style.height = '0px'; // 리스트를 접어 상세 카드의 본래 높이를 측정
|
|
|
|
|
const target = detailCardEl.offsetHeight - (header ? header.offsetHeight : 0);
|
|
|
|
|
const target = detailCardEl.offsetHeight
|
|
|
|
|
- (header ? header.offsetHeight : 0)
|
|
|
|
|
- (summary ? summary.offsetHeight : 0);
|
|
|
|
|
listScrollEl.style.height = Math.max(160, target) + 'px';
|
|
|
|
|
}
|
|
|
|
|
window.addEventListener('resize', syncListHeight);
|
|
|
|
|
@@ -326,7 +338,7 @@
|
|
|
|
|
+ '<td class="text-left pl-2">' + packEsc(code) + ' ' + packEsc(name) + '</td>'
|
|
|
|
|
+ '<td class="text-center text-gray-400">-</td>'
|
|
|
|
|
+ '<td class="text-right pr-2">' + nf(qty) + '</td>'
|
|
|
|
|
+ '<td class="text-center">' + unit + '</td></tr>');
|
|
|
|
|
+ '<td class="text-left pl-2">' + unit + '</td></tr>');
|
|
|
|
|
};
|
|
|
|
|
items.forEach((it) => {
|
|
|
|
|
const code = it.soi_bag_code || '';
|
|
|
|
|
@@ -389,6 +401,13 @@
|
|
|
|
|
: '<tr><td colspan="10" class="text-center py-8 text-gray-400">전화 주문 데이터가 없습니다.</td></tr>';
|
|
|
|
|
document.querySelectorAll('.sort-th .sort-ind').forEach((s) => { s.textContent = ''; });
|
|
|
|
|
if (th) th.querySelector('.sort-ind').textContent = sortDir === 'asc' ? ' ▲' : ' ▼';
|
|
|
|
|
|
|
|
|
|
// 하단 합계 — 취소 주문은 제외
|
|
|
|
|
const normals = arr.filter((o) => o.so_status !== 'cancelled');
|
|
|
|
|
const sumCountEl = document.getElementById('list-sum-count');
|
|
|
|
|
const sumAmountEl = document.getElementById('list-sum-amount');
|
|
|
|
|
if (sumCountEl) sumCountEl.textContent = nf(normals.length);
|
|
|
|
|
if (sumAmountEl) sumAmountEl.textContent = nf(normals.reduce((s, o) => s + (Number(o.so_total_amount) || 0), 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.querySelectorAll('.sort-th').forEach((th) => {
|
|
|
|
|
|