fix(admin/orders): 출고처리 — 세금계산서 발행 버튼 제거 + 기본 검색 상태 '출고요청+출고완료'
Deploy momo-erp / deploy (push) Successful in 2m2s

- 출고처리 우측 상세에서 [세금계산서 발행] 버튼 제거 (계산서(면세) 만 유지)
  업무 흐름: 출고요청 → 출고완료 → 입금완료 → 계산서 발행 → 전자세금계산서.
  입금완료 후의 발행은 계산서 관리 메뉴에서 처리.
- 검색조건 기본값: 'EDITABLE' (= REQUESTED + APPROVED) 두 상태만 노출.
  드롭다운에 '출고요청+출고완료' 옵션 추가, 기존 '전체 상태'/개별상태 옵션 유지.
- orders/list API: statuses?: string[] (IN) 파라미터 지원 (status 단일은 기존대로).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
chpark
2026-05-15 10:59:44 +09:00
parent 4a6a5fe6dc
commit 3c73c5a47a
2 changed files with 17 additions and 18 deletions
+9 -15
View File
@@ -65,10 +65,11 @@ export default function AdminOrdersPage() {
// URL 쿼리 우선: dateFrom/dateTo 키가 있으면 그 값 사용 (빈 문자열도 명시적 = 전체 기간).
// 키가 없을 때 기본값 — 한 달 전 ~ 오늘
const initial = (() => {
if (typeof window === "undefined") return { status: "", dateFrom: oneMonthAgoStr(), dateTo: todayStr(), keyword: "" };
// 기본 status = "EDITABLE" → REQUESTED + APPROVED (출고요청 + 출고완료) 두 건만 노출
if (typeof window === "undefined") return { status: "EDITABLE", dateFrom: oneMonthAgoStr(), dateTo: todayStr(), keyword: "" };
const q = new URLSearchParams(window.location.search);
return {
status: q.get("status") ?? "",
status: q.get("status") ?? "EDITABLE",
dateFrom: q.has("dateFrom") ? (q.get("dateFrom") ?? "") : oneMonthAgoStr(),
dateTo: q.has("dateTo") ? (q.get("dateTo") ?? "") : todayStr(),
keyword: q.get("keyword") ?? "",
@@ -92,7 +93,8 @@ export default function AdminOrdersPage() {
const res = await fetch("/api/m/orders/list", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({
status: status || undefined,
status: status === "EDITABLE" ? undefined : (status || undefined),
statuses: status === "EDITABLE" ? ["REQUESTED", "APPROVED"] : undefined,
dateFrom: dateFrom || undefined,
dateTo: dateTo || undefined,
keyword: keyword || undefined,
@@ -273,7 +275,8 @@ export default function AdminOrdersPage() {
<input type="date" value={dateTo} onChange={(e) => setDateTo(e.target.value)}
className="h-8 sm:h-9 px-2 rounded border border-slate-200 text-xs sm:text-sm min-w-0 flex-1 sm:flex-none sm:w-[140px]" />
<select value={status} onChange={(e) => setStatus(e.target.value)}
className="h-8 sm:h-9 px-2 rounded border border-slate-200 text-xs sm:text-sm bg-white sm:w-[140px]">
className="h-8 sm:h-9 px-2 rounded border border-slate-200 text-xs sm:text-sm bg-white sm:w-[180px]">
<option value="EDITABLE">+</option>
<option value=""> </option>
{Object.entries(STATUS_LABEL).map(([k, v]) => <option key={k} value={k}>{v}</option>)}
</select>
@@ -285,8 +288,8 @@ export default function AdminOrdersPage() {
className="h-8 sm:h-9 px-3 rounded bg-slate-800 text-white text-xs sm:text-sm font-bold hover:bg-slate-900 disabled:opacity-50">
</button>
{(dateFrom !== oneMonthAgoStr() || dateTo !== todayStr() || status || keyword) && (
<button onClick={() => { setDateFrom(oneMonthAgoStr()); setDateTo(todayStr()); setStatus(""); setKeyword(""); }}
{(dateFrom !== oneMonthAgoStr() || dateTo !== todayStr() || status !== "EDITABLE" || keyword) && (
<button onClick={() => { setDateFrom(oneMonthAgoStr()); setDateTo(todayStr()); setStatus("EDITABLE"); setKeyword(""); }}
className="h-8 sm:h-9 px-2 rounded border border-slate-200 bg-white text-slate-600 text-[11px]">
</button>
@@ -1153,15 +1156,6 @@ function IssueEinvoiceButton({ order }: { order: DetailOrder }) {
}
return (
<div className="flex gap-1.5">
<button
type="button"
disabled={busy}
onClick={() => onIssue("TAX")}
className="inline-flex items-center gap-1 h-8 px-2.5 rounded bg-rose-600 text-white text-[11px] font-bold hover:bg-rose-700 disabled:opacity-50"
title="과세 전자세금계산서 발행"
>
</button>
<button
type="button"
disabled={busy}
+8 -3
View File
@@ -7,8 +7,9 @@ export async function POST(req: NextRequest) {
if (r instanceof NextResponse) return r;
const body = await req.json().catch(() => ({}));
const { dateFrom, dateTo, status, customerObjid, keyword, mine } = body as {
dateFrom?: string; dateTo?: string; status?: string; customerObjid?: string; keyword?: string;
const { dateFrom, dateTo, status, statuses, customerObjid, keyword, mine } = body as {
dateFrom?: string; dateTo?: string; status?: string; statuses?: string[];
customerObjid?: string; keyword?: string;
mine?: boolean;
};
@@ -28,7 +29,11 @@ export async function POST(req: NextRequest) {
params.push(customerObjid);
}
if (status) {
if (Array.isArray(statuses) && statuses.length > 0) {
const ph = statuses.map(() => `$${i++}`).join(",");
conditions.push(`O.status IN (${ph})`);
params.push(...statuses);
} else if (status) {
conditions.push(`O.status = $${i++}`);
params.push(status);
}