diff --git a/src/app/(main)/settings/qrCodeHandle/page.tsx b/src/app/(main)/settings/qrCodeHandle/page.tsx
index e0a84c7..d363561 100644
--- a/src/app/(main)/settings/qrCodeHandle/page.tsx
+++ b/src/app/(main)/settings/qrCodeHandle/page.tsx
@@ -4,6 +4,7 @@ import Typography from "@mui/material/Typography";
import { getServerI18n } from "@/i18n";
import QrCodeHandleSearchWrapper from "@/components/qrCodeHandles/qrCodeHandleSearchWrapper";
import QrCodeHandleEquipmentSearchWrapper from "@/components/qrCodeHandles/qrCodeHandleEquipmentSearchWrapper";
+import QrCodeHandleWarehouseSearchWrapper from "@/components/qrCodeHandles/qrCodeHandleWarehouseSearchWrapper";
import QrCodeHandleTabs from "@/components/qrCodeHandles/qrCodeHandleTabs";
import { I18nProvider } from "@/i18n";
import Box from "@mui/material/Box";
@@ -19,7 +20,7 @@ const QrCodeHandlePage: React.FC = async () => {
{t("QR Code Handle")}
-
+
}>
@@ -35,6 +36,13 @@ const QrCodeHandlePage: React.FC = async () => {
}
+ warehouseTabContent={
+ }>
+
+
+
+
+ }
/>
diff --git a/src/app/api/do/actions.tsx b/src/app/api/do/actions.tsx
index 5007a80..ff20f0a 100644
--- a/src/app/api/do/actions.tsx
+++ b/src/app/api/do/actions.tsx
@@ -131,6 +131,21 @@ export interface getTicketReleaseTable {
handlerName: string | null;
numberOfFGItems: number;
}
+
+export interface TruckScheduleDashboardItem {
+ storeId: string | null;
+ truckId: number | null;
+ truckLanceCode: string | null;
+ truckDepartureTime: string | number[] | null;
+ numberOfShopsToServe: number;
+ numberOfPickTickets: number;
+ totalItemsToPick: number;
+ numberOfTicketsReleased: number;
+ firstTicketStartTime: string | number[] | null;
+ numberOfTicketsCompleted: number;
+ lastTicketEndTime: string | number[] | null;
+ pickTimeTakenMinutes: number | null;
+}
export interface SearchDeliveryOrderInfoRequest {
code: string;
shopName: string;
@@ -181,6 +196,15 @@ export const fetchTicketReleaseTable = cache(async (startDate: string, endDate:
}
);
});
+
+export const fetchTruckScheduleDashboard = cache(async () => {
+ return await serverFetchJson(
+ `${BASE_API_URL}/doPickOrder/truck-schedule-dashboard`,
+ {
+ method: "GET",
+ }
+ );
+});
export const startBatchReleaseAsyncSingle = cache(async (data: { doId: number; userId: number }) => {
const { doId, userId } = data;
return await serverFetchJson<{ id: number|null; code: string; entity?: any }>(
diff --git a/src/app/api/do/client.ts b/src/app/api/do/client.ts
new file mode 100644
index 0000000..8adddde
--- /dev/null
+++ b/src/app/api/do/client.ts
@@ -0,0 +1,16 @@
+"use client";
+
+import {
+ fetchTruckScheduleDashboard,
+ type TruckScheduleDashboardItem
+} from "./actions";
+
+export const fetchTruckScheduleDashboardClient = async (): Promise => {
+ return await fetchTruckScheduleDashboard();
+};
+
+export type { TruckScheduleDashboardItem };
+
+export default fetchTruckScheduleDashboardClient;
+
+
diff --git a/src/app/api/warehouse/client.ts b/src/app/api/warehouse/client.ts
new file mode 100644
index 0000000..454d48a
--- /dev/null
+++ b/src/app/api/warehouse/client.ts
@@ -0,0 +1,33 @@
+"use client";
+
+import { NEXT_PUBLIC_API_URL } from "@/config/api";
+import { WarehouseResult } from "./index";
+
+export const exportWarehouseQrCode = async (warehouseIds: number[]): Promise<{ blobValue: Uint8Array; filename: string }> => {
+
+ const token = localStorage.getItem("accessToken");
+
+ const response = await fetch(`${NEXT_PUBLIC_API_URL}/warehouse/export-qrcode`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ ...(token && { Authorization: `Bearer ${token}` }),
+ },
+ body: JSON.stringify({ warehouseIds }),
+ });
+
+ if (!response.ok) {
+ if (response.status === 401) {
+ throw new Error("Unauthorized: Please log in again");
+ }
+ throw new Error(`Failed to export QR code: ${response.status} ${response.statusText}`);
+ }
+
+ const filename = response.headers.get("Content-Disposition")?.split("filename=")[1]?.replace(/"/g, "") || "warehouse_qrcode.pdf";
+
+ const blob = await response.blob();
+ const arrayBuffer = await blob.arrayBuffer();
+ const blobValue = new Uint8Array(arrayBuffer);
+
+ return { blobValue, filename };
+};
diff --git a/src/components/CreateItem/CreateItem.tsx b/src/components/CreateItem/CreateItem.tsx
index 69b8e9e..f4fd8e2 100644
--- a/src/components/CreateItem/CreateItem.tsx
+++ b/src/components/CreateItem/CreateItem.tsx
@@ -159,9 +159,8 @@ const CreateItem: React.FC = ({
console.log(qcCheck);
// return
// do api
- console.log("asdad");
const responseI = await saveItem(data);
- console.log("asdad");
+
const responseQ = await saveItemQcChecks(qcCheck);
if (responseI && responseQ) {
if (!Boolean(responseI.id)) {
diff --git a/src/components/DashboardPage/DashboardPage.tsx b/src/components/DashboardPage/DashboardPage.tsx
index f2d0dad..d417a8a 100644
--- a/src/components/DashboardPage/DashboardPage.tsx
+++ b/src/components/DashboardPage/DashboardPage.tsx
@@ -17,6 +17,7 @@ import CollapsibleCard from "../CollapsibleCard";
// import SupervisorQcApproval, { IQCItems } from "./QC/SupervisorQcApproval";
import { EscalationResult } from "@/app/api/escalation";
import EscalationLogTable from "./escalation/EscalationLogTable";
+import { TruckScheduleDashboard } from "./truckSchedule";
type Props = {
// iqc: IQCItems[] | undefined
escalationLogs: EscalationResult[]
@@ -42,6 +43,13 @@ const DashboardPage: React.FC = ({
return (
+
+
+
+
+
+
+
{
+ const { t } = useTranslation("dashboard");
+ const [selectedStore, setSelectedStore] = useState("");
+ const [data, setData] = useState([]);
+ const [loading, setLoading] = useState(true);
+ // Initialize as null to avoid SSR/client hydration mismatch
+ const [currentTime, setCurrentTime] = useState(null);
+ const [isClient, setIsClient] = useState(false);
+ const completedTrackerRef = useRef