diff --git a/.scannerwork/.sonar_lock b/.scannerwork/.sonar_lock new file mode 100644 index 00000000..e69de29b diff --git a/.scannerwork/report-task.txt b/.scannerwork/report-task.txt new file mode 100644 index 00000000..363424f2 --- /dev/null +++ b/.scannerwork/report-task.txt @@ -0,0 +1,6 @@ +projectKey=vexplor +serverUrl=http://localhost:9000 +serverVersion=26.3.0.120487 +dashboardUrl=http://localhost:9000/dashboard?id=vexplor +ceTaskId=f2c72369-4d50-4483-bf76-b03788385757 +ceTaskUrl=http://localhost:9000/api/ce/task?id=f2c72369-4d50-4483-bf76-b03788385757 diff --git a/frontend/app/(main)/admin/screenMng/popSettingsMng/page.tsx b/frontend/app/(main)/admin/screenMng/popSettingsMng/page.tsx index 80d8b7dd..1b5ee89d 100644 --- a/frontend/app/(main)/admin/screenMng/popSettingsMng/page.tsx +++ b/frontend/app/(main)/admin/screenMng/popSettingsMng/page.tsx @@ -165,15 +165,16 @@ interface SettingField { key: string; label: string; description: string; - type: "toggle" | "text" | "number" | "select" | "color" | "tags" | "array-object"; + type: "toggle" | "text" | "number" | "select" | "color" | "tags" | "array-object" | "numbering-rule"; defaultValue?: unknown; options?: { value: string; label: string }[]; fields?: { key: string; label: string; type: string }[]; + tableFilter?: string; // numbering-rule์šฉ: inbound/outbound ๋“ฑ } const SETTINGS_SCHEMA: Record = { inbound: [ - { key: "numberingRuleId", label: "๐Ÿ“‹ ์ž…๊ณ ๋ฒˆํ˜ธ ์ฑ„๋ฒˆ๊ทœ์น™", description: "์ž…๊ณ  ํ™•์ • ์‹œ ์‚ฌ์šฉํ•  ์ฑ„๋ฒˆ๊ทœ์น™์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค", type: "text" }, + { key: "numberingRuleId", label: "๐Ÿ“‹ ์ž…๊ณ ๋ฒˆํ˜ธ ์ฑ„๋ฒˆ๊ทœ์น™", description: "์ž…๊ณ  ํ™•์ • ์‹œ ์‚ฌ์šฉํ•  ์ฑ„๋ฒˆ๊ทœ์น™์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค", type: "numbering-rule", tableFilter: "inbound" }, { key: "barcodeEnabled", label: "๋ฐ”์ฝ”๋“œ ์Šค์บ” (๋ฏธ๊ตฌํ˜„)", description: "๋ฐ”์ฝ”๋“œ/QR ์Šค์บ” ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค", type: "toggle" }, { key: "inspectionRequired", label: "๊ฒ€์‚ฌ ํ•„์ˆ˜ (๋ฏธ๊ตฌํ˜„)", description: "์ž…๊ณ  ์‹œ ๊ฒ€์‚ฌ ํ•ญ๋ชฉ์„ ํ•„์ˆ˜๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค", type: "toggle" }, { key: "photoUpload", label: "์‚ฌ์ง„ ์ฒจ๋ถ€ (๋ฏธ๊ตฌํ˜„)", description: "์ž…๊ณ  ํ™•์ • ์‹œ ์‚ฌ์ง„ ์ฒจ๋ถ€๋ฅผ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค", type: "toggle" }, @@ -181,7 +182,7 @@ const SETTINGS_SCHEMA: Record = { { key: "defectSeparation", label: "๋ถˆ๋Ÿ‰ ๋ถ„๋ฆฌ (๋ฏธ๊ตฌํ˜„)", description: "์–‘ํ’ˆ/๋ถˆ๋Ÿ‰ ์ˆ˜๋Ÿ‰์„ ๋ถ„๋ฆฌ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค", type: "toggle" }, ], outbound: [ - { key: "numberingRuleId", label: "๐Ÿ“‹ ์ถœ๊ณ ๋ฒˆํ˜ธ ์ฑ„๋ฒˆ๊ทœ์น™", description: "์ถœ๊ณ  ํ™•์ • ์‹œ ์‚ฌ์šฉํ•  ์ฑ„๋ฒˆ๊ทœ์น™์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค", type: "text" }, + { key: "numberingRuleId", label: "๐Ÿ“‹ ์ถœ๊ณ ๋ฒˆํ˜ธ ์ฑ„๋ฒˆ๊ทœ์น™", description: "์ถœ๊ณ  ํ™•์ • ์‹œ ์‚ฌ์šฉํ•  ์ฑ„๋ฒˆ๊ทœ์น™์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค", type: "numbering-rule", tableFilter: "outbound" }, { key: "barcodeEnabled", label: "๋ฐ”์ฝ”๋“œ ์Šค์บ” (๋ฏธ๊ตฌํ˜„)", description: "๋ฐ”์ฝ”๋“œ/QR ์Šค์บ” ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค", type: "toggle" }, { key: "photoUpload", label: "์‚ฌ์ง„ ์ฒจ๋ถ€ (๋ฏธ๊ตฌํ˜„)", description: "์ถœ๊ณ  ์‹œ ์‚ฌ์ง„ ์ฒจ๋ถ€๋ฅผ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค", type: "toggle" }, ], @@ -256,6 +257,82 @@ const SETTINGS_SCHEMA: Record = { ], }; +// ============================================================ +// ์ฑ„๋ฒˆ๊ทœ์น™ ์…€๋ ‰ํŠธ ์ปดํฌ๋„ŒํŠธ +// ============================================================ + +function NumberingRuleSelect({ + field, + value, + onChange, +}: { + field: SettingField; + value: unknown; + onChange: (value: unknown) => void; +}) { + const { user } = useAuth(); + const [rules, setRules] = useState<{ value: string; label: string }[]>([]); + const [loading, setLoading] = useState(false); + + useEffect(() => { + const loadRules = async () => { + setLoading(true); + try { + const companyCode = user?.companyCode || "COMPANY_7"; + const res = await apiClient.get(`/numbering-rules?company_code=${companyCode}`); + const data = res.data?.data || res.data || []; + const allRules = Array.isArray(data) ? data : (data.rules || []); + // tableFilter๋กœ ํ•„ํ„ฐ๋ง (inbound/outbound ๋“ฑ) + const filtered = field.tableFilter + ? allRules.filter((r: any) => + (r.table_name || "").toLowerCase().includes(field.tableFilter!) || + (r.rule_name || r.column_name || "").toLowerCase().includes(field.tableFilter!) + ) + : allRules; + setRules( + filtered.length > 0 + ? filtered.map((r: any) => ({ + value: r.id || r.rule_id, + label: `${r.rule_name || r.table_name + "." + r.column_name} (${r.prefix || ""}${r.separator || ""}...)`, + })) + : allRules.map((r: any) => ({ + value: r.id || r.rule_id, + label: `${r.rule_name || r.table_name + "." + r.column_name}`, + })) + ); + } catch { + setRules([]); + } + setLoading(false); + }; + loadRules(); + }, [user?.companyCode, field.tableFilter]); + + return ( +
+ +

