| @@ -1,5 +1,5 @@ | |||||
| API_URL=http://10.10.0.81:8090/api | |||||
| API_URL=http://127.0.0.1:8090/api | |||||
| NEXTAUTH_SECRET=secret | NEXTAUTH_SECRET=secret | ||||
| NEXTAUTH_URL=http://10.10.0.81:3000 | |||||
| NEXT_PUBLIC_API_URL=http://10.10.0.81:8090/api | |||||
| NEXTAUTH_URL=http://127.0.0.1:3000 | |||||
| NEXT_PUBLIC_API_URL=http://127.0.0.1:8090/api | |||||
| NEXT_PUBLIC_QC_MEASUREMENT_ENABLED=false | NEXT_PUBLIC_QC_MEASUREMENT_ENABLED=false | ||||
| @@ -16,24 +16,11 @@ const LoginPage = () => { | |||||
| lg={6} | lg={6} | ||||
| sx={{ | sx={{ | ||||
| display: { xs: "none", sm: "block" }, | display: { xs: "none", sm: "block" }, | ||||
| backgroundColor: "#c5e58b", | |||||
| backgroundImage: "linear-gradient(135deg, rgba(59,130,246,0.15) 0%, #f1f5f9 45%, #f8fafc 100%)", | |||||
| backgroundColor: "#f8fafc", | |||||
| minHeight: { xs: 0, sm: "100vh" }, | minHeight: { xs: 0, sm: "100vh" }, | ||||
| }} | }} | ||||
| > | |||||
| <Box | |||||
| sx={{ | |||||
| width: "100%", | |||||
| height: "100%", | |||||
| minHeight: { sm: "100vh" }, | |||||
| backgroundImage: "url('logo/HomepageLogo.png')", | |||||
| backgroundRepeat: "no-repeat", | |||||
| backgroundPosition: "center", | |||||
| backgroundSize: "contain", | |||||
| maxWidth: 960, | |||||
| margin: "0 auto", | |||||
| }} | |||||
| /> | |||||
| </Grid> | |||||
| /> | |||||
| <Grid | <Grid | ||||
| item | item | ||||
| xs={12} | xs={12} | ||||
| @@ -244,7 +244,7 @@ const NavigationContent: React.FC = () => { | |||||
| labelKey: "nav.m18Sync", | labelKey: "nav.m18Sync", | ||||
| path: "/m18Syn", | path: "/m18Syn", | ||||
| requiredAbility: [AUTH.M18_SYNC, AUTH.ADMIN], | requiredAbility: [AUTH.M18_SYNC, AUTH.ADMIN], | ||||
| isHidden: false, | |||||
| isHidden: true, | |||||
| }, | }, | ||||
| { | { | ||||
| id: "nav.chartReports", | id: "nav.chartReports", | ||||
| @@ -416,6 +416,7 @@ const NavigationContent: React.FC = () => { | |||||
| icon: <Science />, | icon: <Science />, | ||||
| labelKey: "nav.settings.importTesting", | labelKey: "nav.settings.importTesting", | ||||
| path: "/settings/m18ImportTesting", | path: "/settings/m18ImportTesting", | ||||
| isHidden: true, | |||||
| }, | }, | ||||
| { | { | ||||
| id: "nav.settings.importExcel", | id: "nav.settings.importExcel", | ||||
| @@ -294,17 +294,6 @@ const PoSearch: React.FC<Props> = ({ | |||||
| if (typeof v === "string" && (v as string).trim() === "") return; | if (typeof v === "string" && (v as string).trim() === "") return; | ||||
| cleanedQuery[k] = String(v); | cleanedQuery[k] = String(v); | ||||
| }); | }); | ||||
| const searchedCodeRaw = (filterArgs as any)?.code; | |||||
| const searchedCode = | |||||
| typeof searchedCodeRaw === "string" ? searchedCodeRaw.trim() : ""; | |||||
| const isM18PoCode = | |||||
| searchedCode.length > 14 && | |||||
| (searchedCode.startsWith("PP") || searchedCode.startsWith("PF")); | |||||
| if (isM18PoCode) { | |||||
| cleanedQuery.refreshFromM18 = "true"; | |||||
| setIsM18LookupLoading(true); | |||||
| setAutoSyncStatus("載入中..."); | |||||
| } | |||||
| try { | try { | ||||
| const baseListResp = await clientAuthFetch( | const baseListResp = await clientAuthFetch( | ||||
| @@ -320,17 +309,8 @@ const PoSearch: React.FC<Props> = ({ | |||||
| const records: PoResult[] = res.records ?? []; | const records: PoResult[] = res.records ?? []; | ||||
| setFilteredPo(records); | setFilteredPo(records); | ||||
| setTotalCount(res.total ?? 0); | setTotalCount(res.total ?? 0); | ||||
| if (isM18PoCode) { | |||||
| const refreshAction = baseListResp.headers.get("X-M18-Po-Refresh"); | |||||
| if (refreshAction === "synced") { | |||||
| setAutoSyncStatus(records.length > 0 ? "已從M18同步PO" : "找不到PO"); | |||||
| } else { | |||||
| setAutoSyncStatus(null); | |||||
| } | |||||
| } | |||||
| } catch (e) { | } catch (e) { | ||||
| console.error("PO list fetch error:", e); | console.error("PO list fetch error:", e); | ||||
| if (isM18PoCode) setAutoSyncStatus("找不到PO"); | |||||
| } finally { | } finally { | ||||
| setIsM18LookupLoading(false); | setIsM18LookupLoading(false); | ||||
| autoSyncInProgressRef.current = false; | autoSyncInProgressRef.current = false; | ||||
| @@ -26,6 +26,11 @@ export default async function middleware( | |||||
| req: NextRequestWithAuth, | req: NextRequestWithAuth, | ||||
| event: NextFetchEvent, | event: NextFetchEvent, | ||||
| ) { | ) { | ||||
| const blockedDemoPaths = ["/m18Syn", "/settings/m18ImportTesting", "/testing", "/jo/testing"]; | |||||
| if (blockedDemoPaths.some((path) => req.nextUrl.pathname === path || req.nextUrl.pathname.startsWith(`${path}/`))) { | |||||
| return NextResponse.redirect(new URL("/dashboard", req.url)); | |||||
| } | |||||
| // Handle language parameters | // Handle language parameters | ||||
| const langPref = req.nextUrl.searchParams.get(LANG_QUERY_PARAM); | const langPref = req.nextUrl.searchParams.get(LANG_QUERY_PARAM); | ||||
| if (langPref) { | if (langPref) { | ||||