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,6 +2167,13 @@ const ThemeSlice = createSlice({
changeBillName: (state, action) => {
state.BillName = action?.payload;
},
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;
@ -2397,7 +2406,6 @@ const ThemeSlice = createSlice({
getPrintSelectionComponentData.fulfilled,
(state, action) => {
if (action?.payload?.data?.statusCode === 1) {
state.PrintTemplate =
action?.payload?.data?.data?.[0]?.ComponentDetails?.find(
(item) =>
@ -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');
@ -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,6 +664,8 @@ 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(
@ -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');
@ -1177,6 +1205,9 @@ const SelectionComponent = forwardRef((props, ref) => {
...(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 }}>
@ -1670,8 +1701,6 @@ const SelectionComponent = forwardRef((props, ref) => {
/>
</div>
)}
{
<div style={{ marginTop: '1rem' }}>
<Title level={5} style={{ marginBottom: 12 }}>
BillName
@ -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 && (

View File

@ -72,6 +72,7 @@ const Printstyle4 = ({
SalesModePref,
MembershipApplied = null,
}) => {
console.log(printDatas, 'printDatas')
const dispatch = useDispatch();
const GlobalUpiID = useSelector(GlobalUpiIDprint);
const FieldDetails = useSelector(GloabalFieldDetails);
@ -88,7 +89,13 @@ const Printstyle4 = ({
const CashierNameField = FieldDetails?.['CashierName'];
const LogoField = FieldDetails?.['Logo'];
const CreditDetails = FieldDetails?.['Credit details'];
const orderNo = FieldDetails?.['Order No'];
const paymentTypelabel = FieldDetails?.['Payment Type Label'];
const WeightasKg = FieldDetails?.['Weight'];
const BillLabel=FieldDetails?.['BillNoLabel']
const Total_Label=FieldDetails?.['Total Label']
const BillNoLabel = (printDatas?.PrintDocLabel && BillLabel) ? printDatas?.PrintDocLabel : "Bill No";
const TotalLabel = (printDatas?.PrintTotalLabel && Total_Label) ? printDatas?.PrintTotalLabel : "SUB TOTAL";
const GlobalSlNo = useSelector(GlobalprintSlNo);
const GlobalItem = useSelector(GlobalprintItem);
const GlobalMRP = useSelector(GlobalprintMRP);
@ -587,7 +594,7 @@ const Printstyle4 = ({
</div>
<div style={{ fontSize: '12px', fontWeight: '500' }}>
Bill No :
{BillNoLabel}:
{GlobaldummyData
? '51'
: table2Data?.OrderId &&
@ -1347,29 +1354,6 @@ const Printstyle4 = ({
</div>
)}
<div className="PrintStyle4-ThirdDivMaster">
<div
className="print2subTotal"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
fontSize: '12px',
fontWeight: 500,
fontFamily: 'Poppins',
borderBottom: '1px dashed #000',
borderTop: '1px dashed #000',
padding: '5px 0',
...netAmountStyle,
}}
>
{' '}
<div>Sub Total</div>
<div>
{GlobaldummyData
? '1,066'
: Number(table2Data?.NetAmount).toFixed(2)}
</div>
</div>
<div
className="print2subTotal"
style={{
@ -1404,6 +1388,30 @@ const Printstyle4 = ({
</div>
</div>
</div>
<div
className="print2subTotal"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
fontSize: '12px',
fontWeight: 500,
fontFamily: 'Poppins',
borderBottom: '1px dashed #000',
borderTop: '1px dashed #000',
padding: '5px 0',
...netAmountStyle,
}}
>
{' '}
<div>{TotalLabel}</div>
<div>
{GlobaldummyData
? '1,066'
: Number(table2Data?.NetAmount).toFixed(2)}
</div>
</div>
</div>
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? (
@ -1765,7 +1773,7 @@ const Printstyle4 = ({
</div>
)}
<div
{paymentTypelabel && <div
style={{
display: 'flex',
justifyContent: 'space-evenly',
@ -1792,7 +1800,7 @@ const Printstyle4 = ({
: Number(table2Data?.NetAmount).toFixed(2)}
/-{' '}
</div>
</div>
</div>}
{isEditedBill && lastTransaction && (
<div
style={{
@ -2014,11 +2022,11 @@ const Printstyle4 = ({
<div style={{}}>
{/* <div className='PrintStyle4-FourthSmallwordings'>Scan to Pay</div> */}
<div style={{ fontSize: '12px', fontWeight: '600' }}>
{orderNo && <div style={{ fontSize: '12px', fontWeight: '600' }}>
YOUR ORDER NO:
{table2Data?.SalesId &&
extractLastNumber(table2Data?.SalesId)}
</div>
</div>}
<div className="PrintStyle4-FourthP">
{PaymentStatusSuccess?.length > 1 &&
!isEditedBill && (
@ -2338,28 +2346,6 @@ const Printstyle4 = ({
</div>
)}
<div className="PrintStyle4-ThirdDivMaster">
<div
className="print2subTotal"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
fontSize: '12px',
fontWeight: '600',
fontFamily: 'Poppins',
borderBottom: '1px dashed #000',
borderTop: '1px dashed #000',
padding: '5px 0',
...netAmountStyle,
}}
>
<div>Sub Total</div>
<div>
{GlobaldummyData
? '1,066'
: Number(table2Data?.NetAmount).toFixed(2)}
</div>
</div>
<div
className="print2subTotal"
style={{
@ -2394,6 +2380,29 @@ const Printstyle4 = ({
</div>
</div>
</div>
<div
className="print2subTotal"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
fontSize: '12px',
fontWeight: '600',
fontFamily: 'Poppins',
borderBottom: '1px dashed #000',
borderTop: '1px dashed #000',
padding: '5px 0',
...netAmountStyle,
}}
>
<div>{TotalLabel}</div>
<div>
{GlobaldummyData
? '1,066'
: Number(table2Data?.NetAmount).toFixed(2)}
</div>
</div>
</div>
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? (
@ -2755,7 +2764,7 @@ const Printstyle4 = ({
</div>
)}
<div
{paymentTypelabel && <div
style={{
display: 'flex',
justifyContent: 'space-evenly',
@ -2782,7 +2791,7 @@ const Printstyle4 = ({
: Number(table2Data?.NetAmount).toFixed(2)}
/-{' '}
</div>
</div>
</div>}
{isEditedBill && lastTransaction && (
<div
style={{
@ -2995,11 +3004,11 @@ const Printstyle4 = ({
)}
<div style={{}}>
{/* <div className='PrintStyle4-FourthSmallwordings'>Scan to Pay</div> */}
<div style={{ fontSize: '12px', fontWeight: '600' }}>
{orderNo && <div style={{ fontSize: '12px', fontWeight: '600' }}>
YOUR ORDER NO:
{table2Data?.SalesId &&
extractLastNumber(table2Data?.SalesId)}
</div>
</div>}
<div className="PrintStyle4-FourthP">
{PaymentStatusSuccess?.length > 1 && !isEditedBill && (
<>
@ -3399,7 +3408,7 @@ const Printstyle4 = ({
</div>
<div>
Bill No :
{BillNoLabel}:
{GlobaldummyData
? '51'
: table2Data?.OrderId &&
@ -4215,29 +4224,6 @@ const Printstyle4 = ({
</>
)}
<div className="PrintStyle4-ThirdDivMaster">
<div
className="print2subTotal"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
fontSize: '12px',
fontWeight: 500,
fontFamily: 'Poppins',
borderBottom: '1px dashed #000',
borderTop: '1px dashed #000',
padding: '5px 0',
...netAmountStyle,
}}
>
<div>Sub Total</div>
<div>
{GlobaldummyData
? '1,066'
: Number(table2Data?.NetAmount).toFixed(2)}
</div>
</div>
<div
className="print2subTotal"
style={{
@ -4265,6 +4251,30 @@ const Printstyle4 = ({
</div>
</div>
</div>
<div
className="print2subTotal"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
fontSize: '12px',
fontWeight: 500,
fontFamily: 'Poppins',
borderBottom: '1px dashed #000',
borderTop: '1px dashed #000',
padding: '5px 0',
...netAmountStyle,
}}
>
<div>{TotalLabel}</div>
<div>
{GlobaldummyData
? '1,066'
: Number(table2Data?.NetAmount).toFixed(2)}
</div>
</div>
</div>
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? (
@ -4610,7 +4620,7 @@ const Printstyle4 = ({
</div>
)}
<div
{paymentTypelabel && <div
style={{
display: 'flex',
justifyContent: 'space-evenly',
@ -4637,7 +4647,7 @@ const Printstyle4 = ({
: Number(table2Data?.NetAmount).toFixed(2)}
/-{' '}
</div>
</div>
</div>}
{isEditedBill && lastTransaction && (
<div
style={{
@ -4836,10 +4846,10 @@ const Printstyle4 = ({
)}
<div style={{}}>
{/* <div className='PrintStyle4-FourthSmallwordings'>Scan to Pay</div> */}
<div style={{ fontSize: '12px', fontWeight: '600' }}>
{orderNo && <div style={{ fontSize: '12px', fontWeight: '600' }}>
YOUR ORDER NO:
{table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
</div>
</div>}
<div className="PrintStyle4-FourthP">
{PaymentStatusSuccess?.length > 1 && !isEditedBill && (
<>

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' ? (