{field.description}

+ {loading ? ( +

์ฑ„๋ฒˆ๊ทœ์น™ ๋กœ๋“œ ์ค‘...

+ ) : rules.length === 0 ? ( +

๋“ฑ๋ก๋œ ์ฑ„๋ฒˆ๊ทœ์น™์ด ์—†์Šต๋‹ˆ๋‹ค. PC์—์„œ ๋จผ์ € ์ฑ„๋ฒˆ๊ทœ์น™์„ ๋“ฑ๋กํ•ด์ฃผ์„ธ์š”.

+ ) : ( + + )} +
+ ); +} + // ============================================================ // Sub-components: TagEditor, ArrayObjectEditor // ============================================================ @@ -484,6 +561,8 @@ function SettingRow({ ); + case "numbering-rule": + return ; case "color": return (
diff --git a/sonar-project.properties b/sonar-project.properties index 4a233136..b08e2bd3 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.projectKey=vexplor sonar.projectName=vexplor -sonar.sources=backend-node/src,frontend/src -sonar.exclusions=**/node_modules/**,**/dist/**,**/*.test.*,**/test-scenarios/** -sonar.javascript.lcov.reportPaths=coverage/lcov.info +sonar.sources=backend-node/src +sonar.exclusions=**/node_modules/**,**/dist/**,**/*.test.*,**/test-scenarios/**,**/build/**,**/.next/** sonar.host.url=http://localhost:9000 sonar.sourceEncoding=UTF-8 +sonar.scm.disabled=true