Merge pull request 'FIX #247 Printer mapping open automatically' (#248) from March-3-deployment into main

Reviewed-on: Pozomind/pozo-retail-app#248
This commit is contained in:
karthikalakshmi 2026-03-05 18:58:30 +05:30
commit 4aca59f4d2
10 changed files with 253 additions and 84 deletions

View File

@ -636,17 +636,35 @@ export default function BST1Payment() {
Discount, Discount,
]); ]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
// const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// alert("hih") if (response?.data?.statusCode === 0) {
// dispatch(getPrintSelectionComponentData(Data1)).unwrap(); 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 //mohan stoped data
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {

View File

@ -722,16 +722,35 @@ const BSBillingTable2 = () => {
Discount, Discount,
]); ]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
// const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).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(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup || NavBarOptions?.some((e) => e?.OptionName == 'Hold')) { if (holdCheckedSalesSetup || NavBarOptions?.some((e) => e?.OptionName == 'Hold')) {

View File

@ -711,17 +711,35 @@ const BSBillingTable3Pay = () => {
Discount, Discount,
]); ]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
// const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).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(() => { useEffect(() => {
(!CustomerMobileNumber && isOtpEnabled && salesaskiosk) && setCustomerOtpmodalopen(true); (!CustomerMobileNumber && isOtpEnabled && salesaskiosk) && setCustomerOtpmodalopen(true);
}, [PrintOrderDetails, CustomerMobileNumber]); }, [PrintOrderDetails, CustomerMobileNumber]);

View File

@ -539,16 +539,35 @@ const BSBilling4Payment = () => {
} }
}, [OrderCardDetail]); }, [OrderCardDetail]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).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(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {

View File

@ -565,16 +565,35 @@ const BSBillingTable5 = () => {
} }
}, [OrderCardDetail]); }, [OrderCardDetail]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
// const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).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(() => { useEffect(() => {
if (selOption) { if (selOption) {
closePrintOption(); closePrintOption();

View File

@ -690,16 +690,35 @@ const BST6Payment = () => {
Discount, Discount,
]); ]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
// const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).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 //mohan stoped data
useEffect(() => { useEffect(() => {
if ( if (

View File

@ -684,16 +684,35 @@ const BSBilling7Payment = () => {
Discount, Discount,
]); ]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
// const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).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(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) { if (holdCheckedSalesSetup) {

View File

@ -875,17 +875,36 @@ const BSC1Payment = (props) => {
Discount, Discount,
]); ]);
useEffect(() => { useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); // && isMobile && MobileA4Print
// const Data1 = { AppId, CompId, BranchId }; const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).unwrap(); if (response?.data?.statusCode === 0) {
handlePrintMappingClick()
}
console.log(response, "printer mapping response");
}
} catch (error) {
console.error("Error fetching printer mapping:", error);
}
};
fetchPrinterMapping();
handleOtherData(); handleOtherData();
}, []); }, []);
const handlePrintMappingClick = () => {
// setReprint1(true)
window.dispatchEvent(new Event('CLICK PRINTER MAPPING'));
};
useEffect(() => { useEffect(() => {
if (!preferenceshortcutkey) return; if (!preferenceshortcutkey) return;

View File

@ -62,7 +62,7 @@ const BSPrinterSetting = ({
const printmodelOpen = () => { const printmodelOpen = () => {
setOpenModel(true); setOpenModel(true);
setReprintShow(true); setReprintShow(true);
setPrintSettingsShow(true); // setPrintSettingsShow(true);
// dispatch(changeSelectedPrintdummyData(false)); // dispatch(changeSelectedPrintdummyData(false));
}; };
const preferenceshortcutkey = SettingDataSelector?.[0]?.[ const preferenceshortcutkey = SettingDataSelector?.[0]?.[
@ -111,6 +111,25 @@ const BSPrinterSetting = ({
window.removeEventListener('CLICK REPRINT', printmodelOpen); 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 // printmodelOpen
useEffect(() => { useEffect(() => {
@ -252,7 +271,7 @@ const BSPrinterSetting = ({
children={ children={
<div className="PrinterSettingTab"> <div className="PrinterSettingTab">
<Tabs <Tabs
defaultActiveKey="reprint" defaultActiveKey={printSettingsShow ? "printSettings" : "reprint"}
type="card" type="card"
onChange={(activeKey) => { onChange={(activeKey) => {
if (activeKey === 'reprint') { if (activeKey === 'reprint') {

View File

@ -245,7 +245,7 @@ const PreferenceList = () => {
res?.data?.data?.map((i) => ({ res?.data?.data?.map((i) => ({
SettingIdName: i.ConfigName, SettingIdName: i.ConfigName,
SettingId: i.ConfigId, SettingId: i.ConfigId,
Comments: 'Enter Comment', Comments: i.Comments || "",
SettingValue: 'N', SettingValue: 'N',
})) }))
); );
@ -380,7 +380,7 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
? values.retailshortname || "" ? values.retailshortname || ""
: key === "wholesaleshortname" : key === "wholesaleshortname"
? values.wholesaleshortname || "" ? values.wholesaleshortname || ""
: setting.Comments || "Enter Comment", : setting.Comments || "",
SettingValue: SettingValue:
key === "retailshortname" || key === "wholesaleshortname" key === "retailshortname" || key === "wholesaleshortname"