|
|
|
@@ -24,11 +24,15 @@ import NewCreateItem from "./newcreatitem"; |
|
|
|
import AssignAndRelease from "./AssignAndRelease"; |
|
|
|
import AssignTo from "./assignTo"; |
|
|
|
import { fetchAllItemsInClient, ItemCombo } from "@/app/api/settings/item/actions"; |
|
|
|
import { fetchPickOrderClient, autoAssignAndReleasePickOrder, autoAssignAndReleasePickOrderByStore } from "@/app/api/pickOrder/actions"; |
|
|
|
import { fetchPickOrderClient, autoAssignAndReleasePickOrder, autoAssignAndReleasePickOrderByStore, FGPickOrderResponse, fetchFGPickOrders } from "@/app/api/pickOrder/actions"; |
|
|
|
import Jobcreatitem from "./Jobcreatitem"; |
|
|
|
import { useSession } from "next-auth/react"; |
|
|
|
import { SessionWithTokens } from "@/config/authConfig"; |
|
|
|
import PickExecutionDetail from "./GoodPickExecutiondetail"; |
|
|
|
import Swal from "sweetalert2"; |
|
|
|
import { PrintDeliveryNoteRequest, printDN } from "@/app/api/do/actions"; |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
pickOrders: PickOrderResult[]; |
|
|
|
} |
|
|
|
@@ -52,6 +56,9 @@ const PickOrderSearch: React.FC<Props> = ({ pickOrders }) => { |
|
|
|
const [tabIndex, setTabIndex] = useState(0); |
|
|
|
const [totalCount, setTotalCount] = useState<number>(); |
|
|
|
const [isAssigning, setIsAssigning] = useState(false); |
|
|
|
|
|
|
|
const [fgPickOrdersData, setFgPickOrdersData] = useState<FGPickOrderResponse[]>([]); |
|
|
|
|
|
|
|
const handleAssignByStore = async (storeId: "2/F" | "4/F") => { |
|
|
|
if (!currentUserId) { |
|
|
|
console.error("Missing user id in session"); |
|
|
|
@@ -109,6 +116,101 @@ const PickOrderSearch: React.FC<Props> = ({ pickOrders }) => { |
|
|
|
setIsOpenCreateModal(false) |
|
|
|
}, []) |
|
|
|
|
|
|
|
const handleDN = useCallback(async () =>{ |
|
|
|
const askNumofCarton = await Swal.fire({ |
|
|
|
title: t("Enter the number of cartons: "), |
|
|
|
input: "number", |
|
|
|
inputPlaceholder: t("Number of cartons"), |
|
|
|
inputAttributes:{ |
|
|
|
min: "1", |
|
|
|
step: "1" |
|
|
|
}, |
|
|
|
inputValidator: (value) => { |
|
|
|
if(!value){ |
|
|
|
return t("You need to enter a number") |
|
|
|
} |
|
|
|
if(parseInt(value) < 1){ |
|
|
|
return t("Number must be at least 1"); |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
showCancelButton: true, |
|
|
|
confirmButtonText: t("Confirm"), |
|
|
|
cancelButtonText: t("Cancel"), |
|
|
|
showLoaderOnConfirm: true, |
|
|
|
allowOutsideClick: () => !Swal.isLoading() |
|
|
|
}); |
|
|
|
|
|
|
|
if (askNumofCarton.isConfirmed) { |
|
|
|
const numOfCartons = askNumofCarton.value; |
|
|
|
console.log(numOfCartons) |
|
|
|
} |
|
|
|
},[t]); |
|
|
|
|
|
|
|
const handleDNandLabel = useCallback(async () =>{ |
|
|
|
const askNumofCarton = await Swal.fire({ |
|
|
|
title: t("Enter the number of cartons: "), |
|
|
|
input: "number", |
|
|
|
inputPlaceholder: t("Number of cartons"), |
|
|
|
inputAttributes:{ |
|
|
|
min: "1", |
|
|
|
step: "1" |
|
|
|
}, |
|
|
|
inputValidator: (value) => { |
|
|
|
if(!value){ |
|
|
|
return t("You need to enter a number") |
|
|
|
} |
|
|
|
if(parseInt(value) < 1){ |
|
|
|
return t("Number must be at least 1"); |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
showCancelButton: true, |
|
|
|
confirmButtonText: t("Confirm"), |
|
|
|
cancelButtonText: t("Cancel"), |
|
|
|
showLoaderOnConfirm: true, |
|
|
|
allowOutsideClick: () => !Swal.isLoading() |
|
|
|
}); |
|
|
|
|
|
|
|
if (askNumofCarton.isConfirmed) { |
|
|
|
const numOfCartons = askNumofCarton.value; |
|
|
|
} |
|
|
|
},[t]); |
|
|
|
|
|
|
|
const handleLabel = useCallback(async () =>{ |
|
|
|
const askNumofCarton = await Swal.fire({ |
|
|
|
title: t("Enter the number of cartons: "), |
|
|
|
input: "number", |
|
|
|
inputPlaceholder: t("Number of cartons"), |
|
|
|
inputAttributes:{ |
|
|
|
min: "1", |
|
|
|
step: "1" |
|
|
|
}, |
|
|
|
inputValidator: (value) => { |
|
|
|
if(!value){ |
|
|
|
return t("You need to enter a number") |
|
|
|
} |
|
|
|
if(parseInt(value) < 1){ |
|
|
|
return t("Number must be at least 1"); |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
showCancelButton: true, |
|
|
|
confirmButtonText: t("Confirm"), |
|
|
|
cancelButtonText: t("Cancel"), |
|
|
|
showLoaderOnConfirm: true, |
|
|
|
allowOutsideClick: () => !Swal.isLoading() |
|
|
|
}); |
|
|
|
|
|
|
|
if (askNumofCarton.isConfirmed) { |
|
|
|
const numOfCartons = askNumofCarton.value; |
|
|
|
} |
|
|
|
},[t]); |
|
|
|
|
|
|
|
const handleDraft = useCallback(async () =>{ |
|
|
|
|
|
|
|
},[t]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
@@ -294,10 +396,10 @@ const PickOrderSearch: React.FC<Props> = ({ pickOrders }) => { |
|
|
|
{/* First 4 buttons aligned left */} |
|
|
|
<Grid item xs={6}> |
|
|
|
<Stack direction="row" spacing={1}> |
|
|
|
<Button variant="contained">{t("Print Draft")}</Button> |
|
|
|
<Button variant="contained">{t("Print Pick Order and DN Label")}</Button> |
|
|
|
<Button variant="contained">{t("Print Pick Order")}</Button> |
|
|
|
<Button variant="contained">{t("Print DN Label")}</Button> |
|
|
|
<Button variant="contained" onClick={handleDraft}>{t("Print Draft")}</Button> |
|
|
|
<Button variant="contained" onClick={handleDNandLabel}>{t("Print Pick Order and DN Label")}</Button> |
|
|
|
<Button variant="contained" onClick={handleDN}>{t("Print Pick Order")}</Button> |
|
|
|
<Button variant="contained" onClick={handleLabel}>{t("Print DN Label")}</Button> |
|
|
|
</Stack> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
|