diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx index b1b3f14..fbd7340 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx @@ -636,17 +636,35 @@ export default function BST1Payment() { Discount, ]); useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, - }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - // const Data1 = { AppId, CompId, BranchId }; - // alert("hih") - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); - }, []); + + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; + // && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } + }; + + fetchPrinterMapping(); + + }, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; //mohan stoped data useEffect(() => { if (CompId && BranchId && AppId) { diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx index 7892c93..31ec053 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx @@ -722,16 +722,35 @@ const BSBillingTable2 = () => { Discount, ]); useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, - }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - // const Data1 = { AppId, CompId, BranchId }; - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); - }, []); + + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; + // && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } + }; + + fetchPrinterMapping(); + + }, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; useEffect(() => { if (CompId && BranchId && AppId) { if (holdCheckedSalesSetup || NavBarOptions?.some((e) => e?.OptionName == 'Hold')) { diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx index b25a613..d6ecf2f 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx @@ -710,18 +710,36 @@ const BSBillingTable3Pay = () => { OtherServiceTicketClaim, Discount, ]); - useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, - }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - // const Data1 = { AppId, CompId, BranchId }; - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); - }, []); + useEffect(() => { + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; +// && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } + }; + + fetchPrinterMapping(); + +}, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; useEffect(() => { (!CustomerMobileNumber && isOtpEnabled && salesaskiosk) && setCustomerOtpmodalopen(true); }, [PrintOrderDetails, CustomerMobileNumber]); diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx index 908c4a1..08f3b9e 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx @@ -539,16 +539,35 @@ const BSBilling4Payment = () => { } }, [OrderCardDetail]); useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, - }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - const Data1 = { AppId, CompId, BranchId }; - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); - }, []); + + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; + // && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } + }; + + fetchPrinterMapping(); + + }, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; useEffect(() => { if (salesBillEdit) { diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx index 7c44ca6..f688d3b 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx @@ -565,16 +565,35 @@ const BSBillingTable5 = () => { } }, [OrderCardDetail]); useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, - }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - // const Data1 = { AppId, CompId, BranchId }; - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); - }, []); + + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; + // && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } + }; + + fetchPrinterMapping(); + + }, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; useEffect(() => { if (selOption) { closePrintOption(); diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx index adaf9e1..d473333 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx @@ -690,16 +690,35 @@ const BST6Payment = () => { Discount, ]); useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, - }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - // const Data1 = { AppId, CompId, BranchId }; - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); - }, []); + + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; + // && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } + }; + + fetchPrinterMapping(); + + }, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; //mohan stoped data useEffect(() => { if ( diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx index 8bf8247..d0f6d14 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx @@ -683,17 +683,36 @@ const BSBilling7Payment = () => { OtherServiceTicketClaim, Discount, ]); - useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, + useEffect(() => { + + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; + // && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - // const Data1 = { AppId, CompId, BranchId }; - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); + + fetchPrinterMapping(); + }, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; useEffect(() => { if (CompId && BranchId && AppId) { if (holdCheckedSalesSetup) { diff --git a/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx b/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx index e6fef5c..b45815a 100644 --- a/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx @@ -874,18 +874,37 @@ const BSC1Payment = (props) => { OtherServiceTicketClaim, Discount, ]); - useEffect(() => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - UserId: UserId, + useEffect(() => { + + const fetchPrinterMapping = async () => { + try { + if (UserType !== 'Super Admin' && isMobile && MobileA4Print) { + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + UserId: UserId, + }; + // && isMobile && MobileA4Print + const response = await dispatch(getPrinterMappingDetails(data)).unwrap(); + if (response?.data?.statusCode === 0) { + handlePrintMappingClick() + } + console.log(response, "printer mapping response"); + } + } catch (error) { + console.error("Error fetching printer mapping:", error); + } }; - dispatch(getPrinterMappingDetails(data)).unwrap(); - // const Data1 = { AppId, CompId, BranchId }; - // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); + + fetchPrinterMapping(); handleOtherData(); }, []); + const handlePrintMappingClick = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK PRINTER MAPPING')); + }; + useEffect(() => { if (!preferenceshortcutkey) return; diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx index 3ecf60b..990ea68 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx @@ -62,7 +62,7 @@ const BSPrinterSetting = ({ const printmodelOpen = () => { setOpenModel(true); setReprintShow(true); - setPrintSettingsShow(true); + // setPrintSettingsShow(true); // dispatch(changeSelectedPrintdummyData(false)); }; const preferenceshortcutkey = SettingDataSelector?.[0]?.[ @@ -111,6 +111,25 @@ const BSPrinterSetting = ({ window.removeEventListener('CLICK REPRINT', printmodelOpen); }; }, []); + useEffect(() => { + window.addEventListener('CLICK PRINTER MAPPING', printmappingOpen); + return () => { + window.removeEventListener('CLICK PRINTER MAPPING', printmappingOpen); + }; + }, []); + const printmappingOpen = () => { + setOpenModel(true); + // Open Print Settings tab + setPrintSettingsShow(true); + setReprintShow(false); + setReceiptReprintShow(false); + + // Trigger printer list + setTimeout(() => { + openPrinter(); + }, 500); + + } // printmodelOpen useEffect(() => { @@ -252,7 +271,7 @@ const BSPrinterSetting = ({ children={