Update src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx

This commit is contained in:
karthikalakshmi 2026-03-03 09:57:22 +05:30
parent a4dffb91df
commit 38a0494c6c
1 changed files with 142 additions and 153 deletions

View File

@ -105,9 +105,9 @@ const PrintStyle11 = ({
const GlobalLogo = useSelector(GlobalprintLogo); const GlobalLogo = useSelector(GlobalprintLogo);
const GlobalCredit = useSelector(GlobalprintCredit); const GlobalCredit = useSelector(GlobalprintCredit);
const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor);
const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter(
(i) => i.SettingIdName === 'PrintUom' (i) => i.SettingIdName === 'PrintUom'
)?.[0]; )?.[0];
const estimatePrintHeader = const estimatePrintHeader =
SettingData?.[0]?.SettingDtlDetails?.find( SettingData?.[0]?.SettingDtlDetails?.find(
(setting) => (setting) =>
@ -467,8 +467,8 @@ const PrintStyle11 = ({
: PaymentStatusSuccess?.length === 1 : PaymentStatusSuccess?.length === 1
? PaymentStatusSuccess?.[0]?.PaymentTypeName ? PaymentStatusSuccess?.[0]?.PaymentTypeName
: ''}{' '} : ''}{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode})`} `(${table2Data?.SalesMode})`} */}
</div> </div>
<div <div
style={{ style={{
@ -487,6 +487,10 @@ const PrintStyle11 = ({
table2Data?.FYStatus table2Data?.FYStatus
)} )}
</div> </div>
{SalesModePref?.SettingValue == 'Y' && <div style={{ fontSize: '13px', margin: '0rem 0.5rem', fontWeight: 600 }}>
{' '}
Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}
</div>}
</div> </div>
)} )}
{!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && ( {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
@ -494,8 +498,8 @@ const PrintStyle11 = ({
style={{ textTransform: 'uppercase', textAlign: 'center' }} style={{ textTransform: 'uppercase', textAlign: 'center' }}
> >
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode})`} `(${table2Data?.SalesMode})`} */}
</div> </div>
)} )}
<hr className="PrintStyle11-print-dottline" /> <hr className="PrintStyle11-print-dottline" />
@ -685,87 +689,65 @@ const PrintStyle11 = ({
? item?.BrandName ? item?.BrandName
: ''} : ''}
&nbsp; &nbsp;
{item?.ProductIdentifierDtls?.length > <div style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>
0 {item?.ProductIdentifierDtls?.map((detail, index) => {
? item?.ProductIdentifierDtls?.filter( const serial = detail.SerialNumber?.trim();
(items) => const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(', ');
!( const description = detail.Description?.trim();
items.SerialNumber == '' ||
items.SerialNumber == null // Skip if nothing exists
) if (!serial && !imeis && !description) return null;
)?.map((a) => {
return ( return (
<div>{a.SerialNumber}</div> <div key={index} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
); {/* Serial + IMEI in one line */}
}) {(serial || imeis) && (
: ''}{' '} <div style={{ display: 'flex', gap: '3px' }}>
{item?.ProductIdentifierDtls?.length > {serial && <div>{serial}</div>}
0 {imei && <div>{imeis}</div>}
? item?.ProductIdentifierDtls.filter( </div>
(item1) => )}
item1.IMEI1 !== '' || {/* Description on new line */}
item1.IMEI2 !== '' {description && <div>{description}</div>}
)?.map((item2) => {
const imei1 = item2.IMEI1 || '';
const imei2 = item2.IMEI2 || '';
return (
<div>
{[imei1, imei2]
.filter(Boolean)
.join(',')}
</div> </div>
); );
}) })}
: ''} </div>
</div> </div>
) : ( ) : (
<div> <div>
{UomPrint?.SettingValue === 'Y' ({item?.Size ? item?.Size : '1'}{' '}
? `${item?.Size || '1'} ${ {item?.SinglePc == 'Y'
item?.SinglePc === 'Y' ? 'PCS'
? 'PCS' : item?.Type != 'C'
: item?.Type !== 'C' ? item?.UomName
? item?.UomName : 'COMBO'}
: 'COMBO' )
}`
: ''
}
{item?.BrandName !== null {item?.BrandName !== null
? item?.BrandName ? item?.BrandName
: ''} : ''}
&nbsp; &nbsp;
{item?.ProductIdentifierDtls?.length > <div style={{ display: 'flex', gap: "3px", flexWrap: 'wrap' }}>
0 {item?.ProductIdentifierDtls?.map((detail, index) => {
? item?.ProductIdentifierDtls?.filter( const serial = detail.SerialNumber;
(items) => const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(',');
!( const description = detail.Description;
items.SerialNumber == '' ||
items.SerialNumber == null // Only render if at least one value exists
) if (!serial && !imeis && !description) return null;
)?.map((a) => {
return ( return (
<div>{a.SerialNumber}</div> <div key={index} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
); <div style={{ display: 'flex', gap: '3px' }}>
}) {serial && <div>{serial}</div>}
: ''}{' '} {imeis && <div>{imeis}</div>}
{item?.ProductIdentifierDtls?.length > </div>
0 {description && <div>{description}</div>}
? item?.ProductIdentifierDtls.filter(
(item1) =>
item1.IMEI1 !== '' ||
item1.IMEI2 !== ''
)?.map((item2) => {
const imei1 = item2.IMEI1 || '';
const imei2 = item2.IMEI2 || '';
return (
<div>
{[imei1, imei2]
.filter(Boolean)
.join(',')}
</div> </div>
); );
}) })}
: ''} </div>
</div> </div>
)} )}
</td> </td>
@ -1020,8 +1002,6 @@ const PrintStyle11 = ({
}} }}
> >
<div>{item?.ProdName}</div> <div>{item?.ProdName}</div>
{UomPrint?.SettingValue === 'Y' &&
<div> <div>
({item?.Size ? item?.Size : '1'}{' '} ({item?.Size ? item?.Size : '1'}{' '}
{item?.SinglePc == 'Y' {item?.SinglePc == 'Y'
@ -1031,7 +1011,6 @@ const PrintStyle11 = ({
: 'COMBO'} : 'COMBO'}
) )
</div> </div>
}
</td> </td>
)} )}
{GlobaldummyData {GlobaldummyData
@ -3124,8 +3103,8 @@ const PrintStyle11 = ({
: PaymentStatusSuccess?.length === 1 : PaymentStatusSuccess?.length === 1
? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill'
: ''}{' '} : ''}{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode})`} `(${table2Data?.SalesMode})`} */}
</div> </div>
<div <div
style={{ style={{
@ -3144,13 +3123,17 @@ const PrintStyle11 = ({
table2Data?.FYStatus table2Data?.FYStatus
)} )}
</div> </div>
{SalesModePref?.SettingValue == 'Y' && <div style={{ fontSize: '13px', margin: '0rem 0.5rem', fontWeight: 600 }}>
{' '}
Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}
</div>}
</div> </div>
)} )}
{!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && ( {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
<div style={{ textTransform: 'uppercase', textAlign: 'center' }}> <div style={{ textTransform: 'uppercase', textAlign: 'center' }}>
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode})`} `(${table2Data?.SalesMode})`} */}
</div> </div>
)} )}
@ -3288,70 +3271,53 @@ const PrintStyle11 = ({
(pkg) => pkg.ProdId === item.ProdId (pkg) => pkg.ProdId === item.ProdId
).length > 0 ? ( ).length > 0 ? (
<div> <div>
{PackageDetails?.filter( {/* Package Details */}
(pkg) => pkg.ProdId === item.ProdId {PackageDetails?.filter(pkg => pkg.ProdId === item.ProdId)?.map((pkg, idx) => (
)?.map((item, index) => ( <span key={idx} style={{ display: 'block' }}>
<span {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType})
key={index}
style={{ display: 'block' }}
>
{item.ParcelCount} PCS{' '}
{item.ParcelQty} PACK (
{item.ParcelType})
</span> </span>
))} ))}
{item?.BrandName !== null
? item?.BrandName {item?.BrandName && <div>{item.BrandName}</div>}
: ''}
&nbsp; {/* Product Identifiers */}
{item?.ProductIdentifierDtls?.length > 0 {item?.ProductIdentifierDtls?.map((detail, idx) => {
? item?.ProductIdentifierDtls?.filter( const serial = detail.SerialNumber?.trim();
(items) => const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(', ');
!( const description = detail.Description?.trim();
items.SerialNumber == '' ||
items.SerialNumber == null // Skip if nothing exists
) if (!serial && !imeis && !description) return null;
)?.map((a) => {
return ( return (
<div>{a.SerialNumber}</div> <div key={idx} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
); {/* Serial + IMEIs on one line */}
}) {(serial || imeis) && (
: ''}{' '} <div style={{ display: 'flex', gap: '3px' }}>
{item?.ProductIdentifierDtls?.length > 0 {serial && <div>{serial}</div>}
? item?.ProductIdentifierDtls.filter( {imeis && <div>{imeis}</div>}
(item1) => </div>
item1.IMEI1 !== '' || )}
item1.IMEI2 !== '' {/* Description on new line */}
)?.map((item2) => { {description && <div>{description}</div>}
const imei1 = item2.IMEI1 || ''; </div>
const imei2 = item2.IMEI2 || ''; );
return ( })}
<div>
{[imei1, imei2]
.filter(Boolean)
.join(',')}
</div>
);
})
: ''}
</div> </div>
) : ( ) : (
<div> <div>
{UomPrint?.SettingValue === 'Y' {UomPrint?.SettingValue === 'Y' && (
? `${item?.Size || '1'} ${ <div>
item?.SinglePc === 'Y' ({item?.Size ? item?.Size : '1'}{' '}
? 'PCS' {item?.SinglePc == 'Y'
: item?.Type !== 'C' ? 'PCS'
? item?.UomName : item?.Type != 'C'
: 'COMBO' ? item?.UomName
}` : 'COMBO'})
: '' </div>
} )}
{item?.BrandName !== null {item?.BrandName && <div>{item.BrandName}</div>}
? item?.BrandName {/* {item?.ProductIdentifierDtls?.length > 0
: ''}
&nbsp;
{item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls?.filter( ? item?.ProductIdentifierDtls?.filter(
(items) => (items) =>
!( !(
@ -3380,7 +3346,31 @@ const PrintStyle11 = ({
</div> </div>
); );
}) })
: ''} : ''} */}
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
{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 (
<div key={index} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
{/* Serial + IMEIs on one line */}
{(serial || imeis) && (
<div style={{ display: 'flex', gap: '3px' }}>
{serial && <div>{serial}</div>}
{imeis && <div>{imeis}</div>}
</div>
)}
{/* Description on new line */}
{description && <div>{description}</div>}
</div>
);
})}
</div>
</div> </div>
)} )}
</td> </td>
@ -3600,18 +3590,17 @@ const PrintStyle11 = ({
}} }}
> >
<div>{item?.ProdName}</div> <div>{item?.ProdName}</div>
{UomPrint?.SettingValue === 'Y' && {UomPrint?.SettingValue === 'Y' && (
<div>
<div> ({item?.Size ? item?.Size : '1'}{' '}
({item?.Size ? item?.Size : '1'}{' '} {item?.SinglePc == 'Y'
{item?.SinglePc == 'Y' ? 'PCS'
? 'PCS' : item?.Type != 'C'
: item?.Type != 'C' ? item?.UomName
? item?.UomName : 'COMBO'})
: 'COMBO'} </div>
) )}
</div> {item?.BrandName && <div>{item.BrandName}</div>}
}
</td> </td>
)} )}
{GlobaldummyData {GlobaldummyData