after fixed conflict
This commit is contained in:
commit
27afbf7dbc
File diff suppressed because it is too large
Load Diff
|
|
@ -2029,125 +2029,190 @@ const ProductList = () => {
|
||||||
formRef?.current?.resetFields();
|
formRef?.current?.resetFields();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
|
|
||||||
|
|
||||||
|
const handleResetExcelData = useCallback(() => {
|
||||||
|
dispatch(emptyExcelData());
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleCancel = useCallback(() => {
|
||||||
setOpenExcel(false);
|
setOpenExcel(false);
|
||||||
handleResetExcelData();
|
handleResetExcelData();
|
||||||
};
|
}, [handleResetExcelData]);
|
||||||
|
|
||||||
const openModal = () => {
|
const openModal = useCallback(() => {
|
||||||
setOpenExcel(true);
|
setOpenExcel(true);
|
||||||
};
|
}, []);
|
||||||
|
const handleSubmitbulk = useCallback((excelData) => {
|
||||||
const handleResetExcelData = () => {
|
|
||||||
dispatch(emptyExcelData());
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSubmitbulk = (excelData) => {
|
|
||||||
setExceldatasubmit(excelData?.filter((e) => e?.isModified));
|
setExceldatasubmit(excelData?.filter((e) => e?.isModified));
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = useCallback(async () => {
|
||||||
setBulkpost(true);
|
setBulkpost(true);
|
||||||
let FilterData = Exceldatasubmit?.filter((a) => a['ProductName'] != '');
|
|
||||||
|
|
||||||
if (FilterData && FilterData.length > 0) {
|
const FilterData = Exceldatasubmit?.filter(
|
||||||
const formattedData = FilterData?.map((data) => ({
|
a => a.ProductName !== ''
|
||||||
AppId: getSession('AppId'),
|
);
|
||||||
CompId: getSession('CompId'),
|
|
||||||
BranchId: getSession('BranchId'),
|
|
||||||
CreatedBy: getSession('UserId'),
|
|
||||||
|
|
||||||
ProdName: data?.ProductName,
|
if (!FilterData || FilterData.length === 0) {
|
||||||
ProdVariantName: data?.ProductVariantName,
|
|
||||||
Size: data?.Quantity,
|
|
||||||
UOM: data?.UOM,
|
|
||||||
MRP: data?.MRP,
|
|
||||||
WhSalePrice: data?.WhSalePrice,
|
|
||||||
SellPrice: data?.SellPrice,
|
|
||||||
ProdCat: data?.Category ? data?.Category : 'General',
|
|
||||||
ProdSubCat: data?.SubCategory,
|
|
||||||
Brand: data?.Brand ? data?.Brand : '',
|
|
||||||
AutoGenerateQr: data?.AutoGenerateQrcode
|
|
||||||
? data?.AutoGenerateQrcode
|
|
||||||
: 'No',
|
|
||||||
QRCode: data?.AddQrCode,
|
|
||||||
StockAvailable: data?.StockAvailable ? data?.StockAvailable : 'No',
|
|
||||||
TaxId: data?.Tax ? data?.Tax : 'NIL - 0%',
|
|
||||||
Cess: data?.Cess,
|
|
||||||
HSNCode: data?.HSN,
|
|
||||||
PartNumber: data?.PartNumber,
|
|
||||||
Rack: data?.Rack,
|
|
||||||
ManufDate: moment(data?.ManufactureDate, ['M/D/YY']).format(
|
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
|
||||||
),
|
|
||||||
ExpDate: moment(data?.ExpireDate, ['M/D/YY']).format(
|
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
|
||||||
),
|
|
||||||
AvailableFrom: data?.AvailableFrom
|
|
||||||
? moment(data?.AvailableFrom, ['M/D/YY']).format('HH:mm:ss')
|
|
||||||
: '',
|
|
||||||
AvailableTo: data?.AvailableTo
|
|
||||||
? moment(data?.AvailableTo, ['M/D/YY']).format('HH:mm:ss')
|
|
||||||
: '',
|
|
||||||
OnePcsAvailable: data?.Amountperpiece ? data?.Amountperpiece : 'No',
|
|
||||||
OnePcsPrice: data?.AmountperpiecePrice,
|
|
||||||
// NoOfPcs:data?.NumberOfPieceInside,
|
|
||||||
AutoGenerateSingleQr: data?.AutoGenerateOnePieceQrcode
|
|
||||||
? data?.AutoGenerateOnePieceQrcode
|
|
||||||
: 'No',
|
|
||||||
OnePcQR: data?.AutoGenerateOnePieceQrcodeNumber,
|
|
||||||
// ProductType:data?.ProductType,
|
|
||||||
TokenAvailable: data?.TokenAvailable ? data?.TokenAvailable : 'No',
|
|
||||||
ProdLogo: data?.Productimage,
|
|
||||||
}));
|
|
||||||
|
|
||||||
let postDatas = { prodDetails: formattedData };
|
|
||||||
|
|
||||||
let response = await dispatch(bulkpostdata(postDatas)).unwrap();
|
|
||||||
if (response?.data?.statusCode == 1) {
|
|
||||||
setMessageType('success');
|
|
||||||
setMessageData(response?.data?.response);
|
|
||||||
setBulkpost(false);
|
|
||||||
setpage(1);
|
|
||||||
|
|
||||||
var responseData = await dispatch(
|
|
||||||
getProductDataPageNo({ CompId, BranchId, AppId, PageNumber: 1 })
|
|
||||||
).unwrap();
|
|
||||||
setCurrentPage(1);
|
|
||||||
|
|
||||||
if (responseData?.data?.statusCode === 1) {
|
|
||||||
setCachedData({ [currentPage]: responseData?.data?.data });
|
|
||||||
setproductData(responseData?.data?.data);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setMessageType('error');
|
|
||||||
setMessageData(responseData?.data?.response);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleResetExcelData();
|
|
||||||
handleCancel();
|
|
||||||
} else {
|
|
||||||
setBulkpost(false);
|
setBulkpost(false);
|
||||||
setMessageType('error');
|
setMessageType('error');
|
||||||
setMessageData('No data to submit. Please upload an Excel file.');
|
setMessageData('No data to submit. Please upload an Excel file.');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const Unit = UomPreference?.map((e) => e.ConfigName);
|
const formattedData = FilterData.map(data => ({
|
||||||
const CategoryId = ProdCatData?.map((e) => e.ConfigId);
|
AppId: getSession('AppId'),
|
||||||
const CategoryNames = ProdCatData?.map((e) => e.ConfigName);
|
CompId: getSession('CompId'),
|
||||||
const CatconfigId = ProdCatData?.map((e) => e.ConfigId);
|
BranchId: getSession('BranchId'),
|
||||||
const Subcatnames = subCatData?.map((e) => e.ConfigName);
|
CreatedBy: getSession('UserId'),
|
||||||
const SubcatId = subCatData?.map((e) => e.ConfigId);
|
|
||||||
const SubcatNumFId = subCatData?.map((e) => e.NumFId);
|
ProdName: data.ProductName,
|
||||||
const BrandNumFId = allBrandData?.map((e) => e.NumFId);
|
ProdVariantName: data.ProductVariantName,
|
||||||
const BrandId = allBrandData?.map((e) => e.ConfigId);
|
Size: data.Quantity,
|
||||||
const BrandName = allBrandData?.map((e) => e.ConfigName);
|
UOM: data.UOM,
|
||||||
const SuplierNames = SupplierData?.map((e) => e.SuppName);
|
MRP: data.MRP,
|
||||||
const TaxDatas = TaxData?.map((e) => e.TaxIdName);
|
WhSalePrice: data.WhSalePrice,
|
||||||
const TaxData1 = TaxData?.map((e) => e.TaxPercentage);
|
SellPrice: data.SellPrice,
|
||||||
const combinedTaxData = TaxDatas?.map(
|
ProdCat: data.Category || 'General',
|
||||||
(taxIdName, index) => `${taxIdName} - ${TaxData1[index]}%`
|
ProdSubCat: data.SubCategory,
|
||||||
|
Brand: data.Brand || '',
|
||||||
|
AutoGenerateQr: data.AutoGenerateQrcode || 'No',
|
||||||
|
QRCode: data.AddQrCode,
|
||||||
|
StockAvailable: data.StockAvailable || 'No',
|
||||||
|
TaxId: data.Tax || 'NIL - 0%',
|
||||||
|
Cess: data.Cess,
|
||||||
|
HSNCode: data.HSN,
|
||||||
|
PartNumber: data.PartNumber,
|
||||||
|
Rack: data.Rack,
|
||||||
|
ManufDate: moment(data.ManufactureDate, ['M/D/YY']).format(
|
||||||
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
|
),
|
||||||
|
ExpDate: moment(data.ExpireDate, ['M/D/YY']).format(
|
||||||
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
|
),
|
||||||
|
AvailableFrom: data.AvailableFrom
|
||||||
|
? moment(data.AvailableFrom, ['M/D/YY']).format('HH:mm:ss')
|
||||||
|
: '',
|
||||||
|
AvailableTo: data.AvailableTo
|
||||||
|
? moment(data.AvailableTo, ['M/D/YY']).format('HH:mm:ss')
|
||||||
|
: '',
|
||||||
|
OnePcsAvailable: data.Amountperpiece || 'No',
|
||||||
|
OnePcsPrice: data.AmountperpiecePrice,
|
||||||
|
AutoGenerateSingleQr: data.AutoGenerateOnePieceQrcode || 'No',
|
||||||
|
OnePcQR: data.AutoGenerateOnePieceQrcodeNumber,
|
||||||
|
TokenAvailable: data.TokenAvailable || 'No',
|
||||||
|
ProdLogo: data.Productimage,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const postDatas = { prodDetails: formattedData };
|
||||||
|
|
||||||
|
const response = await dispatch(bulkpostdata(postDatas)).unwrap();
|
||||||
|
|
||||||
|
if (response?.data?.statusCode === 1) {
|
||||||
|
setMessageType('success');
|
||||||
|
setMessageData(response.data.response);
|
||||||
|
setpage(1);
|
||||||
|
|
||||||
|
const responseData = await dispatch(
|
||||||
|
getProductDataPageNo({ CompId, BranchId, AppId, PageNumber: 1 })
|
||||||
|
).unwrap();
|
||||||
|
|
||||||
|
if (responseData?.data?.statusCode === 1) {
|
||||||
|
setCachedData({ 1: responseData.data.data });
|
||||||
|
setproductData(responseData.data.data);
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setMessageType('error');
|
||||||
|
setMessageData(response?.data?.response);
|
||||||
|
}
|
||||||
|
|
||||||
|
setBulkpost(false);
|
||||||
|
handleResetExcelData();
|
||||||
|
handleCancel();
|
||||||
|
}, [
|
||||||
|
Exceldatasubmit,
|
||||||
|
|
||||||
|
CompId,
|
||||||
|
BranchId,
|
||||||
|
AppId,
|
||||||
|
handleResetExcelData,
|
||||||
|
handleCancel
|
||||||
|
]);
|
||||||
|
|
||||||
|
const Unit = useMemo(
|
||||||
|
() => UomPreference?.map((e) => e.ConfigName),
|
||||||
|
[UomPreference]
|
||||||
|
);
|
||||||
|
|
||||||
|
const CategoryId = useMemo(
|
||||||
|
() => ProdCatData?.map((e) => e.ConfigId),
|
||||||
|
[ProdCatData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const CategoryNames = useMemo(
|
||||||
|
() => ProdCatData?.map((e) => e.ConfigName),
|
||||||
|
[ProdCatData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const CatconfigId = useMemo(
|
||||||
|
() => ProdCatData?.map((e) => e.ConfigId),
|
||||||
|
[ProdCatData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const Subcatnames = useMemo(
|
||||||
|
() => subCatData?.map((e) => e.ConfigName),
|
||||||
|
[subCatData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const SubcatId = useMemo(
|
||||||
|
() => subCatData?.map((e) => e.ConfigId),
|
||||||
|
[subCatData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const SubcatNumFId = useMemo(
|
||||||
|
() => subCatData?.map((e) => e.NumFId),
|
||||||
|
[subCatData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const BrandNumFId = useMemo(
|
||||||
|
() => allBrandData?.map((e) => e.NumFId),
|
||||||
|
[allBrandData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const BrandId = useMemo(
|
||||||
|
() => allBrandData?.map((e) => e.ConfigId),
|
||||||
|
[allBrandData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const BrandName = useMemo(
|
||||||
|
() => allBrandData?.map((e) => e.ConfigName),
|
||||||
|
[allBrandData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const SuplierNames = useMemo(
|
||||||
|
() => SupplierData?.map((e) => e.SuppName),
|
||||||
|
[SupplierData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const TaxDatas = useMemo(
|
||||||
|
() => TaxData?.map((e) => e.TaxIdName),
|
||||||
|
[TaxData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const TaxData1 = useMemo(
|
||||||
|
() => TaxData?.map((e) => e.TaxPercentage),
|
||||||
|
[TaxData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const combinedTaxData = useMemo(
|
||||||
|
() =>
|
||||||
|
TaxDatas?.map(
|
||||||
|
(taxIdName, index) => `${taxIdName} - ${TaxData1[index]}%`
|
||||||
|
),
|
||||||
|
[TaxDatas, TaxData1]
|
||||||
);
|
);
|
||||||
const Deletebulk = async () => {
|
const Deletebulk = async () => {
|
||||||
let data = {
|
let data = {
|
||||||
|
|
@ -2641,7 +2706,7 @@ const ProductList = () => {
|
||||||
generateQRCodeCopy={(code) =>
|
generateQRCodeCopy={(code) =>
|
||||||
generateQRCodeCopy(QrandbarcodeDatas, code)
|
generateQRCodeCopy(QrandbarcodeDatas, code)
|
||||||
}
|
}
|
||||||
generateCodeImage={(code, codeType = 'Q') => generateCodeImage(code, codeType, QrandbarcodeDatas) }
|
generateCodeImage={(code, codeType = 'Q') => generateCodeImage(code, codeType, QrandbarcodeDatas)}
|
||||||
imageTagBarcodeAndQR={imageTagBarcodeAndQR}
|
imageTagBarcodeAndQR={imageTagBarcodeAndQR}
|
||||||
dropdownValue={dropdownValue}
|
dropdownValue={dropdownValue}
|
||||||
barcodeTemplateDetails={barcodeTemplateDetails}
|
barcodeTemplateDetails={barcodeTemplateDetails}
|
||||||
|
|
|
||||||
|
|
@ -1715,7 +1715,7 @@ const StockForm = ({ formType }) => {
|
||||||
title: 'Amount per piece',
|
title: 'Amount per piece',
|
||||||
dataIndex: 'OnePcsPrice',
|
dataIndex: 'OnePcsPrice',
|
||||||
key: 'OnePcsPrice',
|
key: 'OnePcsPrice',
|
||||||
width: 70,
|
width: 125,
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (_, record, index) => {
|
render: (_, record, index) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -1751,7 +1751,7 @@ const StockForm = ({ formType }) => {
|
||||||
title: 'Number of piece',
|
title: 'Number of piece',
|
||||||
dataIndex: 'NoOfPcs',
|
dataIndex: 'NoOfPcs',
|
||||||
key: 'NoOfPcs',
|
key: 'NoOfPcs',
|
||||||
width: 70,
|
width: 125,
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (_, record, index) => {
|
render: (_, record, index) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -1784,7 +1784,7 @@ const StockForm = ({ formType }) => {
|
||||||
title: 'Wholesale price',
|
title: 'Wholesale price',
|
||||||
dataIndex: 'WhSalePrice',
|
dataIndex: 'WhSalePrice',
|
||||||
key: 'WhSalePrice',
|
key: 'WhSalePrice',
|
||||||
width: 70,
|
width: 125,
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -1821,6 +1821,7 @@ const StockForm = ({ formType }) => {
|
||||||
dataIndex: 'ManufDate',
|
dataIndex: 'ManufDate',
|
||||||
key: 'ManufDate',
|
key: 'ManufDate',
|
||||||
editable: true,
|
editable: true,
|
||||||
|
width: 100,
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<DatePicProd
|
<DatePicProd
|
||||||
|
|
@ -1856,6 +1857,7 @@ const StockForm = ({ formType }) => {
|
||||||
dataIndex: 'ExpDate',
|
dataIndex: 'ExpDate',
|
||||||
key: 'ExpDate',
|
key: 'ExpDate',
|
||||||
editable: true,
|
editable: true,
|
||||||
|
width: 100,
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<DatePicProd
|
<DatePicProd
|
||||||
|
|
@ -1879,7 +1881,8 @@ const StockForm = ({ formType }) => {
|
||||||
dataIndex: 'Hsn',
|
dataIndex: 'Hsn',
|
||||||
key: 'Hsn',
|
key: 'Hsn',
|
||||||
editable: true,
|
editable: true,
|
||||||
// width: 130,
|
width: 100,
|
||||||
|
align: 'center',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -1911,6 +1914,8 @@ const StockForm = ({ formType }) => {
|
||||||
dataIndex: 'Model',
|
dataIndex: 'Model',
|
||||||
key: 'Model',
|
key: 'Model',
|
||||||
editable: true,
|
editable: true,
|
||||||
|
width: 100,
|
||||||
|
align: 'center',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -1942,6 +1947,8 @@ const StockForm = ({ formType }) => {
|
||||||
title: 'Batch',
|
title: 'Batch',
|
||||||
dataIndex: 'Batch',
|
dataIndex: 'Batch',
|
||||||
key: 'Batch',
|
key: 'Batch',
|
||||||
|
width: 100,
|
||||||
|
align: 'center',
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -1976,6 +1983,8 @@ const StockForm = ({ formType }) => {
|
||||||
dataIndex: 'RejectedQty',
|
dataIndex: 'RejectedQty',
|
||||||
key: 'RejectedQty',
|
key: 'RejectedQty',
|
||||||
editable: true,
|
editable: true,
|
||||||
|
width: 100,
|
||||||
|
align: 'center',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -2034,6 +2043,8 @@ const StockForm = ({ formType }) => {
|
||||||
dataIndex: 'Freeqty',
|
dataIndex: 'Freeqty',
|
||||||
key: 'Freeqty',
|
key: 'Freeqty',
|
||||||
editable: true,
|
editable: true,
|
||||||
|
width: 100,
|
||||||
|
align: 'center',
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import Search from '../../Components/Forms/Search';
|
||||||
import { RadioGrpButton } from '../../Components/Forms/RadioGroup.jsx';
|
import { RadioGrpButton } from '../../Components/Forms/RadioGroup.jsx';
|
||||||
import { useAuth } from '../../AuthContext.jsx';
|
import { useAuth } from '../../AuthContext.jsx';
|
||||||
import '../../Styles/OverAllStyle/OverAllStyle.scss';
|
import '../../Styles/OverAllStyle/OverAllStyle.scss';
|
||||||
|
import './StockPriceUpdate.scss';
|
||||||
import { getPreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js';
|
import { getPreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js';
|
||||||
import { DropDowns } from '../../Components/Forms/DropDown.jsx';
|
import { DropDowns } from '../../Components/Forms/DropDown.jsx';
|
||||||
import { FiDelete, FiUploadCloud } from 'react-icons/fi';
|
import { FiDelete, FiUploadCloud } from 'react-icons/fi';
|
||||||
|
|
@ -119,6 +120,7 @@ const StockPriceUpdate = () => {
|
||||||
const [fileLoading, setFileLoading] = useState(false);
|
const [fileLoading, setFileLoading] = useState(false);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [headers, setHeaders] = useState([]);
|
const [headers, setHeaders] = useState([]);
|
||||||
|
console.log(headers, 'headers');
|
||||||
const [uploadedData, setUploadedData] = useState([]);
|
const [uploadedData, setUploadedData] = useState([]);
|
||||||
const CompId = getSession('CompId');
|
const CompId = getSession('CompId');
|
||||||
const BranchId = getSession('BranchId');
|
const BranchId = getSession('BranchId');
|
||||||
|
|
@ -150,7 +152,7 @@ const StockPriceUpdate = () => {
|
||||||
const handleRemoveRecord = (index) => {
|
const handleRemoveRecord = (index) => {
|
||||||
setUploadedData((prev) => prev.filter((_, i) => i !== index));
|
setUploadedData((prev) => prev.filter((_, i) => i !== index));
|
||||||
};
|
};
|
||||||
|
console.log(uploadedData, 'uploadedData');
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: 'Product Name',
|
title: 'Product Name',
|
||||||
|
|
@ -158,7 +160,10 @@ const StockPriceUpdate = () => {
|
||||||
key: 'ProductName',
|
key: 'ProductName',
|
||||||
width: 180,
|
width: 180,
|
||||||
render: (value, record, index) => (
|
render: (value, record, index) => (
|
||||||
<p>{`${value} (${record?.Size} ${record?.UOMName})`}</p>
|
<p>
|
||||||
|
{value}{' '}
|
||||||
|
{record?.Size && `(${record?.Size || ''} ${record?.UOMName || ''})`}
|
||||||
|
</p>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -807,6 +812,7 @@ const StockPriceUpdate = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
currentRow[field] = numValue;
|
currentRow[field] = numValue;
|
||||||
|
currentRow.isModified = true;
|
||||||
updated[rowIndex] = currentRow;
|
updated[rowIndex] = currentRow;
|
||||||
return updated;
|
return updated;
|
||||||
});
|
});
|
||||||
|
|
@ -1487,7 +1493,7 @@ const StockPriceUpdate = () => {
|
||||||
|
|
||||||
/* ---------------- COLUMN DEFINITIONS ---------------- */
|
/* ---------------- COLUMN DEFINITIONS ---------------- */
|
||||||
const columns = [
|
const columns = [
|
||||||
{ header: 'Product Name', key: 'ProdName', width: 100 },
|
{ header: 'Product Name', key: 'ProdName', width: 20 },
|
||||||
...(isStockVariantBased === 'Yes'
|
...(isStockVariantBased === 'Yes'
|
||||||
? [{ header: 'Variant Name', key: 'ProdVariantName', width: 20 }]
|
? [{ header: 'Variant Name', key: 'ProdVariantName', width: 20 }]
|
||||||
: []),
|
: []),
|
||||||
|
|
@ -1755,7 +1761,34 @@ const StockPriceUpdate = () => {
|
||||||
setFileLoading(false);
|
setFileLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setUploadedData(extractedData);
|
|
||||||
|
// Compare and mark as Old/Modified
|
||||||
|
const comparedData = extractedData
|
||||||
|
.map((uploaded) => {
|
||||||
|
const current = BulkProductData.find(
|
||||||
|
(p) =>
|
||||||
|
p.ProdId === uploaded.ProdId &&
|
||||||
|
(!uploaded.InwardDtlId || p.InwardDtlId === uploaded.InwardDtlId)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (current) {
|
||||||
|
const isModified =
|
||||||
|
Number(current.MRP) !== Number(uploaded.NewMRP) ||
|
||||||
|
Number(current.SellPrice) !== Number(uploaded.NewSellPrice) ||
|
||||||
|
Number(current.WhSalePrice || 0) !==
|
||||||
|
Number(uploaded.NewWholeSalePrice || 0);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...uploaded,
|
||||||
|
isModified,
|
||||||
|
status: isModified ? 'Modified' : 'Old',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ...uploaded, isModified: false, status: 'Old' };
|
||||||
|
})
|
||||||
|
.sort((a, b) => Number(b.isModified) - Number(a.isModified));
|
||||||
|
setUploadedData(comparedData);
|
||||||
setFileLoading(false);
|
setFileLoading(false);
|
||||||
// setFormValuesFromExtractedData(extractedData);
|
// setFormValuesFromExtractedData(extractedData);
|
||||||
};
|
};
|
||||||
|
|
@ -1929,10 +1962,13 @@ const StockPriceUpdate = () => {
|
||||||
const hasMRP = !!data?.NewMRP;
|
const hasMRP = !!data?.NewMRP;
|
||||||
const hasSell = !!data?.NewSellPrice;
|
const hasSell = !!data?.NewSellPrice;
|
||||||
const hasWholesale = !!data?.NewWholeSalePrice;
|
const hasWholesale = !!data?.NewWholeSalePrice;
|
||||||
|
const isModified = data?.isModified === true;
|
||||||
|
|
||||||
// valid cases
|
// valid cases
|
||||||
if (hasMRP && hasSell) return true;
|
if (hasMRP && hasSell && isModified) return true;
|
||||||
if (!hasMRP && !hasSell && hasWholesale) return true;
|
|
||||||
|
// ✅ Case 2: Only Wholesale changed
|
||||||
|
if (!hasMRP && !hasSell && hasWholesale && isModified) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
@ -1954,6 +1990,12 @@ const StockPriceUpdate = () => {
|
||||||
CreatedBy: UserId,
|
CreatedBy: UserId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!updatedData || updatedData.length === 0) {
|
||||||
|
setMessageData('Minimum 1 product needs to be changed or added');
|
||||||
|
setMessageType('error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const res = await dispatch(bulkPriceUpdate(putData))?.unwrap();
|
const res = await dispatch(bulkPriceUpdate(putData))?.unwrap();
|
||||||
|
|
||||||
if (res?.data?.statusCode === 1) {
|
if (res?.data?.statusCode === 1) {
|
||||||
|
|
@ -2046,7 +2088,7 @@ const StockPriceUpdate = () => {
|
||||||
onComplete={onComplete}
|
onComplete={onComplete}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="formAddNew" style={{justifyContent:"space-between"}}>
|
<div className="formAddNew" style={{ justifyContent: 'space-between' }}>
|
||||||
<div>
|
<div>
|
||||||
<FormHeader title={'Price Change'} />
|
<FormHeader title={'Price Change'} />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -2058,9 +2100,7 @@ const StockPriceUpdate = () => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{RadioSelection == 'Bulk' && (
|
{RadioSelection == 'Bulk' && (
|
||||||
<div
|
<div className="PriChangeUpper">
|
||||||
className='PriChangeUpper'
|
|
||||||
>
|
|
||||||
<div className="formSearch">
|
<div className="formSearch">
|
||||||
<Search
|
<Search
|
||||||
value={BulksearchedText}
|
value={BulksearchedText}
|
||||||
|
|
@ -2360,14 +2400,24 @@ const StockPriceUpdate = () => {
|
||||||
<Table
|
<Table
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey={(record) => record.localId}
|
rowKey={(record) => record.localId}
|
||||||
// components={components}
|
|
||||||
// bordered
|
|
||||||
dataSource={uploadedData}
|
dataSource={uploadedData}
|
||||||
// className="tableExcelUpload"
|
|
||||||
// onChange={handleTableChange}
|
|
||||||
className="price-change-data"
|
className="price-change-data"
|
||||||
|
rowClassName={(record) =>
|
||||||
|
record.isModified ? 'modified-row' : 'old-row'
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="legend-container">
|
||||||
|
<div className="legend-item">
|
||||||
|
<div className="legend-box old-box"></div>
|
||||||
|
<span className="legend-text">Old</span>
|
||||||
|
</div>
|
||||||
|
<div className="legend-item">
|
||||||
|
<div className="legend-box modified-box"></div>
|
||||||
|
<span className="legend-text">Modified</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="cancel-link"
|
className="cancel-link"
|
||||||
onClick={handleCancelData}
|
onClick={handleCancelData}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
.viewerExcelupload {
|
||||||
|
.ant-table-tbody {
|
||||||
|
.old-row {
|
||||||
|
background-color: #97441d !important;
|
||||||
|
|
||||||
|
td {
|
||||||
|
background-color: #ffe1fb !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #ffe1fb !important;
|
||||||
|
|
||||||
|
> td {
|
||||||
|
background-color: #ffe1fb !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.modified-row {
|
||||||
|
background-color: #cdffd5 !important;
|
||||||
|
|
||||||
|
td {
|
||||||
|
background-color: #cdffd5 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #cdffd5 !important;
|
||||||
|
|
||||||
|
> td {
|
||||||
|
background-color: #cdffd5 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-table-tbody > tr.old-row:hover > td {
|
||||||
|
background-color: #ff9595 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-table-tbody > tr.modified-row:hover > td {
|
||||||
|
background-color: #aeffbb !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-container {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-box {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-box {
|
||||||
|
background: #ffe1fb;
|
||||||
|
border: 1px solid #ff43e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modified-box {
|
||||||
|
background: #cdffd5;
|
||||||
|
border: 1px solid #72e018;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-text {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
function useWhyDidYouUpdate(componentName, props) {
|
||||||
|
const prevProps = useRef(props);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const allKeys = Object.keys({ ...prevProps.current, ...props });
|
||||||
|
const changes = {};
|
||||||
|
|
||||||
|
allKeys.forEach((key) => {
|
||||||
|
if (prevProps.current[key] !== props[key]) {
|
||||||
|
changes[key] = {
|
||||||
|
from: prevProps.current[key],
|
||||||
|
to: props[key],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Object.keys(changes).length > 0) {
|
||||||
|
console.log(`🔍 ${componentName} re-rendered due to:`, changes);
|
||||||
|
}
|
||||||
|
|
||||||
|
prevProps.current = props;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export default useWhyDidYouUpdate
|
||||||
|
|
@ -107,7 +107,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-table-cell {
|
.ant-table-cell {
|
||||||
|
|
||||||
.ant-form-item {
|
.ant-form-item {
|
||||||
margin-bottom: unset;
|
margin-bottom: unset;
|
||||||
|
|
||||||
|
|
@ -116,4 +115,38 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.SheetIndiacte {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
div {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdsheet {
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
border: 1px solid #5bff73;
|
||||||
|
background-color: #b3ffbf;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.mdsheet2 {
|
||||||
|
width: 25px;
|
||||||
|
border-radius: 4px;
|
||||||
|
height: 25px;
|
||||||
|
background-color: #ffc7f8;
|
||||||
|
border: 1px solid #ff74ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #333;
|
||||||
|
font-family: "Poppins";
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue