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

This commit is contained in:
karthikalakshmi 2026-03-03 09:56:46 +05:30
parent fb09fc5382
commit a4dffb91df
1 changed files with 91 additions and 95 deletions

View File

@ -104,9 +104,6 @@ const Printstyle12 = ({
const GlobalCredit = useSelector(GlobalprintCredit); const GlobalCredit = useSelector(GlobalprintCredit);
const SettingData = useSelector(PreferenceData); const SettingData = useSelector(PreferenceData);
const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor);
const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter(
(i) => i.SettingIdName === 'PrintUom'
)?.[0];
const estimatePrintHeader = const estimatePrintHeader =
SettingData?.[0]?.SettingDtlDetails?.find( SettingData?.[0]?.SettingDtlDetails?.find(
(setting) => (setting) =>
@ -841,62 +838,46 @@ const Printstyle12 = ({
{item.ParcelType}) {item.ParcelType})
</span> </span>
))} ))}
{item?.BrandName !== null {item?.BrandName && <div>{item.BrandName}</div>}
? item?.BrandName <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
: ''} {item?.ProductIdentifierDtls?.map((detail, index) => {
&nbsp; const serial = detail.SerialNumber?.trim();
{item?.ProductIdentifierDtls const imeis = [detail.IMEI1, detail.IMEI2].filter(Boolean).join(', ');
?.length > 0 const description = detail.Description?.trim();
? item?.ProductIdentifierDtls?.filter(
(items) => // Skip if all are empty
!( if (!serial && !imeis && !description) return null;
items.SerialNumber ==
'' ||
items.SerialNumber == null
)
)?.map((a) => {
return ( return (
<div>{a.SerialNumber}</div> <div key={index} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
); {/* Serial + IMEIs on the same row */}
}) {(serial || imeis) && (
: ''}{' '} <div style={{ display: 'flex', gap: '3px' }}>
{item?.ProductIdentifierDtls {serial && <div>{serial}</div>}
?.length > 0 {imeis && <div>{imeis}</div>}
? item?.ProductIdentifierDtls.filter( </div>
(item1) => )}
item1.IMEI1 !== '' ||
item1.IMEI2 !== '' {/* Description on new line */}
)?.map((item2) => { {description && <div>{description}</div>}
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' {UomPrint?.SettingValue === 'Y' && (
? `${item?.Size || '1'} ${ <div>
item?.SinglePc === 'Y' ({item?.Size || '1'}){' '}
{item?.SinglePc === 'Y'
? 'PCS' ? 'PCS'
: item?.Type !== 'C' : item?.Type !== 'C'
? item?.UomName ? item?.UomName
: 'COMBO' : 'COMBO'}
}` </div>
: '' )}
} {item?.BrandName && <div>{item.BrandName}</div>}
{item?.BrandName !== null
? item?.BrandName
: ''}
&nbsp;
{item?.ProductIdentifierDtls {item?.ProductIdentifierDtls
?.length > 0 ?.length > 0
? item?.ProductIdentifierDtls?.filter( ? item?.ProductIdentifierDtls?.filter(
@ -1133,18 +1114,16 @@ const Printstyle12 = ({
}} }}
> >
<div>{item?.ProdName}</div> <div>{item?.ProdName}</div>
{UomPrint?.SettingValue === 'Y' && {UomPrint?.SettingValue === 'Y' && (
<div>
<div> ({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>
}
</td> </td>
)} )}
{GlobaldummyData {GlobaldummyData
@ -3482,10 +3461,7 @@ const Printstyle12 = ({
{item.ParcelType}) {item.ParcelType})
</span> </span>
))} ))}
{item?.BrandName !== null {item?.BrandName && <div>{item.BrandName}</div>}
? item?.BrandName
: ''}
&nbsp;
{item?.ProductIdentifierDtls?.length > 0 {item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls?.filter( ? item?.ProductIdentifierDtls?.filter(
(items) => (items) =>
@ -3519,21 +3495,18 @@ const Printstyle12 = ({
</div> </div>
) : ( ) : (
<div> <div>
{UomPrint?.SettingValue === 'Y' {UomPrint?.SettingValue === 'Y' && (
? `${item?.Size || '1'} ${ <div>
item?.SinglePc === 'Y' ({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) =>
!( !(
@ -3562,7 +3535,32 @@ const Printstyle12 = ({
</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 empty entries
if (!serial && !imeis && !description) return null;
return (
<div key={index} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
{/* Serial + IMEIs in one row */}
{(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>
@ -3751,18 +3749,16 @@ const Printstyle12 = ({
}} }}
> >
<div>{item?.ProdName}</div> <div>{item?.ProdName}</div>
{UomPrint?.SettingValue === 'Y' {UomPrint?.SettingValue === 'Y' && (
&& <div>
<div> ({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>
}
</td> </td>
)} )}
{GlobaldummyData {GlobaldummyData