Merge pull request 'Counter mapping' (#165) from PushMainVM into main
Reviewed-on: Pozomind/pozo-retail-app#165
This commit is contained in:
commit
5fbbe5760f
|
|
@ -28,7 +28,7 @@ import {
|
||||||
import { useAuth } from '../../AuthContext.jsx';
|
import { useAuth } from '../../AuthContext.jsx';
|
||||||
import '../../Styles/CounterCategoryMappingForm/CounterCategoryMapping.scss';
|
import '../../Styles/CounterCategoryMappingForm/CounterCategoryMapping.scss';
|
||||||
const subDirectory = import.meta.env.BASE_URL;
|
const subDirectory = import.meta.env.BASE_URL;
|
||||||
import FolderExploreCompoent from "./FolderExploreCompoent.jsx"
|
import FolderExploreCompoent from './FolderExploreCompoent.jsx';
|
||||||
|
|
||||||
const CounterCategoryMappingForm = () => {
|
const CounterCategoryMappingForm = () => {
|
||||||
const { SadminuserAccess } = useAuth();
|
const { SadminuserAccess } = useAuth();
|
||||||
|
|
@ -56,7 +56,7 @@ const CounterCategoryMappingForm = () => {
|
||||||
const [openModel, setOpenModel] = useState(false);
|
const [openModel, setOpenModel] = useState(false);
|
||||||
const [expandedRows, setExpandedRows] = useState([]);
|
const [expandedRows, setExpandedRows] = useState([]);
|
||||||
|
|
||||||
console.log(CounterName, 'CounterName')
|
console.log(CounterName, 'CounterName');
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
|
|
@ -69,7 +69,6 @@ const CounterCategoryMappingForm = () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(changeBreadCrumb({ items: items }));
|
dispatch(changeBreadCrumb({ items: items }));
|
||||||
getCategorydetails();
|
getCategorydetails();
|
||||||
|
|
@ -83,7 +82,6 @@ const CounterCategoryMappingForm = () => {
|
||||||
}
|
}
|
||||||
}, [Editstate]);
|
}, [Editstate]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (UserType === 'Employee') {
|
if (UserType === 'Employee') {
|
||||||
fetchApi();
|
fetchApi();
|
||||||
|
|
@ -112,22 +110,19 @@ const CounterCategoryMappingForm = () => {
|
||||||
if (Category?.data?.statusCode === 1) {
|
if (Category?.data?.statusCode === 1) {
|
||||||
if (Category?.data?.data?.length > 0) {
|
if (Category?.data?.data?.length > 0) {
|
||||||
const categoryList = Category.data.data;
|
const categoryList = Category.data.data;
|
||||||
const filteredCategories = categoryList?.map(e => ({
|
const filteredCategories = categoryList?.map((e) => ({
|
||||||
ProdCat: e.ProdCat,
|
ProdCat: e.ProdCat,
|
||||||
ProdCatName: e?.ProdCatName,
|
ProdCatName: e?.ProdCatName,
|
||||||
isCatExpend: false,
|
isCatExpend: false,
|
||||||
ProdSubCat: []
|
ProdSubCat: [],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setExpandedRows(filteredCategories);
|
setExpandedRows(filteredCategories);
|
||||||
}
|
} else {
|
||||||
else {
|
setExpandedRows([]);
|
||||||
setExpandedRows([])
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setExpandedRows([])
|
setExpandedRows([]);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -137,95 +132,92 @@ const CounterCategoryMappingForm = () => {
|
||||||
AppId: AppId,
|
AppId: AppId,
|
||||||
BranchId: BranchId,
|
BranchId: BranchId,
|
||||||
CompId: CompId,
|
CompId: CompId,
|
||||||
"CounterId": EditData?.CounterId,
|
CounterId: EditData?.CounterId,
|
||||||
"CounterName": CounterName,
|
CounterName: CounterName,
|
||||||
"ActiveStatus": "A",
|
ActiveStatus: 'A',
|
||||||
|
|
||||||
CategoryDetails: (expandedRows || [])
|
CategoryDetails: (expandedRows || [])
|
||||||
.filter(cat => cat?.isCatExpend || cat?.CounterCatId)
|
.filter((cat) => cat?.isCatExpend || cat?.CounterCatId)
|
||||||
.map(cat => {
|
.map((cat) => {
|
||||||
|
|
||||||
const selectedSubs = (cat?.ProdSubCat || [])
|
const selectedSubs = (cat?.ProdSubCat || [])
|
||||||
.filter(sub => sub?.isSubcatexpend || sub?.CounterSubCatId)
|
.filter((sub) => sub?.isSubcatexpend || sub?.CounterSubCatId)
|
||||||
.map(sub => ({
|
.map((sub) => ({
|
||||||
ProdSubCat: sub?.ProdSubCat,
|
ProdSubCat: sub?.ProdSubCat,
|
||||||
CounterCatId: sub?.CounterCatId || null,
|
CounterCatId: sub?.CounterCatId || null,
|
||||||
CounterSubCatId: sub?.CounterSubCatId || null,
|
CounterSubCatId: sub?.CounterSubCatId || null,
|
||||||
ActiveStatus: sub?.isSubcatexpend ? "A" : "D"
|
ActiveStatus: sub?.isSubcatexpend ? 'A' : 'D',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
CounterId: EditData?.CounterId || null,
|
CounterId: EditData?.CounterId || null,
|
||||||
CounterCatId: cat?.CounterCatId,
|
CounterCatId: cat?.CounterCatId,
|
||||||
ProdCat: cat?.ProdCat,
|
ProdCat: cat?.ProdCat,
|
||||||
ActiveStatus: cat?.isCatExpend ? "A" : "D",
|
ActiveStatus: cat?.isCatExpend ? 'A' : 'D',
|
||||||
SubCategoryDetails: selectedSubs
|
SubCategoryDetails: selectedSubs,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
"UpdatedBy": UserId
|
UpdatedBy: UserId,
|
||||||
}
|
};
|
||||||
let PostCounterToken = await dispatch(
|
let PostCounterToken = await dispatch(
|
||||||
putCounterCategoryMap(putData)
|
putCounterCategoryMap(putData)
|
||||||
).unwrap();
|
).unwrap();
|
||||||
if (PostCounterToken?.data?.statusCode === 1) {
|
if (PostCounterToken?.data?.statusCode === 1) {
|
||||||
setEditData([])
|
setEditData([]);
|
||||||
setEditState(false)
|
setEditState(false);
|
||||||
setMessageType('success');
|
setMessageType('success');
|
||||||
setMessageData(PostCounterToken?.data?.response);
|
setMessageData(PostCounterToken?.data?.response);
|
||||||
setOpenModel(false)
|
setOpenModel(false);
|
||||||
ClearDatas()
|
ClearDatas();
|
||||||
formRef?.current?.resetFields();
|
formRef?.current?.resetFields();
|
||||||
} else {
|
} else {
|
||||||
setMessageType('error');
|
setMessageType('error');
|
||||||
setMessageData(PostCounterToken?.data?.response);
|
setMessageData(PostCounterToken?.data?.response);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let postdata = {
|
let postdata = {
|
||||||
AppId: AppId,
|
AppId: AppId,
|
||||||
BranchId: BranchId,
|
BranchId: BranchId,
|
||||||
CompId: CompId,
|
CompId: CompId,
|
||||||
CounterName: "values?.CounterName",
|
CounterName: CounterName,
|
||||||
ActiveStatus: 'A',
|
ActiveStatus: 'A',
|
||||||
CategoryDetails: (expandedRows || [])
|
CategoryDetails: (expandedRows || [])
|
||||||
.filter(cat => cat?.isCatExpend)
|
.filter((cat) => cat?.isCatExpend)
|
||||||
.map(cat => {
|
.map((cat) => {
|
||||||
|
|
||||||
const selectedSubs = (cat?.ProdSubCat || [])
|
const selectedSubs = (cat?.ProdSubCat || [])
|
||||||
.filter(sub => sub?.isSubcatexpend)
|
.filter((sub) => sub?.isSubcatexpend)
|
||||||
.map(sub => ({
|
.map((sub) => ({
|
||||||
ProdSubCat: sub?.ProdSubCat,
|
ProdSubCat: sub?.ProdSubCat,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ProdCat: cat?.ProdCat,
|
ProdCat: cat?.ProdCat,
|
||||||
SubCategoryDetails: selectedSubs
|
SubCategoryDetails: selectedSubs,
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
,
|
|
||||||
CreatedBy: UserId,
|
CreatedBy: UserId,
|
||||||
};
|
};
|
||||||
let PostCounterToken = await dispatch(
|
let PostCounterToken = await dispatch(
|
||||||
postCounterCategoryMap(postdata)
|
postCounterCategoryMap(postdata)
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
|
||||||
if (PostCounterToken?.data?.statusCode === 1) {
|
if (PostCounterToken?.data?.statusCode === 1) {
|
||||||
setMessageType('success');
|
setMessageType('success');
|
||||||
setMessageData(PostCounterToken?.data?.response);
|
setMessageData(PostCounterToken?.data?.response);
|
||||||
setOpenModel(false)
|
setOpenModel(false);
|
||||||
|
ClearDatas();
|
||||||
formRef?.current?.resetFields();
|
formRef?.current?.resetFields();
|
||||||
} else {
|
} else {
|
||||||
setMessageType('error');
|
setMessageType('error');
|
||||||
setMessageData(PostCounterToken?.data?.response);
|
setMessageData(PostCounterToken?.data?.response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
const getCounterTokenDatas = async () => {
|
const getCounterTokenDatas = async () => {
|
||||||
let data = {
|
let data = {
|
||||||
AppId: AppId,
|
AppId: AppId,
|
||||||
CompId: CompId,
|
CompId: CompId,
|
||||||
BranchId: BranchId,
|
BranchId: BranchId,
|
||||||
UserId: UserId
|
UserId: UserId,
|
||||||
};
|
};
|
||||||
let Counterdatas = await dispatch(getCounterTokenData(data)).unwrap();
|
let Counterdatas = await dispatch(getCounterTokenData(data)).unwrap();
|
||||||
if (Counterdatas?.data?.statusCode === 1) {
|
if (Counterdatas?.data?.statusCode === 1) {
|
||||||
|
|
@ -264,14 +256,12 @@ const CounterCategoryMappingForm = () => {
|
||||||
(item) => item.ProdSubCat !== null
|
(item) => item.ProdSubCat !== null
|
||||||
);
|
);
|
||||||
if (filterSubcategory?.length > 0) {
|
if (filterSubcategory?.length > 0) {
|
||||||
return filterSubcategory
|
return filterSubcategory;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return []
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return []
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onComplete = useCallback(() => {
|
const onComplete = useCallback(() => {
|
||||||
|
|
@ -287,10 +277,9 @@ const CounterCategoryMappingForm = () => {
|
||||||
setCategoryDataModal(false);
|
setCategoryDataModal(false);
|
||||||
};
|
};
|
||||||
const editData = async (record, index) => {
|
const editData = async (record, index) => {
|
||||||
|
setCounterName(record?.CounterName);
|
||||||
setCounterName(record?.CounterName)
|
|
||||||
setEditState(true);
|
setEditState(true);
|
||||||
setOpenModel(true)
|
setOpenModel(true);
|
||||||
setEditData(record);
|
setEditData(record);
|
||||||
|
|
||||||
formRef?.current?.setFieldsValue({
|
formRef?.current?.setFieldsValue({
|
||||||
|
|
@ -298,7 +287,7 @@ const CounterCategoryMappingForm = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
record?.CategoryDetails.map(cat =>
|
record?.CategoryDetails.map((cat) =>
|
||||||
getSubCategorydetailsFromChild(cat?.ProdCat)
|
getSubCategorydetailsFromChild(cat?.ProdCat)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -306,18 +295,18 @@ const CounterCategoryMappingForm = () => {
|
||||||
record?.CategoryDetails.forEach((cat, i) => {
|
record?.CategoryDetails.forEach((cat, i) => {
|
||||||
subCategoryMap[cat?.ProdCat] = results[i] || [];
|
subCategoryMap[cat?.ProdCat] = results[i] || [];
|
||||||
});
|
});
|
||||||
console.log(subCategoryMap, "subCategoryMap");
|
console.log(subCategoryMap, 'subCategoryMap');
|
||||||
|
|
||||||
setExpandedRows(prev =>
|
setExpandedRows((prev) =>
|
||||||
prev.map(e => {
|
prev.map((e) => {
|
||||||
const catDetail = record?.CategoryDetails?.find(
|
const catDetail = record?.CategoryDetails?.find(
|
||||||
x => x?.ProdCat === e.ProdCat
|
(x) => x?.ProdCat === e.ProdCat
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!catDetail) return e;
|
if (!catDetail) return e;
|
||||||
|
|
||||||
const subDetailMap = {};
|
const subDetailMap = {};
|
||||||
catDetail?.SubCategoryDetails?.forEach(s => {
|
catDetail?.SubCategoryDetails?.forEach((s) => {
|
||||||
subDetailMap[s?.ProdSubCat] = s;
|
subDetailMap[s?.ProdSubCat] = s;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -325,23 +314,22 @@ const CounterCategoryMappingForm = () => {
|
||||||
...e,
|
...e,
|
||||||
isCatExpend: true,
|
isCatExpend: true,
|
||||||
CounterCatId: catDetail?.CounterCatId,
|
CounterCatId: catDetail?.CounterCatId,
|
||||||
ActiveStatus: "A",
|
ActiveStatus: 'A',
|
||||||
|
|
||||||
// ✅ Attach subcategories
|
// ✅ Attach subcategories
|
||||||
ProdSubCat: (subCategoryMap[e?.ProdCat] || []).map(sub => {
|
ProdSubCat: (subCategoryMap[e?.ProdCat] || []).map((sub) => {
|
||||||
const subDetail = subDetailMap[sub?.ProdSubCat];
|
const subDetail = subDetailMap[sub?.ProdSubCat];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...sub,
|
...sub,
|
||||||
CounterCatId: subDetail?.CounterCatId,
|
CounterCatId: subDetail?.CounterCatId,
|
||||||
CounterSubCatId: subDetail?.CounterSubCatId,
|
CounterSubCatId: subDetail?.CounterSubCatId,
|
||||||
isSubcatexpend: !!subDetail // true if exists
|
isSubcatexpend: !!subDetail, // true if exists
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
const statusFormatter = async (record, index) => {
|
const statusFormatter = async (record, index) => {
|
||||||
let deletedata = {
|
let deletedata = {
|
||||||
|
|
@ -367,8 +355,8 @@ const CounterCategoryMappingForm = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const ClearDatas = async () => {
|
const ClearDatas = async () => {
|
||||||
getCategorydetails();
|
await getCategorydetails();
|
||||||
getCounterTokenDatas();
|
await getCounterTokenDatas();
|
||||||
formRef?.current?.resetFields();
|
formRef?.current?.resetFields();
|
||||||
setCounterName(null);
|
setCounterName(null);
|
||||||
setEditData([]);
|
setEditData([]);
|
||||||
|
|
@ -419,9 +407,9 @@ const CounterCategoryMappingForm = () => {
|
||||||
style={{ color: '#1292EE' }}
|
style={{ color: '#1292EE' }}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
empData?.UpdateAccess === 'Y' ||
|
empData?.UpdateAccess === 'Y' ||
|
||||||
SAAccessCommonMaster?.UpdateAccess === 'Y' ||
|
SAAccessCommonMaster?.UpdateAccess === 'Y' ||
|
||||||
UserType == 'Admin' ||
|
UserType == 'Admin' ||
|
||||||
UserType == 'Super Admin'
|
UserType == 'Super Admin'
|
||||||
? editData(record, index)
|
? editData(record, index)
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
|
|
@ -436,9 +424,9 @@ const CounterCategoryMappingForm = () => {
|
||||||
}}
|
}}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
empData?.DeleteAccess === 'Y' ||
|
empData?.DeleteAccess === 'Y' ||
|
||||||
SAAccessCommonMaster?.DeleteAccess === 'Y' ||
|
SAAccessCommonMaster?.DeleteAccess === 'Y' ||
|
||||||
UserType == 'Admin' ||
|
UserType == 'Admin' ||
|
||||||
UserType == 'Super Admin'
|
UserType == 'Super Admin'
|
||||||
? statusFormatter(record, index)
|
? statusFormatter(record, index)
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
|
|
@ -453,10 +441,10 @@ const CounterCategoryMappingForm = () => {
|
||||||
}}
|
}}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
empData?.DeleteAccess === 'Y' ||
|
empData?.DeleteAccess === 'Y' ||
|
||||||
empData?.DeleteAccess === undefined ||
|
empData?.DeleteAccess === undefined ||
|
||||||
SAAccessCommonMaster?.DeleteAccess === 'Y' ||
|
SAAccessCommonMaster?.DeleteAccess === 'Y' ||
|
||||||
UserType == 'Admin' ||
|
UserType == 'Admin' ||
|
||||||
UserType == 'Super Admin'
|
UserType == 'Super Admin'
|
||||||
? statusFormatter(record, index)
|
? statusFormatter(record, index)
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
|
|
@ -465,14 +453,12 @@ const CounterCategoryMappingForm = () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const handleNewMapping = () => {
|
const handleNewMapping = () => {
|
||||||
setOpenModel(true)
|
setOpenModel(true);
|
||||||
setEditState(false)
|
setEditState(false);
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleChangeinput = async ({ type, value, Cat, subcat }) => {
|
const handleChangeinput = async ({ type, value, Cat, subcat }) => {
|
||||||
|
if (type === 'cat') {
|
||||||
if (type === "cat") {
|
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
try {
|
try {
|
||||||
let data;
|
let data;
|
||||||
|
|
@ -483,20 +469,20 @@ const CounterCategoryMappingForm = () => {
|
||||||
memoizedData.current[Cat] = data;
|
memoizedData.current[Cat] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
setExpandedRows(prev => {
|
setExpandedRows((prev) => {
|
||||||
const alreadyExists = prev.find(e => e.ProdCat === Cat);
|
const alreadyExists = prev.find((e) => e.ProdCat === Cat);
|
||||||
|
|
||||||
if (alreadyExists) {
|
if (alreadyExists) {
|
||||||
return prev.map(e =>
|
return prev.map((e) =>
|
||||||
e.ProdCat === Cat
|
e.ProdCat === Cat
|
||||||
? {
|
? {
|
||||||
...e,
|
...e,
|
||||||
isCatExpend: true,
|
isCatExpend: true,
|
||||||
ProdSubCat: data.map(sub => ({
|
ProdSubCat: data.map((sub) => ({
|
||||||
...sub,
|
...sub,
|
||||||
isSubcatexpend: true,
|
isSubcatexpend: true,
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
: e
|
: e
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -506,51 +492,41 @@ const CounterCategoryMappingForm = () => {
|
||||||
{
|
{
|
||||||
ProdCat: Cat,
|
ProdCat: Cat,
|
||||||
isCatExpend: true,
|
isCatExpend: true,
|
||||||
ProdSubCat: data.map(sub => ({
|
ProdSubCat: data.map((sub) => ({
|
||||||
...sub,
|
...sub,
|
||||||
isSubcatexpend: false,
|
isSubcatexpend: false,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Subcategory fetch failed", error);
|
console.error('Subcategory fetch failed', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setExpandedRows(prev =>
|
setExpandedRows((prev) =>
|
||||||
prev.map(e =>
|
prev.map((e) =>
|
||||||
e.ProdCat === Cat
|
e.ProdCat === Cat ? { ...e, isCatExpend: false } : e
|
||||||
? { ...e, isCatExpend: false }
|
|
||||||
: e
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else if (type === 'subcat') {
|
||||||
}
|
setExpandedRows((prev) =>
|
||||||
else if (type === "subcat") {
|
prev.map((e) => {
|
||||||
|
|
||||||
setExpandedRows(prev =>
|
|
||||||
prev.map(e => {
|
|
||||||
|
|
||||||
if (e.ProdCat !== Cat) return e;
|
if (e.ProdCat !== Cat) return e;
|
||||||
|
|
||||||
const updatedSubs = e.ProdSubCat.map(sub =>
|
const updatedSubs = e.ProdSubCat.map((sub) =>
|
||||||
sub.ProdSubCat === subcat
|
sub.ProdSubCat === subcat ? { ...sub, isSubcatexpend: value } : sub
|
||||||
? { ...sub, isSubcatexpend: value }
|
|
||||||
: sub
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// 🔥 Check if ANY subcategory is still true
|
// 🔥 Check if ANY subcategory is still true
|
||||||
const isAnySubSelected = updatedSubs.some(
|
const isAnySubSelected = updatedSubs.some(
|
||||||
sub => sub.isSubcatexpend
|
(sub) => sub.isSubcatexpend
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...e,
|
...e,
|
||||||
isCatExpend: isAnySubSelected, // auto update category
|
isCatExpend: isAnySubSelected, // auto update category
|
||||||
ProdSubCat: updatedSubs
|
ProdSubCat: updatedSubs,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -560,7 +536,7 @@ const CounterCategoryMappingForm = () => {
|
||||||
return (
|
return (
|
||||||
<div className="pageOverAll">
|
<div className="pageOverAll">
|
||||||
<div className="userPage">
|
<div className="userPage">
|
||||||
<div className='countermapBTN'>
|
<div className="countermapBTN">
|
||||||
<FormHeader title={'Counter Category Mapping'} />
|
<FormHeader title={'Counter Category Mapping'} />
|
||||||
<Buttons
|
<Buttons
|
||||||
buttonText="Add New"
|
buttonText="Add New"
|
||||||
|
|
@ -766,13 +742,12 @@ const CounterCategoryMappingForm = () => {
|
||||||
</div>
|
</div>
|
||||||
</Form> */}
|
</Form> */}
|
||||||
|
|
||||||
|
|
||||||
{CounterDetail?.length > 0 && (
|
{CounterDetail?.length > 0 && (
|
||||||
<div style={{ height: '400px', overflowY: 'scroll' }}>
|
<div style={{ height: '400px', overflowY: 'scroll' }}>
|
||||||
<Table
|
<Table
|
||||||
dataSource={CounterDetail}
|
dataSource={CounterDetail}
|
||||||
columns={TableColumns}
|
columns={TableColumns}
|
||||||
// pagination={handlePageChange}
|
// pagination={handlePageChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -831,21 +806,21 @@ const CounterCategoryMappingForm = () => {
|
||||||
>
|
>
|
||||||
{item?.SubCategoryDetails?.length > 0
|
{item?.SubCategoryDetails?.length > 0
|
||||||
? item?.SubCategoryDetails?.map((subCategory) => (
|
? item?.SubCategoryDetails?.map((subCategory) => (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
padding: '3px',
|
padding: '3px',
|
||||||
width: 'max-content',
|
width: 'max-content',
|
||||||
backgroundColor: '#dbe6f5',
|
backgroundColor: '#dbe6f5',
|
||||||
borderRadius: '5px',
|
borderRadius: '5px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
columnGap: '5px',
|
columnGap: '5px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{subCategory?.ProdSubCatName}
|
{subCategory?.ProdSubCatName}
|
||||||
{/* <CloseCircleOutlined className="close-icon" onClick={() => handleRemoveSubCategory(subCategory)} /> */}
|
{/* <CloseCircleOutlined className="close-icon" onClick={() => handleRemoveSubCategory(subCategory)} /> */}
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
: '-'}
|
: '-'}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -862,7 +837,10 @@ const CounterCategoryMappingForm = () => {
|
||||||
<DefaultModal
|
<DefaultModal
|
||||||
open={openModel}
|
open={openModel}
|
||||||
title="Category Mapping"
|
title="Category Mapping"
|
||||||
handleCancel={() => { setOpenModel(false); ClearDatas() }}
|
handleCancel={() => {
|
||||||
|
setOpenModel(false);
|
||||||
|
ClearDatas();
|
||||||
|
}}
|
||||||
handleSubmit={() => handleFinish()}
|
handleSubmit={() => handleFinish()}
|
||||||
width={600}
|
width={600}
|
||||||
footer={false}
|
footer={false}
|
||||||
|
|
@ -897,13 +875,10 @@ const CounterCategoryMappingForm = () => {
|
||||||
allowClear
|
allowClear
|
||||||
value={CounterName}
|
value={CounterName}
|
||||||
onChange={(e) => setCounterName(e.target.value)}
|
onChange={(e) => setCounterName(e.target.value)}
|
||||||
style={{ marginBottom: "16px" }}
|
style={{ marginBottom: '16px' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className='addCatAmping'>
|
<div className="addCatAmping">
|
||||||
|
|
||||||
|
|
||||||
{expandedRows?.map((item) => (
|
{expandedRows?.map((item) => (
|
||||||
<FolderExploreCompoent
|
<FolderExploreCompoent
|
||||||
key={item.ProdCat}
|
key={item.ProdCat}
|
||||||
|
|
@ -912,22 +887,21 @@ const CounterCategoryMappingForm = () => {
|
||||||
expandedRows={expandedRows}
|
expandedRows={expandedRows}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<div
|
||||||
display: "flex",
|
style={{
|
||||||
flexDirection: "row-reverse"
|
display: 'flex',
|
||||||
}}>
|
flexDirection: 'row-reverse',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Buttons
|
<Buttons
|
||||||
buttonText="SUBMIT"
|
buttonText="SUBMIT"
|
||||||
color="901D77"
|
color="901D77"
|
||||||
icon={<ArrowRightOutlined />}
|
icon={<ArrowRightOutlined />}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</DefaultModal>
|
</DefaultModal>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue