Merge pull request 'Printstyle 4 design changed for user requirement' (#275) from branchloginissueandprint into main

Reviewed-on: Pozomind/pozo-retail-app#275
This commit is contained in:
karthikalakshmi 2026-03-11 17:21:09 +05:30
commit 8e974bd2eb
4 changed files with 2068 additions and 1985 deletions

View File

@ -471,6 +471,8 @@ const initialState = {
notes: false,
SignatureImage: '',
BillName: '',
BillNolabel: '',
Totallabel: '',
SelectedHeaderColour: false,
SelectedTableHeaderColour: false,
SelectedTableBodyColour: false,
@ -2165,45 +2167,52 @@ const ThemeSlice = createSlice({
changeBillName: (state, action) => {
state.BillName = action?.payload;
},
changeSelectedHeaderColor: (state, action) => {
state.SelectedHeaderColor = action?.payload?.background;
state.SelectedHeaderFontColor = action?.payload?.font;
},
changeSelectedTableHeaderColor: (state, action) => {
state.SelectedTableHeaderColor = action?.payload?.background;
state.SelectedTableHeaderFontColor = action?.payload?.font;
},
changeSelectedTableBodyColor: (state, action) => {
state.SelectedTableBodyColor = action?.payload?.background;
state.SelectedTableBodyFontColor = action?.payload?.font;
},
changeSelectedFooterColor: (state, action) => {
state.SelectedFooterColor = action?.payload?.background;
state.SelectedFooterFontColor = action?.payload?.font;
},
// toggles indicating whether each colour option should actually be applied in print
changeSelectedHeaderColour: (state, action) => {
state.SelectedHeaderColour = action?.payload;
},
changeSelectedTableHeaderColour: (state, action) => {
state.SelectedTableHeaderColour = action?.payload;
},
changeSelectedTableBodyColour: (state, action) => {
state.SelectedTableBodyColour = action?.payload;
},
changeSelectedFooterColour: (state, action) => {
state.SelectedFooterColour = action?.payload;
},
changeSelectedNetAmountColour: (state, action) => {
state.SelectedNetAmountColour = action?.payload;
},
changeRowType: (state, action) => {
state.rowType = action?.payload;
},
changeSelectedNetAmountColor: (state, action) => {
state.SelectedNetAmountColor = action?.payload?.background;
state.SelectedNetAmountFontColor = action?.payload?.font;
},
changeBillNolabel: (state, action) => {
state.BillNolabel = action?.payload;
},
changetotallabel: (state, action) => {
state.Totallabel = action?.payload;
},
changeSelectedHeaderColor: (state, action) => {
state.SelectedHeaderColor = action?.payload?.background;
state.SelectedHeaderFontColor = action?.payload?.font;
},
changeSelectedTableHeaderColor: (state, action) => {
state.SelectedTableHeaderColor = action?.payload?.background;
state.SelectedTableHeaderFontColor = action?.payload?.font;
},
changeSelectedTableBodyColor: (state, action) => {
state.SelectedTableBodyColor = action?.payload?.background;
state.SelectedTableBodyFontColor = action?.payload?.font;
},
changeSelectedFooterColor: (state, action) => {
state.SelectedFooterColor = action?.payload?.background;
state.SelectedFooterFontColor = action?.payload?.font;
},
// toggles indicating whether each colour option should actually be applied in print
changeSelectedHeaderColour: (state, action) => {
state.SelectedHeaderColour = action?.payload;
},
changeSelectedTableHeaderColour: (state, action) => {
state.SelectedTableHeaderColour = action?.payload;
},
changeSelectedTableBodyColour: (state, action) => {
state.SelectedTableBodyColour = action?.payload;
},
changeSelectedFooterColour: (state, action) => {
state.SelectedFooterColour = action?.payload;
},
changeSelectedNetAmountColour: (state, action) => {
state.SelectedNetAmountColour = action?.payload;
},
changeRowType: (state, action) => {
state.rowType = action?.payload;
},
changeSelectedNetAmountColor: (state, action) => {
state.SelectedNetAmountColor = action?.payload?.background;
state.SelectedNetAmountFontColor = action?.payload?.font;
},
changeCurrentColor: (state, action) => {
const { color } = action?.payload;
state.CurrentColor = color;
@ -2397,45 +2406,44 @@ const ThemeSlice = createSlice({
getPrintSelectionComponentData.fulfilled,
(state, action) => {
if (action?.payload?.data?.statusCode === 1) {
state.PrintTemplate =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'Sales'
)?.StyleName;
state.DCPrintTemplate =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' &&
item.PrintTypeName === 'Delivery Chalan'
)?.StyleName;
state.printDatas =
action?.payload?.data?.data?.[0]?.ComponentDetails.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'Sales'
);
state.DCtoInvoice =
action?.payload?.data?.data?.[0]?.ComponentDetails.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'DC to Invoice'
);
state.PrintFieldDetails =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'Sales'
)?.FieldDetails?.reduce((acc, item) => {
acc[item.ConfigName] = true;
return acc;
}, {});
state.DCtoInvoicePrintFieldDetails =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'DC to Invoice'
)?.FieldDetails?.reduce((acc, item) => {
acc[item.ConfigName] = true;
return acc;
}, {});
state.PrintTemplate =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'Sales'
)?.StyleName;
state.DCPrintTemplate =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' &&
item.PrintTypeName === 'Delivery Chalan'
)?.StyleName;
state.printDatas =
action?.payload?.data?.data?.[0]?.ComponentDetails.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'Sales'
);
state.DCtoInvoice =
action?.payload?.data?.data?.[0]?.ComponentDetails.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'DC to Invoice'
);
state.PrintFieldDetails =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'Sales'
)?.FieldDetails?.reduce((acc, item) => {
acc[item.ConfigName] = true;
return acc;
}, {});
state.DCtoInvoicePrintFieldDetails =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
item.SetasDefault == 'Y' && item.PrintTypeName === 'DC to Invoice'
)?.FieldDetails?.reduce((acc, item) => {
acc[item.ConfigName] = true;
return acc;
}, {});
} else if (action?.payload?.data?.statusCode == 0) {
state.PrintTemplate = undefined;
}
@ -2744,6 +2752,8 @@ export const {
changeReprintDataFound,
changePricingAppPricingName,
changeBillName,
changeBillNolabel,
changetotallabel,
changetemplateData,
changeSessionData,
changeThemeCreation,
@ -2799,6 +2809,8 @@ export const GlobalSelectedNetAmountColour = (state) => state.theme?.SelectedNet
export const Globalnotes = (state) => state.theme?.notes;
export const GlobalSignatureImage = (state) => state.theme?.SignatureImage;
export const GlobalBillName = (state) => state.theme?.BillName;
export const GlobalBillNolabel = (state) => state.theme?.BillNolabel;
export const GlobalTotallabel = (state) => state.theme?.Totallabel;
export const GlobalSelectedPrintHeaderColor = (state) =>
state.theme?.SelectedHeaderColor;
export const GlobalSelectedPrintHeaderFontColor = (state) =>

View File

@ -90,6 +90,8 @@ import {
changeSelectedTableBodyColour,
changeSelectedFooterColour,
changeSelectedNetAmountColour,
changeBillNolabel,
changetotallabel,
} from '../../../../Features/ThemeChange/ThemeChange';
import '../../../../Styles/BookingScreen/Components/SelectionComponent/SelectionComponent.scss';
import { useAuth } from '../../../../AuthContext.jsx';
@ -152,6 +154,7 @@ const SelectionComponent = forwardRef((props, ref) => {
const [selectedSizeCheckList, setSelectedSizeCheckList] = useState([]);
const [sizeOptionData, setSizeOptionData] = useState([]);
console.log(sizeOptionData, "sizeOptionData")
const [styleData, setStyleData] = useState([]);
const [checkedList, setCheckedList] = useState([]);
@ -163,6 +166,9 @@ const SelectionComponent = forwardRef((props, ref) => {
const [PrintType, setPrintType] = useState(true);
const [PageSize, setPageSize] = useState('3inch');
const [isFooterChecking, setisFooterChecking] = useState(false);
const [isbillnoLabel, setisbillnoLabel] = useState(false);
const [istotalLabel, setistotalLabel] = useState(false);
const [isBillName, setisBillName] = useState(false);
const [isTermscondChecking, setisTermscondChecking] = useState(false);
const [isSignatureChecking, setisSignatureChecking] = useState(false);
@ -183,6 +189,8 @@ const SelectionComponent = forwardRef((props, ref) => {
const [previewTitle, setPreviewTitle] = useState('');
const [Notes, setNote] = useState('');
const [BillName, setBillName] = useState('');
const [BillNolabel, setBillNolabel] = useState('');
const [totalLabel, settotalLabel] = useState('');
const [openColorModal, setOpenColorModal] = useState(false);
const [bgColor, setBgColor] = useState('#ffffff');
const [fontColor, setFontColor] = useState('#000000');
@ -280,10 +288,10 @@ const SelectionComponent = forwardRef((props, ref) => {
style={{ color: '#1292EE' }}
onClick={() =>
UserType === 'Super Admin' ||
(UserType === 'Super Admin User' &&
SAAccessCommonMaster?.UpdateAccess === 'Y') ||
(UserType === 'Employee' && empData?.UpdateAccess === 'Y') ||
UserType === 'Admin'
(UserType === 'Super Admin User' &&
SAAccessCommonMaster?.UpdateAccess === 'Y') ||
(UserType === 'Employee' && empData?.UpdateAccess === 'Y') ||
UserType === 'Admin'
? actionsFormatter(record, index)
: null
}
@ -292,11 +300,11 @@ const SelectionComponent = forwardRef((props, ref) => {
<a
onClick={() =>
!edit &&
(UserType === 'Super Admin' ||
(UserType === 'Super Admin User' &&
SAAccessCommonMaster?.DeleteAccess === 'Y') ||
(UserType === 'Employee' && empData?.DeleteAccess === 'Y') ||
UserType === 'Admin')
(UserType === 'Super Admin' ||
(UserType === 'Super Admin User' &&
SAAccessCommonMaster?.DeleteAccess === 'Y') ||
(UserType === 'Employee' && empData?.DeleteAccess === 'Y') ||
UserType === 'Admin')
? statusFormatter(index)
: ''
}
@ -394,6 +402,12 @@ const SelectionComponent = forwardRef((props, ref) => {
let CheckBillnamename = sizeCheckList?.find(
(item) => item.ConfigName?.toLowerCase() == 'billname'
);
let CheckBillnolable = sizeCheckList?.find(
(item) => item.ConfigName?.toLowerCase() == 'billnolabel'
);
let CheckTotallable = sizeCheckList?.find(
(item) => item.ConfigName?.toLowerCase() == 'total label'
);
let Checktermdcondition = sizeCheckList?.find(
(item) => item.ConfigName?.toLowerCase() == 'terms&conditions'
);
@ -403,6 +417,8 @@ const SelectionComponent = forwardRef((props, ref) => {
let headerColour = sizeCheckList?.find(
(item) => item.ConfigName?.toLowerCase() == 'header colour'
);
setistotalLabel(checkedList?.includes(CheckTotallable?.ConfigId))
setisbillnoLabel(checkedList?.includes(CheckBillnolable?.ConfigId))
setisFooterChecking(checkedList?.includes(Checkfootername?.ConfigId));
setisBillName(checkedList?.includes(CheckBillnamename?.ConfigId));
setisTermscondChecking(
@ -544,6 +560,8 @@ const SelectionComponent = forwardRef((props, ref) => {
Signature: item.Signature,
PrintType: item.PrintType,
PrintHdrName: item.PrintHdrName,
PrintDocLabel: item.PrintDocLabel,
PrintTotalLabel:item.PrintTotalLabel,
// legacy fields are filled from the array so older code still works
PrintHdrColor:
item.PrintHdrColor ||
@ -632,6 +650,8 @@ const SelectionComponent = forwardRef((props, ref) => {
PrintTypeId,
PrintHdrColor,
PrintColors,
PrintDocLabel,
PrintTotalLabel
} = row;
if (index >= 4) setShowMore(true);
if (index <= 4) setShowMore(false);
@ -644,12 +664,14 @@ const SelectionComponent = forwardRef((props, ref) => {
setPageSize(PageSize);
setNote(Notes);
setBillName(PrintHdrName);
setBillNolabel(PrintDocLabel);
settotalLabel(PrintTotalLabel);
setEdit(true);
// load existing header color, falling back to array
setSelectedColour(
PrintHdrColor ||
getColor(PrintColors, 'headerColor')?.background ||
'#000000'
getColor(PrintColors, 'headerColor')?.background ||
'#000000'
);
// setSelectedHeaderFontColor(PrintHdrFontColor);
setSelectedStyleId(StyleId);
@ -702,6 +724,9 @@ const SelectionComponent = forwardRef((props, ref) => {
dispatch(changeNotes(helperFunction('Notes')));
dispatch(changeSignatureImage(Signature));
dispatch(changeBillName(PrintHdrName));
dispatch(changeBillNolabel(PrintDocLabel));
dispatch(changetotallabel(PrintTotalLabel));
// derive color objects; prefer the legacy fields but fall back to the PrintColors array
const hdr = getColor(PrintColors, 'headerColor');
const tblHdr = getColor(PrintColors, 'tableHeaderColor');
@ -1033,6 +1058,8 @@ const SelectionComponent = forwardRef((props, ref) => {
Notes: Notes,
PageSize: PageSize,
PrintHdrName: BillName,
PrintDocLabel: BillNolabel,
PrintTotalLabel:totalLabel,
PrintType: PrintType ? 'S' : 'C',
PrintTypeId: segmentValue,
// Header color (background) and font
@ -1113,6 +1140,7 @@ const SelectionComponent = forwardRef((props, ref) => {
};
const onfinish = async (values) => {
if (!templateEdit && sizeOptionData?.length == 0) {
setMessageType('error');
setMessageData('Please Setup the Screen');
@ -1164,19 +1192,22 @@ const SelectionComponent = forwardRef((props, ref) => {
})),
...(item?.TermsandConditions?.length > 0
? {
PrintTermsandConditions: (item?.TermsandConditions
? item?.TermsandConditions
: []
)?.map((item) => {
return {
TermsandConditions: item,
};
}),
}
PrintTermsandConditions: (item?.TermsandConditions
? item?.TermsandConditions
: []
)?.map((item) => {
return {
TermsandConditions: item,
};
}),
}
: {}),
...(item?.Notes ? { Notes: item.Notes } : {}),
...(item?.PageSize ? { PageSize: item.PageSize } : {}),
...(item?.PrintHdrName ? { PrintHdrName: item.PrintHdrName } : {}),
...(item?.PrintDocLabel ? { PrintDocLabel: item.PrintDocLabel } : {}),
...(item?.PrintTotalLabel ? { PrintTotalLabel: item.PrintTotalLabel } : {}),
...(item?.Signature ? { Signature: item?.Signature } : {}),
PrintType: item?.PrintType,
})
@ -1654,7 +1685,7 @@ const SelectionComponent = forwardRef((props, ref) => {
</div>
<div className="selectBillFiledInput">
<div className="PrintCutColor" style={{marginBottom:"10px"}}>
<div className="PrintCutColor" style={{ marginBottom: "10px" }}>
{isFooterChecking && (
<div style={{ marginTop: '1rem' }}>
<Title level={5} style={{ marginBottom: 12 }}>
@ -1669,10 +1700,8 @@ const SelectionComponent = forwardRef((props, ref) => {
}}
/>
</div>
)}
{
<div style={{ marginTop: '1rem' }}>
)}
<div style={{ marginTop: '1rem' }}>
<Title level={5} style={{ marginBottom: 12 }}>
BillName
</Title>
@ -1686,6 +1715,38 @@ const SelectionComponent = forwardRef((props, ref) => {
}}
/>
</div>
{isbillnoLabel &&
<div style={{ marginTop: '1rem' }}>
<Title level={5} style={{ marginBottom: 12 }}>
BillNo Label
</Title>
<InputField
isOnChange={BillNolabel}
label={<label> Bill No Label</label>}
value={BillNolabel}
onChange={(e) => {
setBillNolabel(e.target.value);
dispatch(changeBillNolabel(e.target.value));
}}
/>
</div>
}
{istotalLabel &&
<div style={{ marginTop: '1rem' }}>
<Title level={5} style={{ marginBottom: 12 }}>
Total Label
</Title>
<InputField
isOnChange={totalLabel}
label={<label> Total Label</label>}
value={totalLabel}
onChange={(e) => {
settotalLabel(e.target.value);
dispatch(changetotallabel(e.target.value));
}}
/>
</div>
}
{isTermscondChecking && (
@ -2043,12 +2104,12 @@ const SelectionComponent = forwardRef((props, ref) => {
UserType === 'Super Admin' || UserType === 'Admin'
? false
: !(
empData?.AddAccess === 'Y' ||
SAAccessCommonMaster?.AddAccess === 'Y' ||
((empData?.UpdateAccess === 'Y' ||
SAAccessCommonMaster?.UpdateAccess === 'Y') &&
templateEdit)
)
empData?.AddAccess === 'Y' ||
SAAccessCommonMaster?.AddAccess === 'Y' ||
((empData?.UpdateAccess === 'Y' ||
SAAccessCommonMaster?.UpdateAccess === 'Y') &&
templateEdit)
)
}
/>
</div>

View File

@ -593,8 +593,8 @@ const PaymentPdfBooking = ({
{TakeawayTotalOfferAmt > 0 && (
<td className="Re-print-body-Rate">
{item?.Type !== 'C'
? (item?.OfferAmt || item?.DiscountAmt || 0)
: (item?.OfferValue || item?.DiscountAmt || 0)}
? (item?.OfferAmt || (item?.DiscountAmt / item?.SalesQty) || 0)
: (item?.OfferValue || (item?.DiscountAmt / item?.SalesQty) || 0)}
</td>
)}
{table2Data?.OrderType !== 'E' ? (
@ -676,8 +676,8 @@ const PaymentPdfBooking = ({
{DineinTotalOfferAmt > 0 && (
<td className="Re-print-body-Rate">
{item?.Type !== 'C'
? (item?.OfferAmt || item?.DiscountAmt || 0)
: (item?.OfferValue || item?.DiscountAmt || 0)}
? (item?.OfferAmt || (item?.DiscountAmt / item?.SalesQty) || 0)
: (item?.OfferValue || (item?.DiscountAmt / item?.SalesQty) || 0)}
</td>
)}
{table2Data?.OrderType !== 'E' ? (