Merge branch 'main' of http://192.168.1.62:3000/Pozomind/pozo-retail-app into March-3-deployment
This commit is contained in:
commit
47a75e8843
|
|
@ -3180,13 +3180,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
...(
|
...(
|
||||||
!offerApply && itemDiscountPrice > 0
|
!offerApply && itemDiscountPrice > 0
|
||||||
? {
|
? {
|
||||||
DiscountAmt: safeRound(itemDiscountPrice),
|
DiscountAmt: safeRound(itemDiscountPrice*fixedQty ),
|
||||||
DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
|
DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
|
||||||
DiscountValue:
|
DiscountValue:
|
||||||
itemDiscountPercentageSelection === 'Fixed'
|
itemDiscountPercentageSelection === 'Fixed'
|
||||||
? itemDiscountPrice
|
? itemDiscountPrice*fixedQty
|
||||||
: (
|
: (
|
||||||
(itemDiscountPrice /
|
(itemDiscountPrice*fixedQty /
|
||||||
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * 100
|
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * 100
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -3301,7 +3301,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const { OfferType = null, OfferPrice = 0 } = product;
|
const { OfferType = null, OfferPrice = 0 } = product;
|
||||||
|
|
||||||
let totalAmount = qty * rate;
|
let totalAmount = qty * rate;
|
||||||
totalAmount = totalAmount - (itemDiscountPrice || 0);
|
totalAmount = totalAmount - (itemDiscountPrice*qty|| 0);
|
||||||
const taxAmount = (
|
const taxAmount = (
|
||||||
(totalAmount * taxPercentage) /
|
(totalAmount * taxPercentage) /
|
||||||
(100 + taxPercentage)
|
(100 + taxPercentage)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import {
|
||||||
GlobalSelectedFooterFontColor,
|
GlobalSelectedFooterFontColor,
|
||||||
GlobalSelectedNetAmountColor,
|
GlobalSelectedNetAmountColor,
|
||||||
GlobalSelectedNetAmountFontColor,
|
GlobalSelectedNetAmountFontColor,
|
||||||
|
GloabalFieldDetails,
|
||||||
} from '../../../../Features/ThemeChange/ThemeChange';
|
} from '../../../../Features/ThemeChange/ThemeChange';
|
||||||
import { isMobile } from 'react-device-detect';
|
import { isMobile } from 'react-device-detect';
|
||||||
import { extractLastNumberOrderId } from '../../../../Services/Others';
|
import { extractLastNumberOrderId } from '../../../../Services/Others';
|
||||||
|
|
@ -70,6 +71,10 @@ const TaxInvoice = ({
|
||||||
const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor;
|
const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor;
|
||||||
const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor;
|
const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor;
|
||||||
const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor;
|
const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor;
|
||||||
|
const FieldDetails = useSelector(GloabalFieldDetails);
|
||||||
|
console.log(FieldDetails,"FieldDetails")
|
||||||
|
const Discount = FieldDetails?.['Discount'];
|
||||||
|
console.log(Discount, "Discount")
|
||||||
// Function to convert number to words
|
// Function to convert number to words
|
||||||
const numberToWords = (num) => {
|
const numberToWords = (num) => {
|
||||||
const a = [
|
const a = [
|
||||||
|
|
@ -802,7 +807,8 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 8% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
|
// '5% 40% 12% 11% 16% 8% 16%',
|
||||||
fontSize: '10px',
|
fontSize: '10px',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
borderBottom: '1px solid #000',
|
borderBottom: '1px solid #000',
|
||||||
|
|
@ -855,6 +861,15 @@ const TaxInvoice = ({
|
||||||
>
|
>
|
||||||
Rate
|
Rate
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div
|
||||||
|
style={{
|
||||||
|
padding: '8px 4px',
|
||||||
|
borderRight: '1px solid #000',
|
||||||
|
textAlign: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Disc
|
||||||
|
</div>}
|
||||||
{/* <div style={{ padding: '8px 4px', borderRight: '1px solid #000', textAlign: 'center' }}>per</div> */}
|
{/* <div style={{ padding: '8px 4px', borderRight: '1px solid #000', textAlign: 'center' }}>per</div> */}
|
||||||
<div style={{ padding: '8px 4px', textAlign: 'center' }}>
|
<div style={{ padding: '8px 4px', textAlign: 'center' }}>
|
||||||
Amount
|
Amount
|
||||||
|
|
@ -869,7 +884,7 @@ const TaxInvoice = ({
|
||||||
key={index}
|
key={index}
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
...(index % 2 === 0 && rowtypeStyle === "even"
|
...(index % 2 === 0 && rowtypeStyle === "even"
|
||||||
? tableBodyStyle
|
? tableBodyStyle
|
||||||
|
|
@ -976,6 +991,21 @@ const TaxInvoice = ({
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div
|
||||||
|
style={{
|
||||||
|
padding: '4px 4px',
|
||||||
|
borderRight: '1px solid #000',
|
||||||
|
textAlign: 'right',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{Number(
|
||||||
|
|
||||||
|
(item.DiscountAmt / item.SalesQty) || 0
|
||||||
|
).toLocaleString('en-IN', {
|
||||||
|
minimumFractionDigits: 2,
|
||||||
|
maximumFractionDigits: 2,
|
||||||
|
})}
|
||||||
|
</div>}
|
||||||
{/* <div style={{ padding: '8px 4px', borderRight: '1px solid #000', textAlign: 'center' }}>{item.UomName || 'NOS'}</div> */}
|
{/* <div style={{ padding: '8px 4px', borderRight: '1px solid #000', textAlign: 'center' }}>{item.UomName || 'NOS'}</div> */}
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
|
@ -1003,7 +1033,7 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16% ' : '5% 40% 12% 11% 16% 16% ',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
fontSize: '15px',
|
fontSize: '15px',
|
||||||
minHeight: '22px',
|
minHeight: '22px',
|
||||||
|
|
@ -1017,6 +1047,7 @@ const TaxInvoice = ({
|
||||||
borderRight: '1px solid #000',
|
borderRight: '1px solid #000',
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
|
{Discount && <div style={{ borderRight: '1px solid #000' }}></div>}
|
||||||
<div style={{ borderRight: '1px solid #000' }}></div>
|
<div style={{ borderRight: '1px solid #000' }}></div>
|
||||||
<div style={{ borderRight: '1px solid #000' }}></div>
|
<div style={{ borderRight: '1px solid #000' }}></div>
|
||||||
<div style={{ borderRight: '1px solid #000' }}></div>
|
<div style={{ borderRight: '1px solid #000' }}></div>
|
||||||
|
|
@ -1048,7 +1079,7 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
fontSize: '11px',
|
fontSize: '11px',
|
||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
|
|
@ -1067,6 +1098,9 @@ const TaxInvoice = ({
|
||||||
>
|
>
|
||||||
CGST
|
CGST
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div
|
||||||
|
style={{ borderRight: '1px solid #000' }}
|
||||||
|
></div>}
|
||||||
<div
|
<div
|
||||||
style={{ borderRight: '1px solid #000' }}
|
style={{ borderRight: '1px solid #000' }}
|
||||||
></div>
|
></div>
|
||||||
|
|
@ -1100,7 +1134,7 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
fontSize: '11px',
|
fontSize: '11px',
|
||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
|
|
@ -1119,6 +1153,9 @@ const TaxInvoice = ({
|
||||||
>
|
>
|
||||||
SGST
|
SGST
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div
|
||||||
|
style={{ borderRight: '1px solid #000' }}
|
||||||
|
></div>}
|
||||||
<div
|
<div
|
||||||
style={{ borderRight: '1px solid #000' }}
|
style={{ borderRight: '1px solid #000' }}
|
||||||
></div>
|
></div>
|
||||||
|
|
@ -1155,7 +1192,7 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
fontSize: '11px',
|
fontSize: '11px',
|
||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
|
|
@ -1174,6 +1211,9 @@ const TaxInvoice = ({
|
||||||
>
|
>
|
||||||
IGST
|
IGST
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div
|
||||||
|
style={{ borderRight: '1px solid #000' }}
|
||||||
|
></div>}
|
||||||
<div
|
<div
|
||||||
style={{ borderRight: '1px solid #000' }}
|
style={{ borderRight: '1px solid #000' }}
|
||||||
></div>
|
></div>
|
||||||
|
|
@ -1211,7 +1251,7 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
// borderBottom: '1px solid #000',
|
// borderBottom: '1px solid #000',
|
||||||
fontSize: '11px',
|
fontSize: '11px',
|
||||||
|
|
@ -1229,6 +1269,10 @@ const TaxInvoice = ({
|
||||||
>
|
>
|
||||||
ROUNDING OFF
|
ROUNDING OFF
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{Discount && <div
|
||||||
|
style={{ borderRight: '1px solid #000' }}
|
||||||
|
></div>}
|
||||||
<div style={{ borderRight: '1px solid #000' }}></div>
|
<div style={{ borderRight: '1px solid #000' }}></div>
|
||||||
<div style={{ borderRight: '1px solid #000' }}></div>
|
<div style={{ borderRight: '1px solid #000' }}></div>
|
||||||
<div style={{ borderRight: '1px solid #000' }}></div>
|
<div style={{ borderRight: '1px solid #000' }}></div>
|
||||||
|
|
@ -1248,7 +1292,7 @@ const TaxInvoice = ({
|
||||||
key={`empty-${idx}`}
|
key={`empty-${idx}`}
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
|
|
||||||
minHeight: '32px', // Adjust height as needed for your design
|
minHeight: '32px', // Adjust height as needed for your design
|
||||||
|
|
@ -1272,6 +1316,15 @@ const TaxInvoice = ({
|
||||||
>
|
>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div
|
||||||
|
style={{
|
||||||
|
padding: '4px 4px',
|
||||||
|
borderRight: '1px solid #000',
|
||||||
|
textAlign: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
|
||||||
|
</div>}
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
padding: '4px 4px',
|
padding: '4px 4px',
|
||||||
|
|
@ -1311,7 +1364,7 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 11% 16% 16%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderRight: '1px solid #000',
|
// borderRight: '1px solid #000',
|
||||||
borderBottom: '1px solid #000',
|
borderBottom: '1px solid #000',
|
||||||
borderTop: '1px solid #000',
|
borderTop: '1px solid #000',
|
||||||
|
|
@ -1347,6 +1400,7 @@ const TaxInvoice = ({
|
||||||
0}{' '}
|
0}{' '}
|
||||||
NOS
|
NOS
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div style={{ borderRight: '1px solid #000' }}></div>}
|
||||||
<div style={{ borderRight: '1px solid #000' }}></div>
|
<div style={{ borderRight: '1px solid #000' }}></div>
|
||||||
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
|
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
|
||||||
<div
|
<div
|
||||||
|
|
@ -1376,7 +1430,7 @@ const TaxInvoice = ({
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '5% 40% 12% 10% 12% 8% 13%',
|
gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%',
|
||||||
// borderBottom: '1px solid #000',
|
// borderBottom: '1px solid #000',
|
||||||
borderLeft: '1px solid #000',
|
borderLeft: '1px solid #000',
|
||||||
borderRight: '1px solid #000',
|
borderRight: '1px solid #000',
|
||||||
|
|
@ -1403,6 +1457,15 @@ const TaxInvoice = ({
|
||||||
>
|
>
|
||||||
No items to display
|
No items to display
|
||||||
</div>
|
</div>
|
||||||
|
{Discount && <div
|
||||||
|
style={{
|
||||||
|
padding: '8px 4px',
|
||||||
|
borderRight: '1px solid #000',
|
||||||
|
textAlign: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
-
|
||||||
|
</div>}
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
padding: '8px 4px',
|
padding: '8px 4px',
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useState, useEffect, useRef } from 'react';
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { InputField } from '../../Components/Forms/InputField.jsx';
|
import { InputField } from '../../Components/Forms/InputField.jsx';
|
||||||
import Buttons from '../../Components/Forms/Buttons.jsx';
|
import Buttons from '../../Components/Forms/Buttons.jsx';
|
||||||
|
|
@ -37,6 +37,7 @@ import { MdLocationOn, MdHome } from 'react-icons/md';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { ApplicationPreferences } from '../../Features/BrachLogin/BranchLogin.js';
|
import { ApplicationPreferences } from '../../Features/BrachLogin/BranchLogin.js';
|
||||||
import { IoMdAddCircleOutline } from 'react-icons/io';
|
import { IoMdAddCircleOutline } from 'react-icons/io';
|
||||||
|
import { isIndianMobile } from '../../utils/calculations.js';
|
||||||
|
|
||||||
const subDirectory = import.meta.env.BASE_URL;
|
const subDirectory = import.meta.env.BASE_URL;
|
||||||
|
|
||||||
|
|
@ -354,57 +355,41 @@ const CustomerForm = ({ formType }) => {
|
||||||
|
|
||||||
//post data
|
//post data
|
||||||
const onFinish = async (values) => {
|
const onFinish = async (values) => {
|
||||||
let postData = values;
|
try {
|
||||||
console.log(postData, 'postData');
|
let postData = values;
|
||||||
|
console.log(postData, 'postData');
|
||||||
// Handle address data - use only the addresses from addressesList
|
const validMobile = isIndianMobile(postData?.CustMobile);
|
||||||
const addedAddresses = addressesList || [];
|
if (!validMobile) {
|
||||||
|
setMessageType('warning');
|
||||||
// Only include addresses that have Address1 and Zip
|
setMessageData('Please enter a valid Indian mobile number.');
|
||||||
const validAddresses = addedAddresses.filter(
|
return;
|
||||||
(addr) => addr?.Address1 && addr?.Zip
|
|
||||||
);
|
|
||||||
|
|
||||||
postData['CustomerAddressDtl'] = validAddresses;
|
|
||||||
|
|
||||||
postData['CreatedBy'] = UserId;
|
|
||||||
postData['CompId'] = CompId;
|
|
||||||
postData['BranchId'] = BranchId;
|
|
||||||
postData['UserId'] = GetUserId;
|
|
||||||
// postData["OutStandingAmount"] = parseInt(values?.OutStandingAmount);
|
|
||||||
postData['InitialOutStanding'] = parseInt(values?.OutStandingAmount);
|
|
||||||
|
|
||||||
postData['Document'] = ImageUrl;
|
|
||||||
postData['CustomerProfile'] = ImageUrl ? ImageUrl : null;
|
|
||||||
postData['CreditDays'] =
|
|
||||||
selectedCredit === 'others' ? otherCreditValue : selectedCredit;
|
|
||||||
let response = {};
|
|
||||||
if (formType === 'add') {
|
|
||||||
// if (SelectedUserCreation === "N") {
|
|
||||||
postData['AppId'] = AppId;
|
|
||||||
// }
|
|
||||||
if (offerType) {
|
|
||||||
postData['OfferType'] = offerType;
|
|
||||||
}
|
|
||||||
if (Maritalstatus == 'N') {
|
|
||||||
postData['MarriedStatus'] = 'N';
|
|
||||||
postData['CustDOB'] = DobDate;
|
|
||||||
}
|
|
||||||
if (Maritalstatus == 'Y') {
|
|
||||||
postData['MarriedStatus'] = 'Y';
|
|
||||||
postData['CustDOB'] = DobDate;
|
|
||||||
postData['SpouseDOB'] = SpouseDobDate;
|
|
||||||
postData['AnniversaryDate'] = anniversaryDate;
|
|
||||||
}
|
}
|
||||||
|
// Handle address data - use only the addresses from addressesList
|
||||||
|
const addedAddresses = addressesList || [];
|
||||||
|
|
||||||
response = await dispatch(postCust(postData)).unwrap();
|
// Only include addresses that have Address1 and Zip
|
||||||
} else if (formType === 'edit') {
|
const validAddresses = addedAddresses.filter(
|
||||||
if (editstate) {
|
(addr) => addr?.Address1 && addr?.Zip
|
||||||
postData['CustId'] = editstate?.CustId;
|
);
|
||||||
postData['AddId'] = editstate?.CustAddId;
|
|
||||||
postData['AppId'] = editstate?.AppId;
|
postData['CustomerAddressDtl'] = validAddresses;
|
||||||
postData['UpdatedBy'] = UserId;
|
|
||||||
postData['UserId'] = editstate?.UserId;
|
postData['CreatedBy'] = UserId;
|
||||||
|
postData['CompId'] = CompId;
|
||||||
|
postData['BranchId'] = BranchId;
|
||||||
|
postData['UserId'] = GetUserId;
|
||||||
|
// postData["OutStandingAmount"] = parseInt(values?.OutStandingAmount);
|
||||||
|
postData['InitialOutStanding'] = parseInt(values?.OutStandingAmount);
|
||||||
|
|
||||||
|
postData['Document'] = ImageUrl;
|
||||||
|
postData['CustomerProfile'] = ImageUrl ? ImageUrl : null;
|
||||||
|
postData['CreditDays'] =
|
||||||
|
selectedCredit === 'others' ? otherCreditValue : selectedCredit;
|
||||||
|
let response = {};
|
||||||
|
if (formType === 'add') {
|
||||||
|
// if (SelectedUserCreation === "N") {
|
||||||
|
postData['AppId'] = AppId;
|
||||||
|
// }
|
||||||
if (offerType) {
|
if (offerType) {
|
||||||
postData['OfferType'] = offerType;
|
postData['OfferType'] = offerType;
|
||||||
}
|
}
|
||||||
|
|
@ -418,22 +403,48 @@ const CustomerForm = ({ formType }) => {
|
||||||
postData['SpouseDOB'] = SpouseDobDate;
|
postData['SpouseDOB'] = SpouseDobDate;
|
||||||
postData['AnniversaryDate'] = anniversaryDate;
|
postData['AnniversaryDate'] = anniversaryDate;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
response = await dispatch(putCust(postData)).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response?.data?.statusCode == 1) {
|
response = await dispatch(postCust(postData)).unwrap();
|
||||||
navigate(`${subDirectory}setting/customer-master/`, {
|
} else if (formType === 'edit') {
|
||||||
state: {
|
if (editstate) {
|
||||||
Notiffy: {
|
postData['CustId'] = editstate?.CustId;
|
||||||
messageType: 'success',
|
postData['AddId'] = editstate?.CustAddId;
|
||||||
messageData: response?.data?.response,
|
postData['AppId'] = editstate?.AppId;
|
||||||
|
postData['UpdatedBy'] = UserId;
|
||||||
|
postData['UserId'] = editstate?.UserId;
|
||||||
|
if (offerType) {
|
||||||
|
postData['OfferType'] = offerType;
|
||||||
|
}
|
||||||
|
if (Maritalstatus == 'N') {
|
||||||
|
postData['MarriedStatus'] = 'N';
|
||||||
|
postData['CustDOB'] = DobDate;
|
||||||
|
}
|
||||||
|
if (Maritalstatus == 'Y') {
|
||||||
|
postData['MarriedStatus'] = 'Y';
|
||||||
|
postData['CustDOB'] = DobDate;
|
||||||
|
postData['SpouseDOB'] = SpouseDobDate;
|
||||||
|
postData['AnniversaryDate'] = anniversaryDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response = await dispatch(putCust(postData)).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response?.data?.statusCode == 1) {
|
||||||
|
navigate(`${subDirectory}setting/customer-master/`, {
|
||||||
|
state: {
|
||||||
|
Notiffy: {
|
||||||
|
messageType: 'success',
|
||||||
|
messageData: response?.data?.response,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
});
|
} else {
|
||||||
} else {
|
setMessageType('error');
|
||||||
setMessageType('error');
|
setMessageData(response?.data?.response);
|
||||||
setMessageData(response?.data?.response);
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Validation error will stop submit
|
||||||
|
console.log("Validation Failed:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -841,12 +852,17 @@ const CustomerForm = ({ formType }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onComplete = useCallback(() => {
|
||||||
|
setMessageType(null);
|
||||||
|
setMessageData(null);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="CustomerForm-Master">
|
<div className="CustomerForm-Master">
|
||||||
<div className="pageOverAll">
|
<div className="pageOverAll">
|
||||||
<div className="userPage userPageCustMaster">
|
<div className="userPage userPageCustMaster">
|
||||||
<div className="userPageContent">
|
<div className="userPageContent">
|
||||||
<Messages messageType={messageType} messageData={messageData} />
|
<Messages messageType={messageType} messageData={messageData} onComplete={onComplete} />
|
||||||
<div className="formName">
|
<div className="formName">
|
||||||
<FormHeader title={'Customer'} />
|
<FormHeader title={'Customer'} />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -865,10 +881,12 @@ const CustomerForm = ({ formType }) => {
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /^\d{10}$/,
|
message: "Please Enter Mobile Number",
|
||||||
message: 'Please Enter a Valid Mobile Number',
|
},
|
||||||
|
{
|
||||||
|
pattern: /^[6-9]\d{9}$/,
|
||||||
|
message: "Please enter a valid mobile number",
|
||||||
},
|
},
|
||||||
|
|
||||||
{ validator: validatePhoneNumber },
|
{ validator: validatePhoneNumber },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
|
@ -888,10 +906,10 @@ const CustomerForm = ({ formType }) => {
|
||||||
}
|
}
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
onInput={(e) =>
|
onInput={(e) =>
|
||||||
(e.target.value = e.target.value.replace(
|
(e.target.value = e.target.value.replace(
|
||||||
/[^0-9]/g,
|
/[^0-9]/g,
|
||||||
''
|
''
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
@ -987,15 +1005,15 @@ const CustomerForm = ({ formType }) => {
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
isOnChange={
|
isOnChange={
|
||||||
formType == 'edit' ||
|
formType == 'edit' ||
|
||||||
formRef.current?.getFieldsValue()?.CustName != ''
|
formRef.current?.getFieldsValue()?.CustName != ''
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
// isOnChange={
|
// isOnChange={
|
||||||
// formType == 'edit' || fieldChangeMap['CustName']
|
// formType == 'edit' || fieldChangeMap['CustName']
|
||||||
// ? true
|
// ? true
|
||||||
// : false
|
// : false
|
||||||
// }
|
// }
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|
@ -1031,7 +1049,7 @@ const CustomerForm = ({ formType }) => {
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
isOnChange={
|
isOnChange={
|
||||||
formType == 'edit' ||
|
formType == 'edit' ||
|
||||||
fieldChangeMap['CustShortName']
|
fieldChangeMap['CustShortName']
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
|
|
@ -1076,9 +1094,9 @@ const CustomerForm = ({ formType }) => {
|
||||||
<p>Upload Profile</p>
|
<p>Upload Profile</p>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="CustomerProfile"
|
name="CustomerProfile"
|
||||||
// getValueFromEvent={(e) =>
|
// getValueFromEvent={(e) =>
|
||||||
// formType === 'edit' ? editstate?.EmpPhotoLink : e
|
// formType === 'edit' ? editstate?.EmpPhotoLink : e
|
||||||
// }
|
// }
|
||||||
>
|
>
|
||||||
<Imageupload
|
<Imageupload
|
||||||
singleImage={true}
|
singleImage={true}
|
||||||
|
|
@ -1108,7 +1126,7 @@ const CustomerForm = ({ formType }) => {
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
isOnChange={
|
isOnChange={
|
||||||
formType == 'edit' ||
|
formType == 'edit' ||
|
||||||
formRef.current?.getFieldsValue()?.CustEmail
|
formRef.current?.getFieldsValue()?.CustEmail
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
|
|
@ -1133,7 +1151,7 @@ const CustomerForm = ({ formType }) => {
|
||||||
maxLength={15}
|
maxLength={15}
|
||||||
isOnChange={
|
isOnChange={
|
||||||
formType == 'edit' ||
|
formType == 'edit' ||
|
||||||
formRef.current?.getFieldsValue()?.CustGSTIN
|
formRef.current?.getFieldsValue()?.CustGSTIN
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
|
|
@ -1157,7 +1175,7 @@ const CustomerForm = ({ formType }) => {
|
||||||
autocapitalize="on"
|
autocapitalize="on"
|
||||||
isOnChange={
|
isOnChange={
|
||||||
formType == 'edit' ||
|
formType == 'edit' ||
|
||||||
formRef.current?.getFieldsValue()?.StateCode
|
formRef.current?.getFieldsValue()?.StateCode
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
|
|
@ -1173,13 +1191,13 @@ const CustomerForm = ({ formType }) => {
|
||||||
style={
|
style={
|
||||||
offerType == 'P'
|
offerType == 'P'
|
||||||
? {
|
? {
|
||||||
opacity: '1',
|
opacity: '1',
|
||||||
boxShadow:
|
boxShadow:
|
||||||
'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px',
|
'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px',
|
||||||
margin: '3px',
|
margin: '3px',
|
||||||
padding: '5px',
|
padding: '5px',
|
||||||
backgroundColor: '#fff',
|
backgroundColor: '#fff',
|
||||||
}
|
}
|
||||||
: { opacity: '0.6', boxShadow: 'none' }
|
: { opacity: '0.6', boxShadow: 'none' }
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -1200,13 +1218,13 @@ const CustomerForm = ({ formType }) => {
|
||||||
style={
|
style={
|
||||||
offerType == 'F'
|
offerType == 'F'
|
||||||
? {
|
? {
|
||||||
opacity: '1',
|
opacity: '1',
|
||||||
boxShadow:
|
boxShadow:
|
||||||
'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px',
|
'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px',
|
||||||
margin: '3px',
|
margin: '3px',
|
||||||
padding: '5px',
|
padding: '5px',
|
||||||
backgroundColor: '#fff',
|
backgroundColor: '#fff',
|
||||||
}
|
}
|
||||||
: { opacity: '0.6', boxShadow: 'none' }
|
: { opacity: '0.6', boxShadow: 'none' }
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -1384,7 +1402,7 @@ const CustomerForm = ({ formType }) => {
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
// style={{ marginLeft: '10px', width: '120px' }}
|
// style={{ marginLeft: '10px', width: '120px' }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -1404,8 +1422,8 @@ const CustomerForm = ({ formType }) => {
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
isOnChange={
|
isOnChange={
|
||||||
formType == 'edit' ||
|
formType == 'edit' ||
|
||||||
formRef.current?.getFieldsValue()
|
formRef.current?.getFieldsValue()
|
||||||
?.CreditLimit
|
?.CreditLimit
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
|
|
@ -1932,7 +1950,7 @@ const CustomerForm = ({ formType }) => {
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="State"
|
name="State"
|
||||||
// rules={[{ required: true }]}
|
// rules={[{ required: true }]}
|
||||||
>
|
>
|
||||||
<InputField
|
<InputField
|
||||||
field="State"
|
field="State"
|
||||||
|
|
@ -2031,9 +2049,9 @@ const CustomerForm = ({ formType }) => {
|
||||||
prevlca={
|
prevlca={
|
||||||
editstate
|
editstate
|
||||||
? {
|
? {
|
||||||
lat: editstate.Latitude,
|
lat: editstate.Latitude,
|
||||||
lng: editstate.Longitude,
|
lng: editstate.Longitude,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1733,6 +1733,10 @@ const PaymentPdfBooking = ({
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<h6 style={{ textAlign: 'center', marginTop: '5px' }}>
|
||||||
|
Your Order No:{' '}
|
||||||
|
{table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
|
||||||
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue