diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx index 3f2f410..64d3dab 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx @@ -31,6 +31,16 @@ import { GlobalprintCredit, GlobalprintTax, GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalRowType, + GlobalSelectedNetAmountColor, + GlobalSelectedNetAmountFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss'; import QRCode from 'react-qr-code'; @@ -67,7 +77,6 @@ const PrintStyle1 = ({ const FieldDetails = useSelector(GloabalFieldDetails); const SLNO = FieldDetails?.['Sl.No']; const Item = FieldDetails?.['Item']; - console.log(Item, 'PrintStyle1PrintStyle1'); const MRP = FieldDetails?.['MRP']; const Discount = FieldDetails?.['Discount']; const Tax = FieldDetails?.['Tax']; @@ -80,6 +89,12 @@ const PrintStyle1 = ({ const LogoField = FieldDetails?.['Logo']; const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; + const HeaderColor = FieldDetails?.['Header Colour']; + const NetAmountColor = FieldDetails?.['Net Amount']; + const TableHeaderColour = FieldDetails?.['Table Header Colour']; + const TableBodyColour = FieldDetails?.['Table Body Colour']; + const FooterColor = FieldDetails?.['Footer Colour']; + console.log(FieldDetails, 'FieldDetailsFieldDetails', printDatas); const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -96,7 +111,16 @@ const PrintStyle1 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); - + const SelectedHeaderFontColor = useSelector(GlobalSelectedPrintHeaderFontColor); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector(GlobalSelectedTableHeaderFontColor); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector(GlobalSelectedTableBodyFontColor); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector(GlobalSelectedFooterFontColor); + const SelectedNetAmountColor = useSelector(GlobalSelectedNetAmountColor); + const SelectedNetAmountFontColor = useSelector(GlobalSelectedNetAmountFontColor); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); @@ -128,10 +152,10 @@ const PrintStyle1 = ({ (setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle' )?.SettingValue === 'Y'; - const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( - (i) => i.SettingIdName === 'PrintUom' - )?.[0]; - + const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( + (i) => i.SettingIdName === 'PrintUom' + )?.[0]; + const keysLength = Object.keys(table2Data ?? {}).length; const paymentTypeUPI = PaymentStatus?.find( @@ -145,6 +169,12 @@ const PrintStyle1 = ({ let BillName = printDatas?.PrintHdrName; let FormatTheme = printDatas?.PrintType == 'S' ? true : false; let PageSize = printDatas?.PageSize; + let printColors = printDatas?.PrintColors; + const headerColor = printColors?.find(obj => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find(obj => obj.tableHeaderColor)?.tableHeaderColor; + const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor; + const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor; + const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor; const Signature = FieldDetails?.['signature']; const TermsnAdCondition = FieldDetails?.['terms&conditions']; const isEditedBill = PaymentStatus?.some(payment => { @@ -372,10 +402,42 @@ const PrintStyle1 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (isMobile ? 11 : PageSize == 'A5' ? 5 : 10); - console.log( - PageSize == 'A5' ? '210mm' : '297mm', - 'aggregatedPaymentsaggregatedPayments' - ); + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + } + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData + ? SelectedTableBodyFontColor + : tableBodyColor?.font, + } + const rowtypeStyle = GlobaldummyData ? SelectedRowType : tableBodyColor?.rowType; + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + + color: GlobaldummyData + ? SelectedTableFooterFontColor + : footerColor?.font, + } + const netAmountStyle = { + backgroundColor: GlobaldummyData + ? SelectedNetAmountColor + : netAmtColor?.background, + + color: GlobaldummyData + ? SelectedNetAmountFontColor + : netAmtColor?.font, + } return ( <> {FormatTheme ? ( @@ -432,7 +494,15 @@ const PrintStyle1 = ({ width: '100%', }} > -
+
{GlobaldummyData ? ( GlobalLogo && ( -
+ color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + backgroundColor: GlobaldummyData ? SelectedHeaderColor : headerColor?.background, + }}> +
{' '} {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
@@ -664,58 +734,58 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No + S.No ) : SLNO == true && ( - S.No + S.No )} {GlobaldummyData - ? GlobalItem && Item - : Item == true && Item} + ? GlobalItem && Item + : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN + HSN ) : HsnCode == true && ( - HSN + HSN )} {GlobaldummyData ? GlobalQuantity && ( - Qty + Qty ) : Quantity == true && ( - + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData ? GlobalMRP && ( - MRP + MRP ) : MRP == true && ( - MRP + MRP )} {GlobaldummyData ? GlobalRate && ( - Rate + Rate ) : Rate == true && ( - Rate + Rate )} {GlobaldummyData ? GlobalDiscount && ( - Dis + Dis ) : Discount == true && ( - Dis + Dis )} {GlobaldummyData ? GlobalTax && ( - Tax % + Tax % ) : Tax == true && table2Data?.OrderType !== 'E' && ( - Tax % + Tax % )} {GlobaldummyData ? GlobalAmount && ( @@ -723,6 +793,7 @@ const PrintStyle1 = ({ style={{ width: '10px', textAlign: 'right', + ...headerStyle, }} > Amt @@ -733,6 +804,7 @@ const PrintStyle1 = ({ style={{ width: '10px', textAlign: 'right', + ...headerStyle, }} > Amt @@ -742,7 +814,18 @@ const PrintStyle1 = ({ {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -758,7 +841,7 @@ const PrintStyle1 = ({ ? GlobalItem && {item?.ProdName} : Item == true && (
{item?.ProdName}
{PackageDetails?.filter( @@ -798,7 +881,7 @@ const PrintStyle1 = ({  {' '} {item?.BrandName !== null ?
{item?.BrandName}
- : ''} + : ''}  
{item?.ProductIdentifierDtls?.length > 0 @@ -953,58 +1036,58 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No + S.No ) : SLNO == true && ( - S.No + S.No )} {GlobaldummyData - ? GlobalItem && Item - : Item == true && Item} + ? GlobalItem && Item + : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN + HSN ) : HsnCode == true && ( - HSN + HSN )} {GlobaldummyData ? GlobalQuantity && ( - Qty + Qty ) : Quantity == true && ( - + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData ? GlobalMRP && ( - MRP + MRP ) : MRP == true && ( - MRP + MRP )} {GlobaldummyData ? GlobalRate && ( - Rate + Rate ) : Rate == true && ( - Rate + Rate )} {GlobaldummyData ? GlobalDiscount && ( - Dis + Dis ) : Discount == true && ( - Dis + Dis )} {GlobaldummyData ? GlobalTax && ( - Tax % + Tax % ) : Tax == true && table2Data?.OrderType !== 'E' && ( - Tax % + Tax % )} {GlobaldummyData ? GlobalAmount && ( @@ -1012,6 +1095,7 @@ const PrintStyle1 = ({ style={{ width: '10px', textAlign: 'right', + ...headerStyle, }} > Amt @@ -1022,6 +1106,7 @@ const PrintStyle1 = ({ style={{ width: '10px', textAlign: 'right', + ...headerStyle, }} > Amt @@ -1031,7 +1116,18 @@ const PrintStyle1 = ({ {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -1047,20 +1143,20 @@ const PrintStyle1 = ({ ? GlobalItem && {item?.ProdName} : Item == true && (
{item?.ProdName}
{UomPrint?.SettingValue === 'Y' && -
- ({item?.Size ? 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'} + ) +
+ } {sportsAppPreference && `${item?.BookingDate?.trim() ? `(${dateFormatChange(item.BookingDate)})` @@ -1225,6 +1321,7 @@ const PrintStyle1 = ({ padding: 0, fontSize: '10px', fontWeight: '600', + ...netAmountStyle }} > Amount :₹ @@ -1815,6 +1912,7 @@ const PrintStyle1 = ({ pageBreakBefore: 'avoid', pageBreakInside: 'avoid', minHeight: 'auto', + ...footerColorStyle }} > {GlobaldummyData @@ -2091,6 +2189,7 @@ const PrintStyle1 = ({ padding: 0, fontSize: '10px', fontWeight: '600', + ...netAmountStyle }} > Amount :₹ @@ -2667,6 +2766,7 @@ const PrintStyle1 = ({ pageBreakBefore: 'avoid', pageBreakInside: 'avoid', minHeight: 'auto', + ...footerColorStyle }} > {GlobaldummyData @@ -2922,6 +3022,7 @@ const PrintStyle1 = ({ padding: 0, fontSize: '10px', fontWeight: '600', + ...netAmountStyle }} > Amount :₹ @@ -3491,6 +3592,7 @@ const PrintStyle1 = ({ pageBreakBefore: 'avoid', pageBreakInside: 'avoid', minHeight: 'auto', + ...footerColorStyle }} > {GlobaldummyData @@ -3696,7 +3798,21 @@ const PrintStyle1 = ({ id={`PrintStyle1-${index}`} style={{ fontFamily: "'Courier New', Courier, monospace" }} > -
+
{GlobaldummyData ? ( GlobalLogo && ( +
{' '} @@ -3900,60 +4021,60 @@ const PrintStyle1 = ({ {GlobaldummyData - ? GlobalSlNo && S.No + ? GlobalSlNo && S.No : SLNO == true && ( - S.No + S.No )} {GlobaldummyData ? GlobalItem && ( - Item + Item ) - : Item == true && Item} + : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN + HSN ) : HsnCode == true && ( - HSN + HSN )} {GlobaldummyData ? GlobalQuantity && ( - Qty + Qty ) : Quantity == true && ( - + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData - ? GlobalMRP && MRP - : MRP == true && MRP} + ? GlobalMRP && MRP + : MRP == true && MRP} {GlobaldummyData - ? GlobalRate && Rate + ? GlobalRate && Rate : Rate == true && ( - Rate + Rate )} {GlobaldummyData ? GlobalDiscount && ( - Dis + Dis ) : Discount == true && ( - Dis + Dis )} {GlobaldummyData - ? GlobalTax && Tax % + ? GlobalTax && Tax % : Tax == true && table2Data?.OrderType !== 'E' && ( - Tax % + Tax % )} {GlobaldummyData ? GlobalAmount && ( - + Amt ) : Amount == true && ( - + Amt )} @@ -3962,7 +4083,18 @@ const PrintStyle1 = ({ {(GlobaldummyData ? products : TakeawayData)?.map( (item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -3978,7 +4110,7 @@ const PrintStyle1 = ({ ? GlobalItem && {item?.ProdName} : Item == true && (
{item?.ProdName}
{PackageDetails?.filter( @@ -3999,7 +4131,7 @@ const PrintStyle1 = ({ ))}
) : ( - UomPrint?.SettingValue === 'Y' && + UomPrint?.SettingValue === 'Y' &&
({item?.Size ? item?.Size : '1'}{' '} {item?.SinglePc == 'Y' @@ -4019,7 +4151,7 @@ const PrintStyle1 = ({ {item?.BrandName !== null ? item?.BrandName : ''} -   +  
{item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( @@ -4167,58 +4299,58 @@ const PrintStyle1 = ({ {GlobaldummyData - ? GlobalSlNo && S.No + ? GlobalSlNo && S.No : SLNO == true && ( - S.No + S.No )} {GlobaldummyData - ? GlobalItem && Item - : Item == true && Item} + ? GlobalItem && Item + : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN + HSN ) : HsnCode == true && ( - HSN + HSN )} {GlobaldummyData ? GlobalQuantity && ( - Qty + Qty ) : Quantity == true && ( - + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData - ? GlobalMRP && MRP - : MRP == true && MRP} + ? GlobalMRP && MRP + : MRP == true && MRP} {GlobaldummyData - ? GlobalRate && Rate + ? GlobalRate && Rate : Rate == true && ( - Rate + Rate )} {GlobaldummyData ? GlobalDiscount && ( - Dis + Dis ) : Discount == true && ( - Dis + Dis )} {GlobaldummyData - ? GlobalTax && Tax % + ? GlobalTax && Tax % : Tax == true && table2Data?.OrderType !== 'E' && ( - Tax % + Tax % )} {GlobaldummyData ? GlobalAmount && ( - + Amt ) : Amount == true && ( - + Amt )} @@ -4227,7 +4359,18 @@ const PrintStyle1 = ({ {(GlobaldummyData ? products : DineInData)?.map( (item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -4243,20 +4386,20 @@ const PrintStyle1 = ({ ? GlobalItem && {item?.ProdName} : Item == true && (
{item?.ProdName}
{UomPrint?.SettingValue === 'Y' && -
- ({item?.Size ? 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'} + ) +
+ } {sportsAppPreference && `${item?.BookingDate?.trim() ? `(${dateFormatChange(item.BookingDate)})` @@ -4414,6 +4557,7 @@ const PrintStyle1 = ({ padding: 0, fontSize: '10px', fontWeight: '600', + ...netAmountStyle }} > Amount :₹ @@ -4954,7 +5098,6 @@ const PrintStyle1 = ({ )}
-
{GlobaldummyData