From 122260c95bf86d57c68e2d21b68ba446c8209404 Mon Sep 17 00:00:00 2001 From: Srinath Date: Wed, 4 Mar 2026 16:33:38 +0530 Subject: [PATCH] Implement dynamic header and table color functionality --- .../PrintTemplates/A4/PrintStyleA5.jsx | 772 ++++++++++-------- 1 file changed, 441 insertions(+), 331 deletions(-) diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/PrintStyleA5.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/PrintStyleA5.jsx index 9a13a93..b0b2e73 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/PrintStyleA5.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/PrintStyleA5.jsx @@ -32,6 +32,17 @@ import { GlobalPritdummyData, GlobalSignatureImage, GlobalthemeFormat, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableBodyColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedNetAmountColor, + GlobalSelectedNetAmountFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import signature from '../../../../Images/signatureimage.jpg'; import Logo from '../../../../Images/Logo.jpg'; @@ -102,6 +113,23 @@ const PrintA5Style11 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); + 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); + 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 estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -276,6 +304,51 @@ const PrintA5Style11 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > 6; + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData + ? SelectedHeaderFontColor + : headerColor?.font, + } + const tableHeaderStyle = { + 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 (
{' '} @@ -508,6 +582,7 @@ const PrintA5Style11 = ({ style={{ background: '#373B44', color: '#fff', + ...tableHeaderStyle, }} > {GlobaldummyData @@ -688,7 +763,18 @@ const PrintA5Style11 = ({ {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -931,7 +1017,8 @@ const PrintA5Style11 = ({ fontSize: '25px', fontWeight: '600', padding: '10px', - backgroundColor: '#fdc716', + // backgroundColor: '#fdc716', + ...netAmountStyle, textAlign: 'center', }} > @@ -1249,187 +1336,189 @@ const PrintA5Style11 = ({ >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)} - {GlobaldummyData - ? GlobalIsnotes && ( -
-

- Notes : 10 days Return policy -

- -
-
- ) - : Notestext && ( -
-

- {Notestext} -

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

- Terms & Conditions + ? GlobalIsnotes && ( +

+

+ Notes : 10 days Return policy

-
    -
  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 && ( -
+ : Notestext && ( +

- Terms & Conditions + {Notestext}

-
    - {TermsAndConditions?.map( - (item) => ( -
  1. - {item?.TermsandConditions} -
  2. - ) - )} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
+ +
)} - {GlobaldummyData - ? GlobalSignature && ( -
-

+ {GlobaldummyData + ? GlobaltermsAndConditions && ( +

- Signature -

- + 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 && ( +
-
- ) - : Signature == true && ( -
-

- Signature -

- + Terms & Conditions +

+
    + {TermsAndConditions?.map( + (item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ) + )} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} + + {GlobaldummyData + ? GlobalSignature && ( +
-
- )} + > +

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )} +
)} @@ -1494,6 +1583,7 @@ const PrintA5Style11 = ({ style={{ background: '#373B44', color: '#fff', + ...tableHeaderStyle }} > {GlobaldummyData @@ -1674,7 +1764,18 @@ const PrintA5Style11 = ({ {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -1893,7 +1994,8 @@ const PrintA5Style11 = ({ fontSize: '25px', fontWeight: '600', padding: '10px', - backgroundColor: '#fdc716', + // backgroundColor: '#fdc716', + ...netAmountStyle, textAlign: 'center', }} > @@ -2209,187 +2311,189 @@ const PrintA5Style11 = ({ >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)} - {GlobaldummyData - ? GlobalIsnotes && ( -
-

- Notes : 10 days Return policy -

- -
-
- ) - : Notestext && ( -
-

- {Notestext} -

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

- Terms & Conditions + ? GlobalIsnotes && ( +

+

+ Notes : 10 days Return policy

-
    -
  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 && ( -
+ : Notestext && ( +

- Terms & Conditions + {Notestext}

-
    - {TermsAndConditions?.map( - (item) => ( -
  1. - {item?.TermsandConditions} -
  2. - ) - )} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
+ +
)} - {GlobaldummyData - ? GlobalSignature && ( -
-

+ {GlobaldummyData + ? GlobaltermsAndConditions && ( +

- Signature -

- + 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 && ( +
-
- ) - : Signature == true && ( -
-

- Signature -

- + Terms & Conditions +

+
    + {TermsAndConditions?.map( + (item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ) + )} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} + + {GlobaldummyData + ? GlobalSignature && ( +
-
- )} + > +

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )} +
)} @@ -2488,7 +2592,8 @@ const PrintA5Style11 = ({ fontSize: '25px', fontWeight: '600', padding: '10px', - backgroundColor: '#fdc716', + // backgroundColor: '#fdc716', + ...netAmountStyle, textAlign: 'center', }} > @@ -2824,7 +2929,8 @@ const PrintA5Style11 = ({ >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)} - {GlobaldummyData +
+ {GlobaldummyData ? GlobalIsnotes && (

@@ -2995,6 +3101,7 @@ const PrintA5Style11 = ({ )}

+
)} ))} @@ -3077,7 +3184,8 @@ const PrintA5Style11 = ({ fontSize: '25px', fontWeight: '600', padding: '10px', - backgroundColor: '#fdc716', + // backgroundColor: '#fdc716', + ...netAmountStyle, textAlign: 'center', }} > @@ -3407,7 +3515,8 @@ const PrintA5Style11 = ({ >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`} )} - {GlobaldummyData +
+ {GlobaldummyData ? GlobalIsnotes && (

@@ -3572,6 +3681,7 @@ const PrintA5Style11 = ({ )}

+ )}