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,
]);
useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// alert("hih")
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// && 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) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -875,17 +875,36 @@ const BSC1Payment = (props) => {
Discount,
]);
useEffect(() => {
let data = {
const fetchPrinterMapping = async () => {
try {
if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
const data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// && 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();
handleOtherData();
}, []);
const handlePrintMappingClick = () => {
// setReprint1(true)
window.dispatchEvent(new Event('CLICK PRINTER MAPPING'));
};
useEffect(() => {
if (!preferenceshortcutkey) return;

View File

@ -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={
<div className="PrinterSettingTab">
<Tabs
defaultActiveKey="reprint"
defaultActiveKey={printSettingsShow ? "printSettings" : "reprint"}
type="card"
onChange={(activeKey) => {
if (activeKey === 'reprint') {

View File

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