| @@ -24,16 +24,12 @@ 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, FGPickOrderResponse, fetchFGPickOrders } from "@/app/api/pickOrder/actions"; | |||
| import { fetchPickOrderClient, autoAssignAndReleasePickOrder, autoAssignAndReleasePickOrderByStore } 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 GoodPickExecutionRecord from "./GoodPickExecutionRecord"; | |||
| import Swal from "sweetalert2"; | |||
| import { PrintDeliveryNoteRequest, printDN } from "@/app/api/do/actions"; | |||
| interface Props { | |||
| pickOrders: PickOrderResult[]; | |||
| } | |||
| @@ -69,9 +65,6 @@ const PickOrderSearch: React.FC<Props> = ({ pickOrders }) => { | |||
| window.addEventListener('pickOrderAssigned', onAssigned); | |||
| return () => window.removeEventListener('pickOrderAssigned', onAssigned); | |||
| }, []); | |||
| const [fgPickOrdersData, setFgPickOrdersData] = useState<FGPickOrderResponse[]>([]); | |||
| const handleAssignByStore = async (storeId: "2/F" | "4/F") => { | |||
| if (!currentUserId) { | |||
| console.error("Missing user id in session"); | |||
| @@ -129,101 +122,6 @@ 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(() => { | |||
| @@ -417,18 +315,6 @@ const PickOrderSearch: React.FC<Props> = ({ pickOrders }) => { | |||
| </Typography> | |||
| </Box> | |||
| </Grid> | |||
| </Grid> | |||
| {/* First 4 buttons aligned left */} | |||
| <Grid item xs={6}> | |||
| <Stack direction="row" spacing={1}> | |||
| <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> | |||
| {/* Last 2 buttons aligned right */} | |||
| <Grid item xs={6} > | |||