From f7479844799e7e79a614dbf78f0bfcbf5222077c Mon Sep 17 00:00:00 2001 From: "vluk@2fi-solutions.com.hk" Date: Mon, 2 Feb 2026 16:19:52 +0800 Subject: [PATCH] make some chinese looks better --- src/app/(main)/ps/page.tsx | 30 +++++++++++++++++-- src/app/(main)/report/page.tsx | 14 ++++----- .../NavigationContent/NavigationContent.tsx | 11 ++----- src/config/reportConfig.ts | 18 +++++------ 4 files changed, 46 insertions(+), 27 deletions(-) diff --git a/src/app/(main)/ps/page.tsx b/src/app/(main)/ps/page.tsx index dcf4b86..19e66b6 100644 --- a/src/app/(main)/ps/page.tsx +++ b/src/app/(main)/ps/page.tsx @@ -12,6 +12,7 @@ import { OnlinePrediction, FileDownload, SettingsEthernet } from "@mui/icons-material"; import dayjs from "dayjs"; +import { I18nProvider } from "@/i18n"; import { NEXT_PUBLIC_API_URL } from "@/config/api"; export default function ProductionSchedulePage() { @@ -217,7 +218,32 @@ export default function ProductionSchedulePage() { }; - const handleAutoGenJob = async () => { /* unchanged */ }; + const handleAutoGenJob = async () => { + if (!isDateToday) return; + const token = localStorage.getItem("accessToken"); + setIsGenerating(true); + try { + const response = await fetch(`${NEXT_PUBLIC_API_URL}/productionSchedule/detail/detailed/release`, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ id: selectedPs.id }) + }); + + if (response.ok) { + alert("Job Orders generated successfully!"); + setIsDetailOpen(false); + } else { + alert("Failed to generate jobs."); + } + } catch (e) { + console.error("Release Error:", e); + } finally { + setIsGenerating(false); + } + }; return ( @@ -226,7 +252,7 @@ export default function ProductionSchedulePage() { - Production Planning + 排期 diff --git a/src/app/(main)/report/page.tsx b/src/app/(main)/report/page.tsx index c1b3edb..95f4d74 100644 --- a/src/app/(main)/report/page.tsx +++ b/src/app/(main)/report/page.tsx @@ -44,7 +44,7 @@ export default function ReportPage() { .map(field => field.label); if (missingFields.length > 0) { - alert(`Please enter the following mandatory fields:\n- ${missingFields.join('\n- ')}`); + alert(`缺少必填條件:\n- ${missingFields.join('\n- ')}`); return; } @@ -91,21 +91,21 @@ export default function ReportPage() { return ( - Report Management + 管理報告 - Select Report Type + 選擇報告 {REPORTS.map((report) => ( @@ -120,7 +120,7 @@ export default function ReportPage() { - Search Criteria: {currentReport.title} + 搜尋條件: {currentReport.title} @@ -156,7 +156,7 @@ export default function ReportPage() { disabled={loading} sx={{ px: 4 }} > - {loading ? "Generating..." : "Print Report"} + {loading ? "生成報告..." : "列印報告"} diff --git a/src/components/NavigationContent/NavigationContent.tsx b/src/components/NavigationContent/NavigationContent.tsx index d79a955..242df5f 100644 --- a/src/components/NavigationContent/NavigationContent.tsx +++ b/src/components/NavigationContent/NavigationContent.tsx @@ -247,21 +247,14 @@ const NavigationContent: React.FC = () => { }, { icon: , - label: "PS", - path: "/ps", - requiredAbility: [AUTH.TESTING, AUTH.ADMIN], - isHidden: false, - }, - { - icon: , - label: "Printer Testing", + label: "打袋機列印", path: "/testing", requiredAbility: [AUTH.TESTING, AUTH.ADMIN], isHidden: false, }, { icon: , - label: "Report Management", + label: "管理報告", path: "/report", requiredAbility: [AUTH.TESTING, AUTH.ADMIN], isHidden: false, diff --git a/src/config/reportConfig.ts b/src/config/reportConfig.ts index 50d15e2..5b0391a 100644 --- a/src/config/reportConfig.ts +++ b/src/config/reportConfig.ts @@ -21,7 +21,7 @@ export interface ReportDefinition { export const REPORTS: ReportDefinition[] = [ { id: "rep-001", - title: "Report 1", + title: "報告 1", apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report1`, fields: [ { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory @@ -36,7 +36,7 @@ export const REPORTS: ReportDefinition[] = [ }, { id: "rep-002", - title: "Report 2", + title: "報告 2", apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report2`, fields: [ { label: "Target Date", name: "targetDate", type: "date", required: false }, @@ -49,7 +49,7 @@ export const REPORTS: ReportDefinition[] = [ }, { id: "rep-003", - title: "Report 3", + title: "報告 3", apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report3`, fields: [ { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory @@ -64,14 +64,14 @@ export const REPORTS: ReportDefinition[] = [ }, { id: "rep-004", - title: "Stock In Traceability Report", + title: "入倉記錄報告", apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-in-traceability`, fields: [ - { label: "Stock Category", name: "stockCategory", type: "text", required: false, placeholder: "e.g. Meat" }, - { label: "Stock Sub Category", name: "stockSubCategory", type: "text", required: false, placeholder: "e.g. Chicken" }, - { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. MT-001" }, - { label: "Last In Date Start", name: "lastInDateStart", type: "date", required: false }, - { label: "Last In Date End", name: "lastInDateEnd", type: "date", required: false }, + { label: "倉存類別 Stock Category", name: "stockCategory", type: "text", required: false, placeholder: "e.g. Meat" }, + { label: "倉存細分類 Stock Sub Category", name: "stockSubCategory", type: "text", required: false, placeholder: "e.g. Chicken" }, + { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. MT-001" }, + { label: "入倉日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false }, + { label: "入倉日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false }, ] } // Add more reports following the same pattern...