2 Commits

Author SHA1 Message Date
kjs
21b4459757 Merge branch 'jskim-node' of https://g.wace.me/jskim/vexplor_dev into jskim-node 2026-04-13 16:05:06 +09:00
kjs
adf1738772 refactor: Enhance subcontractor, supplier, and customer division handling in item pages
- Added API calls to fetch division types for subcontractors, suppliers, and customers, improving data accuracy and relevance in the respective item pages.
- Updated table cell rendering to utilize the resolved division values, ensuring a more user-friendly display of information.
- These changes aim to provide tailored data views and enhance the overall user experience across multiple company implementations.
2026-04-13 16:05:04 +09:00
21 changed files with 132 additions and 75 deletions

View File

@@ -104,6 +104,11 @@ export default function SubcontractorItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 외주업체 거래유형 (subcontractor_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUBCONTRACTOR_TABLE}/division/values`);
if (res.data?.success) optMap["subcontractor_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
};
load();
@@ -536,7 +541,7 @@ export default function SubcontractorItemPage() {
<TableCell className="text-center"><input type="checkbox" checked={subCheckedIds.has(s.id)} readOnly /></TableCell>
<TableCell className="text-[13px]">{s.subcontractor_code}</TableCell>
<TableCell className="text-sm">{s.subcontractor_name}</TableCell>
<TableCell className="text-[13px]">{s.division}</TableCell>
<TableCell className="text-[13px]">{resolve("subcontractor_division", s.division)}</TableCell>
<TableCell className="text-[13px]">{s.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -286,6 +286,11 @@ export default function PurchaseItemPage() {
} catch { /* skip */ }
})
);
// 공급업체 거래유형 (supplier_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUPPLIER_TABLE}/division/values`);
if (res.data?.success) optMap["supplier_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1700,7 +1705,7 @@ export default function PurchaseItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.supplier_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.supplier_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("supplier_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -285,6 +285,11 @@ export default function SalesItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 거래처 거래유형 (customer_mng.division)
try {
const res = await apiClient.get(`/table-categories/customer_mng/division/values`);
if (res.data?.success) optMap["customer_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1702,7 +1707,7 @@ export default function SalesItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.customer_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.customer_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("customer_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -104,6 +104,11 @@ export default function SubcontractorItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 외주업체 거래유형 (subcontractor_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUBCONTRACTOR_TABLE}/division/values`);
if (res.data?.success) optMap["subcontractor_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
};
load();
@@ -536,7 +541,7 @@ export default function SubcontractorItemPage() {
<TableCell className="text-center"><input type="checkbox" checked={subCheckedIds.has(s.id)} readOnly /></TableCell>
<TableCell className="text-[13px]">{s.subcontractor_code}</TableCell>
<TableCell className="text-sm">{s.subcontractor_name}</TableCell>
<TableCell className="text-[13px]">{s.division}</TableCell>
<TableCell className="text-[13px]">{resolve("subcontractor_division", s.division)}</TableCell>
<TableCell className="text-[13px]">{s.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -286,6 +286,11 @@ export default function PurchaseItemPage() {
} catch { /* skip */ }
})
);
// 공급업체 거래유형 (supplier_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUPPLIER_TABLE}/division/values`);
if (res.data?.success) optMap["supplier_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1700,7 +1705,7 @@ export default function PurchaseItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.supplier_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.supplier_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("supplier_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -285,6 +285,11 @@ export default function SalesItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 거래처 거래유형 (customer_mng.division)
try {
const res = await apiClient.get(`/table-categories/customer_mng/division/values`);
if (res.data?.success) optMap["customer_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1702,7 +1707,7 @@ export default function SalesItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.customer_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.customer_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("customer_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -104,6 +104,11 @@ export default function SubcontractorItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 외주업체 거래유형 (subcontractor_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUBCONTRACTOR_TABLE}/division/values`);
if (res.data?.success) optMap["subcontractor_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
};
load();
@@ -536,7 +541,7 @@ export default function SubcontractorItemPage() {
<TableCell className="text-center"><input type="checkbox" checked={subCheckedIds.has(s.id)} readOnly /></TableCell>
<TableCell className="text-[13px]">{s.subcontractor_code}</TableCell>
<TableCell className="text-sm">{s.subcontractor_name}</TableCell>
<TableCell className="text-[13px]">{s.division}</TableCell>
<TableCell className="text-[13px]">{resolve("subcontractor_division", s.division)}</TableCell>
<TableCell className="text-[13px]">{s.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -286,6 +286,11 @@ export default function PurchaseItemPage() {
} catch { /* skip */ }
})
);
// 공급업체 거래유형 (supplier_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUPPLIER_TABLE}/division/values`);
if (res.data?.success) optMap["supplier_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1700,7 +1705,7 @@ export default function PurchaseItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.supplier_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.supplier_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("supplier_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -285,6 +285,11 @@ export default function SalesItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 거래처 거래유형 (customer_mng.division)
try {
const res = await apiClient.get(`/table-categories/customer_mng/division/values`);
if (res.data?.success) optMap["customer_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1702,7 +1707,7 @@ export default function SalesItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.customer_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.customer_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("customer_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -104,6 +104,11 @@ export default function SubcontractorItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 외주업체 거래유형 (subcontractor_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUBCONTRACTOR_TABLE}/division/values`);
if (res.data?.success) optMap["subcontractor_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
};
load();
@@ -536,7 +541,7 @@ export default function SubcontractorItemPage() {
<TableCell className="text-center"><input type="checkbox" checked={subCheckedIds.has(s.id)} readOnly /></TableCell>
<TableCell className="text-[13px]">{s.subcontractor_code}</TableCell>
<TableCell className="text-sm">{s.subcontractor_name}</TableCell>
<TableCell className="text-[13px]">{s.division}</TableCell>
<TableCell className="text-[13px]">{resolve("subcontractor_division", s.division)}</TableCell>
<TableCell className="text-[13px]">{s.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -142,10 +142,6 @@ const FORM_FIELDS = [
{ key: "division", label: "관리품목", type: "multi-category" },
{ key: "type", label: "품목구분", type: "category" },
{ key: "size", label: "규격", type: "text" },
{ key: "width", label: "가로", type: "text", placeholder: "숫자 입력 (mm)" },
{ key: "height", label: "세로", type: "text", placeholder: "숫자 입력 (mm)" },
{ key: "thickness", label: "두께", type: "text", placeholder: "숫자 입력 (mm)" },
{ key: "area", label: "면적", type: "text", placeholder: "숫자 입력 (㎡)" },
{ key: "unit", label: "단위", type: "category" },
{ key: "material", label: "재질", type: "category" },
{ key: "status", label: "상태", type: "category" },
@@ -179,10 +175,6 @@ const ITEM_GRID_COLUMNS = [
{ key: "item_number", label: "품번" },
{ key: "item_name", label: "품명" },
{ key: "size", label: "규격" },
{ key: "width", label: "가로" },
{ key: "height", label: "세로" },
{ key: "thickness", label: "두께" },
{ key: "area", label: "면적" },
{ key: "unit", label: "단위" },
{ key: "standard_price", label: "기준단가/구매단가" },
{ key: "currency_code", label: "통화" },
@@ -294,6 +286,11 @@ export default function PurchaseItemPage() {
} catch { /* skip */ }
})
);
// 공급업체 거래유형 (supplier_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUPPLIER_TABLE}/division/values`);
if (res.data?.success) optMap["supplier_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1613,25 +1610,9 @@ export default function PurchaseItemPage() {
) : (
<Input
value={formData[field.key] || ""}
readOnly={field.key === "area"}
onChange={(e) => {
if (field.key === "area") return;
const v = e.target.value;
setFormData((prev) => {
const next = { ...prev, [field.key]: v };
// 가로/세로 변경 시 면적(㎡) 자동 계산: (가로mm × 세로mm) / 1,000,000
if (field.key === "width" || field.key === "height") {
const w = Number(field.key === "width" ? v : prev.width);
const h = Number(field.key === "height" ? v : prev.height);
if (!isNaN(w) && !isNaN(h) && w > 0 && h > 0) {
next.area = ((w * h) / 1_000_000).toFixed(4);
}
}
return next;
});
}}
placeholder={field.key === "area" ? "자동 계산" : ("placeholder" in field ? field.placeholder : field.label)}
className={cn("h-9", field.key === "area" && "bg-muted cursor-not-allowed")}
onChange={(e) => setFormData((prev) => ({ ...prev, [field.key]: e.target.value }))}
placeholder={"placeholder" in field ? field.placeholder : field.label}
className="h-9"
/>
)}
</div>
@@ -1724,7 +1705,7 @@ export default function PurchaseItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.supplier_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.supplier_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("supplier_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -285,6 +285,11 @@ export default function SalesItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 거래처 거래유형 (customer_mng.division)
try {
const res = await apiClient.get(`/table-categories/customer_mng/division/values`);
if (res.data?.success) optMap["customer_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1702,7 +1707,7 @@ export default function SalesItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.customer_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.customer_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("customer_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -104,6 +104,11 @@ export default function SubcontractorItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 외주업체 거래유형 (subcontractor_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUBCONTRACTOR_TABLE}/division/values`);
if (res.data?.success) optMap["subcontractor_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
};
load();
@@ -536,7 +541,7 @@ export default function SubcontractorItemPage() {
<TableCell className="text-center"><input type="checkbox" checked={subCheckedIds.has(s.id)} readOnly /></TableCell>
<TableCell className="text-[13px]">{s.subcontractor_code}</TableCell>
<TableCell className="text-sm">{s.subcontractor_name}</TableCell>
<TableCell className="text-[13px]">{s.division}</TableCell>
<TableCell className="text-[13px]">{resolve("subcontractor_division", s.division)}</TableCell>
<TableCell className="text-[13px]">{s.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -286,6 +286,11 @@ export default function PurchaseItemPage() {
} catch { /* skip */ }
})
);
// 공급업체 거래유형 (supplier_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUPPLIER_TABLE}/division/values`);
if (res.data?.success) optMap["supplier_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1700,7 +1705,7 @@ export default function PurchaseItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.supplier_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.supplier_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("supplier_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -285,6 +285,11 @@ export default function SalesItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 거래처 거래유형 (customer_mng.division)
try {
const res = await apiClient.get(`/table-categories/customer_mng/division/values`);
if (res.data?.success) optMap["customer_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1702,7 +1707,7 @@ export default function SalesItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.customer_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.customer_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("customer_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -104,6 +104,11 @@ export default function SubcontractorItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 외주업체 거래유형 (subcontractor_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUBCONTRACTOR_TABLE}/division/values`);
if (res.data?.success) optMap["subcontractor_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
};
load();
@@ -536,7 +541,7 @@ export default function SubcontractorItemPage() {
<TableCell className="text-center"><input type="checkbox" checked={subCheckedIds.has(s.id)} readOnly /></TableCell>
<TableCell className="text-[13px]">{s.subcontractor_code}</TableCell>
<TableCell className="text-sm">{s.subcontractor_name}</TableCell>
<TableCell className="text-[13px]">{s.division}</TableCell>
<TableCell className="text-[13px]">{resolve("subcontractor_division", s.division)}</TableCell>
<TableCell className="text-[13px]">{s.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -286,6 +286,11 @@ export default function PurchaseItemPage() {
} catch { /* skip */ }
})
);
// 공급업체 거래유형 (supplier_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUPPLIER_TABLE}/division/values`);
if (res.data?.success) optMap["supplier_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1700,7 +1705,7 @@ export default function PurchaseItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.supplier_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.supplier_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("supplier_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -285,6 +285,11 @@ export default function SalesItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 거래처 거래유형 (customer_mng.division)
try {
const res = await apiClient.get(`/table-categories/customer_mng/division/values`);
if (res.data?.success) optMap["customer_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1702,7 +1707,7 @@ export default function SalesItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.customer_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.customer_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("customer_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -104,6 +104,11 @@ export default function SubcontractorItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 외주업체 거래유형 (subcontractor_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUBCONTRACTOR_TABLE}/division/values`);
if (res.data?.success) optMap["subcontractor_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
};
load();
@@ -536,7 +541,7 @@ export default function SubcontractorItemPage() {
<TableCell className="text-center"><input type="checkbox" checked={subCheckedIds.has(s.id)} readOnly /></TableCell>
<TableCell className="text-[13px]">{s.subcontractor_code}</TableCell>
<TableCell className="text-sm">{s.subcontractor_name}</TableCell>
<TableCell className="text-[13px]">{s.division}</TableCell>
<TableCell className="text-[13px]">{resolve("subcontractor_division", s.division)}</TableCell>
<TableCell className="text-[13px]">{s.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -142,10 +142,6 @@ const FORM_FIELDS = [
{ key: "division", label: "관리품목", type: "multi-category" },
{ key: "type", label: "품목구분", type: "category" },
{ key: "size", label: "규격", type: "text" },
{ key: "width", label: "가로", type: "text", placeholder: "숫자 입력 (mm)" },
{ key: "height", label: "세로", type: "text", placeholder: "숫자 입력 (mm)" },
{ key: "thickness", label: "두께", type: "text", placeholder: "숫자 입력 (mm)" },
{ key: "area", label: "면적", type: "text", placeholder: "숫자 입력 (㎡)" },
{ key: "unit", label: "단위", type: "category" },
{ key: "material", label: "재질", type: "category" },
{ key: "status", label: "상태", type: "category" },
@@ -179,10 +175,6 @@ const ITEM_GRID_COLUMNS = [
{ key: "item_number", label: "품번" },
{ key: "item_name", label: "품명" },
{ key: "size", label: "규격" },
{ key: "width", label: "가로" },
{ key: "height", label: "세로" },
{ key: "thickness", label: "두께" },
{ key: "area", label: "면적" },
{ key: "unit", label: "단위" },
{ key: "standard_price", label: "기준단가/구매단가" },
{ key: "currency_code", label: "통화" },
@@ -294,6 +286,11 @@ export default function PurchaseItemPage() {
} catch { /* skip */ }
})
);
// 공급업체 거래유형 (supplier_mng.division)
try {
const res = await apiClient.get(`/table-categories/${SUPPLIER_TABLE}/division/values`);
if (res.data?.success) optMap["supplier_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1613,25 +1610,9 @@ export default function PurchaseItemPage() {
) : (
<Input
value={formData[field.key] || ""}
readOnly={field.key === "area"}
onChange={(e) => {
if (field.key === "area") return;
const v = e.target.value;
setFormData((prev) => {
const next = { ...prev, [field.key]: v };
// 가로/세로 변경 시 면적(㎡) 자동 계산: (가로mm × 세로mm) / 1,000,000
if (field.key === "width" || field.key === "height") {
const w = Number(field.key === "width" ? v : prev.width);
const h = Number(field.key === "height" ? v : prev.height);
if (!isNaN(w) && !isNaN(h) && w > 0 && h > 0) {
next.area = ((w * h) / 1_000_000).toFixed(4);
}
}
return next;
});
}}
placeholder={field.key === "area" ? "자동 계산" : ("placeholder" in field ? field.placeholder : field.label)}
className={cn("h-9", field.key === "area" && "bg-muted cursor-not-allowed")}
onChange={(e) => setFormData((prev) => ({ ...prev, [field.key]: e.target.value }))}
placeholder={"placeholder" in field ? field.placeholder : field.label}
className="h-9"
/>
)}
</div>
@@ -1724,7 +1705,7 @@ export default function PurchaseItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.supplier_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.supplier_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("supplier_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}

View File

@@ -285,6 +285,11 @@ export default function SalesItemPage() {
if (res.data?.success) optMap[col] = flatten(res.data.data || []);
} catch { /* skip */ }
}
// 거래처 거래유형 (customer_mng.division)
try {
const res = await apiClient.get(`/table-categories/customer_mng/division/values`);
if (res.data?.success) optMap["customer_division"] = flatten(res.data.data || []);
} catch { /* skip */ }
setCategoryOptions(optMap);
// 단가 카테고리
@@ -1702,7 +1707,7 @@ export default function SalesItemPage() {
</TableCell>
<TableCell className="text-[13px] font-mono text-muted-foreground">{c.customer_code}</TableCell>
<TableCell className="text-sm font-medium text-foreground">{c.customer_name}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.division}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{resolve("customer_division", c.division)}</TableCell>
<TableCell className="text-[13px] text-muted-foreground">{c.contact_person}</TableCell>
</TableRow>
))}