Merge pull request 'employee-Access' (#18) from employee-Access into main
Reviewed-on: Pozomind/pozo-retail-app#18
This commit is contained in:
commit
6a6baca89f
|
|
@ -444,7 +444,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
|
||||
const SadminUserPurchaseMenuItem = [
|
||||
getsubItem('Purchase Order', `${subDirectory}setting/purchase-order`),
|
||||
getsubItem('Purchase Entry', `${subDirectory}setting/purchase-entry/new`),
|
||||
getsubItem('Product Receipt', `${subDirectory}setting/purchase-entry/new`),
|
||||
getsubItem('Purchase Return', `${subDirectory}setting/purchase-return`),
|
||||
];
|
||||
|
||||
|
|
@ -498,7 +498,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
),
|
||||
!iswarehouse &&
|
||||
getsubItem(
|
||||
'Counter Category Mapping',
|
||||
'Counter Mapping',
|
||||
`${subDirectory}setting/counter-category-mapping`
|
||||
),
|
||||
];
|
||||
|
|
@ -533,7 +533,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
getsubItem('Print Setup', `${subDirectory}saleslayouts/print-selection`),
|
||||
getsubItem('Kiosk Setup', `${subDirectory}saleslayouts/kiosk-selection`),
|
||||
getsubItem(
|
||||
'Barcode / Qr Setup',
|
||||
'Barcode / QR',
|
||||
`${subDirectory}saleslayouts/barcode-qr-selection`
|
||||
),
|
||||
];
|
||||
|
|
@ -875,7 +875,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
`${subDirectory}setting/sales-bill-cancel`
|
||||
),
|
||||
getsubItem(
|
||||
'Product Return',
|
||||
'Sales Product Return',
|
||||
`${subDirectory}setting/sales-bill-product-return`
|
||||
),
|
||||
sportsAppPreference &&
|
||||
|
|
@ -1047,9 +1047,9 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
|
||||
const Purchase = [
|
||||
getsubItem('Automated Reorder', `${subDirectory}setting/automated-reorder`),
|
||||
getsubItem('Purchase Order', `${subDirectory}setting/purchase-order/new`),
|
||||
getsubItem('Product Receipt', `${subDirectory}setting/purchase-entry/new`),
|
||||
getsubItem('Product Return', `${subDirectory}setting/purchase-return`),
|
||||
getsubItem('Purchase Order', `${subDirectory}setting/purchase-order`),
|
||||
getsubItem('Product Receipt', `${subDirectory}setting/purchase-entry`),
|
||||
getsubItem('Product Return', `${subDirectory}setting/purchase-return/list`),
|
||||
getsubItem(
|
||||
'Stock Adjustment',
|
||||
`${subDirectory}setting/stock-adjustment-list`
|
||||
|
|
@ -1087,7 +1087,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
!sportsAppPreference &&
|
||||
getsubItem(
|
||||
'DC to Invoice',
|
||||
`${subDirectory}setting/delivery-challan-to-invoice`
|
||||
`${subDirectory}setting/delivery-challan-to-invoice/list`
|
||||
),
|
||||
!iswarehouse &&
|
||||
getsubItem('Customer', `${subDirectory}setting/customer-master`),
|
||||
|
|
@ -1119,8 +1119,8 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
`${subDirectory}setting/sales-bill-cancel`
|
||||
),
|
||||
getsubItem(
|
||||
'Product Return',
|
||||
`${subDirectory}setting/sales-bill-product-return`
|
||||
'Sales Product Return',
|
||||
`${subDirectory}setting/sales-bill-product-return/list`
|
||||
),
|
||||
sportsAppPreference &&
|
||||
getsubItem(
|
||||
|
|
@ -1139,8 +1139,8 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
const PurchaseMenuItem = [
|
||||
getsubItem('Automated Reorder', `${subDirectory}setting/automated-reorder`),
|
||||
getsubItem('Purchase Order', `${subDirectory}setting/purchase-order`),
|
||||
getsubItem('Purchase Entry', `${subDirectory}setting/purchase-entry/new`),
|
||||
getsubItem('Purchase Return', `${subDirectory}setting/purchase-return`),
|
||||
getsubItem('Product Receipt', `${subDirectory}setting/purchase-entry/new`),
|
||||
getsubItem('Product Return', `${subDirectory}setting/purchase-return`),
|
||||
getsubItem(
|
||||
'Stock Adjustment',
|
||||
`${subDirectory}setting/stock-adjustment-list`
|
||||
|
|
@ -1196,7 +1196,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
)
|
||||
: '',
|
||||
getsubItem(
|
||||
'Counter Category Mapping',
|
||||
'Counter Mapping',
|
||||
`${subDirectory}setting/counter-category-mapping`
|
||||
),
|
||||
getsubItem('Image Bulk Upload', `${subDirectory}setting/image-bulk-upload`),
|
||||
|
|
@ -1240,7 +1240,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
),
|
||||
getsubItem('Sales Bill Cancel', `${subDirectory}setting/sales-bill-cancel`),
|
||||
getsubItem(
|
||||
'Sales Bill Product Return',
|
||||
'Sales Product Return',
|
||||
`${subDirectory}setting/sales-bill-product-return`
|
||||
),
|
||||
sportsAppPreference &&
|
||||
|
|
@ -1845,7 +1845,7 @@ const customizedmenuitem = []
|
|||
`${subDirectory}setting/sales-bill-cancel`
|
||||
),
|
||||
getsubItem(
|
||||
'Product Return',
|
||||
'Sales Product Return',
|
||||
`${subDirectory}setting/sales-bill-product-return`
|
||||
),
|
||||
sportsAppPreference &&
|
||||
|
|
@ -2433,7 +2433,7 @@ const customizedmenuitem = []
|
|||
),
|
||||
!sportsAppPreference &&
|
||||
getsubItem(
|
||||
'Product Return',
|
||||
'Sales Product Return',
|
||||
`${subDirectory}setting/sales-bill-product-return`
|
||||
),
|
||||
sportsAppPreference &&
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { getSession } from "../../Services/Others";
|
||||
import { changeBreadCrumb } from "../../Features/AppPage/CenterPage";
|
||||
import { changeBreadCrumb, getEmpAccess } from "../../Features/AppPage/CenterPage";
|
||||
import { Messages } from "../../Components/Notifications/Messages";
|
||||
import { Tables } from "../../Components/Tables/Table";
|
||||
import FormHeader from "../PageComponents/FormHeader";
|
||||
|
|
@ -19,6 +19,7 @@ import { deleteAutomatedReorder, getAutomatedReorderList } from "../../Features/
|
|||
import { DefaultModal } from "../../Components/Modal/DefaultModal";
|
||||
import { FaRegEye } from "react-icons/fa";
|
||||
import { render } from "react-dom";
|
||||
import { useAuth } from "../../AuthContext";
|
||||
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
|
||||
|
|
@ -40,11 +41,18 @@ const AutomatedReorderList = () => {
|
|||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const state = location?.state;
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(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);
|
||||
|
|
@ -176,6 +184,40 @@ const AutomatedReorderList = () => {
|
|||
}
|
||||
}, [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();
|
||||
|
|
@ -251,6 +293,7 @@ const AutomatedReorderList = () => {
|
|||
<Buttons
|
||||
buttonText={'Add New'}
|
||||
handleSubmit={handleAdd}
|
||||
disabled={addnewAccess}
|
||||
color="901D77"
|
||||
icon={<PlusOutlined />}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ const BarcodeTemplateSetup = () => {
|
|||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
const SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Barcode / Qr Setup'
|
||||
(e) => e?.MenuName === 'Barcode / QR'
|
||||
);
|
||||
// useDispatch
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -335,7 +335,7 @@ const BarcodeTemplateSetup = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Barcode / Qr Setup'
|
||||
(item) => item.ConfigName === 'Barcode / QR'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2208,7 +2208,15 @@ const ComboSalesBillTable = () => {
|
|||
{row?.BrandName ? ` ${row.BrandName}` : ''}
|
||||
{row?.Type !== 'C' && (
|
||||
<p className="Tbl3-Variant">
|
||||
{row?.ProdVariantName} {row?.Size} {row?.UomName}
|
||||
{/* {row?.ProdVariantName} {row?.Size} {row?.UomName} */}
|
||||
(
|
||||
{!row?.ProdVariantName?.toLowerCase()?.includes(
|
||||
'variant'
|
||||
) && <span>{row?.ProdVariantName} </span>}
|
||||
{row?.Size}
|
||||
{row?.SinglePc == 'Y' ? 'PCS' : row?.UomName}
|
||||
|
||||
)
|
||||
</p>
|
||||
)}
|
||||
{row?.Type === 'C' &&
|
||||
|
|
|
|||
|
|
@ -17,10 +17,15 @@ import { getSession } from '../../../../Services/Others';
|
|||
import Buttons from '../../../../Components/Forms/Buttons';
|
||||
import { BiSkipNext, BiSkipPrevious } from 'react-icons/bi';
|
||||
import { MdOutlineDisplaySettings } from "react-icons/md";
|
||||
import { useAuth } from '../../../../AuthContext';
|
||||
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage';
|
||||
|
||||
|
||||
const BookingSelectionPage = (props) => {
|
||||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Sales Screen'
|
||||
);
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const CompId = getSession('CompId');
|
||||
|
|
@ -42,6 +47,8 @@ const BookingSelectionPage = (props) => {
|
|||
console.log(SelectedTheme, "currentSlide")
|
||||
const [OthersCount, setOthersCount] = useState(1);
|
||||
const [isNext, isSetNext] = useState(true);
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
const rightIsLastSlide = currentSlide === mergedThemes.length - 1;
|
||||
const leftIsFirstSlide = currentSlide === 0 && OthersCount > 1;
|
||||
const [pendingSlide, setPendingSlide] = useState(null);
|
||||
|
|
@ -64,6 +71,40 @@ const BookingSelectionPage = (props) => {
|
|||
GetOthersTemplate()
|
||||
// gettemplatedetail()
|
||||
}, [])
|
||||
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 === 'Sales Screen'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
const gettemplatedetail = async () => {
|
||||
let tempdetail = await dispatch(
|
||||
getTemplate({ CompId: CompId, BranchId: BranchId, AppId: AppId })
|
||||
|
|
@ -305,6 +346,7 @@ const BookingSelectionPage = (props) => {
|
|||
<Buttons
|
||||
buttonText="Save"
|
||||
color="901D77"
|
||||
disabled = {addnewAccess}
|
||||
handleSubmit={handleMainSubmit}
|
||||
icon={<ArrowRightOutlined />}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ const SelectionComponent = forwardRef((props, ref) => {
|
|||
console.log(SadminuserAccess, 'SadminuserAccess');
|
||||
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Sales Setup'
|
||||
(e) => e?.MenuName === 'Sales Screen'
|
||||
);
|
||||
const dispatch = useDispatch();
|
||||
const formRef = useRef(null);
|
||||
|
|
@ -453,7 +453,7 @@ const SelectionComponent = forwardRef((props, ref) => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Sales Setup'
|
||||
(item) => item.ConfigName === 'Sales Screen'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ const SelectionComponent = forwardRef((props, ref) => {
|
|||
}));
|
||||
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Print Setup'
|
||||
(e) => e?.MenuName === 'Print Forms'
|
||||
);
|
||||
|
||||
const formRef = useRef(null);
|
||||
|
|
@ -395,7 +395,7 @@ const SelectionComponent = forwardRef((props, ref) => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Print Setup'
|
||||
(item) => item.ConfigName === 'Print Forms'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const CancellationList = () => {
|
|||
console.log(SadminuserAccess, 'SadminuserAccess');
|
||||
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Cancellation and Reschedule Rules'
|
||||
(e) => e?.MenuName === 'Cancel / Reschedule'
|
||||
);
|
||||
|
||||
const navigateTo = useNavigate();
|
||||
|
|
@ -234,7 +234,7 @@ const CancellationList = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Cancellation and Reschedule Rules'
|
||||
(item) => item.ConfigName === 'Cancel / Reschedule'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ const valueStyle = {
|
|||
const ChangePaymentmode = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Cancel Payment Change'
|
||||
(e) => e?.MenuName === 'Payment Mode Change'
|
||||
);
|
||||
|
||||
const formRef = useRef();
|
||||
|
|
@ -182,6 +182,11 @@ const ChangePaymentmode = () => {
|
|||
getCreditcustDetail();
|
||||
}, [SelectCustId, SelectCust]);
|
||||
|
||||
useEffect(() => {
|
||||
if (UserType === 'Employee') {
|
||||
fetchApi();
|
||||
}
|
||||
}, [UserType]);
|
||||
const fetchApi = async () => {
|
||||
let data = {
|
||||
CompId: CompId,
|
||||
|
|
@ -191,7 +196,7 @@ const ChangePaymentmode = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Cancel Payment Change'
|
||||
(item) => item.ConfigName === 'Payment Mode Change'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
@ -2119,7 +2124,7 @@ const ChangePaymentmode = () => {
|
|||
buttonText="SUBMIT"
|
||||
color="901D77"
|
||||
icon={<ArrowRightOutlined />}
|
||||
disabled={addnewAccess ? false : isdisabled}
|
||||
disabled={addnewAccess}
|
||||
/>
|
||||
</div>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { PlusOutlined } from '@ant-design/icons';
|
|||
import { Messages } from '../../Components/Notifications/Messages';
|
||||
import { Tables } from '../../Components/Tables/Table';
|
||||
import { Search } from '../../Components/Forms/Search';
|
||||
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage.js';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage.js';
|
||||
import { BsEye } from "react-icons/bs";
|
||||
import Buttons from '../../Components/Forms/Buttons';
|
||||
import { getSession } from '../../Services/Others';
|
||||
|
|
@ -14,6 +14,7 @@ import FormHeader from '../PageComponents/FormHeader.jsx';
|
|||
import { getSalesReturn } from '../../Features/CancelReschedule/CancelApplicableProd.js';
|
||||
import '../../Styles/OverAllStyle/OverAllStyle.scss';
|
||||
import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
|
||||
import { useAuth } from '../../AuthContext.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const items = [
|
||||
|
|
@ -33,16 +34,24 @@ const items = [
|
|||
];
|
||||
|
||||
const SalesBillProductReturnList = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
const SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Sales Product Return'
|
||||
);
|
||||
const [page, setpage] = useState(1);
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
const navigateTo = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const [tabledata, setTabledata] = useState();
|
||||
const [message, setMessage] = useState({ type: null, data: null });
|
||||
const [searchedText, setSearchedText] = useState('');
|
||||
const [sortedInfo, setSortedInfo] = useState({});
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
const [productDetailsModel, setProductDetailsModel] = useState({
|
||||
model: false,
|
||||
data: []
|
||||
|
|
@ -98,6 +107,38 @@ const SalesBillProductReturnList = () => {
|
|||
setMessage({ type: null, data: null })
|
||||
}, []);
|
||||
|
||||
|
||||
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]);
|
||||
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApi()
|
||||
}
|
||||
}, [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 === 'Sales Product Return'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
const columns = [
|
||||
{
|
||||
title: 'Sl.No',
|
||||
|
|
@ -170,6 +211,7 @@ const SalesBillProductReturnList = () => {
|
|||
buttonText={'Add New'}
|
||||
handleSubmit={() => handelAddButton()}
|
||||
color="901D77"
|
||||
disabled={addnewAccess}
|
||||
icon={<PlusOutlined />}
|
||||
>
|
||||
OPEN
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ const items = [
|
|||
const ComboList = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Combo Product'
|
||||
(e) => e?.MenuName === 'Add Product'
|
||||
);
|
||||
console.log(SadminuserAccess, 'SadminuserAccessSadminuserAccess');
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ const ComboList = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Combo Product'
|
||||
(item) => item.ConfigName === 'Add Product'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ import { isMobile } from 'react-device-detect';
|
|||
const DeliveryChellanForm = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Delivery challan'
|
||||
(e) => e?.MenuName === 'Delivery Challan'
|
||||
);
|
||||
const formRef = useRef(null);
|
||||
const transportFormRef = useRef(null);
|
||||
|
|
@ -182,7 +182,7 @@ const DeliveryChellanForm = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Purchase Quotation'
|
||||
(item) => item.ConfigName === 'Delivery Challan'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const items = [
|
|||
const EmployeeMaster = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Employee'
|
||||
(e) => e?.MenuName === 'Add Employee'
|
||||
);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -144,7 +144,7 @@ const EmployeeMaster = () => {
|
|||
})
|
||||
).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Employee'
|
||||
(item) => item.ConfigName === 'Add Employee'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const ExchangeAndReplacementList = () => {
|
|||
const UserType = getSession('UserType');
|
||||
const { SadminuserAccess } = useAuth();
|
||||
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find((e) => e?.MenuName === 'ExchangeAndReplacement');
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find((e) => e?.MenuName === 'Exchange / Return');
|
||||
|
||||
const items = [
|
||||
{
|
||||
|
|
@ -87,7 +87,7 @@ const ExchangeAndReplacementList = () => {
|
|||
})
|
||||
).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'ExchangeAndReplacement'
|
||||
(item) => item.ConfigName === 'Exchange / Return'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import Search from '../../Components/Forms/Search';
|
|||
import { Tables } from '../../Components/Tables/Table';
|
||||
import FormHeader from '../PageComponents/FormHeader';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage';
|
||||
import {
|
||||
DeleteFilled,
|
||||
EditFilled,
|
||||
|
|
@ -26,7 +26,7 @@ import {
|
|||
import { Space, Table, message, Modal, Alert } from 'antd';
|
||||
import { DefaultModal } from '../../Components/Modal/DefaultModal';
|
||||
import { IoEye } from 'react-icons/io5';
|
||||
|
||||
import { useAuth } from '../../AuthContext';
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const items = [
|
||||
{
|
||||
|
|
@ -40,6 +40,11 @@ const items = [
|
|||
},
|
||||
];
|
||||
const ExchangeReturnMapList = () => {
|
||||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
const SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Rules Mapping'
|
||||
);
|
||||
const dispatch = useDispatch();
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
|
|
@ -53,7 +58,7 @@ const ExchangeReturnMapList = () => {
|
|||
const [messageData, setMessageData] = useState(null);
|
||||
|
||||
// Add missing variables for access control
|
||||
const [SAAccessCommonMaster, setSAAccessCommonMaster] = useState({});
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
const [empData, setEmpData] = useState({});
|
||||
|
||||
const [sortedInfo, setSortedInfo] = useState({});
|
||||
|
|
@ -132,6 +137,38 @@ const ExchangeReturnMapList = () => {
|
|||
// }
|
||||
// };
|
||||
|
||||
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]);
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApiEmpAccess()
|
||||
}
|
||||
}, [UserType])
|
||||
const fetchApiEmpAccess = 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 === 'Rules Mapping'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
|
||||
const statusDeactive = async (data) => {
|
||||
let deleteData = {
|
||||
PolicyId: data.PolicyId,
|
||||
|
|
@ -270,7 +307,7 @@ const ExchangeReturnMapList = () => {
|
|||
(UserType === 'Super Admin User' &&
|
||||
SAAccessCommonMaster?.UpdateAccess === 'Y') ||
|
||||
(UserType === 'Employee' &&
|
||||
empData?.UpdateAccess === 'Y') ||
|
||||
addnewAccess) ||
|
||||
UserType === 'Admin'
|
||||
? actionsFormatter(record, index)
|
||||
: null
|
||||
|
|
@ -301,7 +338,7 @@ const ExchangeReturnMapList = () => {
|
|||
(UserType === 'Super Admin User' &&
|
||||
SAAccessCommonMaster?.DeleteAccess === 'Y') ||
|
||||
(UserType === 'Employee' &&
|
||||
empData?.DeleteAccess === 'Y') ||
|
||||
addnewAccess) ||
|
||||
UserType === 'Admin'
|
||||
? statusDeactive(record)
|
||||
: null
|
||||
|
|
@ -441,6 +478,7 @@ const ExchangeReturnMapList = () => {
|
|||
<Buttons
|
||||
buttonText={'Add New '}
|
||||
handleSubmit={handleAddNew}
|
||||
disabled={addnewAccess}
|
||||
icon={<PlusOutlined />}
|
||||
color="901D77"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -19,23 +19,31 @@ import { deleteOfferCodeData, getCodeBaseProductData, putOfferCodeData } from '.
|
|||
import {
|
||||
ReloadOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage.js';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../../Features/AppPage/CenterPage.js';
|
||||
import { useAuth } from '../../../AuthContext.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
|
||||
const CodeBaseList = () => {
|
||||
dayjs.extend(isSameOrBefore);
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Code Based'
|
||||
);
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const AppId = getSession("AppId")
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
const UserType = getSession('UserType');
|
||||
const UserId = getSession('UserId');
|
||||
|
||||
const [productdata, setProductdata] = useState()
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
const [variantModal, setVariantModal] = useState({
|
||||
open: false,
|
||||
variants: [],
|
||||
|
|
@ -68,6 +76,38 @@ const CodeBaseList = () => {
|
|||
dispatch(changeBreadCrumb({ items: items }));
|
||||
}, []);
|
||||
|
||||
|
||||
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]);
|
||||
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApi()
|
||||
}
|
||||
}, [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 === 'Code Based'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
const onSearch = (value) => {
|
||||
setSearchText(value.toLowerCase());
|
||||
}
|
||||
|
|
@ -137,6 +177,13 @@ const CodeBaseList = () => {
|
|||
setMessageType(null);
|
||||
}, []);
|
||||
|
||||
const canUpdate =
|
||||
UserType === 'Super Admin' ||
|
||||
UserType === 'Admin' ||
|
||||
(UserType === 'Super Admin User' &&
|
||||
SAAccessCommonMaster?.UpdateAccess === 'Y') ||
|
||||
(UserType === 'Employee' && empData?.UpdateAccess === 'Y');
|
||||
|
||||
const generalColumns = [
|
||||
{
|
||||
title: 'Sl.No',
|
||||
|
|
@ -231,40 +278,63 @@ const CodeBaseList = () => {
|
|||
title: "Extend Date",
|
||||
key: "extend",
|
||||
align: "center",
|
||||
render: (_, record) => (
|
||||
render: (_, record) => {
|
||||
const canExtend =
|
||||
record?.ActiveStatus === 'A' && canUpdate;
|
||||
|
||||
return (
|
||||
<Button
|
||||
className="extend-button"
|
||||
onClick={() => handleView(record)}
|
||||
disabled={record.ActiveStatus !== "A"}
|
||||
onClick={() => {
|
||||
if (!canExtend) return;
|
||||
handleView(record);
|
||||
}}
|
||||
disabled={!canExtend}
|
||||
style={{
|
||||
opacity: record.ActiveStatus === "A" ? 1 : 0.6,
|
||||
pointerEvents: record.ActiveStatus === "A" ? "auto" : "none",
|
||||
opacity: canExtend ? 1 : 0.6,
|
||||
pointerEvents: canExtend ? "auto" : "none",
|
||||
height: "32px",
|
||||
width: '100px',
|
||||
padding: "1 12px",
|
||||
width: "100px",
|
||||
padding: "1px 12px",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center"
|
||||
justifyContent: "center",
|
||||
cursor: canExtend ? "pointer" : "not-allowed",
|
||||
}}
|
||||
>
|
||||
Extend
|
||||
</Button>
|
||||
),
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
title: "Actions",
|
||||
key: "actions",
|
||||
render: (_, record, index) => (
|
||||
render: (_, record, index) => {
|
||||
const canUpdate =
|
||||
UserType === "Super Admin" ||
|
||||
UserType === "Admin" ||
|
||||
(UserType === "Super Admin User" && SAAccessCommonMaster?.UpdateAccess === "Y") ||
|
||||
(UserType === "Employee" && empData?.UpdateAccess === "Y");
|
||||
|
||||
const canDelete =
|
||||
UserType === "Super Admin" ||
|
||||
UserType === "Admin" ||
|
||||
(UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
|
||||
(UserType === "Employee" && empData?.DeleteAccess === "Y");
|
||||
|
||||
return (
|
||||
<div style={{ display: "flex", gap: "8px" }}>
|
||||
<IoEyeOutline
|
||||
color="#2563EA"
|
||||
size={18}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setVariantModal({
|
||||
open: true,
|
||||
product: record, // store the selected product
|
||||
product: record,
|
||||
variants: record?.ProdOfferDetails || [],
|
||||
});
|
||||
}}
|
||||
|
|
@ -272,9 +342,13 @@ const CodeBaseList = () => {
|
|||
{record.ActiveStatus === "A" && (
|
||||
<FiEdit
|
||||
color="#2563EA"
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{
|
||||
cursor: canUpdate ? "pointer" : "not-allowed",
|
||||
opacity: canUpdate ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!canUpdate) return;
|
||||
navigate(`${subDirectory}setting/code-base/new`, {
|
||||
state: { formType: "edit", editOffer: record },
|
||||
});
|
||||
|
|
@ -285,25 +359,37 @@ const CodeBaseList = () => {
|
|||
<RiDeleteBinLine
|
||||
color="#2563EA"
|
||||
size={16}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{
|
||||
cursor: canDelete ? "pointer" : "not-allowed",
|
||||
opacity: canDelete ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!canDelete) return;
|
||||
statusFormatter(record, "D", index);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ReloadOutlined
|
||||
style={{ color: "#2563EA", fontSize: "16px", cursor: "pointer" }}
|
||||
style={{
|
||||
color: "#2563EA",
|
||||
fontSize: "16px",
|
||||
cursor: canDelete ? "pointer" : "not-allowed",
|
||||
opacity: canDelete ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!canDelete) return;
|
||||
statusFormatter(record, "A", index);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -324,7 +410,8 @@ const CodeBaseList = () => {
|
|||
|
||||
<div className="offers-card">
|
||||
<h3 className="offers-card__title">Code Base Offers</h3>
|
||||
<button className='CreateNewOfferBtn' onClick={handleNewOffer}>
|
||||
<button className='CreateNewOfferBtn' onClick={handleNewOffer}
|
||||
disabled={addnewAccess}>
|
||||
Create New Offer
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,23 +18,31 @@ import { deleteLoyaltyData, getLoyaltiPointsProductData, putLayoltiPointsData }
|
|||
import {
|
||||
ReloadOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage.js';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../../Features/AppPage/CenterPage.js';
|
||||
import { useAuth } from '../../../AuthContext.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
|
||||
const LoyaltyBasedList = () => {
|
||||
dayjs.extend(isSameOrBefore);
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Loyalty Points'
|
||||
);
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const AppId = getSession("AppId")
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
|
||||
const [productdata, setProductdata] = useState()
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
const [variantModal, setVariantModal] = useState({
|
||||
open: false,
|
||||
reward: null,
|
||||
|
|
@ -69,6 +77,37 @@ const LoyaltyBasedList = () => {
|
|||
useEffect(() => {
|
||||
dispatch(changeBreadCrumb({ items: items }));
|
||||
}, []);
|
||||
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]);
|
||||
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApi()
|
||||
}
|
||||
}, [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 === 'Loyalty Points'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
const onSearch = (value) => {
|
||||
setSearchText(value.toLowerCase());
|
||||
|
|
@ -224,18 +263,31 @@ const LoyaltyBasedList = () => {
|
|||
{
|
||||
title: "Extend Days",
|
||||
key: "extend",
|
||||
// align: "center",
|
||||
render: (_, record) => (
|
||||
render: (_, record) => {
|
||||
const canExtend =
|
||||
record.ActiveStatus === "A" &&
|
||||
(
|
||||
UserType === "Super Admin" ||
|
||||
UserType === "Admin" ||
|
||||
(UserType === "Super Admin User" && SAAccessCommonMaster?.UpdateAccess === "Y") ||
|
||||
(UserType === "Employee" && empData?.UpdateAccess === "Y")
|
||||
);
|
||||
|
||||
return (
|
||||
<Button
|
||||
className="extend-button"
|
||||
onClick={() => handleView(record)}
|
||||
disabled={record.ActiveStatus !== "A"}
|
||||
onClick={() => {
|
||||
if (!canExtend) return;
|
||||
handleView(record);
|
||||
}}
|
||||
disabled={!canExtend}
|
||||
style={{
|
||||
opacity: record.ActiveStatus === "A" ? 1 : 0.6,
|
||||
pointerEvents: record.ActiveStatus === "A" ? "auto" : "none",
|
||||
opacity: canExtend ? 1 : 0.6,
|
||||
pointerEvents: canExtend ? "auto" : "none",
|
||||
cursor: canExtend ? "pointer" : "not-allowed",
|
||||
height: "32px",
|
||||
width: '100px',
|
||||
padding: "1 12px",
|
||||
padding: "1px 12px",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center"
|
||||
|
|
@ -243,13 +295,28 @@ const LoyaltyBasedList = () => {
|
|||
>
|
||||
Extend
|
||||
</Button>
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: "Actions",
|
||||
key: "actions",
|
||||
render: (_, record) => (
|
||||
render: (_, record) => {
|
||||
// Permission checks
|
||||
const canUpdate =
|
||||
UserType === "Super Admin" ||
|
||||
UserType === "Admin" ||
|
||||
(UserType === "Super Admin User" && SAAccessCommonMaster?.UpdateAccess === "Y") ||
|
||||
(UserType === "Employee" && empData?.UpdateAccess === "Y");
|
||||
|
||||
const canDelete =
|
||||
UserType === "Super Admin" ||
|
||||
UserType === "Admin" ||
|
||||
(UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
|
||||
(UserType === "Employee" && empData?.DeleteAccess === "Y");
|
||||
|
||||
return (
|
||||
<div style={{ display: "flex", gap: "8px" }}>
|
||||
{/* View - only if RewardType !== Cash */}
|
||||
{record?.RewardType !== "Cash" && (
|
||||
|
|
@ -259,10 +326,7 @@ const LoyaltyBasedList = () => {
|
|||
style={{ cursor: "pointer" }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setVariantModal({
|
||||
open: true,
|
||||
product: record,
|
||||
});
|
||||
setVariantModal({ open: true, product: record });
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -272,9 +336,13 @@ const LoyaltyBasedList = () => {
|
|||
<FiEdit
|
||||
color="#2563EA"
|
||||
size={14}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{
|
||||
cursor: canUpdate ? "pointer" : "not-allowed",
|
||||
opacity: canUpdate ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!canUpdate) return;
|
||||
navigate(`${subDirectory}setting/loyalty-based/update`, {
|
||||
state: { formType: "edit", editLoyalty: record },
|
||||
});
|
||||
|
|
@ -287,25 +355,37 @@ const LoyaltyBasedList = () => {
|
|||
<RiDeleteBinLine
|
||||
color="#2563EA"
|
||||
size={16}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{
|
||||
cursor: canDelete ? "pointer" : "not-allowed",
|
||||
opacity: canDelete ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!canDelete) return;
|
||||
statusFormatter(record, "D"); // deactivate
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ReloadOutlined
|
||||
style={{ color: "#2563EA", fontSize: "14px", cursor: "pointer" }}
|
||||
style={{
|
||||
color: "#2563EA",
|
||||
fontSize: "14px",
|
||||
cursor: canDelete ? "pointer" : "not-allowed",
|
||||
opacity: canDelete ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!canDelete) return;
|
||||
statusFormatter(record, "A"); // reactivate
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -326,7 +406,7 @@ const LoyaltyBasedList = () => {
|
|||
|
||||
<div className="offers-card">
|
||||
<h3 className="offers-card__title">Loyalty Points</h3>
|
||||
<button className='CreateNewOfferBtn' onClick={handleNewOffer}>
|
||||
<button className='CreateNewOfferBtn' onClick={handleNewOffer} disabled={addnewAccess}>
|
||||
Create New Offer
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ import {
|
|||
} from '../../../Features/Offer/Offernew/Offernew.js';
|
||||
|
||||
import { Messages } from '../../../Components/Notifications/Messages.jsx';
|
||||
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage.js';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../../Features/AppPage/CenterPage.js';
|
||||
import { useAuth } from '../../../AuthContext.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const OfferListNew = () => {
|
||||
|
|
@ -39,6 +40,8 @@ const OfferListNew = () => {
|
|||
const AppId = getSession('AppId');
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
const UserType = getSession('UserType');
|
||||
const UserId = getSession('UserId');
|
||||
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
|
|
@ -46,6 +49,10 @@ const OfferListNew = () => {
|
|||
const [page, setpage] = useState(1);
|
||||
const [sortedInfo, setSortedInfo] = useState({});
|
||||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Product Based'
|
||||
);
|
||||
console.log(products, 'products');
|
||||
|
||||
const [allOffers, setAllOffers] = useState([]);
|
||||
|
|
@ -54,6 +61,8 @@ const OfferListNew = () => {
|
|||
offer: null,
|
||||
newToDate: null,
|
||||
});
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
|
||||
const items = [
|
||||
{
|
||||
|
|
@ -540,6 +549,37 @@ const OfferListNew = () => {
|
|||
// ])
|
||||
};
|
||||
|
||||
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]);
|
||||
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApi()
|
||||
}
|
||||
}, [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 === 'Product Based'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
function ExtractDateFormate(dateString) {
|
||||
if (!dateString) return '';
|
||||
|
||||
|
|
@ -683,73 +723,131 @@ const OfferListNew = () => {
|
|||
dataIndex: 'extend',
|
||||
key: 'extend',
|
||||
align: 'center',
|
||||
render: (_, record) =>
|
||||
record?.ActiveStatus === 'A' ? (
|
||||
render: (_, record) => {
|
||||
|
||||
const canUpdate =
|
||||
UserType === 'Super Admin' ||
|
||||
UserType === 'Admin' ||
|
||||
(UserType === 'Super Admin User' &&
|
||||
SAAccessCommonMaster?.UpdateAccess === 'Y') ||
|
||||
(UserType === 'Employee' && empData?.UpdateAccess === 'Y');
|
||||
|
||||
const canEdit =
|
||||
record?.ActiveStatus === 'A' && canUpdate;
|
||||
|
||||
return record?.ActiveStatus === 'A' ? (
|
||||
<div
|
||||
className="extend-button"
|
||||
onClick={() =>
|
||||
setExtendModal({ open: true, offer: record, newToDate: null })
|
||||
}
|
||||
className={canEdit ? 'extend-button' : 'extendisabled'}
|
||||
onClick={() => {
|
||||
if (!canEdit) return;
|
||||
setExtendModal({
|
||||
open: true,
|
||||
offer: record,
|
||||
newToDate: null,
|
||||
});
|
||||
}}
|
||||
style={{
|
||||
height: '32px',
|
||||
width: '100px',
|
||||
padding: '1 12px',
|
||||
padding: '1px 12px',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
cursor: canEdit ? 'pointer' : 'not-allowed',
|
||||
opacity: canEdit ? 1 : 0.5,
|
||||
}}
|
||||
>
|
||||
Extend
|
||||
</div>
|
||||
) : (
|
||||
<div className="extendisabled">Extend</div>
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
title: 'Actions',
|
||||
dataIndex: 'actions',
|
||||
key: 'actions',
|
||||
render: (_, record, index) => (
|
||||
render: (_, record, index) => {
|
||||
|
||||
const canUpdate =
|
||||
UserType === 'Super Admin' ||
|
||||
UserType === 'Admin' ||
|
||||
(UserType === 'Super Admin User' && SAAccessCommonMaster?.UpdateAccess === 'Y') ||
|
||||
(UserType === 'Employee' && empData?.UpdateAccess === 'Y');
|
||||
|
||||
const canDelete =
|
||||
UserType === 'Super Admin' ||
|
||||
UserType === 'Admin' ||
|
||||
(UserType === 'Super Admin User' && SAAccessCommonMaster?.DeleteAccess === 'Y') ||
|
||||
(UserType === 'Employee' && empData?.DeleteAccess === 'Y');
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', gap: '8px' }}>
|
||||
<IoEyeOutline
|
||||
color="#2563EA"
|
||||
size={18}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={(e) => {
|
||||
(e.stopPropagation(),
|
||||
setOpen((prev) => !prev),
|
||||
setProducts(record));
|
||||
e.stopPropagation();
|
||||
setOpen((prev) => !prev);
|
||||
setProducts(record);
|
||||
}}
|
||||
/>
|
||||
{record.ActiveStatus == 'A' && (
|
||||
|
||||
{/* Edit */}
|
||||
{record?.ActiveStatus === 'A' && (
|
||||
<FiEdit
|
||||
color="#2563EA"
|
||||
style={{
|
||||
cursor: canUpdate ? 'pointer' : 'not-allowed',
|
||||
opacity: canUpdate ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
(e.stopPropagation(), actionsFormatter(record, index));
|
||||
e.stopPropagation();
|
||||
if (!canUpdate) return;
|
||||
actionsFormatter(record, index);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{record?.ActiveStatus == 'A' ? (
|
||||
{record?.ActiveStatus === 'A' ? (
|
||||
<RiDeleteBinLine
|
||||
color="#2563EA"
|
||||
size={16}
|
||||
style={{
|
||||
cursor: canDelete ? 'pointer' : 'not-allowed',
|
||||
opacity: canDelete ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
(e.stopPropagation(), statusFormatter(record, index));
|
||||
e.stopPropagation();
|
||||
if (!canDelete) return;
|
||||
statusFormatter(record, index);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ReloadOutlined
|
||||
color="#2563EA"
|
||||
size={16}
|
||||
style={{
|
||||
cursor: canDelete ? 'pointer' : 'not-allowed',
|
||||
opacity: canDelete ? 1 : 0.5,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
(e.stopPropagation(), statusFormatter(record, index));
|
||||
e.stopPropagation();
|
||||
if (!canDelete) return;
|
||||
statusFormatter(record, index);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
];
|
||||
|
||||
const handleNewOffer = () => {
|
||||
|
|
@ -797,7 +895,9 @@ const OfferListNew = () => {
|
|||
<h3 className="offers-card__title">Product Offers</h3>
|
||||
</div>
|
||||
|
||||
<button className="CreateNewOfferBtn" onClick={handleNewOffer}>
|
||||
<button className="CreateNewOfferBtn"
|
||||
onClick={handleNewOffer}
|
||||
disabled={addnewAccess}>
|
||||
Create New Offer
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ const colorText = 'Color : Red';
|
|||
const ProductList = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Product'
|
||||
(e) => e?.MenuName === 'Add Product'
|
||||
);
|
||||
const formRef = useRef();
|
||||
// const ref1 = useRef(null);
|
||||
|
|
@ -1708,7 +1708,7 @@ const ProductList = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Product'
|
||||
(item) => item.ConfigName === 'Add Product'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -612,7 +612,7 @@ const SalesQuotationForm = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Purchase Quotation'
|
||||
(item) => item.ConfigName === 'Sales Quotation'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
@ -1653,7 +1653,7 @@ const SalesQuotationForm = () => {
|
|||
|
||||
// Add these functions inside your component, before the return statement:
|
||||
// const handleEmailClick = () => {
|
||||
// const subject = encodeURIComponent('Purchase Quotation');
|
||||
// const subject = encodeURIComponent('Sales Quotation');
|
||||
// const body = encodeURIComponent('Please find attached the purchase quotation.');
|
||||
// window.open(`mailto:?subject=${subject}&body=${body}`);
|
||||
// };
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ const items = [
|
|||
const PurchaseReturnGet = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Purchase Return'
|
||||
(e) => e?.MenuName === 'Product Return'
|
||||
);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -158,7 +158,7 @@ const PurchaseReturnGet = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Purchase Return'
|
||||
(item) => item.ConfigName === 'Product Return'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,11 +21,12 @@ import {
|
|||
ApplicationPreferences,
|
||||
getBranchDetail,
|
||||
} from '../../Features/BrachLogin/BranchLogin';
|
||||
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage';
|
||||
import { useSelector } from 'react-redux';
|
||||
import PublicQrCodeShare from './PublicQrCodeShare/PublicQrCodeShare';
|
||||
import { FeatureAddon } from '../../Features/BookingScreen/BookingData/BookingData';
|
||||
import { getPaymentOptionsData } from '../../Features/Payment/Paymentoptions/Paymentoptions';
|
||||
import { useAuth } from '../../AuthContext';
|
||||
|
||||
const subDirectory = import.meta.env.ENV_MAIN_BASE_URL;
|
||||
const items = [
|
||||
|
|
@ -57,6 +58,8 @@ const PublicQrCode = () => {
|
|||
const [Tabledata, setTabledata] = useState([]);
|
||||
const [CheckTabledata, setCheckTabledata] = useState([]);
|
||||
const [qrCodeUrl, setQrCodeUrl] = useState('');
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
const [selectedConfig, setSelectedConfig] = useState({
|
||||
id: '',
|
||||
name: 'Both',
|
||||
|
|
@ -78,6 +81,11 @@ const PublicQrCode = () => {
|
|||
const BranchId = getSession('BranchId');
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
const { SadminuserAccess } = useAuth();
|
||||
const SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'SelfBooking QR Code'
|
||||
);
|
||||
const allowed = ['TakeAway', CheckTabledata?.length > 0 ? 'Dine In' : ''];
|
||||
const bookingTypePreference = appPreferences?.find(
|
||||
(preference) => preference?.PreferredCatName === 'Booking Type'
|
||||
|
|
@ -210,6 +218,38 @@ const PublicQrCode = () => {
|
|||
}
|
||||
};
|
||||
|
||||
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]);
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApiEmpAccess()
|
||||
}
|
||||
}, [UserType])
|
||||
const fetchApiEmpAccess = 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 === 'SelfBooking QR Code'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
const fetchApi = async () => {
|
||||
let response = await dispatch(getConfiguration({ Type: 'SA' })).unwrap();
|
||||
if (response?.data?.statusCode === 1) {
|
||||
|
|
@ -752,7 +792,7 @@ const PublicQrCode = () => {
|
|||
className="tertiary_Button"
|
||||
color="901D77"
|
||||
handleSubmit={HandleSubmit}
|
||||
// disabled={addnewAccess}
|
||||
disabled={addnewAccess}
|
||||
icon={<PlusOutlined />}
|
||||
>
|
||||
GENERATE
|
||||
|
|
|
|||
|
|
@ -26,11 +26,12 @@ import {
|
|||
import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
|
||||
import { Form, Table, Input } from 'antd';
|
||||
import { TiDelete } from 'react-icons/ti';
|
||||
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage.js';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage.js';
|
||||
import { EditFilled, StopOutlined } from '@ant-design/icons';
|
||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||
import { DropDowns } from '../../Components/Forms/DropDown.jsx';
|
||||
import { CgCloseR } from 'react-icons/cg';
|
||||
import { useAuth } from '../../AuthContext.jsx';
|
||||
|
||||
const SalesRemovallist = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -38,8 +39,13 @@ const SalesRemovallist = () => {
|
|||
const BranchId = getSession('BranchId');
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
const formRef = useRef(null);
|
||||
const { RangePicker } = DatePicker;
|
||||
const { SadminuserAccess } = useAuth();
|
||||
const SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Sales Entry Cancel'
|
||||
);
|
||||
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
|
|
@ -64,6 +70,8 @@ const SalesRemovallist = () => {
|
|||
const [IdentifyDetails, setIdentifyDetails] = useState([]);
|
||||
const [Identifiersnumber, setIdentifiersnumber] = useState([]);
|
||||
const [Qty, setQty] = useState();
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
|
||||
|
|
@ -79,6 +87,8 @@ const SalesRemovallist = () => {
|
|||
|
||||
];
|
||||
|
||||
|
||||
|
||||
const onComplete = useCallback(() => {
|
||||
setMessageData(null);
|
||||
setMessageType(null);
|
||||
|
|
@ -107,6 +117,39 @@ const SalesRemovallist = () => {
|
|||
dispatch(changeBreadCrumb({ items: items }));
|
||||
Tabledatas();
|
||||
}, []);
|
||||
|
||||
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]);
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApi()
|
||||
}
|
||||
}, [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 === 'Sales Entry Cancel'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
function safeRound(amountStr) {
|
||||
if (amountStr == null) return '0.00';
|
||||
const cleaned = String(amountStr).replace(/[^0-9.-]+/g, '');
|
||||
|
|
@ -1252,6 +1295,7 @@ const SalesRemovallist = () => {
|
|||
<Buttons
|
||||
buttonText="SUBMIT"
|
||||
color="901D77"
|
||||
disabled={addnewAccess}
|
||||
icon={<ArrowRightOutlined />}
|
||||
handleSubmit={handleSubmit}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
import Buttons from '../../Components/Forms/Buttons';
|
||||
import './StockAdjustment.scss';
|
||||
import { DropDowns } from '../../Components/Forms/DropDown';
|
||||
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { getSession } from '../../Services/Others';
|
||||
import { getAllprodIName } from '../../Features/ProductPage/ProductPage';
|
||||
|
|
@ -25,17 +25,26 @@ import FormHeader from '../PageComponents/FormHeader';
|
|||
import { useNavigate } from 'react-router-dom';
|
||||
import { DefaultModal } from '../../Components/Modal/DefaultModal';
|
||||
import { IoBagRemove } from 'react-icons/io5';
|
||||
import { useAuth } from '../../AuthContext';
|
||||
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const StockAdjustment = () => {
|
||||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Stock Adjustment'
|
||||
);
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
const [productsData, setProductsData] = useState([]);
|
||||
const [stockData, setStockData] = useState([]);
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
|
||||
const uniqueData = useMemo(() => {
|
||||
return stockData.reduce((acc, current) => {
|
||||
|
|
@ -164,6 +173,42 @@ const StockAdjustment = () => {
|
|||
// link: null,
|
||||
// },
|
||||
];
|
||||
|
||||
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 === 'Stock Adjustment'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(changeBreadCrumb({ items: items }));
|
||||
getAllProduct();
|
||||
|
|
@ -318,6 +363,7 @@ const StockAdjustment = () => {
|
|||
<Buttons
|
||||
buttonText="Search"
|
||||
handleSubmit={handleTriggerClick}
|
||||
disabled = {addnewAccess}
|
||||
style={{ marginLeft: 8 }}
|
||||
icon={<FiSearch size={16} />}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ const items = [
|
|||
const StockList = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Purchase Entry'
|
||||
(e) => e?.MenuName === 'Product Receipt'
|
||||
);
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
|
@ -140,7 +140,7 @@ const StockList = () => {
|
|||
};
|
||||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) => item.ConfigName === 'Purchase Entry'
|
||||
(item) => item.ConfigName === 'Product Receipt'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -180,12 +180,20 @@ const CreateTransfer = () => {
|
|||
variant ? `Already added in the table` : 'This product is already Added'
|
||||
);
|
||||
}
|
||||
if (scanner) {
|
||||
setTimeout(() => {
|
||||
productInputRef.current?.focus();
|
||||
setProductSearchText('');
|
||||
}, 100);
|
||||
}
|
||||
|
||||
formProductRef?.current?.resetFields();
|
||||
if (!scanner) {
|
||||
setProductSearchText('');
|
||||
}
|
||||
|
||||
return success;
|
||||
}, []);
|
||||
}, [scanner]);
|
||||
|
||||
const focusProductInput = () => {
|
||||
// give React a tick to close modal/input blur before refocusing
|
||||
|
|
@ -367,7 +375,13 @@ const CreateTransfer = () => {
|
|||
setVariantDetails([]);
|
||||
setSelectedProductForVariant(null);
|
||||
setSelectedVariants([]);
|
||||
focusProductInput();
|
||||
|
||||
if (scanner) {
|
||||
setTimeout(() => {
|
||||
productInputRef.current?.focus();
|
||||
setProductSearchText('');
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteRow = (index) => {
|
||||
|
|
@ -618,7 +632,13 @@ const CreateTransfer = () => {
|
|||
setVariantDetails([]);
|
||||
setSelectedProductForVariant(null);
|
||||
setSelectedVariants([]);
|
||||
focusProductInput();
|
||||
|
||||
if (scanner) {
|
||||
setTimeout(() => {
|
||||
productInputRef.current?.focus();
|
||||
setProductSearchText('');
|
||||
}, 100);
|
||||
}
|
||||
}}
|
||||
onOk={handleAddSelectedVariants}
|
||||
okText="Add Selected Variants"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { Messages } from '../../../Components/Notifications/Messages';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../../Features/AppPage/CenterPage';
|
||||
import FormHeader from '../../PageComponents/FormHeader';
|
||||
import Buttons from '../../../Components/Forms/Buttons';
|
||||
import Search from '../../../Components/Forms/Search';
|
||||
|
|
@ -18,10 +18,12 @@ import { getSession } from '../../../Services/Others';
|
|||
import { Table, Space } from 'antd';
|
||||
import { IoEye } from 'react-icons/io5';
|
||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||
import { useAuth } from '../../../AuthContext';
|
||||
|
||||
const KitchenFinishlist = () => {
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find((e) => e?.MenuName === "Finished Goods");
|
||||
const items = [
|
||||
{
|
||||
name: 'Home',
|
||||
|
|
@ -50,6 +52,9 @@ const KitchenFinishlist = () => {
|
|||
const [page, setpage] = useState(1);
|
||||
const [AllocatedProductStocks, setAllocatedProductStocks] = useState();
|
||||
const [AllocatedProductModal, setAllocatedProductModal] = useState(false);
|
||||
const [empData, setEmpData] = useState();
|
||||
const UserType = getSession('UserType');
|
||||
const [addnewAccess, setaddnewAccess] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(changeBreadCrumb({ items: items }));
|
||||
|
|
@ -64,6 +69,42 @@ const KitchenFinishlist = () => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
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 === 'Finished Goods')
|
||||
setEmpData(datas?.[0])
|
||||
|
||||
}
|
||||
|
||||
|
||||
const onComplete = useCallback(() => {
|
||||
setMessageData(null);
|
||||
setMessageType(null);
|
||||
|
|
@ -232,7 +273,7 @@ const KitchenFinishlist = () => {
|
|||
<div className="productMaster-input">
|
||||
<Buttons
|
||||
buttonText={'Add New'}
|
||||
// disabled={addnewAccess}
|
||||
disabled={addnewAccess}
|
||||
handleSubmit={() => handelAddButton()}
|
||||
color="901D77"
|
||||
icon={<PlusOutlined />}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { Messages } from '../../../Components/Notifications/Messages';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../../Features/AppPage/CenterPage';
|
||||
import FormHeader from '../../PageComponents/FormHeader';
|
||||
import Buttons from '../../../Components/Forms/Buttons';
|
||||
import Search from '../../../Components/Forms/Search';
|
||||
|
|
@ -21,6 +21,7 @@ import {
|
|||
} from '../../../Features/StoreKitchen/StoreRecipe';
|
||||
import { getSession } from '../../../Services/Others';
|
||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||
import { useAuth } from '../../../AuthContext';
|
||||
|
||||
const StoreRecipelist = () => {
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
|
|
@ -34,6 +35,8 @@ const StoreRecipelist = () => {
|
|||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find((e) => e?.MenuName === "Bill Of Material");
|
||||
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
|
|
@ -44,6 +47,8 @@ const StoreRecipelist = () => {
|
|||
const [sortedInfo, setSortedInfo] = useState({});
|
||||
const [CreatedProductdata, setCreatedProductdata] = useState();
|
||||
const [CreatedProdModal, setCreatedProdModal] = useState();
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(changeBreadCrumb({ items: items }));
|
||||
|
|
@ -58,6 +63,41 @@ const StoreRecipelist = () => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
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 === 'Bill Of Material')
|
||||
setEmpData(datas?.[0])
|
||||
|
||||
}
|
||||
const onComplete = useCallback(() => {
|
||||
setMessageData(null);
|
||||
setMessageType(null);
|
||||
|
|
@ -315,7 +355,7 @@ const StoreRecipelist = () => {
|
|||
<div className="productMaster-input">
|
||||
<Buttons
|
||||
buttonText={'Add New'}
|
||||
// disabled={addnewAccess}
|
||||
disabled={addnewAccess}
|
||||
handleSubmit={() => handelAddButton()}
|
||||
color="901D77"
|
||||
icon={<PlusOutlined />}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { Messages } from '../../../Components/Notifications/Messages';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../../Features/AppPage/CenterPage';
|
||||
import FormHeader from '../../PageComponents/FormHeader';
|
||||
import Buttons from '../../../Components/Forms/Buttons';
|
||||
import Search from '../../../Components/Forms/Search';
|
||||
|
|
@ -18,9 +18,12 @@ import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
|||
import { IoEye } from 'react-icons/io5';
|
||||
import { getSession } from '../../../Services/Others';
|
||||
import { getStoretoProduction } from '../../../Features/StoreKitchen/StoreRecipe';
|
||||
import { useAuth } from '../../../AuthContext';
|
||||
|
||||
const Storekitchenlist = () => {
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find((e) => e?.MenuName === "Material Issue");
|
||||
|
||||
const location = useLocation();
|
||||
const navigateTo = useNavigate();
|
||||
|
|
@ -40,6 +43,8 @@ const Storekitchenlist = () => {
|
|||
const [Tablelist, setTablelist] = useState();
|
||||
const [AllocatedProductStocks, setAllocatedProductStocks] = useState([]);
|
||||
const [AllocatedProductModal, setAllocatedProductModal] = useState(false);
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(changeBreadCrumb({ items: items }));
|
||||
|
|
@ -54,6 +59,41 @@ const Storekitchenlist = () => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
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 === 'Material Issue')
|
||||
setEmpData(datas?.[0])
|
||||
|
||||
}
|
||||
|
||||
const onComplete = useCallback(() => {
|
||||
setMessageData(null);
|
||||
setMessageType(null);
|
||||
|
|
@ -292,7 +332,7 @@ const Storekitchenlist = () => {
|
|||
<div className="productMaster-input">
|
||||
<Buttons
|
||||
buttonText={'Add New'}
|
||||
// disabled={addnewAccess}
|
||||
disabled={addnewAccess}
|
||||
handleSubmit={() => handelAddButton()}
|
||||
color="901D77"
|
||||
icon={<PlusOutlined />}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ const SupplierMaster = () => {
|
|||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === (AppType === 'Wholesale' ? 'Seller' : 'Supplier')
|
||||
(e) => e?.MenuName === (AppType === 'Wholesale' ? 'Seller' : 'Add Supplier')
|
||||
);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -103,7 +103,7 @@ const SupplierMaster = () => {
|
|||
let response = await dispatch(getEmpAccess(data)).unwrap();
|
||||
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
|
||||
(item) =>
|
||||
item.ConfigName === (AppType === 'Wholesale' ? 'Seller' : 'Supplier')
|
||||
item.ConfigName === (AppType === 'Wholesale' ? 'Seller' : 'Add Supplier')
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { DeleteFilled, PlusOutlined, ReloadOutlined } from '@ant-design/icons';
|
|||
import { Messages } from '../../Components/Notifications/Messages';
|
||||
import { Tables } from '../../Components/Tables/Table';
|
||||
import { Search } from '../../Components/Forms/Search';
|
||||
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage.js';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage.js';
|
||||
import Buttons from '../../Components/Forms/Buttons';
|
||||
import { ExtractDateFormate, getSession } from '../../Services/Others';
|
||||
import FormHeader from '../PageComponents/FormHeader.jsx';
|
||||
|
|
@ -34,7 +34,7 @@ const items = [
|
|||
const SupplierProductMapping = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
const SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Supplier Product Mapping'
|
||||
(e) => e?.MenuName === 'Product Mapping'
|
||||
);
|
||||
|
||||
const [page, setpage] = useState(1);
|
||||
|
|
@ -132,14 +132,13 @@ const SupplierProductMapping = () => {
|
|||
}}
|
||||
onClick={
|
||||
() =>
|
||||
// (
|
||||
// (UserType === 'Super Admin') ||
|
||||
// (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
|
||||
// (UserType === 'Employee' && empData?.DeleteAccess === "Y") ||
|
||||
// (UserType === 'Admin'))
|
||||
// ?
|
||||
((UserType === 'Super Admin') ||
|
||||
(UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
|
||||
(UserType === 'Employee' && empData?.DeleteAccess === "Y") ||
|
||||
(UserType === 'Admin'))
|
||||
?
|
||||
statusFormatter(record)
|
||||
// : null
|
||||
: null
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
|
|
@ -149,14 +148,13 @@ const SupplierProductMapping = () => {
|
|||
}}
|
||||
onClick={
|
||||
() =>
|
||||
// (
|
||||
// (UserType === 'Super Admin') ||
|
||||
// (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
|
||||
// (UserType === 'Employee' && empData?.DeleteAccess === "Y") ||
|
||||
// (UserType === 'Admin'))
|
||||
// ?
|
||||
((UserType === 'Super Admin') ||
|
||||
(UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
|
||||
(UserType === 'Employee' && empData?.DeleteAccess === "Y") ||
|
||||
(UserType === 'Admin'))
|
||||
?
|
||||
statusFormatter(record)
|
||||
// : null
|
||||
: null
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -186,6 +184,25 @@ const SupplierProductMapping = () => {
|
|||
setaddnewAccess(!hasAccess);
|
||||
}, [empData, SAAccessCommonMaster, UserType]);
|
||||
|
||||
useEffect(() => {
|
||||
if (UserType === "Employee") {
|
||||
fetchApi()
|
||||
}
|
||||
}, [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 === 'Product Mapping'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
const handleModalCancel = () => {
|
||||
setIsModalOpen(false);
|
||||
setModalSelectedSupplier(null);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import { InputField } from '../../Components/Forms/InputField.jsx';
|
|||
import Buttons from '../../Components/Forms/Buttons.jsx';
|
||||
import { Messages } from '../../Components/Notifications/Messages.jsx';
|
||||
import { DeleteFilled } from '@ant-design/icons';
|
||||
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage.js';
|
||||
import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage.js';
|
||||
import FormHeader from '../PageComponents/FormHeader.jsx';
|
||||
import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
|
||||
import { getSession, validateSafeInput } from '../../Services/Others.js';
|
||||
|
|
@ -65,6 +65,7 @@ import {
|
|||
import { FiUploadCloud } from 'react-icons/fi';
|
||||
import OpeningStockExcel from './OpeningStockExcel.jsx';
|
||||
import { sendupiotp } from '../../Features/UpiDetails/UpiDetails.js';
|
||||
import { useAuth } from '../../AuthContext.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const EditableContext = React.createContext(null);
|
||||
|
|
@ -160,6 +161,10 @@ const OpeningStockList = () => {
|
|||
const productAddInfoRef = useRef(null);
|
||||
const navigateTo = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Opening Stock'
|
||||
);
|
||||
|
||||
const location = useLocation();
|
||||
const [form] = Form.useForm();
|
||||
|
|
@ -171,7 +176,10 @@ const OpeningStockList = () => {
|
|||
const BranchId = getSession('BranchId');
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
const MobileNo = getSession('MobileNo');
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
|
||||
const [openExcel, setOpenExcel] = useState(false);
|
||||
const [applicationRestrictedFields, setApplicationRestrictedFields] =
|
||||
|
|
@ -207,6 +215,40 @@ const OpeningStockList = () => {
|
|||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [timeLeft]);
|
||||
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 === 'Opening Stock'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
|
||||
console.log(otpAccessMap, 'otpAccessMap');
|
||||
const [Delete, setDelete] = useState(false);
|
||||
|
|
@ -1209,6 +1251,7 @@ const OpeningStockList = () => {
|
|||
<Buttons
|
||||
buttonText={'Add New'}
|
||||
handleSubmit={() => handelAddButton()}
|
||||
disabled={addnewAccess}
|
||||
color="901D77"
|
||||
icon={<PlusOutlined />}
|
||||
/>
|
||||
|
|
@ -1218,7 +1261,7 @@ const OpeningStockList = () => {
|
|||
buttonText="Upload Excel"
|
||||
className="tertiary_Button"
|
||||
handleSubmit={openModal}
|
||||
disabled={false}
|
||||
disabled={addnewAccess}
|
||||
icon={<FiUploadCloud size={18} />}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -718,7 +718,7 @@ export const routesConfig = [
|
|||
{
|
||||
path: 'counter-category-mapping',
|
||||
component: CounterCategoryMappingForm,
|
||||
empAccess: 'Counter Category Mapping',
|
||||
empAccess: 'Counter Mapping',
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -873,17 +873,17 @@ export const routesConfig = [
|
|||
{
|
||||
path: 'code-base',
|
||||
component: CodeBaseList,
|
||||
empAccess: 'Code Base',
|
||||
empAccess: 'Code Based',
|
||||
},
|
||||
{
|
||||
path: 'code-base/new',
|
||||
component: (props) => <CodeBase {...props} formType="add" />,
|
||||
empAccess: 'Code Base',
|
||||
empAccess: 'Code Based',
|
||||
},
|
||||
{
|
||||
path: 'code-base/new',
|
||||
component: (props) => <CodeBase {...props} formType="edit" />,
|
||||
empAccess: 'Code Base',
|
||||
empAccess: 'Code Based',
|
||||
},
|
||||
|
||||
{ path: 'item-wise', component: ItemWise, empAccess: 'Item Wise Offer' },
|
||||
|
|
@ -923,17 +923,17 @@ export const routesConfig = [
|
|||
path: 'loyalty-based',
|
||||
// component: LoyaltyBased,
|
||||
component: LoyaltyBasedList,
|
||||
empAccess: 'Loyalty Based',
|
||||
empAccess: 'Loyalty Points',
|
||||
},
|
||||
{
|
||||
path: 'loyalty-based/new',
|
||||
component: (props) => <LoyaltyBased {...props} formType="add" />,
|
||||
empAccess: 'Loyalty Based',
|
||||
empAccess: 'Loyalty Points',
|
||||
},
|
||||
{
|
||||
path: 'loyalty-based/update',
|
||||
component: (props) => <LoyaltyBased {...props} formType="edit" />,
|
||||
empAccess: 'Loyalty Based',
|
||||
empAccess: 'Loyalty Points',
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1081,11 +1081,7 @@ export const routesConfig = [
|
|||
empAccess: 'Product Receipt',
|
||||
},
|
||||
|
||||
{
|
||||
path: 'purchase-order',
|
||||
component: PurchaseOrderList,
|
||||
empAccess: 'Purchase Order',
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
path: 'receive-stocks',
|
||||
|
|
@ -1109,6 +1105,11 @@ export const routesConfig = [
|
|||
component: gstInvoiceSetUpList,
|
||||
empAccess: 'Gst Invoice Setup',
|
||||
},
|
||||
{
|
||||
path: 'purchase-order',
|
||||
component: PurchaseOrderList,
|
||||
empAccess: 'Purchase Order',
|
||||
},
|
||||
{
|
||||
path: 'purchase-order/new',
|
||||
component: (props) => <PurchaseOrder {...props} formType="add" />,
|
||||
|
|
@ -1118,7 +1119,7 @@ export const routesConfig = [
|
|||
{
|
||||
path: 'purchase-return/list',
|
||||
component: PurchaseReturnget,
|
||||
empAccess: 'Purchase Return',
|
||||
empAccess: 'Product Return',
|
||||
},
|
||||
{
|
||||
path: 'purchaseconfirm',
|
||||
|
|
@ -1128,7 +1129,7 @@ export const routesConfig = [
|
|||
{
|
||||
path: 'purchase-return',
|
||||
component: PurchaseReturn,
|
||||
empAccess: 'Purchase Return',
|
||||
empAccess: 'Product Return',
|
||||
},
|
||||
//free Products
|
||||
{
|
||||
|
|
@ -1186,6 +1187,11 @@ export const routesConfig = [
|
|||
component: PurchaseQuotationForm,
|
||||
empAccess: 'Sales Quotation',
|
||||
},
|
||||
{
|
||||
path: 'sales-quotation/list',
|
||||
component: PurchaseQuotationList,
|
||||
empAccess: 'Sales Quotation',
|
||||
},
|
||||
{
|
||||
path: 'sales-order',
|
||||
component: SalesOrder,
|
||||
|
|
@ -1215,11 +1221,7 @@ export const routesConfig = [
|
|||
component: DeliveryChallanToInvoiceForm,
|
||||
empAccess: 'DC to Invoice',
|
||||
},
|
||||
{
|
||||
path: 'sales-quotation/list',
|
||||
component: PurchaseQuotationList,
|
||||
empAccess: 'Sales Quotation',
|
||||
},
|
||||
|
||||
|
||||
{ path: 'shift-master', component: ShiftMasterList, empAccess: 'Shift' },
|
||||
{
|
||||
|
|
@ -1324,17 +1326,17 @@ export const routesConfig = [
|
|||
{
|
||||
path: 'combo-master',
|
||||
component: ComboList,
|
||||
empAccess: 'Combo Product',
|
||||
empAccess: 'Add Product',
|
||||
},
|
||||
{
|
||||
path: 'combo-master/new',
|
||||
component: (props) => <ComboMaster {...props} formType="add" />,
|
||||
empAccess: 'Combo Product',
|
||||
empAccess: 'Add Product',
|
||||
},
|
||||
{
|
||||
path: 'combo-master/update',
|
||||
component: (props) => <ComboMaster {...props} formType="edit" />,
|
||||
empAccess: 'Combo Product',
|
||||
empAccess: 'Add Product',
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1443,17 +1445,17 @@ export const routesConfig = [
|
|||
{
|
||||
path: 'sales-bill-cancel',
|
||||
component: SalesBillCancel,
|
||||
empAccess: 'Sales Bill Cancel',
|
||||
empAccess: 'Sales Entry Cancel',
|
||||
},
|
||||
{
|
||||
path: 'sales-bill-product-return/list',
|
||||
component: SalesBillProductsReturnList,
|
||||
empAccess: 'Product Return',
|
||||
empAccess: 'Sales Product Return',
|
||||
},
|
||||
{
|
||||
path: 'sales-bill-product-return',
|
||||
component: SalesBillProductsReturn,
|
||||
empAccess: 'Product Return',
|
||||
empAccess: 'Sales Product Return',
|
||||
},
|
||||
{
|
||||
path: 'booking-reschedule',
|
||||
|
|
@ -1583,7 +1585,7 @@ export const routesConfig = [
|
|||
{
|
||||
path: `barcode-qr-selection`,
|
||||
component: BarcodeTemplateSetup,
|
||||
empAccess: 'Barcode / Qr',
|
||||
empAccess: 'Barcode / QR',
|
||||
},
|
||||
{
|
||||
path: 'kiosk-component',
|
||||
|
|
|
|||
Loading…
Reference in New Issue