e8dc97a32f
Deploy momo-erp / deploy (push) Successful in 46s
- src/app/(main), admin, admin-panel, common, api/{admin,common,menu} 복원
- /api/auth/login: FITO 인증 다시 활성화 (plm_admin 등 FITO 사용자 로그인 가능)
- 미들웨어: 옛 경로 강제 리다이렉트 제거
- /m/layout.tsx: FITO 슈퍼관리자(isAdmin)도 ADMIN 으로 받아 모모 페이지 진입 허용
- DB 005: menu_info 에 모모유통 루트(9000000) + 자식 19개(/m/* URL 직접 연결)
→ plm_admin 로그인 후 사이드바 [모모유통] 그룹에서 클릭 시 동작
→ 메뉴 관리 UI 에서 추가/수정/삭제 가능
83 lines
3.7 KiB
TypeScript
83 lines
3.7 KiB
TypeScript
"use client";
|
|
|
|
import { useState, useCallback, useEffect } from "react";
|
|
import { DataGrid, type GridColumn } from "@/components/grid/data-grid";
|
|
import { SearchForm, SearchField } from "@/components/layout/search-form";
|
|
import { Input } from "@/components/ui/input";
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
// scm/scmInvoiceList.jsp 대응 - SCM 거래명세서관리
|
|
export default function ScmInvoicePage() {
|
|
const [year, setYear] = useState(new Date().getFullYear().toString());
|
|
const [supplierName, setSupplierName] = useState("");
|
|
const [invoiceDateFrom, setInvoiceDateFrom] = useState("");
|
|
const [invoiceDateTo, setInvoiceDateTo] = useState("");
|
|
const [data, setData] = useState<Record<string, unknown>[]>([]);
|
|
|
|
const columns: GridColumn[] = [
|
|
{ title: "거래명세서번호", field: "INVOICE_NO", width: 140, hozAlign: "left",
|
|
cellClick: (row) => window.open(`/scm/invoice/form?objId=${row.OBJID}`, "scmInvoiceDetail", "width=1000,height=700") },
|
|
{ title: "공급업체", field: "SUPPLIER_NAME", width: 150, hozAlign: "left" },
|
|
{ title: "프로젝트번호", field: "PROJECT_NO", width: 120, hozAlign: "left" },
|
|
{ title: "발행일", field: "INVOICE_DATE", width: 100, hozAlign: "center" },
|
|
{ title: "공급가액", field: "SUPPLY_AMOUNT", width: 120, hozAlign: "right", formatter: "money" },
|
|
{ title: "세액", field: "TAX_AMOUNT", width: 100, hozAlign: "right", formatter: "money" },
|
|
{ title: "합계", field: "TOTAL_AMOUNT", width: 120, hozAlign: "right", formatter: "money" },
|
|
{ title: "상태", field: "STATUS_NAME", width: 80, hozAlign: "center" },
|
|
{ title: "등록자", field: "WRITER_NAME", width: 80, hozAlign: "center" },
|
|
];
|
|
|
|
const fetchData = useCallback(async () => {
|
|
const res = await fetch("/api/scm/invoice", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({
|
|
year,
|
|
supplier_name: supplierName,
|
|
invoice_date_from: invoiceDateFrom,
|
|
invoice_date_to: invoiceDateTo,
|
|
}),
|
|
});
|
|
if (res.ok) {
|
|
const json = await res.json();
|
|
setData(json.RESULTLIST || []);
|
|
}
|
|
}, [year, supplierName, invoiceDateFrom, invoiceDateTo]);
|
|
|
|
// 페이지 진입 시 자동 로드
|
|
useEffect(() => { fetchData(); }, [fetchData]);
|
|
|
|
return (
|
|
<div>
|
|
<div className="flex items-center justify-between mb-4">
|
|
<h2 className="text-lg font-bold text-gray-800">SCM 거래명세서관리</h2>
|
|
<div className="flex gap-2">
|
|
<Button size="sm" variant="secondary" onClick={fetchData}>조회</Button>
|
|
</div>
|
|
</div>
|
|
|
|
<SearchForm onSearch={fetchData}>
|
|
<SearchField label="년도">
|
|
<select value={year} onChange={(e) => setYear(e.target.value)}
|
|
className="h-9 w-[100px] rounded border border-gray-300 bg-white px-3 text-sm">
|
|
{Array.from({ length: 5 }, (_, i) => new Date().getFullYear() - i).map((y) => (
|
|
<option key={y} value={y}>{y}</option>
|
|
))}
|
|
</select>
|
|
</SearchField>
|
|
<SearchField label="공급업체">
|
|
<Input value={supplierName} onChange={(e) => setSupplierName(e.target.value)} className="w-[150px]" />
|
|
</SearchField>
|
|
<SearchField label="발행일(From)">
|
|
<Input type="date" value={invoiceDateFrom} onChange={(e) => setInvoiceDateFrom(e.target.value)} className="w-[140px]" />
|
|
</SearchField>
|
|
<SearchField label="발행일(To)">
|
|
<Input type="date" value={invoiceDateTo} onChange={(e) => setInvoiceDateTo(e.target.value)} className="w-[140px]" />
|
|
</SearchField>
|
|
</SearchForm>
|
|
|
|
<DataGrid columns={columns} data={data} />
|
|
</div>
|
|
);
|
|
}
|