feat: 채번규칙 필드를 입고/출고 장바구니 화면에서만 표시

- SettingField에 showOnlyForScreens 옵션 추가
- 입고번호 채번: inbound-cart에서만 표시
- 출고번호 채번: outbound-cart에서만 표시
- 구매입고/판매출고/유형선택 등 다른 화면에서는 채번 필드 숨김

이로써 채번 설정의 컨텍스트가 명확해짐
This commit is contained in:
SeongHyun Kim
2026-04-07 18:46:18 +09:00
parent dad8df7b10
commit a7b914407c

View File

@@ -171,11 +171,12 @@ interface SettingField {
options?: { value: string; label: string }[];
fields?: { key: string; label: string; type: string }[];
tableFilter?: string; // numbering-rule용: inbound/outbound 등
showOnlyForScreens?: string[]; // 특정 화면 ID에서만 표시 (예: ["inbound-cart"])
}
const SETTINGS_SCHEMA: Record<string, SettingField[]> = {
inbound: [
{ key: "numberingRuleId", label: "📋 입고번호 채번규칙", description: "입고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "inbound" },
{ key: "numberingRuleId", label: "📋 입고번호 채번규칙", description: "입고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "inbound", showOnlyForScreens: ["inbound-cart"] },
{ key: "barcodeEnabled", label: "바코드 스캔 (미구현)", description: "바코드/QR 스캔 기능을 사용합니다", type: "toggle" },
{ key: "inspectionRequired", label: "검사 필수 (미구현)", description: "입고 시 검사 항목을 필수로 표시합니다", type: "toggle" },
{ key: "photoUpload", label: "사진 첨부 (미구현)", description: "입고 확정 시 사진 첨부를 허용합니다", type: "toggle" },
@@ -183,7 +184,7 @@ const SETTINGS_SCHEMA: Record<string, SettingField[]> = {
{ key: "defectSeparation", label: "불량 분리 (미구현)", description: "양품/불량 수량을 분리 입력합니다", type: "toggle" },
],
outbound: [
{ key: "numberingRuleId", label: "📋 출고번호 채번규칙", description: "출고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "outbound" },
{ key: "numberingRuleId", label: "📋 출고번호 채번규칙", description: "출고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "outbound", showOnlyForScreens: ["outbound-cart"] },
{ key: "barcodeEnabled", label: "바코드 스캔 (미구현)", description: "바코드/QR 스캔 기능을 사용합니다", type: "toggle" },
{ key: "photoUpload", label: "사진 첨부 (미구현)", description: "출고 시 사진 첨부를 허용합니다", type: "toggle" },
],
@@ -944,7 +945,12 @@ export default function PopSettingsMngPage() {
// ---- Current screen schema values ----
const currentSettingsKey = selectedScreen?.settingsKey || "inbound";
const currentFields = SETTINGS_SCHEMA[currentSettingsKey] || [];
const allFields = SETTINGS_SCHEMA[currentSettingsKey] || [];
// showOnlyForScreens 옵션이 있으면 현재 화면 ID와 일치할 때만 표시
const currentFields = allFields.filter((f) => {
if (!f.showOnlyForScreens) return true;
return selectedScreen?.id ? f.showOnlyForScreens.includes(selectedScreen.id) : false;
});
const currentValues = (settings.screens as Record<string, Record<string, unknown>>)[currentSettingsKey] || {};
return (