Fix #264 Discount change based on preference
This commit is contained in:
parent
cc7a002f18
commit
6a07094d7f
File diff suppressed because it is too large
Load Diff
|
|
@ -58,9 +58,16 @@ const PreferenceList = () => {
|
|||
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
||||
|
||||
const allSettingsMap = {};
|
||||
settingsList?.forEach(({ SettingIdName, SettingValue, SettingCount, SettingTime,Comments }) => {
|
||||
allSettingsMap[SettingIdName?.toLowerCase()] = { value: SettingValue, count: SettingCount, time: SettingTime?.split(' ')?.[0], comments: Comments };
|
||||
});
|
||||
settingsList?.forEach(
|
||||
({ SettingIdName, SettingValue, SettingCount, SettingTime, Comments }) => {
|
||||
allSettingsMap[SettingIdName?.toLowerCase()] = {
|
||||
value: SettingValue,
|
||||
count: SettingCount,
|
||||
time: SettingTime?.split(' ')?.[0],
|
||||
comments: Comments,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
console.log(featureaddDetails, 'featureaddDetails');
|
||||
|
||||
|
|
@ -89,16 +96,35 @@ const PreferenceList = () => {
|
|||
wholesaleshortname: allSettingsMap['wholesaleshortname']?.comments || 'WS',
|
||||
billitemsorder: allSettingsMap['billitemsorder']?.value === 'Y',
|
||||
preorderpricechange: allSettingsMap['preorderpricechange']?.value === 'Y',
|
||||
quantityrestriction: allSettingsMap['overalllimit']?.value === 'Y' || allSettingsMap['itemwiselimit']?.value === 'Y',
|
||||
quantityrestrictiontype: allSettingsMap['overalllimit']?.value === 'Y' ? 'overall' : allSettingsMap['itemwiselimit']?.value === 'Y' ? 'itemwise' : 'overall',
|
||||
kiosktimelimit: allSettingsMap['hours']?.value === 'Y' || allSettingsMap['minutes']?.value === 'Y',
|
||||
kiosktimelimittype: allSettingsMap['hours']?.value === 'Y' ? 'hours' : allSettingsMap['minutes']?.value === 'Y' ? 'minutes' : 'minutes',
|
||||
maxquantity: allSettingsMap['overalllimit']?.value === 'Y' ? allSettingsMap['overalllimit']?.count || 1 : allSettingsMap['itemwiselimit']?.value === 'Y' ? allSettingsMap['itemwiselimit']?.count || 1 : 1,
|
||||
quantityrestriction:
|
||||
allSettingsMap['overalllimit']?.value === 'Y' ||
|
||||
allSettingsMap['itemwiselimit']?.value === 'Y',
|
||||
quantityrestrictiontype:
|
||||
allSettingsMap['overalllimit']?.value === 'Y'
|
||||
? 'overall'
|
||||
: allSettingsMap['itemwiselimit']?.value === 'Y'
|
||||
? 'itemwise'
|
||||
: 'overall',
|
||||
kiosktimelimit:
|
||||
allSettingsMap['hours']?.value === 'Y' ||
|
||||
allSettingsMap['minutes']?.value === 'Y',
|
||||
kiosktimelimittype:
|
||||
allSettingsMap['hours']?.value === 'Y'
|
||||
? 'hours'
|
||||
: allSettingsMap['minutes']?.value === 'Y'
|
||||
? 'minutes'
|
||||
: 'minutes',
|
||||
maxquantity:
|
||||
allSettingsMap['overalllimit']?.value === 'Y'
|
||||
? allSettingsMap['overalllimit']?.count || 1
|
||||
: allSettingsMap['itemwiselimit']?.value === 'Y'
|
||||
? allSettingsMap['itemwiselimit']?.count || 1
|
||||
: 1,
|
||||
maxtime:
|
||||
allSettingsMap['hours']?.value === 'Y'
|
||||
? (allSettingsMap['hours']?.time
|
||||
? allSettingsMap['hours']?.time
|
||||
? parseFloat(allSettingsMap['hours']?.time / 60)
|
||||
: 0.5)
|
||||
: 0.5
|
||||
: allSettingsMap['minutes']?.value === 'Y'
|
||||
? parseFloat(allSettingsMap['minutes']?.time || 30)
|
||||
: 30,
|
||||
|
|
@ -118,14 +144,19 @@ const PreferenceList = () => {
|
|||
),
|
||||
mobilea4: allSettingsMap['mobilea4']?.value === 'Y',
|
||||
estimateSettings: [
|
||||
...(allSettingsMap['estimateprintheader']?.value === 'Y' ? ['estimateprintheader'] : []),
|
||||
...(allSettingsMap['estimatetitle']?.value === 'Y' ? ['estimatetitle'] : []),
|
||||
...(allSettingsMap['estimateprintheader']?.value === 'Y'
|
||||
? ['estimateprintheader']
|
||||
: []),
|
||||
...(allSettingsMap['estimatetitle']?.value === 'Y'
|
||||
? ['estimatetitle']
|
||||
: []),
|
||||
],
|
||||
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||
imeidetails: allSettingsMap['imeidetails']?.value === 'Y',
|
||||
customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y',
|
||||
upiqr: allSettingsMap['upiqr']?.value === 'Y',
|
||||
itemdiscount: allSettingsMap['itemdiscount']?.value === 'Y',
|
||||
lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y',
|
||||
weeklysalesreport: allSettingsMap['weeklysalesreport']?.value === 'Y',
|
||||
notificationblink: allSettingsMap['notificationblink']?.value === 'Y',
|
||||
|
|
@ -245,7 +276,7 @@ const PreferenceList = () => {
|
|||
res?.data?.data?.map((i) => ({
|
||||
SettingIdName: i.ConfigName,
|
||||
SettingId: i.ConfigId,
|
||||
Comments: i.Comments || "",
|
||||
Comments: i.Comments || '',
|
||||
SettingValue: 'N',
|
||||
}))
|
||||
);
|
||||
|
|
@ -305,9 +336,9 @@ const PreferenceList = () => {
|
|||
const handleSubmit = async () => {
|
||||
const values = formRef.current.getFieldsValue();
|
||||
const salesMode = values.salesmode;
|
||||
console.log("Sales Mode:", values.salesmode);
|
||||
console.log("Retail Short Name:", values.retailshortname);
|
||||
console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||
console.log('Sales Mode:', values.salesmode);
|
||||
console.log('Retail Short Name:', values.retailshortname);
|
||||
console.log('Wholesale Short Name:', values.wholesaleshortname);
|
||||
const settings = settingsList || [];
|
||||
console.log(values, 'values');
|
||||
const updatedSettings = settings.map((setting) => {
|
||||
|
|
@ -325,7 +356,7 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
weightasquantity: values.weightasquantity,
|
||||
expiredselection: values.expiredselection,
|
||||
'sales mode': values?.['salesmode'],
|
||||
|
||||
|
||||
billitemsorder: values.billitemsorder,
|
||||
preorderpricechange: values.preorderpricechange,
|
||||
tokenonly: values.tokenonly,
|
||||
|
|
@ -336,14 +367,20 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
imeidetails: values.imeidetails,
|
||||
customisedbillnumber: values.customisedbillnumber,
|
||||
upiqr: values.upiqr,
|
||||
itemdiscount: values.itemdiscount,
|
||||
lowstockreport: values.lowstockreport,
|
||||
weeklysalesreport: values.weeklysalesreport,
|
||||
notificationblink: values.notificationblink,
|
||||
editbill: values.editbill,
|
||||
overalllimit: values.quantityrestriction && values.quantityrestrictiontype === 'overall',
|
||||
itemwiselimit: values.quantityrestriction && values.quantityrestrictiontype === 'itemwise',
|
||||
overalllimit:
|
||||
values.quantityrestriction &&
|
||||
values.quantityrestrictiontype === 'overall',
|
||||
itemwiselimit:
|
||||
values.quantityrestriction &&
|
||||
values.quantityrestrictiontype === 'itemwise',
|
||||
hours: values.kiosktimelimit && values.kiosktimelimittype === 'hours',
|
||||
minutes: values.kiosktimelimit && values.kiosktimelimittype === 'minutes',
|
||||
minutes:
|
||||
values.kiosktimelimit && values.kiosktimelimittype === 'minutes',
|
||||
};
|
||||
|
||||
const arrayValues = {
|
||||
|
|
@ -371,38 +408,38 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
? boolValues[key]
|
||||
: (arrayValues[key]?.includes(key) ?? false);
|
||||
|
||||
return {
|
||||
ConfigName: setting.SettingIdName,
|
||||
SettingId: setting.SettingId,
|
||||
return {
|
||||
ConfigName: setting.SettingIdName,
|
||||
SettingId: setting.SettingId,
|
||||
|
||||
Comments:
|
||||
key === "retailshortname"
|
||||
? values.retailshortname || ""
|
||||
: key === "wholesaleshortname"
|
||||
? values.wholesaleshortname || ""
|
||||
: setting.Comments || "",
|
||||
Comments:
|
||||
key === 'retailshortname'
|
||||
? values.retailshortname || ''
|
||||
: key === 'wholesaleshortname'
|
||||
? values.wholesaleshortname || ''
|
||||
: setting.Comments || '',
|
||||
|
||||
SettingValue:
|
||||
key === "retailshortname" || key === "wholesaleshortname"
|
||||
? salesMode
|
||||
? "Y"
|
||||
: "N"
|
||||
: isChecked
|
||||
? "Y"
|
||||
: "N",
|
||||
SettingValue:
|
||||
key === 'retailshortname' || key === 'wholesaleshortname'
|
||||
? salesMode
|
||||
? 'Y'
|
||||
: 'N'
|
||||
: isChecked
|
||||
? 'Y'
|
||||
: 'N',
|
||||
|
||||
SettingCount:
|
||||
(key === "overalllimit" || key === "itemwiselimit") && isChecked
|
||||
? parseFloat(values.maxquantity) || null
|
||||
: null,
|
||||
SettingCount:
|
||||
(key === 'overalllimit' || key === 'itemwiselimit') && isChecked
|
||||
? parseFloat(values.maxquantity) || null
|
||||
: null,
|
||||
|
||||
SettingTime:
|
||||
key === "hours" && isChecked
|
||||
? (parseFloat(values.maxtime) * 60).toFixed(2) + " Minutes"
|
||||
: key === "minutes" && isChecked
|
||||
? parseFloat(values.maxtime).toFixed(2) + " Minutes"
|
||||
: null,
|
||||
};
|
||||
SettingTime:
|
||||
key === 'hours' && isChecked
|
||||
? (parseFloat(values.maxtime) * 60).toFixed(2) + ' Minutes'
|
||||
: key === 'minutes' && isChecked
|
||||
? parseFloat(values.maxtime).toFixed(2) + ' Minutes'
|
||||
: null,
|
||||
};
|
||||
});
|
||||
|
||||
const payload = {
|
||||
|
|
@ -542,95 +579,130 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
'decimal',
|
||||
'Display values with 2 decimal places throughout the app?'
|
||||
)}
|
||||
{renderCheckbox(
|
||||
{renderCheckbox(
|
||||
'salespageaskiosk',
|
||||
'Do you want to open sales page as kiosk layout?'
|
||||
)}
|
||||
{(allSettingsMap['onlineindividualslots'] !== undefined ||
|
||||
allSettingsMap['allow individual booking'] !== undefined ||
|
||||
allSettingsMap['single booking only'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="BookingOptionsandmethod"
|
||||
label="Individual Selling Setup"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['allow individual booking'] !==
|
||||
undefined && (
|
||||
<Checkbox value="allow individual booking">
|
||||
Allow online individual booking
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['single booking only'] !== undefined && (
|
||||
<Checkbox value="single booking only">
|
||||
Allow single booking Only
|
||||
</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="BookingOptionsandmethod"
|
||||
label="Individual Selling Setup"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['allow individual booking'] !==
|
||||
undefined && (
|
||||
<Checkbox value="allow individual booking">
|
||||
Allow online individual booking
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['single booking only'] !== undefined && (
|
||||
<Checkbox value="single booking only">
|
||||
Allow single booking Only
|
||||
</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
{featureaddDetails?.find(
|
||||
(item) =>
|
||||
item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
||||
) &&
|
||||
renderCheckbox(
|
||||
'kioskotp',
|
||||
'Enable OTP verification for Kiosk Orders?'
|
||||
)}
|
||||
{featureaddDetails?.find(
|
||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
||||
) && renderCheckbox('kioskotp', 'Enable OTP verification for Kiosk Orders?')}
|
||||
{featureaddDetails?.find(
|
||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
||||
) && (allSettingsMap['hours'] !== undefined || allSettingsMap['minutes'] !== undefined) && <>
|
||||
<Form.Item name="kiosktimelimit" label="Restrict orders for the same customer within a time limit?" valuePropName="checked">
|
||||
<Checkbox>Yes</Checkbox>
|
||||
</Form.Item>
|
||||
<Form.Item noStyle shouldUpdate={(prev, curr) => prev.kiosktimelimit !== curr.kiosktimelimit}>
|
||||
{({ getFieldValue }) => getFieldValue('kiosktimelimit') && (
|
||||
<>
|
||||
<Form.Item name="kiosktimelimittype" label="How would you like to apply the time restriction?">
|
||||
<Radio.Group onChange={() => formRef.current?.setFieldsValue({ maxtime: undefined })}>
|
||||
{allSettingsMap['minutes'] !== undefined && (
|
||||
<Radio value="minutes">Minutes</Radio>
|
||||
)}
|
||||
{allSettingsMap['hours'] !== undefined && (
|
||||
<Radio value="hours">Hours</Radio>
|
||||
)}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.kiosktimelimittype !== curr.kiosktimelimittype
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) => {
|
||||
const type = getFieldValue('kiosktimelimittype');
|
||||
|
||||
const isHours = type === 'hours';
|
||||
|
||||
return (
|
||||
<Form.Item
|
||||
name="maxtime"
|
||||
label={`Maximum Time Limit (${isHours ? 'Hours' : 'Minutes'}):`}
|
||||
rules={[
|
||||
{ required: true, message: 'Please enter maximum time' },
|
||||
{
|
||||
type: 'number',
|
||||
min: isHours ? 0.25 : 1,
|
||||
message: isHours
|
||||
? 'Minimum allowed is 0.25 hours'
|
||||
: 'Minimum allowed is 1 minute',
|
||||
},
|
||||
]}
|
||||
(item) =>
|
||||
item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
||||
) &&
|
||||
(allSettingsMap['hours'] !== undefined ||
|
||||
allSettingsMap['minutes'] !== undefined) && (
|
||||
<>
|
||||
<Form.Item
|
||||
name="kiosktimelimit"
|
||||
label="Restrict orders for the same customer within a time limit?"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Checkbox>Yes</Checkbox>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.kiosktimelimit !== curr.kiosktimelimit
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('kiosktimelimit') && (
|
||||
<>
|
||||
<Form.Item
|
||||
name="kiosktimelimittype"
|
||||
label="How would you like to apply the time restriction?"
|
||||
>
|
||||
<Radio.Group
|
||||
onChange={() =>
|
||||
formRef.current?.setFieldsValue({
|
||||
maxtime: undefined,
|
||||
})
|
||||
}
|
||||
>
|
||||
<InputNumber
|
||||
min={isHours ? 0.25 : 1}
|
||||
step={isHours ? 0.25 : 1}
|
||||
precision={isHours ? 2 : 0}
|
||||
style={{ width: '200px' }}
|
||||
/>
|
||||
</Form.Item>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
</Form.Item>
|
||||
</>}
|
||||
{allSettingsMap['minutes'] !== undefined && (
|
||||
<Radio value="minutes">Minutes</Radio>
|
||||
)}
|
||||
{allSettingsMap['hours'] !== undefined && (
|
||||
<Radio value="hours">Hours</Radio>
|
||||
)}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.kiosktimelimittype !==
|
||||
curr.kiosktimelimittype
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) => {
|
||||
const type =
|
||||
getFieldValue('kiosktimelimittype');
|
||||
|
||||
const isHours = type === 'hours';
|
||||
|
||||
return (
|
||||
<Form.Item
|
||||
name="maxtime"
|
||||
label={`Maximum Time Limit (${isHours ? 'Hours' : 'Minutes'}):`}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please enter maximum time',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
min: isHours ? 0.25 : 1,
|
||||
message: isHours
|
||||
? 'Minimum allowed is 0.25 hours'
|
||||
: 'Minimum allowed is 1 minute',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber
|
||||
min={isHours ? 0.25 : 1}
|
||||
step={isHours ? 0.25 : 1}
|
||||
precision={isHours ? 2 : 0}
|
||||
style={{ width: '200px' }}
|
||||
/>
|
||||
</Form.Item>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
|
@ -662,23 +734,23 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
{(allSettingsMap['onbilltime'] !== undefined ||
|
||||
allSettingsMap['1daybefore'] !== undefined ||
|
||||
allSettingsMap['1hourbefore'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="notification"
|
||||
label="Choose notification timing:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['onbilltime'] !== undefined && (
|
||||
<Checkbox value="onbilltime">On Bill Time</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1daybefore'] !== undefined && (
|
||||
<Checkbox value="1daybefore">1 Day Before</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1hourbefore'] !== undefined && (
|
||||
<Checkbox value="1hourbefore">1 Hour Before</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="notification"
|
||||
label="Choose notification timing:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['onbilltime'] !== undefined && (
|
||||
<Checkbox value="onbilltime">On Bill Time</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1daybefore'] !== undefined && (
|
||||
<Checkbox value="1daybefore">1 Day Before</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1hourbefore'] !== undefined && (
|
||||
<Checkbox value="1hourbefore">1 Hour Before</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
|
@ -705,45 +777,45 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
|
||||
{(allSettingsMap['offer'] !== undefined ||
|
||||
allSettingsMap['parking'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="enabledFeatures"
|
||||
label="Select the features you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['parking'] !== undefined && (
|
||||
<Checkbox value="parking">Parking</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['offer'] !== undefined && (
|
||||
<Checkbox value="offer">Offer</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="enabledFeatures"
|
||||
label="Select the features you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['parking'] !== undefined && (
|
||||
<Checkbox value="parking">Parking</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['offer'] !== undefined && (
|
||||
<Checkbox value="offer">Offer</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
{((allSettingsMap['dinein'] !== undefined && dinePreference) ||
|
||||
allSettingsMap['estimation'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="enabledModules"
|
||||
label="Select the modules you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['dinein'] !== undefined &&
|
||||
dinePreference && (
|
||||
<Checkbox value="dinein">Dine-In</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['estimation'] !== undefined && (
|
||||
<Checkbox value="estimation">Estimation</Checkbox>
|
||||
<Form.Item
|
||||
name="enabledModules"
|
||||
label="Select the modules you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['dinein'] !== undefined &&
|
||||
dinePreference && (
|
||||
<Checkbox value="dinein">Dine-In</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
{allSettingsMap['estimation'] !== undefined && (
|
||||
<Checkbox value="estimation">Estimation</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
{renderCheckbox('stockselection', 'Enable stock selection?')}
|
||||
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
||||
{renderCheckbox('expiredselection', 'Show product expiry date?')}
|
||||
{/* {renderCheckbox('sales mode', 'Retail or Wholesale mode?')} */}
|
||||
{(allSettingsMap['sales mode'] !== undefined ) && (
|
||||
{allSettingsMap['sales mode'] !== undefined && (
|
||||
<>
|
||||
<Form.Item
|
||||
<Form.Item
|
||||
name="salesmode"
|
||||
label="Retail or Wholesale mode?"
|
||||
valuePropName="checked"
|
||||
|
|
@ -751,42 +823,49 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
<Checkbox>Yes</Checkbox>
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) => prev.salesmode !== curr.salesmode}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('salesmode') && (
|
||||
<>
|
||||
<Form.Item
|
||||
name="retailshortname"
|
||||
label="Retail Short Name"
|
||||
|
||||
rules={[
|
||||
{ required: true, message: "Please enter Retail Short Name" },
|
||||
]}
|
||||
>
|
||||
<InputField placeholder="Enter Retail Short Name" style={{ width: 250 }} />
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) => prev.salesmode !== curr.salesmode}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('salesmode') && (
|
||||
<>
|
||||
<Form.Item
|
||||
name="retailshortname"
|
||||
label="Retail Short Name"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please enter Retail Short Name',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputField
|
||||
placeholder="Enter Retail Short Name"
|
||||
style={{ width: 250 }}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="wholesaleshortname"
|
||||
label="Wholesale Short Name"
|
||||
|
||||
rules={[
|
||||
{ required: true, message: "Please enter Wholesale Short Name" },
|
||||
]}
|
||||
>
|
||||
<InputField
|
||||
placeholder="Enter Wholesale Short Name"
|
||||
style={{ width: 250 }}
|
||||
/>
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="wholesaleshortname"
|
||||
label="Wholesale Short Name"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please enter Wholesale Short Name',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputField
|
||||
placeholder="Enter Wholesale Short Name"
|
||||
style={{ width: 250 }}
|
||||
/>
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
{renderCheckbox(
|
||||
'billitemsorder',
|
||||
'Show selected items first in Order Summary?'
|
||||
|
|
@ -809,40 +888,77 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
)}
|
||||
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
||||
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
||||
{renderCheckbox(
|
||||
'itemdiscount',
|
||||
'Do you want to show the Item Discount in Price OverRide?'
|
||||
)}
|
||||
{/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
|
||||
|
||||
{(allSettingsMap['overalllimit'] !== undefined || allSettingsMap['itemwiselimit'] !== undefined) && (
|
||||
{(allSettingsMap['overalllimit'] !== undefined ||
|
||||
allSettingsMap['itemwiselimit'] !== undefined) && (
|
||||
<>
|
||||
<Form.Item name="quantityrestriction" label="Do you want to restrict the quantity that can be sold in a single order?" valuePropName="checked">
|
||||
<Form.Item
|
||||
name="quantityrestriction"
|
||||
label="Do you want to restrict the quantity that can be sold in a single order?"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Checkbox>Yes</Checkbox>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item noStyle shouldUpdate={(prev, curr) => prev.quantityrestriction !== curr.quantityrestriction}>
|
||||
{({ getFieldValue }) => getFieldValue('quantityrestriction') && (
|
||||
<>
|
||||
<Form.Item name="quantityrestrictiontype" label="How would you like to apply the quantity restriction?">
|
||||
<Radio.Group onChange={() => formRef.current?.setFieldsValue({ maxquantity: undefined })}>
|
||||
{allSettingsMap['overalllimit'] !== undefined && (
|
||||
<Radio value="overall">Overall Order Quantity</Radio>
|
||||
)}
|
||||
{allSettingsMap['itemwiselimit'] !== undefined && (
|
||||
<Radio value="itemwise">Item-wise Quantity</Radio>
|
||||
)}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.quantityrestriction !== curr.quantityrestriction
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('quantityrestriction') && (
|
||||
<>
|
||||
<Form.Item
|
||||
name="quantityrestrictiontype"
|
||||
label="How would you like to apply the quantity restriction?"
|
||||
>
|
||||
<Radio.Group
|
||||
onChange={() =>
|
||||
formRef.current?.setFieldsValue({
|
||||
maxquantity: undefined,
|
||||
})
|
||||
}
|
||||
>
|
||||
{allSettingsMap['overalllimit'] !== undefined && (
|
||||
<Radio value="overall">
|
||||
Overall Order Quantity
|
||||
</Radio>
|
||||
)}
|
||||
{allSettingsMap['itemwiselimit'] !==
|
||||
undefined && (
|
||||
<Radio value="itemwise">
|
||||
Item-wise Quantity
|
||||
</Radio>
|
||||
)}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="maxquantity"
|
||||
label="Maximum quantity allowed:"
|
||||
rules={[
|
||||
{ required: true, message: 'Please enter maximum quantity' },
|
||||
{ type: 'number', min: 1, message: 'Quantity must be greater than 0' }
|
||||
]}
|
||||
>
|
||||
<InputNumber min={1} style={{ width: '200px' }} />
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item
|
||||
name="maxquantity"
|
||||
label="Maximum quantity allowed:"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please enter maximum quantity',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
min: 1,
|
||||
message: 'Quantity must be greater than 0',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber min={1} style={{ width: '200px' }} />
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
|
|
@ -868,46 +984,46 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
{['whatsapp', 'sms', 'email'].some(
|
||||
(k) => allSettingsMap[k] !== undefined
|
||||
) && (
|
||||
<>
|
||||
<Form.Item
|
||||
name="billOption"
|
||||
label="Choose how to handle bills:"
|
||||
>
|
||||
<Radio.Group>
|
||||
<Radio value="print">Print Bill</Radio>
|
||||
<Radio value="pdf">Send PDF</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<>
|
||||
<Form.Item
|
||||
name="billOption"
|
||||
label="Choose how to handle bills:"
|
||||
>
|
||||
<Radio.Group>
|
||||
<Radio value="print">Print Bill</Radio>
|
||||
<Radio value="pdf">Send PDF</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.billOption !== curr.billOption
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('billOption') === 'pdf' && (
|
||||
<Form.Item
|
||||
name="pdfSendOptions"
|
||||
label="Select how to send the PDF:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['whatsapp'] !== undefined && (
|
||||
<Checkbox value="whatsapp">WhatsApp</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['email'] !== undefined && (
|
||||
<Checkbox value="email">Email</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['sms'] !== undefined && (
|
||||
<Checkbox value="sms">SMS</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.billOption !== curr.billOption
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('billOption') === 'pdf' && (
|
||||
<Form.Item
|
||||
name="pdfSendOptions"
|
||||
label="Select how to send the PDF:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['whatsapp'] !== undefined && (
|
||||
<Checkbox value="whatsapp">WhatsApp</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['email'] !== undefined && (
|
||||
<Checkbox value="email">Email</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['sms'] !== undefined && (
|
||||
<Checkbox value="sms">SMS</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
|
||||
{renderCheckbox(
|
||||
'tokenonly',
|
||||
|
|
@ -937,25 +1053,25 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
{['printuom', 'printlogo', 'printgreetings'].some(
|
||||
(k) => allSettingsMap[k] !== undefined
|
||||
) && (
|
||||
<Form.Item
|
||||
name="printOptions"
|
||||
label="Select what you want to include in the print:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['printuom'] !== undefined && (
|
||||
<Checkbox value="printuom">
|
||||
Unit of Measure (UOM)
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printlogo'] !== undefined && (
|
||||
<Checkbox value="printlogo">Branch Logo</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printgreetings'] !== undefined && (
|
||||
<Checkbox value="printgreetings">Greetings</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="printOptions"
|
||||
label="Select what you want to include in the print:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['printuom'] !== undefined && (
|
||||
<Checkbox value="printuom">
|
||||
Unit of Measure (UOM)
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printlogo'] !== undefined && (
|
||||
<Checkbox value="printlogo">Branch Logo</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printgreetings'] !== undefined && (
|
||||
<Checkbox value="printgreetings">Greetings</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
{renderCheckbox(
|
||||
'mobilea4',
|
||||
|
|
@ -963,20 +1079,24 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
|||
)}
|
||||
{(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)</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['estimatetitle'] !== undefined && (
|
||||
<Checkbox value="estimatetitle">Show “Estimate (R/W)” title</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="estimateSettings"
|
||||
label="Estimate Print Settings :"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['estimateprintheader'] !== undefined && (
|
||||
<Checkbox value="estimateprintheader">
|
||||
Show shop header (Name, Address, GST)
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['estimatetitle'] !== undefined && (
|
||||
<Checkbox value="estimatetitle">
|
||||
Show “Estimate (R/W)” title
|
||||
</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</div>
|
||||
<div className="PreferencesBTN">
|
||||
<Buttons
|
||||
|
|
|
|||
Loading…
Reference in New Issue