total_label_and_billnolabel

This commit is contained in:
Tamilselvan 2026-03-11 17:13:53 +05:30
parent 94fb69b148
commit 429bc41285
3 changed files with 2064 additions and 1981 deletions

View File

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

View File

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