From 38a0494c6c181877d8d81ed725b54cafb741426f Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Tue, 3 Mar 2026 09:57:22 +0530 Subject: [PATCH] Update src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx --- .../ThermalPrinter/PrintStyle11.jsx | 295 +++++++++--------- 1 file changed, 142 insertions(+), 153 deletions(-) diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx index b30bfc9..1d5a721 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx @@ -105,9 +105,9 @@ const PrintStyle11 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); - const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( + const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'PrintUom' - )?.[0]; + )?.[0]; const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -467,8 +467,8 @@ const PrintStyle11 = ({ : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} */}
+ {SalesModePref?.SettingValue == 'Y' &&
+ {' '} + Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '} +
}
)} {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && ( @@ -494,8 +498,8 @@ const PrintStyle11 = ({ style={{ textTransform: 'uppercase', textAlign: 'center' }} > Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} */} )}
@@ -685,87 +689,65 @@ const PrintStyle11 = ({ ? item?.BrandName : ''}   - {item?.ProductIdentifierDtls?.length > - 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { +
+ {item?.ProductIdentifierDtls?.map((detail, index) => { + const serial = detail.SerialNumber?.trim(); + const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(', '); + const description = detail.Description?.trim(); + + // Skip if nothing exists + if (!serial && !imeis && !description) return null; + return ( -
{a.SerialNumber}
- ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > - 0 - ? item?.ProductIdentifierDtls.filter( - (item1) => - item1.IMEI1 !== '' || - item1.IMEI2 !== '' - )?.map((item2) => { - const imei1 = item2.IMEI1 || ''; - const imei2 = item2.IMEI2 || ''; - return ( -
- {[imei1, imei2] - .filter(Boolean) - .join(',')} +
+ {/* Serial + IMEI in one line */} + {(serial || imeis) && ( +
+ {serial &&
{serial}
} + {imei &&
{imeis}
} +
+ )} + {/* Description on new line */} + {description &&
{description}
}
); - }) - : ''} + })} +
) : (
- {UomPrint?.SettingValue === 'Y' - ? `${item?.Size || '1'} ${ - item?.SinglePc === 'Y' - ? 'PCS' - : item?.Type !== 'C' - ? item?.UomName - : 'COMBO' - }` - : '' - } + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) {item?.BrandName !== null ? item?.BrandName : ''}   - {item?.ProductIdentifierDtls?.length > - 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { +
+ {item?.ProductIdentifierDtls?.map((detail, index) => { + const serial = detail.SerialNumber; + const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(','); + const description = detail.Description; + + // Only render if at least one value exists + if (!serial && !imeis && !description) return null; + return ( -
{a.SerialNumber}
- ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > - 0 - ? item?.ProductIdentifierDtls.filter( - (item1) => - item1.IMEI1 !== '' || - item1.IMEI2 !== '' - )?.map((item2) => { - const imei1 = item2.IMEI1 || ''; - const imei2 = item2.IMEI2 || ''; - return ( -
- {[imei1, imei2] - .filter(Boolean) - .join(',')} +
+
+ {serial &&
{serial}
} + {imeis &&
{imeis}
} +
+ {description &&
{description}
}
); - }) - : ''} + })} +
+
)} @@ -1020,8 +1002,6 @@ const PrintStyle11 = ({ }} >
{item?.ProdName}
- {UomPrint?.SettingValue === 'Y' && -
({item?.Size ? item?.Size : '1'}{' '} {item?.SinglePc == 'Y' @@ -1031,7 +1011,6 @@ const PrintStyle11 = ({ : 'COMBO'} )
- } )} {GlobaldummyData @@ -3124,8 +3103,8 @@ const PrintStyle11 = ({ : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} */}
+ {SalesModePref?.SettingValue == 'Y' &&
+ {' '} + Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '} +
}
)} {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} */}
)} @@ -3288,70 +3271,53 @@ const PrintStyle11 = ({ (pkg) => pkg.ProdId === item.ProdId ).length > 0 ? (
- {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) + {/* Package Details */} + {PackageDetails?.filter(pkg => pkg.ProdId === item.ProdId)?.map((pkg, idx) => ( + + {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType}) ))} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
{a.SerialNumber}
- ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls.filter( - (item1) => - item1.IMEI1 !== '' || - item1.IMEI2 !== '' - )?.map((item2) => { - const imei1 = item2.IMEI1 || ''; - const imei2 = item2.IMEI2 || ''; - return ( -
- {[imei1, imei2] - .filter(Boolean) - .join(',')} -
- ); - }) - : ''} + + {item?.BrandName &&
{item.BrandName}
} + + {/* Product Identifiers */} + {item?.ProductIdentifierDtls?.map((detail, idx) => { + const serial = detail.SerialNumber?.trim(); + const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(', '); + const description = detail.Description?.trim(); + + // Skip if nothing exists + if (!serial && !imeis && !description) return null; + + return ( +
+ {/* Serial + IMEIs on one line */} + {(serial || imeis) && ( +
+ {serial &&
{serial}
} + {imeis &&
{imeis}
} +
+ )} + {/* Description on new line */} + {description &&
{description}
} +
+ ); + })}
) : (
- {UomPrint?.SettingValue === 'Y' - ? `${item?.Size || '1'} ${ - item?.SinglePc === 'Y' - ? 'PCS' - : item?.Type !== 'C' - ? item?.UomName - : 'COMBO' - }` - : '' - } - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 + {UomPrint?.SettingValue === 'Y' && ( +
+ ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'}) +
+ )} + {item?.BrandName &&
{item.BrandName}
} + {/* {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls?.filter( (items) => !( @@ -3380,7 +3346,31 @@ const PrintStyle11 = ({
); }) - : ''} + : ''} */} +
+ {item?.ProductIdentifierDtls?.map((detail, index) => { + const serial = detail.SerialNumber?.trim(); + const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(', '); + const description = detail.Description?.trim(); + + // Skip if nothing exists + if (!serial && !imeis && !description) return null; + + return ( +
+ {/* Serial + IMEIs on one line */} + {(serial || imeis) && ( +
+ {serial &&
{serial}
} + {imeis &&
{imeis}
} +
+ )} + {/* Description on new line */} + {description &&
{description}
} +
+ ); + })} +
)} @@ -3600,18 +3590,17 @@ const PrintStyle11 = ({ }} >
{item?.ProdName}
- {UomPrint?.SettingValue === 'Y' && - -
- ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
- } + {UomPrint?.SettingValue === 'Y' && ( +
+ ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'}) +
+ )} + {item?.BrandName &&
{item.BrandName}
} )} {GlobaldummyData