Merge pull request 'Issues Solved' (#311) from PushMainVM into main
Reviewed-on: Pozomind/pozo-retail-app#311
This commit is contained in:
commit
bbf2575d37
|
|
@ -262,7 +262,7 @@ const styles = {
|
||||||
|
|
||||||
status: {
|
status: {
|
||||||
marginTop: '6px',
|
marginTop: '6px',
|
||||||
fontSize: '0.7rem',
|
fontSize: '0.6rem',
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
letterSpacing: '4px',
|
letterSpacing: '4px',
|
||||||
textTransform: 'uppercase',
|
textTransform: 'uppercase',
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
height: 90vh;
|
height: 90vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
font-family: 'Poppins';
|
font-family: "Poppins";
|
||||||
|
|
||||||
.automated-reorder-content {
|
.automated-reorder-content {
|
||||||
padding-top: 18px;
|
padding-top: 18px;
|
||||||
|
|
@ -52,3 +52,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.automated-reorder-list-content {
|
||||||
|
.eyeopenShow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,345 +1,359 @@
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from 'react-redux';
|
||||||
import { getSession } from "../../Services/Others";
|
import { getSession } from '../../Services/Others';
|
||||||
import { changeBreadCrumb, getEmpAccess } from "../../Features/AppPage/CenterPage";
|
|
||||||
import { Messages } from "../../Components/Notifications/Messages";
|
|
||||||
import { Tables } from "../../Components/Tables/Table";
|
|
||||||
import FormHeader from "../PageComponents/FormHeader";
|
|
||||||
import Search from "../../Components/Forms/Search";
|
|
||||||
import Buttons from "../../Components/Forms/Buttons";
|
|
||||||
import {
|
import {
|
||||||
EditFilled,
|
changeBreadCrumb,
|
||||||
DeleteFilled,
|
getEmpAccess,
|
||||||
PlusOutlined,
|
} from '../../Features/AppPage/CenterPage';
|
||||||
ReloadOutlined,
|
import { Messages } from '../../Components/Notifications/Messages';
|
||||||
|
import { Tables } from '../../Components/Tables/Table';
|
||||||
|
import FormHeader from '../PageComponents/FormHeader';
|
||||||
|
import Search from '../../Components/Forms/Search';
|
||||||
|
import Buttons from '../../Components/Forms/Buttons';
|
||||||
|
import {
|
||||||
|
EditFilled,
|
||||||
|
DeleteFilled,
|
||||||
|
PlusOutlined,
|
||||||
|
ReloadOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useLocation, useNavigate } from "react-router-dom";
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import { Space, Tooltip } from "antd";
|
import { Space, Tooltip } from 'antd';
|
||||||
import { deleteAutomatedReorder, getAutomatedReorderList } from "../../Features/PurchaseOrder/PurchaseOrder";
|
import {
|
||||||
import { DefaultModal } from "../../Components/Modal/DefaultModal";
|
deleteAutomatedReorder,
|
||||||
import { FaRegEye } from "react-icons/fa";
|
getAutomatedReorderList,
|
||||||
import { render } from "react-dom";
|
} from '../../Features/PurchaseOrder/PurchaseOrder';
|
||||||
import { useAuth } from "../../AuthContext";
|
import { DefaultModal } from '../../Components/Modal/DefaultModal';
|
||||||
import "./AutomatedReorder.scss";
|
import { FaRegEye } from 'react-icons/fa';
|
||||||
|
import { render } from 'react-dom';
|
||||||
|
import { useAuth } from '../../AuthContext';
|
||||||
|
import './AutomatedReorder.scss';
|
||||||
|
|
||||||
const subDirectory = import.meta.env.BASE_URL;
|
const subDirectory = import.meta.env.BASE_URL;
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
link: `${subDirectory}app-page/home`,
|
link: `${subDirectory}app-page/home`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Automated Reorder',
|
name: 'Automated Reorder',
|
||||||
link: `${subDirectory}setting/automated-reorder`,
|
link: `${subDirectory}setting/automated-reorder`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const AutomatedReorderList = () => {
|
const AutomatedReorderList = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const state = location?.state;
|
const state = location?.state;
|
||||||
const { SadminuserAccess } = useAuth();
|
const { SadminuserAccess } = useAuth();
|
||||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||||
(e) => e?.MenuName === 'Product Receipt'
|
(e) => e?.MenuName === 'Product Receipt'
|
||||||
|
);
|
||||||
|
|
||||||
|
const AppId = getSession('AppId');
|
||||||
|
const CompId = getSession('CompId');
|
||||||
|
const BranchId = getSession('BranchId');
|
||||||
|
const UserId = getSession('UserId');
|
||||||
|
const UserType = getSession('UserType');
|
||||||
|
const [empData, setEmpData] = useState();
|
||||||
|
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||||
|
|
||||||
|
const [messageType, setMessageType] = useState(null);
|
||||||
|
const [messageData, setMessageData] = useState(null);
|
||||||
|
const [supplierModalOpen, setSupplierModalOpen] = useState(false);
|
||||||
|
const [supplierRecords, setSupplierRecords] = useState([]);
|
||||||
|
const [supplierRecordIndex, setSupplierRecordIndex] = useState(null);
|
||||||
|
const [page, setPage] = useState(1);
|
||||||
|
|
||||||
|
const [searchedText, setSearchedText] = useState('');
|
||||||
|
const [tableData, setTableData] = useState([]);
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: 'SL.NO',
|
||||||
|
dataIndex: 'SLNO',
|
||||||
|
key: 'SLNO',
|
||||||
|
width: '10%',
|
||||||
|
render: (_, record, index) => index + 1,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Product Name',
|
||||||
|
dataIndex: 'ProdName',
|
||||||
|
key: 'ProdName',
|
||||||
|
render: (_, record) => `${record.ProdName} (${record.UOMName})`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Supplier',
|
||||||
|
dataIndex: 'Supplier',
|
||||||
|
key: 'Supplier',
|
||||||
|
align: 'center',
|
||||||
|
render: (_, record, index) => (
|
||||||
|
// <div className="productMasterImageUpload">
|
||||||
|
<Tooltip title={record.SupplierDetails ? 'View Image' : 'Upload Image'}>
|
||||||
|
<div className="eyeopenShow">
|
||||||
|
<FaRegEye
|
||||||
|
style={{ background: 'none', cursor: 'pointer' }}
|
||||||
|
size={22}
|
||||||
|
color={record.SupplierDetails && '#1F9B3A'}
|
||||||
|
onClick={() => {
|
||||||
|
setSupplierModalOpen(true);
|
||||||
|
setSupplierRecords(record.SupplierDetails);
|
||||||
|
setSupplierRecordIndex(index);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Order Type',
|
||||||
|
dataIndex: 'OrderType',
|
||||||
|
key: 'OrderType',
|
||||||
|
render: (_, record, index) =>
|
||||||
|
record.OrderType === 'E' ? 'End of Day (EOD)' : 'Immediate',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Confirmation Type',
|
||||||
|
dataIndex: 'OrderProcessing',
|
||||||
|
key: 'OrderProcessing',
|
||||||
|
render: (_, record, index) =>
|
||||||
|
record.OrderProcessing === 'Y' ? 'Need Confirmation' : 'Auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Reorder Quantity',
|
||||||
|
dataIndex: 'OrderQty',
|
||||||
|
key: 'OrderQty',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Action',
|
||||||
|
dataIndex: 'Action',
|
||||||
|
key: 'Action',
|
||||||
|
width: '100px',
|
||||||
|
align: 'center',
|
||||||
|
render: (_, record, index) =>
|
||||||
|
record.ActiveStatus === 'A' ? (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
width: '100%',
|
||||||
|
gap: '10px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<EditFilled
|
||||||
|
style={{ color: '#1292EE' }}
|
||||||
|
onClick={() => handleEdit(record)}
|
||||||
|
/>
|
||||||
|
<DeleteFilled
|
||||||
|
style={{ color: '#FF4D4F' }}
|
||||||
|
onClick={() => handleActiveAndDeactive(record)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<ReloadOutlined
|
||||||
|
style={{ color: '#52C41A' }}
|
||||||
|
onClick={() => handleActiveAndDeactive(record)}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const supplierColumns = [
|
||||||
|
{
|
||||||
|
title: 'SL.NO',
|
||||||
|
dataIndex: 'SLNO',
|
||||||
|
key: 'SLNO',
|
||||||
|
width: '10%',
|
||||||
|
render: (_, record, index) => index + 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Supplier Name',
|
||||||
|
dataIndex: 'SuppName',
|
||||||
|
key: 'SuppName',
|
||||||
|
width: '20%',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
if (AppId && CompId && BranchId) {
|
||||||
|
dispatch(changeBreadCrumb({ items: items }));
|
||||||
|
fetchData();
|
||||||
|
if (state?.Notify) {
|
||||||
|
setMessageType(state?.Notify.messageType);
|
||||||
|
setMessageData(state?.Notify.messageData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error, 'error: changeBreadCrumb');
|
||||||
|
}
|
||||||
|
}, [AppId, CompId, BranchId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (UserType === 'Employee') {
|
||||||
|
fetchApi();
|
||||||
|
}
|
||||||
|
}, [UserType]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let hasAccess = false;
|
||||||
|
|
||||||
|
if (UserType === 'Admin' || UserType === 'Super Admin') {
|
||||||
|
hasAccess = true;
|
||||||
|
} else if (UserType === 'Employee') {
|
||||||
|
hasAccess = empData?.AddAccess === 'Y';
|
||||||
|
} else if (UserType === 'Super Admin User') {
|
||||||
|
hasAccess = SAAccessCommonMaster?.AddAccess === 'Y';
|
||||||
|
}
|
||||||
|
|
||||||
|
setaddnewAccess(!hasAccess);
|
||||||
|
}, [empData, SAAccessCommonMaster, UserType]);
|
||||||
|
|
||||||
|
const fetchApi = async () => {
|
||||||
|
let data = {
|
||||||
|
CompId: CompId,
|
||||||
|
BranchId: BranchId,
|
||||||
|
AppId: AppId,
|
||||||
|
EmpId: UserId,
|
||||||
|
};
|
||||||
|
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||||
|
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||||
|
(item) => item.ConfigName === 'Automated Reorder'
|
||||||
);
|
);
|
||||||
|
setEmpData(datas?.[0]);
|
||||||
|
};
|
||||||
|
|
||||||
const AppId = getSession('AppId');
|
const fetchData = async () => {
|
||||||
const CompId = getSession('CompId');
|
try {
|
||||||
const BranchId = getSession('BranchId');
|
const res = await dispatch(
|
||||||
const UserId = getSession('UserId');
|
getAutomatedReorderList({ AppId, CompId, BranchId })
|
||||||
const UserType = getSession('UserType');
|
)?.unwrap();
|
||||||
const [empData, setEmpData] = useState();
|
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
|
||||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
setTableData(res?.data?.data);
|
||||||
|
} else {
|
||||||
const [messageType, setMessageType] = useState(null);
|
setTableData([]);
|
||||||
const [messageData, setMessageData] = useState(null);
|
}
|
||||||
const [supplierModalOpen, setSupplierModalOpen] = useState(false);
|
} catch (error) {
|
||||||
const [supplierRecords, setSupplierRecords] = useState([]);
|
console.error(error, 'error: getAutomatedReorderList');
|
||||||
const [supplierRecordIndex, setSupplierRecordIndex] = useState(null);
|
|
||||||
const [page, setPage] = useState(1);
|
|
||||||
|
|
||||||
|
|
||||||
const [searchedText, setSearchedText] = useState('');
|
|
||||||
const [tableData, setTableData] = useState([]);
|
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: 'SL.NO',
|
|
||||||
dataIndex: 'SLNO',
|
|
||||||
key: 'SLNO',
|
|
||||||
width: '10%',
|
|
||||||
render: (_, record, index) => index + 1,
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Product Name',
|
|
||||||
dataIndex: 'ProdName',
|
|
||||||
key: 'ProdName',
|
|
||||||
render: (_, record) => (
|
|
||||||
`${record.ProdName} (${record.UOMName})`
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Supplier',
|
|
||||||
dataIndex: 'Supplier',
|
|
||||||
key: 'Supplier',
|
|
||||||
align: 'center',
|
|
||||||
render: (_, record, index) => (
|
|
||||||
// <div className="productMasterImageUpload">
|
|
||||||
<Tooltip title={record.SupplierDetails ? 'View Image' : 'Upload Image'}>
|
|
||||||
<div>
|
|
||||||
<FaRegEye
|
|
||||||
style={{ background: 'none', cursor: 'pointer' }}
|
|
||||||
size={22}
|
|
||||||
color={record.SupplierDetails && '#1F9B3A'}
|
|
||||||
onClick={() => {
|
|
||||||
setSupplierModalOpen(true);
|
|
||||||
setSupplierRecords(record.SupplierDetails);
|
|
||||||
setSupplierRecordIndex(index);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Tooltip>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Order Type',
|
|
||||||
dataIndex: 'OrderType',
|
|
||||||
key: 'OrderType',
|
|
||||||
render: (_, record, index) => (
|
|
||||||
record.OrderType === 'E' ? 'End of Day (EOD)' : 'Immediate'
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Confirmation Type',
|
|
||||||
dataIndex: 'OrderProcessing',
|
|
||||||
key: 'OrderProcessing',
|
|
||||||
render: (_, record, index) => (
|
|
||||||
record.OrderProcessing === 'Y' ? 'Need Confirmation' : 'Auto'
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Reorder Quantity',
|
|
||||||
dataIndex: 'OrderQty',
|
|
||||||
key: 'OrderQty',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Action',
|
|
||||||
dataIndex: 'Action',
|
|
||||||
key: 'Action',
|
|
||||||
width: '100px',
|
|
||||||
align: 'center',
|
|
||||||
render: (_, record, index) => (
|
|
||||||
|
|
||||||
record.ActiveStatus === 'A' ? (
|
|
||||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%', gap: '10px' }}>
|
|
||||||
<EditFilled
|
|
||||||
style={{ color: '#1292EE' }}
|
|
||||||
onClick={() => handleEdit(record)}
|
|
||||||
/>
|
|
||||||
<DeleteFilled
|
|
||||||
style={{ color: '#FF4D4F' }}
|
|
||||||
onClick={() => handleActiveAndDeactive(record)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<ReloadOutlined
|
|
||||||
style={{ color: '#52C41A' }}
|
|
||||||
onClick={() => handleActiveAndDeactive(record)}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const supplierColumns = [
|
|
||||||
{
|
|
||||||
title: 'SL.NO',
|
|
||||||
dataIndex: 'SLNO',
|
|
||||||
key: 'SLNO',
|
|
||||||
width: '10%',
|
|
||||||
render: (_, record, index) => index + 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Supplier Name',
|
|
||||||
dataIndex: 'SuppName',
|
|
||||||
key: 'SuppName',
|
|
||||||
width: '20%',
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
try {
|
|
||||||
if (AppId && CompId && BranchId) {
|
|
||||||
dispatch(changeBreadCrumb({ items: items }));
|
|
||||||
fetchData()
|
|
||||||
if (state?.Notify) {
|
|
||||||
setMessageType(state?.Notify.messageType);
|
|
||||||
setMessageData(state?.Notify.messageData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error, 'error: changeBreadCrumb');
|
|
||||||
}
|
|
||||||
}, [AppId, CompId, BranchId]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (UserType === 'Employee') {
|
|
||||||
fetchApi();
|
|
||||||
}
|
|
||||||
}, [UserType]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let hasAccess = false;
|
|
||||||
|
|
||||||
if (UserType === 'Admin' || UserType === 'Super Admin') {
|
|
||||||
hasAccess = true;
|
|
||||||
} else if (UserType === 'Employee') {
|
|
||||||
hasAccess = empData?.AddAccess === 'Y';
|
|
||||||
} else if (UserType === 'Super Admin User') {
|
|
||||||
hasAccess = SAAccessCommonMaster?.AddAccess === 'Y';
|
|
||||||
}
|
|
||||||
|
|
||||||
setaddnewAccess(!hasAccess);
|
|
||||||
}, [empData, SAAccessCommonMaster, UserType]);
|
|
||||||
|
|
||||||
const fetchApi = async () => {
|
|
||||||
let data = {
|
|
||||||
CompId: CompId,
|
|
||||||
BranchId: BranchId,
|
|
||||||
AppId: AppId,
|
|
||||||
EmpId: UserId,
|
|
||||||
};
|
|
||||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
|
||||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
|
||||||
(item) => item.ConfigName === 'Automated Reorder'
|
|
||||||
);
|
|
||||||
setEmpData(datas?.[0]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchData = async () => {
|
|
||||||
try {
|
|
||||||
const res = await dispatch(getAutomatedReorderList({ AppId, CompId, BranchId }))?.unwrap();
|
|
||||||
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
|
|
||||||
setTableData(res?.data?.data)
|
|
||||||
} else {
|
|
||||||
setTableData([])
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error, 'error: getAutomatedReorderList');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onSearch = (value) => {
|
const onSearch = (value) => {
|
||||||
setSearchedText(value);
|
setSearchedText(value);
|
||||||
};
|
};
|
||||||
const onSearchChange = (e) => {
|
const onSearchChange = (e) => {
|
||||||
setSearchedText(e?.target?.value);
|
setSearchedText(e?.target?.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
navigate(`${subDirectory}setting/automated-reorder/new`);
|
navigate(`${subDirectory}setting/automated-reorder/new`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEdit = (record) => {
|
||||||
|
navigate(`${subDirectory}setting/automated-reorder/update`, {
|
||||||
|
state: {
|
||||||
|
editstate: record,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const handleActiveAndDeactive = async (record) => {
|
||||||
|
const res = await dispatch(
|
||||||
|
deleteAutomatedReorder({
|
||||||
|
UniqueId: record?.UniqueId,
|
||||||
|
UpdatedBy: UserId,
|
||||||
|
ActiveStatus: record?.ActiveStatus === 'A' ? 'D' : 'A',
|
||||||
|
})
|
||||||
|
)?.unwrap();
|
||||||
|
if (res?.data?.statusCode === 1) {
|
||||||
|
setMessageType('success');
|
||||||
|
setMessageData(
|
||||||
|
record?.ActiveStatus === 'A'
|
||||||
|
? 'Deactivated Successfully'
|
||||||
|
: 'Activated Successfully'
|
||||||
|
);
|
||||||
|
fetchData();
|
||||||
|
} else {
|
||||||
|
setMessageType('error');
|
||||||
|
setMessageData(res?.data?.message);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleEdit = (record) => {
|
const onComplete = useCallback(() => {
|
||||||
navigate(`${subDirectory}setting/automated-reorder/update`, {
|
setMessageType(null);
|
||||||
state: {
|
setMessageData(null);
|
||||||
editstate: record,
|
}, []);
|
||||||
}
|
const handlePageChange = (current) => {
|
||||||
});
|
setPage(current);
|
||||||
}
|
};
|
||||||
const handleActiveAndDeactive = async (record) => {
|
|
||||||
const res = await dispatch(deleteAutomatedReorder({ UniqueId: record?.UniqueId, UpdatedBy: UserId, ActiveStatus: record?.ActiveStatus === 'A' ? 'D' : 'A' }))?.unwrap();
|
|
||||||
if (res?.data?.statusCode === 1) {
|
|
||||||
setMessageType('success');
|
|
||||||
setMessageData(record?.ActiveStatus === 'A' ? 'Deactivated Successfully' : 'Activated Successfully');
|
|
||||||
fetchData();
|
|
||||||
} else {
|
|
||||||
setMessageType('error');
|
|
||||||
setMessageData(res?.data?.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const onComplete = useCallback(() => {
|
return (
|
||||||
setMessageType(null);
|
<section className="automated-reorder-list-container">
|
||||||
setMessageData(null);
|
<Messages
|
||||||
}, []);
|
messageType={messageType}
|
||||||
const handlePageChange = (current) => {
|
messageData={messageData}
|
||||||
setPage(current);
|
onComplete={onComplete}
|
||||||
};
|
/>
|
||||||
|
<div className="automated-reorder-list-wrapper">
|
||||||
return (
|
<div className="automated-reorder-list-header">
|
||||||
<section className="automated-reorder-list-container">
|
<div className="formAddNew">
|
||||||
<Messages
|
<div>
|
||||||
messageType={messageType}
|
<FormHeader title={'Automated Reorder'} />
|
||||||
messageData={messageData}
|
|
||||||
onComplete={onComplete}
|
|
||||||
/>
|
|
||||||
<div className="automated-reorder-list-wrapper">
|
|
||||||
<div className="automated-reorder-list-header">
|
|
||||||
<div className="formAddNew">
|
|
||||||
<div>
|
|
||||||
<FormHeader title={'Automated Reorder'} />
|
|
||||||
</div>
|
|
||||||
<div className="searchAddDiv">
|
|
||||||
<div className="formSearch">
|
|
||||||
<Search
|
|
||||||
placeholder="Search"
|
|
||||||
onSearch={onSearch}
|
|
||||||
onSearchChange={onSearchChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<Buttons
|
|
||||||
buttonText={'Add New'}
|
|
||||||
handleSubmit={handleAdd}
|
|
||||||
disabled={addnewAccess}
|
|
||||||
color="901D77"
|
|
||||||
icon={<PlusOutlined />}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="automated-reorder-list-content">
|
|
||||||
<Tables
|
|
||||||
columns={columns}
|
|
||||||
data={tableData}
|
|
||||||
ownPagination={true}
|
|
||||||
pagination={{
|
|
||||||
current: page,
|
|
||||||
onChange: handlePageChange,
|
|
||||||
defaultPageSize: 10,
|
|
||||||
showSizeChanger: false,
|
|
||||||
hideOnSinglePage: true
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<DefaultModal
|
<div className="searchAddDiv">
|
||||||
open={supplierModalOpen}
|
<div className="formSearch">
|
||||||
title={'Suppliers'}
|
<Search
|
||||||
width={500}
|
placeholder="Search"
|
||||||
footer={false}
|
onSearch={onSearch}
|
||||||
handleCancel={() => {
|
onSearchChange={onSearchChange}
|
||||||
setSupplierModalOpen(false);
|
/>
|
||||||
setSupplierRecords(null);
|
</div>
|
||||||
setSupplierRecordIndex(null);
|
<Buttons
|
||||||
}}
|
buttonText={'Add New'}
|
||||||
children={
|
handleSubmit={handleAdd}
|
||||||
<div className="automated-reorder-list-content">
|
disabled={addnewAccess}
|
||||||
<Tables
|
color="901D77"
|
||||||
columns={supplierColumns}
|
icon={<PlusOutlined />}
|
||||||
data={supplierRecords}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
/>
|
<div className="automated-reorder-list-content">
|
||||||
</section>
|
<Tables
|
||||||
)
|
columns={columns}
|
||||||
}
|
data={tableData}
|
||||||
|
ownPagination={true}
|
||||||
|
pagination={{
|
||||||
|
current: page,
|
||||||
|
onChange: handlePageChange,
|
||||||
|
defaultPageSize: 10,
|
||||||
|
showSizeChanger: false,
|
||||||
|
hideOnSinglePage: true,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<DefaultModal
|
||||||
|
open={supplierModalOpen}
|
||||||
|
title={'Suppliers'}
|
||||||
|
width={500}
|
||||||
|
footer={false}
|
||||||
|
handleCancel={() => {
|
||||||
|
setSupplierModalOpen(false);
|
||||||
|
setSupplierRecords(null);
|
||||||
|
setSupplierRecordIndex(null);
|
||||||
|
}}
|
||||||
|
children={
|
||||||
|
<div className="automated-reorder-list-content">
|
||||||
|
<Tables columns={supplierColumns} data={supplierRecords} />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default AutomatedReorderList
|
export default AutomatedReorderList;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -5,7 +5,7 @@ import { Tooltip, Badge, Popconfirm } from 'antd';
|
||||||
import { isMobile } from 'react-device-detect';
|
import { isMobile } from 'react-device-detect';
|
||||||
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
|
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
|
||||||
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
|
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
|
||||||
const CategoryHorizontal = lazy(
|
const CategoryHorizontal = lazy(
|
||||||
() => import('../../Components/BSCategories/BSCategoryHorizontal')
|
() => import('../../Components/BSCategories/BSCategoryHorizontal')
|
||||||
);
|
);
|
||||||
const BSItemCard = lazy(
|
const BSItemCard = lazy(
|
||||||
|
|
@ -16,10 +16,8 @@ const BSBillingTable2 = lazy(
|
||||||
() =>
|
() =>
|
||||||
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
|
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
|
||||||
);
|
);
|
||||||
const BSBillingTable3 = lazy(
|
|
||||||
() =>
|
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall';
|
||||||
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
|
|
||||||
);
|
|
||||||
|
|
||||||
import { dynamicComponentProps } from '../DynamicComponentProps.js';
|
import { dynamicComponentProps } from '../DynamicComponentProps.js';
|
||||||
import {
|
import {
|
||||||
|
|
@ -95,16 +93,10 @@ const BSOtherServicesVerticalcat = lazy(
|
||||||
() => import('../../Components/BSCategories/BSOtherServicesVerticalcat.jsx')
|
() => import('../../Components/BSCategories/BSOtherServicesVerticalcat.jsx')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const SalesCountForStandard = lazy(
|
const SalesCountForStandard = lazy(
|
||||||
() => import('../SalesCountForStandard.jsx')
|
() => import('../SalesCountForStandard.jsx')
|
||||||
);
|
);
|
||||||
|
|
||||||
const StandardTable = lazy(
|
|
||||||
() =>
|
|
||||||
import('../../Components/BSBillingTables/StandardTable/StandardTable.jsx')
|
|
||||||
);
|
|
||||||
|
|
||||||
const ComboSalesBillTable = lazy(
|
const ComboSalesBillTable = lazy(
|
||||||
() =>
|
() =>
|
||||||
import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx')
|
import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx')
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@ import { Messages } from '../../Components/Notifications/Messages';
|
||||||
import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
|
import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
|
||||||
import { useAuth } from '../../AuthContext.jsx';
|
import { useAuth } from '../../AuthContext.jsx';
|
||||||
import { getPreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js';
|
import { getPreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js';
|
||||||
|
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||||
const subDirectory = import.meta.env.BASE_URL;
|
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
|
|
@ -71,7 +70,6 @@ const CustomerMaster = () => {
|
||||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||||
const [allowDecimal, setAllowDecimal] = useState(false);
|
const [allowDecimal, setAllowDecimal] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
if (location?.state?.Notiffy) {
|
if (location?.state?.Notiffy) {
|
||||||
setMessageType(location?.state?.Notiffy.messageType);
|
setMessageType(location?.state?.Notiffy.messageType);
|
||||||
|
|
@ -155,13 +153,22 @@ const CustomerMaster = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const getPreference = async () => {
|
const getPreference = async () => {
|
||||||
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId, UserId: UserId };
|
const data = {
|
||||||
const { data: res } = await dispatch(getPreferenceData(data)).unwrap()
|
AppId: AppId,
|
||||||
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y');
|
CompId: CompId,
|
||||||
|
BranchId: BranchId,
|
||||||
|
UserId: UserId,
|
||||||
|
};
|
||||||
|
const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
|
||||||
|
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
|
||||||
|
(setting) =>
|
||||||
|
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
|
||||||
|
setting?.SettingValue === 'Y'
|
||||||
|
);
|
||||||
if (decimalSetting) {
|
if (decimalSetting) {
|
||||||
setAllowDecimal(true)
|
setAllowDecimal(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//Delete
|
//Delete
|
||||||
const statusFormatter = async (row) => {
|
const statusFormatter = async (row) => {
|
||||||
|
|
@ -251,7 +258,8 @@ const CustomerMaster = () => {
|
||||||
width: '100px',
|
width: '100px',
|
||||||
render: (text, row) => (
|
render: (text, row) => (
|
||||||
<a style={{ color: 'black', width: '200px' }}>
|
<a style={{ color: 'black', width: '200px' }}>
|
||||||
{(row?.CustName ? (row?.CustName + ' ') : '') + (row?.CustShortName || "") || row?.CustMobile}
|
{(row?.CustName ? row?.CustName + ' ' : '') +
|
||||||
|
(row?.CustShortName || '') || row?.CustMobile}
|
||||||
</a>
|
</a>
|
||||||
),
|
),
|
||||||
filteredValue: [searchedText],
|
filteredValue: [searchedText],
|
||||||
|
|
@ -260,8 +268,12 @@ const CustomerMaster = () => {
|
||||||
String(record.CustShortName)
|
String(record.CustShortName)
|
||||||
?.toLowerCase()
|
?.toLowerCase()
|
||||||
?.includes(value?.toLowerCase()) ||
|
?.includes(value?.toLowerCase()) ||
|
||||||
String(record.CustName)?.toLowerCase()?.includes(value?.toLowerCase()) ||
|
String(record.CustName)
|
||||||
String(record.CustMobile)?.toLowerCase()?.includes(value?.toLowerCase())
|
?.toLowerCase()
|
||||||
|
?.includes(value?.toLowerCase()) ||
|
||||||
|
String(record.CustMobile)
|
||||||
|
?.toLowerCase()
|
||||||
|
?.includes(value?.toLowerCase())
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
sorter: (a, b) => a?.CustName?.length - b?.CustName?.length,
|
sorter: (a, b) => a?.CustName?.length - b?.CustName?.length,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import React, { useState, useRef, useEffect, useContext } from 'react';
|
import React, { useState, useRef, useEffect, useContext } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
// import { read, utils } from 'xlsx';
|
|
||||||
import ExcelJS from 'exceljs';
|
import ExcelJS from 'exceljs';
|
||||||
import { Table, Form, Input, Tooltip, Modal, Select } from 'antd';
|
import { Table, Form, Input, Tooltip, Modal, Select } from 'antd';
|
||||||
import {
|
import {
|
||||||
|
|
@ -18,7 +17,6 @@ import {
|
||||||
getFieldSetupData,
|
getFieldSetupData,
|
||||||
} from '../../Features/ProductPage/ProductPage.js';
|
} from '../../Features/ProductPage/ProductPage.js';
|
||||||
import Imageupload from '../../Components/Forms/Upload.jsx';
|
import Imageupload from '../../Components/Forms/Upload.jsx';
|
||||||
import { BiSolidFileExport } from 'react-icons/bi';
|
|
||||||
import { CiExport } from 'react-icons/ci';
|
import { CiExport } from 'react-icons/ci';
|
||||||
|
|
||||||
import { uploadImage } from '../../Features/upload/upload.js';
|
import { uploadImage } from '../../Features/upload/upload.js';
|
||||||
|
|
@ -617,15 +615,20 @@ const ProductExcel = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(tableFieldPreferences, 'tableFieldPreferences');
|
console.log(tableFieldPreferences, 'tableFieldPreferences');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (excelData && excelData?.length > 0) {
|
if (excelData && excelData?.length > 0) {
|
||||||
let ExecelToJsConvertion = [];
|
let ExecelToJsConvertion = [];
|
||||||
let slicedData = excelData?.slice(1);
|
let slicedData = excelData?.slice(1);
|
||||||
let filteredData = slicedData?.filter(
|
let filteredData = slicedData?.filter((item) => {
|
||||||
(item) => item?.[item?.length - 1]?.trim() !== 'sample row'
|
const values = Object.values(item || {});
|
||||||
);
|
const lastVal = values[values.length - 1];
|
||||||
|
return typeof lastVal === 'string'
|
||||||
|
? lastVal.trim() !== 'sample row'
|
||||||
|
: true;
|
||||||
|
});
|
||||||
filteredData?.map((item, index) => {
|
filteredData?.map((item, index) => {
|
||||||
ExecelToJsConvertion.push({
|
ExecelToJsConvertion?.push({
|
||||||
key: index,
|
key: index,
|
||||||
ProductName: item?.['0'],
|
ProductName: item?.['0'],
|
||||||
Quantity: item?.['1'],
|
Quantity: item?.['1'],
|
||||||
|
|
@ -1005,112 +1008,6 @@ const ProductExcel = ({
|
||||||
reader.readAsArrayBuffer(file);
|
reader.readAsArrayBuffer(file);
|
||||||
};
|
};
|
||||||
|
|
||||||
// const uploadAndProcessExcel = (file) => {
|
|
||||||
// const reader = new FileReader();
|
|
||||||
|
|
||||||
// reader.onload = (e) => {
|
|
||||||
// const data = new Uint8Array(e.target.result);
|
|
||||||
|
|
||||||
// const workbook = read(data, { type: 'array' });
|
|
||||||
// const worksheet = workbook.Sheets[workbook.SheetNames[0]];
|
|
||||||
|
|
||||||
// const jsonData = utils.sheet_to_json(worksheet, {
|
|
||||||
// header: 1,
|
|
||||||
// raw: false,
|
|
||||||
// dateNF: 'DD/MM/YY',
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const nonEmptyRows = jsonData.filter((row) =>
|
|
||||||
// row.some((cell) => cell !== '')
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const header = nonEmptyRows[0];
|
|
||||||
// const rows = nonEmptyRows.slice(1);
|
|
||||||
|
|
||||||
// const dateFields = [
|
|
||||||
// 'Available From',
|
|
||||||
// 'Available To',
|
|
||||||
// 'Manufacture Date',
|
|
||||||
// 'Expire Date',
|
|
||||||
// 'Stock Date',
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// function convertToDisplayFormat(dateString) {
|
|
||||||
// const date = new Date(dateString);
|
|
||||||
// const day = date.getDate().toString().padStart(2, '0');
|
|
||||||
// const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
||||||
// const year = date.getFullYear().toString();
|
|
||||||
// return `${day}-${month}-${year}`;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const formattedData = rows.map((row) => {
|
|
||||||
// let rowData = header.reduce((acc, col, columnIndex) => {
|
|
||||||
// if (dateFields?.includes(col)) {
|
|
||||||
// acc[col] = convertToDisplayFormat(row[columnIndex]);
|
|
||||||
// } else {
|
|
||||||
// acc[col] = row[columnIndex];
|
|
||||||
// }
|
|
||||||
// return acc;
|
|
||||||
// }, {});
|
|
||||||
|
|
||||||
// return rowData;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (jsonData.length > 0) {
|
|
||||||
// const extractedHeaders = Object.keys(formattedData[0]);
|
|
||||||
|
|
||||||
// const filteredData = formattedData.filter(
|
|
||||||
// (item) => !Object.values(item)?.includes('sample row')
|
|
||||||
// );
|
|
||||||
|
|
||||||
// // ✅ Add default variant name if missing
|
|
||||||
// const updatedData = filteredData.map((item) => ({
|
|
||||||
// ...item,
|
|
||||||
// 'Product Varient Name':
|
|
||||||
// item['Product Varient Name'] === undefined
|
|
||||||
// ? 'Variant 1'
|
|
||||||
// : item['Product Varient Name'],
|
|
||||||
// 'Available To':
|
|
||||||
// item['Available To'] == 'NaN-NaN-NaN' ? '' : item['Available To'],
|
|
||||||
// ProdId: item['ProdId'] || null,
|
|
||||||
// }));
|
|
||||||
|
|
||||||
// // Detect modified products
|
|
||||||
|
|
||||||
// const modifiedProducts = findModifiedProducts(OrginalData, updatedData);
|
|
||||||
// const modifiedIds = new Set(modifiedProducts.map((p) => p.ProdId));
|
|
||||||
// const originalIds = new Set(OrginalData?.map((p) => p.ProdId) || []);
|
|
||||||
// const markedData = updatedData
|
|
||||||
// .map((item) => ({
|
|
||||||
// ...item,
|
|
||||||
// isModified:
|
|
||||||
// modifiedIds.has(item.ProdId) || !originalIds.has(item.ProdId),
|
|
||||||
// }))
|
|
||||||
// .sort((a, b) => b.isModified - a.isModified);
|
|
||||||
// setUploadedRawData(markedData);
|
|
||||||
// console.log(modifiedProducts, 'modifiedProducts');
|
|
||||||
|
|
||||||
// // ✅ Set only once with final data
|
|
||||||
// setHeaders(extractedHeaders);
|
|
||||||
|
|
||||||
// autoMapFields(extractedHeaders);
|
|
||||||
// dispatch(uploadExcel({ file, jsonData: nonEmptyRows }));
|
|
||||||
// setWorksheet(worksheet);
|
|
||||||
// setDatas([]); // Clear mapped state initially
|
|
||||||
// setExcelData([]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // setMappingOpen(true);
|
|
||||||
// dispatch(uploadExcel({ file, jsonData: nonEmptyRows }));
|
|
||||||
// setWorksheet(worksheet);
|
|
||||||
// setWorksheet1(worksheet1);
|
|
||||||
// setDatas(formattedData); // Update Datas state here
|
|
||||||
// // setExcelData(formattedData);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// reader.readAsArrayBuffer(file);
|
|
||||||
// };
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
imagecall();
|
imagecall();
|
||||||
addOnlineImage();
|
addOnlineImage();
|
||||||
|
|
@ -1875,24 +1772,6 @@ const ProductExcel = ({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// // Now set protection for all rows
|
|
||||||
// // First, unlock ALL cells in the worksheet
|
|
||||||
// for (let rowNum = 1; rowNum <= worksheet.rowCount; rowNum++) {
|
|
||||||
// const row = worksheet.getRow(rowNum);
|
|
||||||
// row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
||||||
// const config = selectedColumns[colNumber - 1];
|
|
||||||
// cell.protection = { locked: config?.locked || false };
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Then lock ONLY the header row (row 1) and sample row (row 2)
|
|
||||||
// worksheet.getRow(1).eachCell({ includeEmpty: true }, (cell) => {
|
|
||||||
// cell.protection = { locked: true };
|
|
||||||
// });
|
|
||||||
|
|
||||||
// worksheet.getRow(2).eachCell({ includeEmpty: true }, (cell) => {
|
|
||||||
// cell.protection = { locked: true };
|
|
||||||
// });
|
|
||||||
// Add empty rows for data entry
|
// Add empty rows for data entry
|
||||||
for (let i = 1; i <= 1000; i++) {
|
for (let i = 1; i <= 1000; i++) {
|
||||||
worksheet.addRow({});
|
worksheet.addRow({});
|
||||||
|
|
@ -2497,18 +2376,6 @@ const ProductExcel = ({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Usage examples:
|
|
||||||
// Download only specific fields:
|
|
||||||
// handleDownload(['ProdName', 'Size']); // Only Product Name and Quantity
|
|
||||||
// handleDownload(['ProdName', 'Size', 'UOM', 'SellPrice']); // Multiple fields
|
|
||||||
// handleDownload(['ProdName', 'Size', 'UOM', 'SellPrice', 'ProdCat', 'Brand']); // More fields
|
|
||||||
|
|
||||||
// Available field names:
|
|
||||||
// 'ProdName', 'Size', 'UOM', 'SellPrice', 'ProdCat', 'ProdSubCat', 'Brand',
|
|
||||||
// 'ProdVarientName', 'MRP', 'StockAvailable', 'OfferPrice', 'Supplier', 'TaxId',
|
|
||||||
// 'AutoGenerateQr', 'AddQrCode', 'SpecialPrice', 'OnePiecePrice', 'AutoGenOnePieceQr',
|
|
||||||
// 'AutoGenOnePieceQrNum', 'CESS', 'HSNCode', 'PartNumber', 'Rack', 'ManufDate',
|
|
||||||
// 'ExpDate', 'AvailableFrom', 'AvailableTo'
|
|
||||||
const handleFileSubmit = (e) => {
|
const handleFileSubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (excelFile === null) {
|
if (excelFile === null) {
|
||||||
|
|
@ -2883,7 +2750,7 @@ const ProductExcel = ({
|
||||||
<div
|
<div
|
||||||
className="editable-cell-value-wrap"
|
className="editable-cell-value-wrap"
|
||||||
style={{
|
style={{
|
||||||
paddingRight: 24,
|
textAlign: 'right',
|
||||||
}}
|
}}
|
||||||
onClick={toggleEdit}
|
onClick={toggleEdit}
|
||||||
>
|
>
|
||||||
|
|
@ -3162,13 +3029,24 @@ const ProductExcel = ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
height: '80%',
|
alignItems: 'center',
|
||||||
|
height: '60%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
<span>{col.title}</span>
|
<span
|
||||||
|
style={{
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
fontWeight: '500',
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{col.title}
|
||||||
|
</span>
|
||||||
{!isMapped && (
|
{!isMapped && (
|
||||||
<span style={{ color: 'red', fontSize: '11px' }}>Not mapped</span>
|
<span style={{ color: '#f7a0a0', fontSize: '11px' }}>
|
||||||
|
Not mapped
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -3217,7 +3095,7 @@ const ProductExcel = ({
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
right: '-17px',
|
right: '-17px',
|
||||||
top: '80%',
|
top: '90%',
|
||||||
transform: 'translateY(-50%)',
|
transform: 'translateY(-50%)',
|
||||||
color: 'red',
|
color: 'red',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
|
@ -3347,111 +3225,102 @@ const ProductExcel = ({
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
onSubmit={handleFileSubmit}
|
onSubmit={handleFileSubmit}
|
||||||
>
|
>
|
||||||
<div
|
<div className="download-linkMain">
|
||||||
style={{
|
<div className="HeadingUploadExl">
|
||||||
display: 'flex',
|
<p
|
||||||
justifyContent: 'space-between',
|
style={{
|
||||||
flexWrap: 'wrap',
|
fontSize: '16px',
|
||||||
}}
|
fontWeight: '500',
|
||||||
>
|
whiteSpace: 'nowrap',
|
||||||
<p style={{ fontSize: '20px', fontWeight: '500' }}>
|
}}
|
||||||
Upload Your Excel
|
>
|
||||||
</p>
|
Upload Your Excel
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
gap: '0.5rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tooltip title="Field Setup">
|
||||||
|
<div
|
||||||
|
className="btn btn--info"
|
||||||
|
style={{
|
||||||
|
background: '#00694aff',
|
||||||
|
color: '#fff',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
padding: '5px 12px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
}}
|
||||||
|
onClick={handleFieldSetup}
|
||||||
|
>
|
||||||
|
<MdOutlineAppRegistration size={19} />
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
<div
|
||||||
|
className="export-excel-div"
|
||||||
|
onClick={() => handleExportData()}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<CiExport size={20} strokeWidth={1} />
|
||||||
|
</div>
|
||||||
|
<div style={{ fontSize: '14px', letterSpacing: '0.2px' }}>
|
||||||
|
Export Excel
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{message && (
|
||||||
|
<div style={{ color: '#ff4d4f' }}>No Data Found</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{excelData?.length > 0 && excelData && (
|
||||||
|
<div>
|
||||||
|
<Tooltip title="Delete">
|
||||||
|
<AiFillDelete
|
||||||
|
onClick={handlechange22}
|
||||||
|
style={{
|
||||||
|
fontSize: '23px',
|
||||||
|
color: editdelete ? '#52c41a' : '#1292ee',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
|
className="download-link"
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
justifyContent:
|
||||||
gap: '0.5rem',
|
excelData?.length > 0 ? 'space-between' : 'flex-end',
|
||||||
margin: '1rem 0',
|
gap: '1rem',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Tooltip title="Field Setup">
|
{excelData?.length > 0 && (
|
||||||
<div
|
<div className="SheetIndiacte">
|
||||||
className="btn btn--info"
|
<div>
|
||||||
style={{
|
<p className="mdsheet"></p>
|
||||||
background: '#00694aff',
|
<span>Modified</span>
|
||||||
color: '#fff',
|
</div>
|
||||||
display: 'flex',
|
<div>
|
||||||
alignItems: 'center',
|
<p className="mdsheet2"></p>
|
||||||
justifyContent: 'center',
|
<span>Not Modified</span>
|
||||||
padding: '5px 12px',
|
</div>
|
||||||
borderRadius: '4px',
|
|
||||||
}}
|
|
||||||
onClick={handleFieldSetup}
|
|
||||||
>
|
|
||||||
<MdOutlineAppRegistration size={19} />
|
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Tooltip title={'Format Sheet'} placement="top">
|
||||||
|
<button onClick={handleDownload}>
|
||||||
|
<FiDownload style={{ fontSize: '20px' }} />
|
||||||
|
<span>Download Sample Sheet</span>
|
||||||
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<div
|
|
||||||
className="export-excel-div"
|
|
||||||
onClick={() => handleExportData()}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<CiExport size={20} strokeWidth={1} />
|
|
||||||
</div>
|
|
||||||
<div style={{ fontSize: '14px', letterSpacing: '0.2px' }}>
|
|
||||||
Export Excel
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* {excelData?.length > 0 && excelData &&
|
|
||||||
<div className="export-excel-div" onClick={() => setMappingOpen(true)}>
|
|
||||||
<div>
|
|
||||||
<CiBoxList />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Map Your Fields
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
} */}
|
|
||||||
{loading && <div style={{ color: '#ff4d4f' }}>Loading...</div>}
|
|
||||||
{message && <div style={{ color: '#ff4d4f' }}>No Data Found</div>}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{excelData?.length > 0 && excelData && (
|
|
||||||
<div>
|
|
||||||
<Tooltip title="Delete">
|
|
||||||
<AiFillDelete
|
|
||||||
onClick={handlechange22}
|
|
||||||
style={{
|
|
||||||
fontSize: '23px',
|
|
||||||
color: editdelete ? '#52c41a' : '#1292ee',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="download-link"
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'flex-end',
|
|
||||||
// justifyContent: "space-between",
|
|
||||||
justifyContent:
|
|
||||||
excelData?.length > 0 ? 'space-between' : 'flex-end',
|
|
||||||
width: '100%',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{excelData?.length > 0 && (
|
|
||||||
<div className="SheetIndiacte">
|
|
||||||
<div>
|
|
||||||
<p className="mdsheet"></p>
|
|
||||||
<span>Modified</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="mdsheet2"></p>
|
|
||||||
<span>Not Modified</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Tooltip title={'Format Sheet'} placement="top">
|
|
||||||
<button onClick={handleDownload}>
|
|
||||||
<FiDownload style={{ fontSize: '20px' }} />
|
|
||||||
<span>Download Sample Sheet</span>
|
|
||||||
</button>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(!excelData || excelData?.length === 0) && (
|
{(!excelData || excelData?.length === 0) && (
|
||||||
|
|
@ -3542,13 +3411,6 @@ const ProductExcel = ({
|
||||||
margin: '1rem 0rem',
|
margin: '1rem 0rem',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <Tooltip title="Format Sheet" placement="bottom">
|
|
||||||
<div className="download-link" onClick={handleDownload} style={{ display: 'flex', alignItems: 'center', gap: '.5rem', padding: '0.3rem 0.4rem', borderRadius: '6px', backgroundColor: 'ghostwhite' }} >
|
|
||||||
<FiDownload style={{ fontSize: '20px', }} />
|
|
||||||
<a style={{ color: '#000' }}> Download</a>
|
|
||||||
</div>
|
|
||||||
</Tooltip> */}
|
|
||||||
|
|
||||||
{excelData && excelData?.length > 0 && (
|
{excelData && excelData?.length > 0 && (
|
||||||
<div
|
<div
|
||||||
className="cancel-link"
|
className="cancel-link"
|
||||||
|
|
@ -3579,7 +3441,11 @@ const ProductExcel = ({
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="field-setup-content">
|
<div className="field-setup-content">
|
||||||
<Form onFinish={handleFieldSetupSubmit} ref={formRef}>
|
<Form
|
||||||
|
onFinish={handleFieldSetupSubmit}
|
||||||
|
ref={formRef}
|
||||||
|
style={{ marginTop: '1rem' }}
|
||||||
|
>
|
||||||
<Form.Item name="fields">
|
<Form.Item name="fields">
|
||||||
<DropDowns
|
<DropDowns
|
||||||
label="Select fields"
|
label="Select fields"
|
||||||
|
|
@ -3658,7 +3524,6 @@ const ProductExcel = ({
|
||||||
<Modal
|
<Modal
|
||||||
title="Map Your Fields"
|
title="Map Your Fields"
|
||||||
open={MappingOpen}
|
open={MappingOpen}
|
||||||
// onOk={handleMappingConfirm}
|
|
||||||
onCancel={() => setMappingOpen(false)}
|
onCancel={() => setMappingOpen(false)}
|
||||||
>
|
>
|
||||||
{requiredFields.map((field) => {
|
{requiredFields.map((field) => {
|
||||||
|
|
|
||||||
|
|
@ -2714,7 +2714,7 @@ const ProductList = () => {
|
||||||
open={openExcel}
|
open={openExcel}
|
||||||
title="Bulk Upload"
|
title="Bulk Upload"
|
||||||
footer={true}
|
footer={true}
|
||||||
width={excelDataValues?.length > 0 ? 2500 : 600}
|
width={excelDataValues?.length > 0 ? 2500 : 700}
|
||||||
className={'bulkuploadmodal'}
|
className={'bulkuploadmodal'}
|
||||||
children={
|
children={
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.BSItemCard-content {
|
.BSItemCard-content {
|
||||||
padding: 1px 0;
|
padding: 3px 0;
|
||||||
background-color: rgba(255, 255, 255, 0.8);
|
background-color: rgba(255, 255, 255, 0.8);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -96,7 +96,8 @@
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
max-width: 130px;
|
max-width: 130px;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 3;
|
-webkit-line-clamp: 2;
|
||||||
|
line-height: 1;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1721,3 +1721,17 @@ table {
|
||||||
right: 2rem;
|
right: 2rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.addVariant {
|
||||||
|
background: #23378a29;
|
||||||
|
color: #23378a;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: none;
|
||||||
|
font-family: "Poppins", sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 6px;
|
||||||
|
outline: none;
|
||||||
|
height: max-content;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,7 @@
|
||||||
font-weight: bold !important;
|
font-weight: bold !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .viewerExcelupload table {
|
|
||||||
// // table-layout: auto !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
.viewerExcelupload::-webkit-scrollbar {
|
.viewerExcelupload::-webkit-scrollbar {
|
||||||
// display: block !important;
|
|
||||||
width: 0rem;
|
width: 0rem;
|
||||||
height: 0.5rem;
|
height: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +23,7 @@
|
||||||
background-color: #1292ee;
|
background-color: #1292ee;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-family: 'Poppins';
|
font-family: "Poppins";
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
|
|
@ -48,6 +43,8 @@
|
||||||
.tableExcelUpload {
|
.tableExcelUpload {
|
||||||
.ant-table-cell {
|
.ant-table-cell {
|
||||||
padding: 0 8px !important;
|
padding: 0 8px !important;
|
||||||
|
font-family: "Poppins";
|
||||||
|
font-weight: 500 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-select-selection-placeholder {
|
.ant-select-selection-placeholder {
|
||||||
|
|
@ -129,16 +126,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.mdsheet {
|
.mdsheet {
|
||||||
width: 25px;
|
width: 20px;
|
||||||
height: 25px;
|
height: 20px;
|
||||||
border: 1px solid #5bff73;
|
border: 1px solid #5bff73;
|
||||||
background-color: #b3ffbf;
|
background-color: #b3ffbf;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
.mdsheet2 {
|
.mdsheet2 {
|
||||||
width: 25px;
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
height: 25px;
|
|
||||||
background-color: #ffc7f8;
|
background-color: #ffc7f8;
|
||||||
border: 1px solid #ff74ec;
|
border: 1px solid #ff74ec;
|
||||||
}
|
}
|
||||||
|
|
@ -148,5 +145,88 @@
|
||||||
font-family: "Poppins";
|
font-family: "Poppins";
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field-setup-selected-fields {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
margin-bottom: 50px;
|
||||||
|
height: max-content;
|
||||||
|
max-height: 50vh;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
.selected-field {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
background: #0bad77;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
.close-icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
> svg {
|
||||||
|
color: #ffffffff !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.HeadingUploadExl {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
width: 50%;
|
||||||
|
@media (max-width: 950px) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.download-linkMain {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
@media (max-width: 950px) {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-link {
|
||||||
|
width: 50%;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
@media (max-width: 950px) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewerExcelupload {
|
||||||
|
.ant-select-selection-item {
|
||||||
|
margin-top: 0 !important ;
|
||||||
|
padding-top: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-link span {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
.imgUpldr {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue