diff --git a/docs/모모유통 제조사 리스트(26.05.12).xlsx b/docs/모모유통 제조사 리스트(26.05.12).xlsx new file mode 100644 index 0000000..efd0a6a Binary files /dev/null and b/docs/모모유통 제조사 리스트(26.05.12).xlsx differ diff --git a/src/app/(main)/m/admin/items/page.tsx b/src/app/(main)/m/admin/items/page.tsx index 29c0096..557c8ef 100644 --- a/src/app/(main)/m/admin/items/page.tsx +++ b/src/app/(main)/m/admin/items/page.tsx @@ -3,14 +3,13 @@ import { useEffect, useState, useRef, FormEvent } from "react"; import { Plus, Search, Pencil, Trash2, Upload } from "lucide-react"; import Swal from "sweetalert2"; +import { SearchableSelect } from "@/components/ui/searchable-select"; interface Item { OBJID: string; ITEM_CODE: string; ITEM_NAME: string; ITEM_DETAIL: string; - MAKER_OBJID: string; - MAKER_NAME: string; UNIT: string; UNIT_PRICE: number; COST_PRICE: number; @@ -27,7 +26,6 @@ interface Item { } interface Vendor { OBJID: string; VENDOR_NAME: string } -interface Maker { OBJID: string; MAKER_NAME: string } interface ItemAttributes { expiry_date?: string; // 소비기한 (유통기한) @@ -42,7 +40,6 @@ const fmt = (n: number) => Number(n || 0).toLocaleString("ko-KR"); export default function AdminItemsPage() { const [items, setItems] = useState([]); - const [makers, setMakers] = useState([]); const [vendors, setVendors] = useState([]); const [keyword, setKeyword] = useState(""); const [filterStatus, setFilterStatus] = useState(""); @@ -60,15 +57,6 @@ export default function AdminItemsPage() { setItems((await res.json()).RESULTLIST ?? []); }; - const loadMakers = async () => { - const res = await fetch("/api/m/makers/list", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({}), - }); - setMakers((await res.json()).RESULTLIST ?? []); - }; - const loadVendors = async () => { const res = await fetch("/api/m/vendors/list", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}), @@ -78,7 +66,6 @@ export default function AdminItemsPage() { useEffect(() => { loadItems(); - loadMakers(); loadVendors(); }, []); // eslint-disable-line @@ -106,7 +93,6 @@ export default function AdminItemsPage() { actionType: isNew ? "regist" : "update", itemName: editing.ITEM_NAME, itemDetail: editing.ITEM_DETAIL, - makerObjid: editing.MAKER_OBJID, unit: editing.UNIT || "EA", unitPrice: editing.UNIT_PRICE, costPrice: editing.COST_PRICE, @@ -236,7 +222,7 @@ export default function AdminItemsPage() { {it.REQUIRES_DELIVERY === "Y" && 택배} {it.MAX_ORDER_QTY != null && Number(it.MAX_ORDER_QTY) > 0 && ≤{it.MAX_ORDER_QTY}} -
{it.ITEM_CODE} · {it.MAKER_NAME || "제조사 없음"}
+
{it.ITEM_CODE}
단가 ₩{fmt(it.UNIT_PRICE)} @@ -261,7 +247,6 @@ export default function AdminItemsPage() { 품목코드 품목명 - 제조사 구분 단가 원가 @@ -273,7 +258,7 @@ export default function AdminItemsPage() { {items.length === 0 ? ( - + 품목이 없습니다. 신규 등록 버튼을 눌러주세요. @@ -291,7 +276,6 @@ export default function AdminItemsPage() { {it.ITEM_CODE} {it.ITEM_NAME} - {it.MAKER_NAME || "-"} {it.IS_TAX_FREE === "Y" ? ( 면세 @@ -361,29 +345,13 @@ export default function AdminItemsPage() { className="w-full h-10 px-3 rounded-lg border border-slate-200 text-sm focus:border-emerald-500 outline-none" /> - - - - + onChange={(v) => setEditing({ ...editing, VENDOR_OBJID: v })} + placeholder="공급업체 검색" + /> setEditing({ ...editing, UNIT_PRICE: Number(e.target.value) })} - className="w-full h-10 px-3 rounded-lg border border-slate-200 text-sm focus:border-emerald-500 outline-none" + type="text" inputMode="numeric" + value={editing.UNIT_PRICE == null ? "" : Math.round(Number(editing.UNIT_PRICE)).toLocaleString("ko-KR")} + onChange={(e) => { + const n = Number(e.target.value.replace(/[^0-9]/g, "")); + setEditing({ ...editing, UNIT_PRICE: Number.isFinite(n) ? n : 0 }); + }} + className="w-full h-10 px-3 rounded-lg border border-slate-200 text-sm tabular-nums text-right focus:border-emerald-500 outline-none" /> setEditing({ ...editing, COST_PRICE: Number(e.target.value) })} - className="w-full h-10 px-3 rounded-lg border border-slate-200 text-sm focus:border-emerald-500 outline-none" + type="text" inputMode="numeric" + value={editing.COST_PRICE == null ? "" : Math.round(Number(editing.COST_PRICE)).toLocaleString("ko-KR")} + onChange={(e) => { + const n = Number(e.target.value.replace(/[^0-9]/g, "")); + setEditing({ ...editing, COST_PRICE: Number.isFinite(n) ? n : 0 }); + }} + className="w-full h-10 px-3 rounded-lg border border-slate-200 text-sm tabular-nums text-right focus:border-emerald-500 outline-none" />