From 34df7eadbd76347e8476bc5950af7a0b3a81789c Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 5 Mar 2026 13:54:17 +0530 Subject: [PATCH] Implement dynamic header and table color functionality --- .../PurchaseOrdPrintA5.jsx | 93 ++++++++++--------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx index 046e496..6e8c435 100644 --- a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx +++ b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx @@ -162,6 +162,36 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image const calculatedTotalQuantity = purchaseData?.reduce((total, item) => { return total + (Number(item?.SalesQty) || 0); }, 0); + 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 headerStyle = { + backgroundColor: headerColor?.background, + color: headerColor?.font, + } + const tableHeaderStyle = { + backgroundColor: tableHeaderColor?.background, + color: tableHeaderColor?.font, + } + const tableBodyStyle = { + backgroundColor: tableBodyColor?.background, + color: tableBodyColor?.font, + } + const rowtypeStyle = tableBodyColor?.rowType; + const footerColorStyle = { + backgroundColor: footerColor?.background, + color: footerColor?.font, + } + const netAmountStyle = { + backgroundColor: netAmtColor?.background, + color: netAmtColor?.font, + } + + return (
@@ -171,7 +201,7 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image
-
+
- + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } @@ -332,7 +362,18 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && (
S.NoS.No
@@ -556,7 +597,7 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image } -
+
{TermsnAdCondition == true && (

Terms & Conditions @@ -621,25 +662,7 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image }} > <> -

-
-
-
-
ITEMS
-
Qty
- {(TotalOfferAmount > 0 || table2Data?.OverallDisc) ? (
OFFER
) : ""} - {/*
Amount
*/} -
-
-
{GlobaldummyData ? "7" : totalQuantityFilter?.length}
-
{GlobaldummyData ? "9" : calculatedTotalQuantity}
- {(TotalOfferAmount > 0 || table2Data?.OverallDisc) ? (
{Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
) : ""} - {/*
{GlobaldummyData ? "1066" : Number(table2Data?.NetAmount).toFixed(2)}
*/} -
-
-
Purchase Order
-
-
+
@@ -689,33 +712,15 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image
{Date1}
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

- -
-
) : - Notestext && (
+ {Notestext && (

{Notestext}


) } - -
- {GlobaldummyData ? GlobaltermsAndConditions && - (
-

- Terms & Conditions -

-
    -
  1. Once goods are sold, they are not exchangeable or refundable.
  2. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
+
+ {(TermsnAdCondition == true && TermsAndConditions?.length > 0) && (

Terms & Conditions