Merge pull request 'remove readmefile' (#328) from poorinima_print4_style into main

Reviewed-on: Pozomind/pozo-retail-app#328
This commit is contained in:
karthikalakshmi 2026-03-31 17:14:54 +05:30
commit 02843b1990
3 changed files with 1946 additions and 4417 deletions

2556
README.md

File diff suppressed because it is too large Load Diff

View File

@ -175,6 +175,21 @@ const Printstyle4 = ({
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
)?.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 =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
@ -3347,7 +3362,7 @@ const Printstyle4 = ({
width={100}
/>
) : null}
<div
{estimatebrname && <div
style={{
fontSize: '16px',
fontWeight: '600',
@ -3359,10 +3374,10 @@ const Printstyle4 = ({
}}
>
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
</div>
</div>}
</div>
<div
{estimatebraddress && <div
style={{
display: 'flex',
justifyContent: 'center',
@ -3386,12 +3401,14 @@ const Printstyle4 = ({
? '-'
: '') + table2Data?.AddressDetails?.[0]?.Zip
: '')}
</div>
</div>}
{estimatebrphone && (
<div style={{ fontWeight: '500', fontSize: '10px' }}>
{' '}
Mobile : +91{' '}
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
</div>
)}
</div>
)}
{/* <div>

View File

@ -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 { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
import { ArrowRightOutlined } from '@ant-design/icons';
@ -30,6 +30,7 @@ const PreferenceList = ({ setting = false }) => {
const { SadminuserAccess, featureaddDetails } = useAuth();
const dispatch = useDispatch();
const formRef = useRef();
const prevEstimateRef = useRef([]);
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const AppId = getSession('AppId');
@ -157,6 +158,10 @@ const PreferenceList = ({ setting = false }) => {
...(allSettingsMap['estimatetitle']?.value === 'Y'
? ['estimatetitle']
: []),
...(allSettingsMap['estimatebrname']?.value === 'Y' ? ['estimatebrname'] : []),
...(allSettingsMap['estimatebraddress']?.value === 'Y' ? ['estimatebraddress'] : []),
...(allSettingsMap['estimatebrphone']?.value === 'Y' ? ['estimatebrphone'] : []),
],
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
@ -217,6 +222,8 @@ const PreferenceList = ({ setting = false }) => {
setInitialValues(built);
console.log(built, 'built');
formRef.current?.setFieldsValue(built);
prevEstimateRef.current = built.estimateSettings ?? [];
}
}, [settingsList]);
@ -405,8 +412,15 @@ const PreferenceList = ({ setting = false }) => {
dinein: values.enabledModules,
estimation: values.enabledModules,
parking: values.enabledFeatures,
// estimateprintheader: values.estimateSettings,
// estimatebrname: values.estimatebrname,
// estimatebraddress: values.estimatebraddress,
// estimatebrphone: values.estimatebrphone,
estimateprintheader: values.estimateSettings,
estimatetitle: values.estimateSettings,
estimatebrname: values.estimateSettings,
estimatebraddress: values.estimateSettings,
estimatebrphone: values.estimateSettings,
offer: values.enabledFeatures,
whatsapp: values.pdfSendOptions,
sms: values.pdfSendOptions,
@ -533,6 +547,53 @@ const userDropData = async () => {
<Checkbox>Yes</Checkbox>
</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 (
<>
@ -1164,26 +1225,33 @@ const userDropData = async () => {
'mobilea4',
'Prefer printing in A4/A5 on mobile?'
)}
{(allSettingsMap['estimateprintheader'] !== undefined ||
allSettingsMap['estimatetitle'] !== undefined) && (
<Form.Item
name="estimateSettings"
label="Estimate Print Settings :"
>
<Checkbox.Group>
{allSettingsMap['estimateprintheader'] !== undefined && (
<Checkbox value="estimateprintheader">
Show shop header (Name, Address, GST)
{ESTIMATE_PRINT_SETTINGS.some(({ key }) => allSettingsMap[key] !== undefined) && (
<Form.Item noStyle shouldUpdate>
{({ getFieldValue }) => (
<Form.Item name="estimateSettings" label="Estimate Print Settings :">
<Checkbox.Group onChange={(vals) => handleEstimateChange(vals, formRef)}>
{ESTIMATE_PRINT_SETTINGS
.filter(({ key }) => allSettingsMap[key] !== undefined)
.map(({ key, label, children }) => (
<React.Fragment key={key}>
<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>
)}
{allSettingsMap['estimatetitle'] !== undefined && (
<Checkbox value="estimatetitle">
Show Estimate (R/W) title
</Checkbox>
)}
))}
</React.Fragment>
))}
</Checkbox.Group>
</Form.Item>
)}
</Form.Item>
)}
</div>
<div className="PreferencesBTN">
<Buttons