FIX #247 Printer mapping open automatically

This commit is contained in:
karthikalakshmi 2026-03-05 18:57:41 +05:30
parent bdf77905a4
commit 2e10a1a521
10 changed files with 253 additions and 84 deletions

View File

@ -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) {

View File

@ -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')) {

View File

@ -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]);

View File

@ -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) {

View File

@ -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();

View File

@ -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 (

View File

@ -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) {

View File

@ -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;

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"