From 1c8b3c30b093221854015c105cde0f2be237d91a Mon Sep 17 00:00:00 2001 From: "kelvin.yau" Date: Thu, 9 Oct 2025 18:58:54 +0800 Subject: [PATCH] UI, pop up window update --- .../DashboardPage/DashboardPage.tsx | 2 +- src/components/DoSearch/DoSearch.tsx | 6 +- .../FinishedGoodSearch/FinishedGoodSearch.tsx | 68 +++++++++++++++---- .../Jodetail/completeJobOrderRecord.tsx | 2 +- src/i18n/zh/dashboard.json | 4 ++ src/i18n/zh/pickOrder.json | 18 +++-- 6 files changed, 75 insertions(+), 25 deletions(-) diff --git a/src/components/DashboardPage/DashboardPage.tsx b/src/components/DashboardPage/DashboardPage.tsx index 8449af6..f2d0dad 100644 --- a/src/components/DashboardPage/DashboardPage.tsx +++ b/src/components/DashboardPage/DashboardPage.tsx @@ -58,7 +58,7 @@ const DashboardPage: React.FC = ({ - + diff --git a/src/components/DoSearch/DoSearch.tsx b/src/components/DoSearch/DoSearch.tsx index 0a61b52..520d5a6 100644 --- a/src/components/DoSearch/DoSearch.tsx +++ b/src/components/DoSearch/DoSearch.tsx @@ -393,15 +393,15 @@ if(orderStartDate != ""){ const result = await Swal.fire( { - icon: "info", + icon: "question", title: t("Batch Release"), html: t("Selected Shop(s): ") + extractedIdsCount.toString() + `

`+ t("Selected Item(s): ") + extractedItemsCount.toString() + `

`, showCancelButton: true, confirmButtonText: t("Confirm"), cancelButtonText: t("Cancel"), - confirmButtonColor: "#638a01", - cancelButtonColor: "#d33" + confirmButtonColor: "#8dba00", + cancelButtonColor: "#F04438" }); if (result.isConfirmed) { Swal.fire({ diff --git a/src/components/FinishedGoodSearch/FinishedGoodSearch.tsx b/src/components/FinishedGoodSearch/FinishedGoodSearch.tsx index 4a32e78..4034a8d 100644 --- a/src/components/FinishedGoodSearch/FinishedGoodSearch.tsx +++ b/src/components/FinishedGoodSearch/FinishedGoodSearch.tsx @@ -69,7 +69,6 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { const fetchReleasedOrderCount = useCallback(async () => { try { const releasedOrders = await fetchReleasedDoPickOrders(); - // Count only orders that have a valid doOrderId const validCount = releasedOrders.filter(order => order.doOrderId).length; setReleasedOrderCount(validCount); } catch (error) { @@ -105,7 +104,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { if(response.success){ Swal.fire({ position: "bottom-end", - icon: "info", + icon: "success", text: t("Printed Successfully."), showConfirmButton: false, timer: 1500 @@ -130,21 +129,30 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { console.log("Found released orders:", releasedOrders); const confirmResult = await Swal.fire({ - title: t("Confirm Print"), - text: t(`Do you want to print ${releasedOrders.length} draft(s)?`), + title: t("Batch Print"), + text: t("Confirm print: (") + releasedOrders.length.toString() + t("piece(s))"), icon: "question", showCancelButton: true, - confirmButtonText: t("Yes, print"), + confirmButtonText: t("Confirm"), cancelButtonText: t("Cancel"), - confirmButtonColor: "#3085d6", - cancelButtonColor: "#d33" + confirmButtonColor: "#8dba00", + cancelButtonColor: "#F04438" }); - // If user cancels, exit the function if (!confirmResult.isConfirmed) { return; } + Swal.fire({ + title: t("Printing..."), + text: t("Please wait..."), + allowOutsideClick: false, + allowEscapeKey: false, + didOpen: () => { + Swal.showLoading(); + } + }); + for (const order of releasedOrders) { const { doOrderId, pickOrderId } = order; @@ -170,7 +178,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { Swal.fire({ position: "bottom-end", icon: "success", - text: t(`Printed ${releasedOrders.length} draft(s) successfully.`), + text: t("Printed Successfully."), showConfirmButton: false, timer: 1500 }); @@ -183,6 +191,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { const handleDN = useCallback(async () =>{ const askNumofCarton = await Swal.fire({ title: t("Enter the number of cartons: "), + icon: "info", input: "number", inputPlaceholder: t("Number of cartons"), inputAttributes:{ @@ -201,6 +210,8 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { showCancelButton: true, confirmButtonText: t("Confirm"), cancelButtonText: t("Cancel"), + confirmButtonColor: "#8dba00", + cancelButtonColor: "#F04438", showLoaderOnConfirm: true, allowOutsideClick: () => !Swal.isLoading() }); @@ -233,7 +244,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { if(response.success){ Swal.fire({ position: "bottom-end", - icon: "info", + icon: "success", text: t("Printed Successfully."), showConfirmButton: false, timer: 1500 @@ -250,6 +261,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { const handleDNandLabel = useCallback(async () =>{ const askNumofCarton = await Swal.fire({ title: t("Enter the number of cartons: "), + icon: "info", input: "number", inputPlaceholder: t("Number of cartons"), inputAttributes:{ @@ -268,6 +280,8 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { showCancelButton: true, confirmButtonText: t("Confirm"), cancelButtonText: t("Cancel"), + confirmButtonColor: "#8dba00", + cancelButtonColor: "#F04438", showLoaderOnConfirm: true, allowOutsideClick: () => !Swal.isLoading() }); @@ -310,7 +324,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { if(LabelsResponse.success && DNResponse.success){ Swal.fire({ position: "bottom-end", - icon: "info", + icon: "success", text: t("Printed Successfully."), showConfirmButton: false, timer: 1500 @@ -332,6 +346,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { const handleLabel = useCallback(async () =>{ const askNumofCarton = await Swal.fire({ title: t("Enter the number of cartons: "), + icon: "info", input: "number", inputPlaceholder: t("Number of cartons"), inputAttributes:{ @@ -350,6 +365,8 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { showCancelButton: true, confirmButtonText: t("Confirm"), cancelButtonText: t("Cancel"), + confirmButtonColor: "#8dba00", + cancelButtonColor: "#F04438", showLoaderOnConfirm: true, allowOutsideClick: () => !Swal.isLoading() }); @@ -380,7 +397,7 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { if(response.success){ Swal.fire({ position: "bottom-end", - icon: "info", + icon: "success", text: t("Printed Successfully."), showConfirmButton: false, timer: 1500 @@ -454,19 +471,40 @@ const PickOrderSearch: React.FC = ({ pickOrders }) => { window.dispatchEvent(new CustomEvent('pickOrderAssigned')); } else if (res.code === "USER_BUSY") { console.warn("⚠️ User already has pick orders in progress:", res.message); + Swal.fire({ + icon: "warning", + title: t("Warning"), + text: t("You already have a pick order in progess. Please complete it first before taking next pick order."), + confirmButtonText: t("Confirm"), + confirmButtonColor: "#8dba00" + }); // ✅ Show warning but still refresh to show existing orders - alert(`Warning: ${res.message}`); + //alert(`Warning: ${res.message}`); window.dispatchEvent(new CustomEvent('pickOrderAssigned')); } else if (res.code === "NO_ORDERS") { console.log("ℹ️ No available pick orders for store", storeId); - alert(`Info: ${res.message}`); + Swal.fire({ + icon: "info", + title: t("Info"), + text: t("No available pick order(s) for this floor."), + confirmButtonText: t("Confirm"), + confirmButtonColor: "#8dba00" + }); + //alert(`Info: ${res.message}`); } else { console.log("ℹ️ Assignment result:", res.message); alert(`Info: ${res.message}`); } } catch (error) { console.error("❌ Error assigning by store:", error); - alert("Error occurred during assignment"); + Swal.fire({ + icon: "error", + title: t("Error"), + text: t("Error occurred during assignment."), + confirmButtonText: t("Confirm"), + confirmButtonColor: "#8dba00" + }); + //alert("Error occurred during assignment"); } finally { setIsAssigning(false); } diff --git a/src/components/Jodetail/completeJobOrderRecord.tsx b/src/components/Jodetail/completeJobOrderRecord.tsx index 3742a0f..b744062 100644 --- a/src/components/Jodetail/completeJobOrderRecord.tsx +++ b/src/components/Jodetail/completeJobOrderRecord.tsx @@ -321,7 +321,7 @@ const CompleteJobOrderRecord: React.FC = ({ filterArgs }) => { if(response.success){ Swal.fire({ position: "bottom-end", - icon: "info", + icon: "success", text: t("Printed Successfully."), showConfirmButton: false, timer: 1500 diff --git a/src/i18n/zh/dashboard.json b/src/i18n/zh/dashboard.json index a7893e4..a75a248 100644 --- a/src/i18n/zh/dashboard.json +++ b/src/i18n/zh/dashboard.json @@ -56,5 +56,9 @@ "No": "無", "Responsible Escalation List": "負責的上報列表", "show completed logs": "顯示已完成上報", +<<<<<<< Updated upstream "Rows per page": "每頁行數" +======= + "Rows per page": "每頁行數" +>>>>>>> Stashed changes } diff --git a/src/i18n/zh/pickOrder.json b/src/i18n/zh/pickOrder.json index d3d1fdd..e6a81b1 100644 --- a/src/i18n/zh/pickOrder.json +++ b/src/i18n/zh/pickOrder.json @@ -257,7 +257,7 @@ "Pick Execution Detail":"進行提料詳情", "Submit Required Pick Qty":"提交所需提料數量", "Scan Result":"掃描結果", - "Ticket No.":"提票號碼", + "Ticket No.":"提單號碼", "Start QR Scan":"開始QR掃描", "Stop QR Scan":"停止QR掃描", "Scanning...":"掃描中...", @@ -367,9 +367,17 @@ "Enter missing quantity (required if no bad items)": "請輸入缺少數量(如果沒有不良項目)", "Submit All Scanned": "提交所有已掃描項目", "Submitting...": "提交中...", - "COMPLETED": "已完成" - - - + "COMPLETED": "已完成", + "Confirm print: (": "確認列印全部草稿?(總數量:", + "piece(s))": "份)", + "Printing...": "列印中", + "Please wait...": "請稍後", + "No available pick order(s) for this floor.": "此樓層沒有可用的提料單", + "You already have a pick order in progess. Please complete it first before taking next pick order.": "請先完成目前的提料單,再提取下一張", + "Error occurred during assignment.": "提料單分配錯誤", + "Info": "消息", + "Warning": "警告", + "Error": "錯誤", + "Batch Print": "批量列印" } \ No newline at end of file