added phoneumber name address in the preference
This commit is contained in:
parent
03010314c5
commit
df6f4af53e
|
|
@ -175,6 +175,21 @@ const Printstyle4 = ({
|
||||||
(setting) =>
|
(setting) =>
|
||||||
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
|
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
|
||||||
)?.SettingValue === 'Y';
|
)?.SettingValue === 'Y';
|
||||||
|
const estimatebrname =
|
||||||
|
SettingData?.[0]?.SettingDtlDetails?.find(
|
||||||
|
(setting) =>
|
||||||
|
setting?.SettingIdName?.toLowerCase() === 'estimatebrname'
|
||||||
|
)?.SettingValue === 'Y';
|
||||||
|
const estimatebraddress =
|
||||||
|
SettingData?.[0]?.SettingDtlDetails?.find(
|
||||||
|
(setting) =>
|
||||||
|
setting?.SettingIdName?.toLowerCase() === 'estimatebraddress'
|
||||||
|
)?.SettingValue === 'Y';
|
||||||
|
const estimatebrphone =
|
||||||
|
SettingData?.[0]?.SettingDtlDetails?.find(
|
||||||
|
(setting) =>
|
||||||
|
setting?.SettingIdName?.toLowerCase() === 'estimatebrphone'
|
||||||
|
)?.SettingValue === 'Y';
|
||||||
const estimateTitle =
|
const estimateTitle =
|
||||||
SettingData?.[0]?.SettingDtlDetails?.find(
|
SettingData?.[0]?.SettingDtlDetails?.find(
|
||||||
(setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
|
(setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
|
||||||
|
|
@ -3347,7 +3362,7 @@ const Printstyle4 = ({
|
||||||
width={100}
|
width={100}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<div
|
{estimatebrname && <div
|
||||||
style={{
|
style={{
|
||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
|
|
@ -3359,10 +3374,10 @@ const Printstyle4 = ({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
|
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
|
||||||
</div>
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
{estimatebraddress && <div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|
@ -3386,12 +3401,14 @@ const Printstyle4 = ({
|
||||||
? '-'
|
? '-'
|
||||||
: '') + table2Data?.AddressDetails?.[0]?.Zip
|
: '') + table2Data?.AddressDetails?.[0]?.Zip
|
||||||
: '')}
|
: '')}
|
||||||
</div>
|
</div>}
|
||||||
|
{estimatebrphone && (
|
||||||
<div style={{ fontWeight: '500', fontSize: '10px' }}>
|
<div style={{ fontWeight: '500', fontSize: '10px' }}>
|
||||||
{' '}
|
{' '}
|
||||||
Mobile : +91{' '}
|
Mobile : +91{' '}
|
||||||
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
|
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* <div>
|
{/* <div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
|
import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
|
||||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||||
|
|
@ -30,6 +30,7 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
const { SadminuserAccess, featureaddDetails } = useAuth();
|
const { SadminuserAccess, featureaddDetails } = useAuth();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const formRef = useRef();
|
const formRef = useRef();
|
||||||
|
const prevEstimateRef = useRef([]);
|
||||||
const CompId = getSession('CompId');
|
const CompId = getSession('CompId');
|
||||||
const BranchId = getSession('BranchId');
|
const BranchId = getSession('BranchId');
|
||||||
const AppId = getSession('AppId');
|
const AppId = getSession('AppId');
|
||||||
|
|
@ -157,6 +158,10 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
...(allSettingsMap['estimatetitle']?.value === 'Y'
|
...(allSettingsMap['estimatetitle']?.value === 'Y'
|
||||||
? ['estimatetitle']
|
? ['estimatetitle']
|
||||||
: []),
|
: []),
|
||||||
|
...(allSettingsMap['estimatebrname']?.value === 'Y' ? ['estimatebrname'] : []),
|
||||||
|
...(allSettingsMap['estimatebraddress']?.value === 'Y' ? ['estimatebraddress'] : []),
|
||||||
|
...(allSettingsMap['estimatebrphone']?.value === 'Y' ? ['estimatebrphone'] : []),
|
||||||
|
|
||||||
],
|
],
|
||||||
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||||
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||||
|
|
@ -217,6 +222,8 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
setInitialValues(built);
|
setInitialValues(built);
|
||||||
console.log(built, 'built');
|
console.log(built, 'built');
|
||||||
formRef.current?.setFieldsValue(built);
|
formRef.current?.setFieldsValue(built);
|
||||||
|
prevEstimateRef.current = built.estimateSettings ?? [];
|
||||||
|
|
||||||
}
|
}
|
||||||
}, [settingsList]);
|
}, [settingsList]);
|
||||||
|
|
||||||
|
|
@ -405,8 +412,15 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
dinein: values.enabledModules,
|
dinein: values.enabledModules,
|
||||||
estimation: values.enabledModules,
|
estimation: values.enabledModules,
|
||||||
parking: values.enabledFeatures,
|
parking: values.enabledFeatures,
|
||||||
|
// estimateprintheader: values.estimateSettings,
|
||||||
|
// estimatebrname: values.estimatebrname,
|
||||||
|
// estimatebraddress: values.estimatebraddress,
|
||||||
|
// estimatebrphone: values.estimatebrphone,
|
||||||
estimateprintheader: values.estimateSettings,
|
estimateprintheader: values.estimateSettings,
|
||||||
estimatetitle: values.estimateSettings,
|
estimatetitle: values.estimateSettings,
|
||||||
|
estimatebrname: values.estimateSettings,
|
||||||
|
estimatebraddress: values.estimateSettings,
|
||||||
|
estimatebrphone: values.estimateSettings,
|
||||||
offer: values.enabledFeatures,
|
offer: values.enabledFeatures,
|
||||||
whatsapp: values.pdfSendOptions,
|
whatsapp: values.pdfSendOptions,
|
||||||
sms: values.pdfSendOptions,
|
sms: values.pdfSendOptions,
|
||||||
|
|
@ -533,6 +547,53 @@ const userDropData = async () => {
|
||||||
<Checkbox>Yes</Checkbox>
|
<Checkbox>Yes</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
|
const ESTIMATE_PRINT_SETTINGS = [
|
||||||
|
{
|
||||||
|
key: 'estimateprintheader',
|
||||||
|
label: 'Show shop header',
|
||||||
|
children: [
|
||||||
|
{ key: 'estimatebrname', label: 'name' },
|
||||||
|
{ key: 'estimatebraddress', label: 'address' },
|
||||||
|
{ key: 'estimatebrphone', label: 'phone number' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'estimatetitle',
|
||||||
|
label: 'Show "Estimate" title',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const handleEstimateChange = (checkedValues) => {
|
||||||
|
const prev = prevEstimateRef.current;
|
||||||
|
let updated = [...checkedValues];
|
||||||
|
|
||||||
|
ESTIMATE_PRINT_SETTINGS.forEach(({ key, children }) => {
|
||||||
|
if (!children.length) return;
|
||||||
|
|
||||||
|
const childKeys = children
|
||||||
|
.filter((c) => allSettingsMap[c.key] !== undefined)
|
||||||
|
.map((c) => c.key);
|
||||||
|
|
||||||
|
const parentJustChecked = checkedValues.includes(key) && !prev.includes(key);
|
||||||
|
|
||||||
|
// Parent just checked → add all children
|
||||||
|
if (parentJustChecked) {
|
||||||
|
updated = [...new Set([...updated, ...childKeys])];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate AFTER updated may have changed above ✅
|
||||||
|
const anyChildChecked = childKeys.some((c) => updated.includes(c));
|
||||||
|
|
||||||
|
// All children removed → remove parent
|
||||||
|
if (updated.includes(key) && !anyChildChecked) { // ✅ uses variable, no duplicate
|
||||||
|
updated = updated.filter((v) => v !== key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
prevEstimateRef.current = updated;
|
||||||
|
formRef.current?.setFieldValue('estimateSettings', updated);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -1164,26 +1225,33 @@ const userDropData = async () => {
|
||||||
'mobilea4',
|
'mobilea4',
|
||||||
'Prefer printing in A4/A5 on mobile?'
|
'Prefer printing in A4/A5 on mobile?'
|
||||||
)}
|
)}
|
||||||
{(allSettingsMap['estimateprintheader'] !== undefined ||
|
{ESTIMATE_PRINT_SETTINGS.some(({ key }) => allSettingsMap[key] !== undefined) && (
|
||||||
allSettingsMap['estimatetitle'] !== undefined) && (
|
<Form.Item noStyle shouldUpdate>
|
||||||
<Form.Item
|
{({ getFieldValue }) => (
|
||||||
name="estimateSettings"
|
<Form.Item name="estimateSettings" label="Estimate Print Settings :">
|
||||||
label="Estimate Print Settings :"
|
<Checkbox.Group onChange={(vals) => handleEstimateChange(vals, formRef)}>
|
||||||
>
|
{ESTIMATE_PRINT_SETTINGS
|
||||||
<Checkbox.Group>
|
.filter(({ key }) => allSettingsMap[key] !== undefined)
|
||||||
{allSettingsMap['estimateprintheader'] !== undefined && (
|
.map(({ key, label, children }) => (
|
||||||
<Checkbox value="estimateprintheader">
|
<React.Fragment key={key}>
|
||||||
Show shop header (Name, Address, GST)
|
<Checkbox value={key}>{label}</Checkbox>
|
||||||
|
|
||||||
|
{children.length > 0 &&
|
||||||
|
getFieldValue('estimateSettings')?.includes(key) &&
|
||||||
|
children
|
||||||
|
.filter((child) => allSettingsMap[child.key] !== undefined)
|
||||||
|
.map((child) => (
|
||||||
|
<Checkbox key={child.key} value={child.key}>
|
||||||
|
{child.label}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
)}
|
))}
|
||||||
{allSettingsMap['estimatetitle'] !== undefined && (
|
</React.Fragment>
|
||||||
<Checkbox value="estimatetitle">
|
))}
|
||||||
Show “Estimate (R/W)” title
|
|
||||||
</Checkbox>
|
|
||||||
)}
|
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="PreferencesBTN">
|
<div className="PreferencesBTN">
|
||||||
<Buttons
|
<Buttons
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue