Merge pull request 'Mohan' (#132) from Mohan into main
Reviewed-on: Pozomind/pozo-retail-app#132
|
|
@ -8,7 +8,11 @@ import {
|
|||
PricingAppPricingName,
|
||||
} from './Features/BrachLogin/BranchLogin.js';
|
||||
import { changePricingAppPricingName } from './Features/ThemeChange/ThemeChange.js';
|
||||
import { FeatureAddon } from './Features/BookingScreen/BookingData/BookingData.js';
|
||||
import {
|
||||
FeatureAddon,
|
||||
GlobalFeatAddOnData,
|
||||
} from './Features/BookingScreen/BookingData/BookingData.js';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
export const AuthContext = createContext();
|
||||
|
||||
|
|
@ -21,10 +25,10 @@ export const AuthProvider = ({ children }) => {
|
|||
const UserId = getSession('UserId');
|
||||
const UserType = getSession('UserType');
|
||||
const dispatch = useDispatch();
|
||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||
|
||||
const [Access, setAccess] = useState([]);
|
||||
const [SadminuserAccess, setSadminuserAccess] = useState([]);
|
||||
const [FeatureAddonData, setFeatureAddonData] = useState([]);
|
||||
const [ProORAdvance, setProORAdvance] = useState(false);
|
||||
const [Advance, setAdvance] = useState(false);
|
||||
const [freeProductsCount, setFreeProductsCount] = useState(0);
|
||||
|
|
@ -33,9 +37,6 @@ export const AuthProvider = ({ children }) => {
|
|||
|
||||
useEffect(() => {
|
||||
getPricingName();
|
||||
if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') {
|
||||
getFeatureAddonData();
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -94,18 +95,6 @@ export const AuthProvider = ({ children }) => {
|
|||
setSadminuserAccess(response?.data?.data?.[0]?.AppMenuAccessDetails);
|
||||
}
|
||||
};
|
||||
const getFeatureAddonData = async () => {
|
||||
let featureAddon = await dispatch(
|
||||
FeatureAddon({ AppId: AppId, UserId: UserId })
|
||||
).unwrap();
|
||||
if (featureAddon?.data?.statusCode === 1) {
|
||||
await setFeatureAddonData(
|
||||
featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]
|
||||
);
|
||||
} else {
|
||||
await setFeatureAddonData([]);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<AuthContext.Provider
|
||||
|
|
|
|||
|
|
@ -1,6 +1,19 @@
|
|||
import { createAsyncThunk } from '@reduxjs/toolkit';
|
||||
import { axiosRetailInstanceData } from '../AuthenicationToken/AuthenticationToken';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = {
|
||||
activeTab: 'dashboard',
|
||||
};
|
||||
const DashBoard = createSlice({
|
||||
name: 'DashBoard',
|
||||
initialState,
|
||||
reducers: {
|
||||
setActiveTab: (state, action) => {
|
||||
state.activeTab = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
export const getdashboard = createAsyncThunk('getdashboard', async (data) => {
|
||||
if (
|
||||
data?.CompId != null &&
|
||||
|
|
@ -15,8 +28,7 @@ export const getdashboard = createAsyncThunk('getdashboard', async (data) => {
|
|||
return await axiosRetailInstanceData.get(
|
||||
`/DashBoardReport?AppId=${data?.AppId}&CompId=${data?.CompId}&BranchId=${data?.BranchId}&UserId=${data?.UserId}`
|
||||
);
|
||||
}
|
||||
else if (
|
||||
} else if (
|
||||
data?.CompId != null &&
|
||||
data?.CompId != undefined &&
|
||||
data?.BranchId != null &&
|
||||
|
|
@ -27,8 +39,7 @@ export const getdashboard = createAsyncThunk('getdashboard', async (data) => {
|
|||
return await axiosRetailInstanceData.get(
|
||||
`/DashBoardReport?AppId=${data?.AppId}&CompId=${data?.CompId}&BranchId=${data?.BranchId}`
|
||||
);
|
||||
}
|
||||
else if (
|
||||
} else if (
|
||||
data?.CompId != null &&
|
||||
data?.CompId != undefined &&
|
||||
data?.AppId != null &&
|
||||
|
|
@ -109,8 +120,7 @@ export const getpreOrderDashBoard = createAsyncThunk(
|
|||
return await axiosRetailInstanceData.get(
|
||||
`/PreOrder/DashboardReportDtl?appId=${data?.AppId}&compId=${data?.CompId}&branchId=${data?.BranchId}&fromDate=${data?.FromDate}&toDate=${data?.ToDate}`
|
||||
);
|
||||
}
|
||||
else if (
|
||||
} else if (
|
||||
data?.CompId != null &&
|
||||
data?.CompId != undefined &&
|
||||
data?.AppId != null &&
|
||||
|
|
@ -184,8 +194,7 @@ export const getSalesHdr = createAsyncThunk(
|
|||
return await axiosRetailInstanceData.get(
|
||||
`/SalesHdr/DashboardDtl?appId=${data?.AppId}&compId=${data?.CompId}&branchId=${data?.BranchId}&fromDate=${data?.FromDate}&toDate=${data?.ToDate}`
|
||||
);
|
||||
}
|
||||
else if (
|
||||
} else if (
|
||||
data?.CompId != null &&
|
||||
data?.CompId != undefined &&
|
||||
data?.AppId != null &&
|
||||
|
|
@ -198,8 +207,7 @@ export const getSalesHdr = createAsyncThunk(
|
|||
return await axiosRetailInstanceData.get(
|
||||
`/SalesHdr/DashboardDtl?appId=${data?.AppId}&compId=${data?.CompId}&fromDate=${data?.FromDate}&toDate=${data?.ToDate}`
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return await axiosRetailInstanceData.get(
|
||||
`/SalesHdr/DashboardDtl?appId=${data?.AppId}&compId=${data?.CompId}`
|
||||
);
|
||||
|
|
@ -207,5 +215,5 @@ export const getSalesHdr = createAsyncThunk(
|
|||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
export const { setActiveTab } = DashBoard.actions;
|
||||
export default DashBoard.reducer;
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 426 B |
|
After Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 958 B |
|
Before Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 652 B |
|
Before Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 570 B |
|
|
@ -26,6 +26,7 @@ import {
|
|||
ApplicationPreferences,
|
||||
globalBranchType,
|
||||
changeWarehouse,
|
||||
GlobalCompBranchData,
|
||||
} from '../../Features/BrachLogin/BranchLogin.js';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { Messages } from '../../Components/Notifications/Messages.jsx';
|
||||
|
|
@ -62,14 +63,14 @@ const AppPage = () => {
|
|||
UserType,
|
||||
Access,
|
||||
SadminuserAccess,
|
||||
Advance,
|
||||
ProORAdvance,
|
||||
featureaddDetails,
|
||||
} = useAuth();
|
||||
// Retrieve user details
|
||||
const DineInStatus = useSelector(preferencechangeStatus);
|
||||
const iswarehouse = useSelector(globalBranchType);
|
||||
console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
||||
const CompBranchDataGlobal = useSelector(GlobalCompBranchData);
|
||||
|
||||
const SettingData = useSelector(PreferenceData);
|
||||
const appPreferences = useSelector(ApplicationPreferences);
|
||||
const defaultBookingType = useSelector(GlobalDefaultBookingType);
|
||||
|
|
@ -91,11 +92,10 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
type?.PreferredStatus === 'Y'
|
||||
);
|
||||
|
||||
const [CompBranchData, setCompBranchData] = useState();
|
||||
const [CompBranchData, setCompBranchData] = useState(CompBranchDataGlobal);
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
const [EmpSettingMenu, setEmpSettingMenu] = useState([]);
|
||||
console.log(EmpSettingMenu, 'EmpSettingMenu');
|
||||
const [EmpMaster, setEmpMaster] = useState([]);
|
||||
const [EmpPurshase, setEmpPurshase] = useState([]);
|
||||
const [EmpProduction, setEmpProduction] = useState([]);
|
||||
|
|
@ -111,7 +111,6 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
const [offemenu, setofferMenu] = useState([]);
|
||||
const [payMenu, setPayMenu] = useState([]);
|
||||
const [CancelMenu, setCancelMenu] = useState([]);
|
||||
const [SalesMenu, setSalesMenu] = useState([]);
|
||||
const [AndroidApp, setAndroidApp] = useState([]);
|
||||
const [Empprodmenu, setEmpprodmenu] = useState([]);
|
||||
|
||||
|
|
@ -154,7 +153,6 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchBranchData();
|
||||
clearCustomerDisplay();
|
||||
}, []);
|
||||
|
||||
|
|
@ -312,12 +310,19 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
getSession('UserType') === 'Super Admin' ||
|
||||
getSession('UserType') === 'Super Admin User'
|
||||
) {
|
||||
if (CompBranchData?.length > 0) {
|
||||
await sessionStore('BranchLength', CompBranchData?.length);
|
||||
if (CompBranchData?.length == 1) {
|
||||
await sessionStore('BranchId', CompBranchData?.[0]?.BrId);
|
||||
await dispatch(changeSelectedBranchId(CompBranchData?.[0]?.BrId));
|
||||
}
|
||||
} else {
|
||||
const response = await dispatch(
|
||||
getCompBranchData({ CompId: CompId, AppId: AppId })
|
||||
).unwrap();
|
||||
if (response?.data?.statusCode === 1) {
|
||||
setCompBranchData(response?.data?.data);
|
||||
await sessionStore('BranchLength', response?.data?.data?.length);
|
||||
|
||||
if (response?.data?.data?.length == 1) {
|
||||
await sessionStore('BranchId', response?.data?.data?.[0]?.BrId);
|
||||
await dispatch(
|
||||
|
|
@ -325,11 +330,22 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
getSession('UserType') === 'Admin' ||
|
||||
getSession('UserType') === 'Admin User'
|
||||
|| getSession('UserType') === 'Employee'
|
||||
getSession('UserType') === 'Admin User' ||
|
||||
getSession('UserType') === 'Employee'
|
||||
) {
|
||||
if (CompBranchData?.length > 0) {
|
||||
await sessionStore('BranchLength', CompBranchData?.length);
|
||||
if (CompBranchData?.length == 1) {
|
||||
await sessionStore('BranchId', CompBranchData?.[0]?.BrId);
|
||||
await dispatch(changeSelectedBranchId(CompBranchData?.[0]?.BrId));
|
||||
if (CompBranchData?.[0]?.LocationType == 'W') {
|
||||
await dispatch(changeWarehouse(true));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const response = await dispatch(
|
||||
getCompBranchData({ AppId: AppId, UserId: UserId, CompId: CompId })
|
||||
).unwrap();
|
||||
|
|
@ -338,13 +354,16 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
setCompBranchData(response?.data?.data);
|
||||
if (response?.data?.data?.length == 1) {
|
||||
await sessionStore('BranchId', response?.data?.data?.[0]?.BrId);
|
||||
if(response?.data?.data?.[0]?.LocationType == 'W') await dispatch(changeWarehouse(true));
|
||||
if (response?.data?.data?.[0]?.LocationType == 'W') {
|
||||
await dispatch(changeWarehouse(true));
|
||||
}
|
||||
await dispatch(
|
||||
changeSelectedBranchId(response?.data?.data?.[0]?.BrId)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//***************************** */
|
||||
|
|
@ -477,18 +496,24 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
`${subDirectory}setting/supplierproductmapping-master`
|
||||
),
|
||||
]),
|
||||
!sportsAppPreference && getsubItem('Stock Transfer', `${subDirectory}setting/stocktransfer`, null, [
|
||||
!sportsAppPreference &&
|
||||
getsubItem(
|
||||
'Stock Transfer',
|
||||
`${subDirectory}setting/stocktransfer`,
|
||||
null,
|
||||
[
|
||||
getsubItem(
|
||||
'Create Transfer',
|
||||
`${subDirectory}setting/stock-transferlist`
|
||||
),
|
||||
|
||||
getsubItem('Stock Dispatch', `${subDirectory}setting/stock-dispatch`),
|
||||
getsubItem(
|
||||
'Stock Dispatch',
|
||||
`${subDirectory}setting/stock-dispatch`
|
||||
'Received Stocks',
|
||||
`${subDirectory}setting/receive-stocks`
|
||||
),
|
||||
]
|
||||
),
|
||||
getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`),
|
||||
]),
|
||||
getsubItem('Price Change', `${subDirectory}setting/price-change`),
|
||||
!sportsAppPreference &&
|
||||
!iswarehouse &&
|
||||
|
|
@ -580,9 +605,8 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
'GST Invoice Setup',
|
||||
`${subDirectory}setting/gst-invoice-setup`
|
||||
),
|
||||
(!iswarehouse) &&
|
||||
!iswarehouse &&
|
||||
getsubItem('Customization', `${subDirectory}setting/Customize`, null, [
|
||||
|
||||
!iswarehouse
|
||||
? getsubItem(
|
||||
'Sales Screen',
|
||||
|
|
@ -1010,7 +1034,6 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
sportsAppPreference &&
|
||||
getsubItem('Membership', `${subDirectory}setting/membership-master/list`),
|
||||
|
||||
|
||||
getsubItem('Employee', `${subDirectory}employee`, null, [
|
||||
getsubItem('Add Employee', `${subDirectory}setting/employee-master`),
|
||||
getsubItem('Employee Access', `${subDirectory}setting/employee-access`),
|
||||
|
|
@ -1045,17 +1068,23 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
`${subDirectory}setting/supplierproductmapping-master`
|
||||
),
|
||||
]),
|
||||
!sportsAppPreference && getsubItem('Stock Transfer', `${subDirectory}setting/stocktransfer`, null, [
|
||||
!sportsAppPreference &&
|
||||
getsubItem(
|
||||
'Stock Transfer',
|
||||
`${subDirectory}setting/stocktransfer`,
|
||||
null,
|
||||
[
|
||||
getsubItem(
|
||||
'Create Transfer',
|
||||
`${subDirectory}setting/stock-transferlist`
|
||||
),
|
||||
getsubItem('Stock Dispatch', `${subDirectory}setting/stock-dispatch`),
|
||||
getsubItem(
|
||||
'Stock Dispatch',
|
||||
`${subDirectory}setting/stock-dispatch`
|
||||
'Received Stocks',
|
||||
`${subDirectory}setting/receive-stocks`
|
||||
),
|
||||
]
|
||||
),
|
||||
getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`),
|
||||
]),
|
||||
];
|
||||
const productions = [
|
||||
getsubItem('Bill Of Material', `${subDirectory}setting/custom-product`),
|
||||
|
|
@ -1137,17 +1166,23 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
`${subDirectory}setting/supplierproductmapping-master`
|
||||
),
|
||||
]),
|
||||
!sportsAppPreference && getsubItem('Stock Transfer', `${subDirectory}setting/stocktransfer`, null, [
|
||||
!sportsAppPreference &&
|
||||
getsubItem(
|
||||
'Stock Transfer',
|
||||
`${subDirectory}setting/stocktransfer`,
|
||||
null,
|
||||
[
|
||||
getsubItem(
|
||||
'Create Transfer',
|
||||
`${subDirectory}setting/stock-transferlist`
|
||||
),
|
||||
getsubItem('Stock Dispatch', `${subDirectory}setting/stock-dispatch`),
|
||||
getsubItem(
|
||||
'Stock Dispatch',
|
||||
`${subDirectory}setting/stock-dispatch`
|
||||
'Received Stocks',
|
||||
`${subDirectory}setting/receive-stocks`
|
||||
),
|
||||
]
|
||||
),
|
||||
getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`),
|
||||
]),
|
||||
];
|
||||
|
||||
const prodMenu = [
|
||||
|
|
@ -1302,10 +1337,8 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
'GST Invoice Setup',
|
||||
`${subDirectory}setting/gst-invoice-setup`
|
||||
),
|
||||
(
|
||||
!iswarehouse) &&
|
||||
!iswarehouse &&
|
||||
getsubItem('Customization', `${subDirectory}setting/Customize`, null, [
|
||||
|
||||
!iswarehouse
|
||||
? getsubItem(
|
||||
'Sales Screen',
|
||||
|
|
@ -1424,7 +1457,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse');
|
|||
)
|
||||
: '',
|
||||
];
|
||||
const customizedmenuitem = []
|
||||
const customizedmenuitem = [];
|
||||
const AndroidAppMenuItem = [
|
||||
getItem(
|
||||
'Download',
|
||||
|
|
@ -1661,13 +1694,9 @@ const customizedmenuitem = []
|
|||
`${subDirectory}setting/membership-master/list`
|
||||
),
|
||||
|
||||
|
||||
getsubItem('Employee', `${subDirectory}employee`, null, [
|
||||
// getsubItem('Shift', `${subDirectory}setting/shift-master`),
|
||||
getsubItem(
|
||||
'Add Employee',
|
||||
`${subDirectory}setting/employee-master`
|
||||
),
|
||||
getsubItem('Add Employee', `${subDirectory}setting/employee-master`),
|
||||
getsubItem(
|
||||
'Employee Access',
|
||||
`${subDirectory}setting/employee-access`
|
||||
|
|
@ -1718,7 +1747,8 @@ const customizedmenuitem = []
|
|||
`${subDirectory}setting/supplierproductmapping-master`
|
||||
),
|
||||
]),
|
||||
!sportsAppPreference && getsubItem(
|
||||
!sportsAppPreference &&
|
||||
getsubItem(
|
||||
'Stock Transfer',
|
||||
`${subDirectory}setting/stocktransfer`,
|
||||
null,
|
||||
|
|
@ -1731,7 +1761,10 @@ const customizedmenuitem = []
|
|||
'Stock Dispatch',
|
||||
`${subDirectory}setting/stock-dispatch`
|
||||
),
|
||||
getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`),
|
||||
getsubItem(
|
||||
'Received Stocks',
|
||||
`${subDirectory}setting/receive-stocks`
|
||||
),
|
||||
]
|
||||
),
|
||||
]),
|
||||
|
|
@ -2220,13 +2253,9 @@ const customizedmenuitem = []
|
|||
]
|
||||
),
|
||||
|
||||
|
||||
getsubItem('Employee', `${subDirectory}employee`, null, [
|
||||
// getsubItem('Shift', `${subDirectory}setting/shift-master`),
|
||||
getsubItem(
|
||||
'Add Employee',
|
||||
`${subDirectory}setting/employee-master`
|
||||
),
|
||||
getsubItem('Add Employee', `${subDirectory}setting/employee-master`),
|
||||
getsubItem(
|
||||
'Employee Access',
|
||||
`${subDirectory}setting/employee-access`
|
||||
|
|
@ -2242,7 +2271,6 @@ const customizedmenuitem = []
|
|||
`${subDirectory}setting/membership-master/list`
|
||||
),
|
||||
|
||||
|
||||
getsubItem('Common Master', `${subDirectory}setting/common-master`),
|
||||
getsubItem('Tax', `${subDirectory}setting/admin-tax`),
|
||||
|
||||
|
|
@ -2289,7 +2317,8 @@ const customizedmenuitem = []
|
|||
`${subDirectory}setting/supplierproductmapping-master`
|
||||
),
|
||||
]),
|
||||
!sportsAppPreference && getsubItem(
|
||||
!sportsAppPreference &&
|
||||
getsubItem(
|
||||
'Stock Transfer',
|
||||
`${subDirectory}setting/stocktransfer`,
|
||||
null,
|
||||
|
|
@ -2302,7 +2331,10 @@ const customizedmenuitem = []
|
|||
'Stock Dispatch',
|
||||
`${subDirectory}setting/stock-dispatch`
|
||||
),
|
||||
getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`),
|
||||
getsubItem(
|
||||
'Received Stocks',
|
||||
`${subDirectory}setting/receive-stocks`
|
||||
),
|
||||
]
|
||||
),
|
||||
]),
|
||||
|
|
@ -2538,9 +2570,7 @@ const customizedmenuitem = []
|
|||
`${subDirectory}setting/Customized`,
|
||||
null,
|
||||
[
|
||||
|
||||
!sportsAppPreference &&
|
||||
!iswarehouse
|
||||
!sportsAppPreference && !iswarehouse
|
||||
? getsubItem(
|
||||
'Sales Screen',
|
||||
`${subDirectory}saleslayouts/sales-selection`
|
||||
|
|
@ -2563,8 +2593,7 @@ const customizedmenuitem = []
|
|||
)
|
||||
: '',
|
||||
|
||||
!iswarehouse &&
|
||||
!sportsAppPreference
|
||||
!iswarehouse && !sportsAppPreference
|
||||
? getsubItem(
|
||||
'Barcode / QR',
|
||||
`${subDirectory}saleslayouts/barcode-qr-selection`
|
||||
|
|
@ -2696,8 +2725,8 @@ const customizedmenuitem = []
|
|||
<IoIosConstruct className="iconsize" />,
|
||||
EmpProduction
|
||||
),
|
||||
(EmpSales?.length > 0 &&
|
||||
!iswarehouse) &&
|
||||
EmpSales?.length > 0 &&
|
||||
!iswarehouse &&
|
||||
getItem(
|
||||
'Sales',
|
||||
`${subDirectory}saleslist`,
|
||||
|
|
@ -2712,14 +2741,15 @@ const customizedmenuitem = []
|
|||
<MdOutlineRestaurantMenu className="iconsize" />,
|
||||
empFilteredKOTMenu
|
||||
),
|
||||
(EmpfilterReportMenu ?.length > 0 ) &&
|
||||
EmpfilterReportMenu?.length > 0 &&
|
||||
getItem(
|
||||
'REPORTS',
|
||||
`${subDirectory}reports`,
|
||||
<TbReportAnalytics className="iconsize" />,
|
||||
EmpfilterReportMenu
|
||||
),
|
||||
(EmpSuport?.length > 0 && !iswarehouse) &&
|
||||
EmpSuport?.length > 0 &&
|
||||
!iswarehouse &&
|
||||
getsubItem(
|
||||
'Support',
|
||||
`${subDirectory}setting/create-tickets`,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useSelector, useDispatch } from 'react-redux';
|
||||
import BSLayout1 from '../../Pages/BookingScreen/Template/BSLayout1/BSLayout1.jsx';
|
||||
import BSLayout2 from '../../Pages/BookingScreen/Template/BSLayout2/BSLayout2.jsx';
|
||||
|
|
@ -19,14 +19,11 @@ import {
|
|||
changeScanTemplate,
|
||||
} from '../../Features/ThemeChange/ThemeChange';
|
||||
import {
|
||||
ChangeBranchFinancialStatus,
|
||||
changeProductSubCategorie,
|
||||
ChangeScreenSize,
|
||||
FeatureAddon,
|
||||
getConfigType,
|
||||
getLayoutCategories,
|
||||
getLayoutSubCategories,
|
||||
getPreferenceData,
|
||||
getUnpaidData,
|
||||
GlobalFeatAddOnData,
|
||||
GlobalProductCategorie,
|
||||
|
|
@ -35,36 +32,36 @@ import { getSession } from '../../Services/Others';
|
|||
import { usePaymentOptions } from '../../Pages/BookingScreen/Template/PaymentOptions.js';
|
||||
import { getCustomerDisplayWindow } from '../../Features/customerDisplayWindow/customerDisplayWindow.js';
|
||||
import { ChangeRedirectStatus } from '../../Features/AppPage/CenterPage.js';
|
||||
import { WithoutSalesSetup } from './WithoutSalesSetup.jsx';
|
||||
import {
|
||||
changeholddata,
|
||||
gettinghold,
|
||||
} from '../../Features/BookingScreen/HoldOption/HoldOption.js';
|
||||
import { getBranchDetail } from '../../Features/BrachLogin/BranchLogin.js';
|
||||
import Loader from '../../Components/Loader/Loader.jsx';
|
||||
|
||||
const BookingPage = () => {
|
||||
const dispatch = useDispatch();
|
||||
const templateData = useSelector(getTemplateData);
|
||||
const ProdCat = useSelector(GlobalProductCategorie);
|
||||
console.log(templateData, "templateData")
|
||||
console.log(templateData, 'templateData');
|
||||
const BookingLayout = templateData?.BookingLayout?.[0];
|
||||
const [ismounted, setIsmounted] = useState(false)
|
||||
const [ismounted, setIsmounted] = useState(false);
|
||||
const [templateLoaded, setTemplateLoaded] = useState(false);
|
||||
const PricingAppPricingName = useSelector(GlobalPricingAppPricingName);
|
||||
// const Advance = PricingAppPricingName?.some(item => item.PricingName === "Advance");
|
||||
const Pro = PricingAppPricingName?.some((item) => item.PricingName === 'Customized');
|
||||
// const Pro = PricingAppPricingName?.some(
|
||||
// (item) => item.PricingName === 'Customized'
|
||||
// );
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const AppName = getSession('AppName');
|
||||
const UserType = getSession('UserType');
|
||||
const AuthToken = sessionStorage.getItem("auth");
|
||||
const SessionMobileNo = getSession("MobileNo");
|
||||
const AuthToken = sessionStorage.getItem('auth');
|
||||
const SessionMobileNo = getSession('MobileNo');
|
||||
// const [FeatureAddonData, setFeatureAddonData] = useState([]);
|
||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData)
|
||||
const Scantemplatedata = useSelector(GlobalScanTemplate)
|
||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||
const Scantemplatedata = useSelector(GlobalScanTemplate);
|
||||
// useEffect(() => {
|
||||
// dispatch(
|
||||
// getPreferenceData({ CompId: CompId, AppId: AppId, BranchId: BranchId })
|
||||
|
|
@ -166,7 +163,6 @@ const BookingPage = () => {
|
|||
UserId: UserId,
|
||||
});
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
ProdCat &&
|
||||
dispatch(
|
||||
|
|
@ -180,7 +176,6 @@ const BookingPage = () => {
|
|||
}, [ProdCat]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
dispatch(getConfigType({ TypeName: 'Booking Type' })).unwrap();
|
||||
dispatch(ChangeRedirectStatus(true));
|
||||
dispatch(changeProductSubCategorie('NaN'));
|
||||
|
|
@ -217,13 +212,17 @@ const BookingPage = () => {
|
|||
const fetchData = async (Plan) => {
|
||||
if (templateLoaded) return; // STOP duplicate calls
|
||||
|
||||
|
||||
const Data = { AppId, CompId, BranchId };
|
||||
if (Scantemplatedata?.Scantemplate && (Scantemplatedata?.changetemp == 'Combo')) {
|
||||
console.log("dont want any changes")
|
||||
} else
|
||||
if (Scantemplatedata?.changetemp == 'Layout' && (Scantemplatedata?.OldTemp == 'Combo1' ||
|
||||
Scantemplatedata?.OldTemp == 'Combo2')) {
|
||||
if (
|
||||
Scantemplatedata?.Scantemplate &&
|
||||
Scantemplatedata?.changetemp == 'Combo'
|
||||
) {
|
||||
console.log('dont want any changes');
|
||||
} else if (
|
||||
Scantemplatedata?.changetemp == 'Layout' &&
|
||||
(Scantemplatedata?.OldTemp == 'Combo1' ||
|
||||
Scantemplatedata?.OldTemp == 'Combo2')
|
||||
) {
|
||||
let tempdata = {
|
||||
BookingLayout: [
|
||||
'Layout2',
|
||||
|
|
@ -397,13 +396,21 @@ const BookingPage = () => {
|
|||
],
|
||||
],
|
||||
};
|
||||
await dispatch(changeScanTemplate({ Scantemplate: false, changetemp: Scantemplatedata?.changetemp, Template: tempdata, OldTemp: Scantemplatedata?.OldTemp }))
|
||||
await dispatch(
|
||||
changeScanTemplate({
|
||||
Scantemplate: false,
|
||||
changetemp: Scantemplatedata?.changetemp,
|
||||
Template: tempdata,
|
||||
OldTemp: Scantemplatedata?.OldTemp,
|
||||
})
|
||||
);
|
||||
// setIsmounted(false)
|
||||
}
|
||||
else {
|
||||
const templateResponse = await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap();
|
||||
} else {
|
||||
const templateResponse = await dispatch(
|
||||
getTemplate({ CompId, BranchId, AppId })
|
||||
).unwrap();
|
||||
dispatch(getPrintSelectionComponentData(Data)).unwrap();
|
||||
setTemplateLoaded(true)
|
||||
setTemplateLoaded(true);
|
||||
if (
|
||||
!templateResponse?.data?.data ||
|
||||
templateResponse.data.data.length === 0
|
||||
|
|
@ -417,7 +424,6 @@ const BookingPage = () => {
|
|||
// }
|
||||
}
|
||||
// Check if template data is empty or not
|
||||
|
||||
};
|
||||
const Advance = PricingAppPricingName?.some(
|
||||
(item) => item.PricingName === 'Premium'
|
||||
|
|
@ -429,7 +435,11 @@ const BookingPage = () => {
|
|||
(item) => item?.FeatureAddonName?.toLowerCase() === 'customized template'
|
||||
);
|
||||
if (PricingAppPricingName?.length === 0) return;
|
||||
console.log(PricingAppPricingName,FeatureAddonData,"FeatureAddonDataFeatureAddonData")
|
||||
console.log(
|
||||
PricingAppPricingName,
|
||||
FeatureAddonData,
|
||||
'FeatureAddonDataFeatureAddonData'
|
||||
);
|
||||
if (PricingAppPricingName?.length > 0) {
|
||||
if (Advance) {
|
||||
fetchData('Advance');
|
||||
|
|
@ -493,19 +503,21 @@ const BookingPage = () => {
|
|||
// };
|
||||
if (ismounted)
|
||||
return (
|
||||
<div style={{
|
||||
position: "fixed",
|
||||
top: "0",
|
||||
left: "0",
|
||||
right: "0",
|
||||
bottom: "0",
|
||||
height: "100vh",
|
||||
width: "100vw",
|
||||
backgroundColor: "#fff"
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
position: 'fixed',
|
||||
top: '0',
|
||||
left: '0',
|
||||
right: '0',
|
||||
bottom: '0',
|
||||
height: '100vh',
|
||||
width: '100vw',
|
||||
backgroundColor: '#fff',
|
||||
}}
|
||||
>
|
||||
<Loader />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
return (
|
||||
<div style={{ backgroundColor: '#fff !important' }}>
|
||||
{Object.keys(templateData)?.length > 0 ? (
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ const BSC1NavBar = (props) => {
|
|||
)}
|
||||
|
||||
{!isMobile && (
|
||||
<div ClassName="comboPrinterIcon">
|
||||
<div className="comboPrinterIcon">
|
||||
<BSPrinterSetting />
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import './BSTImer.scss';
|
||||
import { FaCalendar } from "react-icons/fa";
|
||||
import { GoClockFill } from "react-icons/go";
|
||||
|
||||
import { ExtractDateFormate } from '../../../../Services/Others';
|
||||
|
||||
const useCurrentTime = () => {
|
||||
|
|
@ -15,7 +14,6 @@ const useCurrentTime = () => {
|
|||
return currentTime;
|
||||
};
|
||||
|
||||
|
||||
const LiveTimer = () => {
|
||||
// Initialize state for current time
|
||||
const [currentTime, setCurrentTime] = useState(new Date());
|
||||
|
|
@ -52,43 +50,22 @@ const LiveTimer = () => {
|
|||
|
||||
export default LiveTimer;
|
||||
|
||||
|
||||
export const TimeDisplay = () => {
|
||||
const currentTime = useCurrentTime();
|
||||
|
||||
const formatTime = (date) =>
|
||||
date.toLocaleTimeString("en-US", {
|
||||
date.toLocaleTimeString('en-US', {
|
||||
hour12: true,
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="timedate">
|
||||
{formatTime(currentTime)}
|
||||
</div>
|
||||
);
|
||||
return <div className="timedate">{formatTime(currentTime)}</div>;
|
||||
};
|
||||
|
||||
export const DateDisplay = () => {
|
||||
const currentDate = useCurrentTime();
|
||||
|
||||
// const formatDate = (date) => {
|
||||
// const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||
// const months = [
|
||||
// "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
// "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
// ];
|
||||
// return `${days[date.getDay()]} ${date.getDate()} ${months[date.getMonth()]}`;
|
||||
// };
|
||||
|
||||
return (
|
||||
<div className="datesNew">
|
||||
{ExtractDateFormate(currentDate)}
|
||||
</div>
|
||||
);
|
||||
return <div className="datesNew">{ExtractDateFormate(currentDate)}</div>;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ import { BiSolidPhoneCall } from 'react-icons/bi';
|
|||
import { PiSignOutLight } from 'react-icons/pi';
|
||||
import PozoSwapIcon from '../UtillComponents/Pozo retail icons/PozoSwapIcon.jsx';
|
||||
import { MdEdit } from 'react-icons/md';
|
||||
import { CgSearchLoading } from "react-icons/cg";
|
||||
import { CgSearchLoading } from 'react-icons/cg';
|
||||
import UserRelieveManager from '../../Template/RealivingUser.jsx';
|
||||
import user from '../../../../Images/dashboard/user.jpg';
|
||||
import BSNavBarUserInfo from './BSNavBarUserInfo';
|
||||
|
|
@ -132,6 +132,7 @@ const BSNavbar1 = (props) => {
|
|||
const [Navmenu, setNavmenu] = useState(false);
|
||||
const [isAccOpen, setAccIsOpen] = useState(false);
|
||||
const [formattedDate, setFormattedDate] = useState('');
|
||||
|
||||
// const [FeatureAddonData, setFeatureAddonData] = useState([]);
|
||||
const [paymentfeataddon, setpaymentfeataddon] = useState(false);
|
||||
const [addcustomer, setAddCustomer] = useState(false);
|
||||
|
|
@ -314,11 +315,6 @@ const BSNavbar1 = (props) => {
|
|||
getFeatureAddonData();
|
||||
}
|
||||
}, [FeatureAddonData]);
|
||||
// useEffect(() => {
|
||||
// if (BranchId) {
|
||||
// Combodata();
|
||||
// }
|
||||
// }, [BranchId, AppId, CompId]);
|
||||
|
||||
const fetchBranchData = async () => {
|
||||
if (UserType === 'Super Admin' || UserType === 'Super Admin User') {
|
||||
|
|
@ -390,7 +386,6 @@ const BSNavbar1 = (props) => {
|
|||
navigate(`${subDirectory}app-page/branch-login`);
|
||||
};
|
||||
|
||||
const notificationView = () => {};
|
||||
//mohan
|
||||
const Logout = async () => {
|
||||
const status = 'N'; // replace with your actual status
|
||||
|
|
@ -456,14 +451,6 @@ const BSNavbar1 = (props) => {
|
|||
}
|
||||
};
|
||||
|
||||
const handleClick = async () => {
|
||||
if (Comboglobal == false) {
|
||||
await dispatch(changeCombosearch(true));
|
||||
} else {
|
||||
await dispatch(changeCombosearch(false));
|
||||
}
|
||||
};
|
||||
|
||||
// const Combodata = async () => {
|
||||
// let data = {
|
||||
// AppId: AppId,
|
||||
|
|
@ -638,16 +625,13 @@ const BSNavbar1 = (props) => {
|
|||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
|
||||
{/* Multiple search */}
|
||||
<Tooltip title={'Multiple Search'}>
|
||||
<div className='MultiSearchIconDiv'>
|
||||
<div className="MultiSearchIconDiv">
|
||||
<CgSearchLoading onClick={() => setMultiple(true)} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
|
||||
|
||||
{!OtherServicesglobal && (
|
||||
<>
|
||||
{navbarOptions?.map((item) => (
|
||||
|
|
@ -672,27 +656,6 @@ const BSNavbar1 = (props) => {
|
|||
<BSNavBarComboSearch SessionData={SessionData} />
|
||||
</div>
|
||||
)}
|
||||
{/* {ComboDropDown?.length >= 1 && (
|
||||
<div style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }}>
|
||||
<TooltipWrapper title="Combo Product" isMobile={isMobile}>
|
||||
<div
|
||||
onClick={handleClick}
|
||||
className="BSBillingNavBar1-AllIcons"
|
||||
style={{
|
||||
width: '1.49rem',
|
||||
margin: '10px',
|
||||
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
<PozoComboProductIcon
|
||||
fill={Comboglobal === true ? '#52C41A' : '#1292EE'}
|
||||
/>
|
||||
</div>
|
||||
|
||||
</TooltipWrapper>
|
||||
</div>
|
||||
)} */}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -1316,9 +1279,7 @@ const BSNavbar1 = (props) => {
|
|||
destroyOnClose={true}
|
||||
children={
|
||||
<>
|
||||
<MultipleSearch
|
||||
close={setMultiple}
|
||||
/>
|
||||
<MultipleSearch close={setMultiple} />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ const BranchLogin = () => {
|
|||
value: option?.UserId,
|
||||
label: option?.UserName,
|
||||
}))}
|
||||
label={<label class="required">User Name</label>}
|
||||
label={<label className="required">User Name</label>}
|
||||
className="field-DropDown"
|
||||
onChangeFunction={(e) => UserDropDownChange(e)}
|
||||
isOnchanges={selectedUserData ? true : false}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
import { useCallback, useEffect, useRef, useState,lazy, Suspense } from 'react';
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
lazy,
|
||||
Suspense,
|
||||
} from 'react';
|
||||
import { useNavigate, useOutletContext } from 'react-router-dom';
|
||||
import { shallowEqual, useDispatch } from 'react-redux';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
|
@ -13,12 +20,12 @@ const TopSellingProductsChart = lazy(
|
|||
() => import('./TopSellingProductsChart.jsx')
|
||||
);
|
||||
|
||||
import sandClock from '../../Images/sandClock.png';
|
||||
import Add from '../../Images/dashboard/Add.png';
|
||||
import AddPurchase from '../../Images/dashboard/AddPurchase.png';
|
||||
import invoice from '../../Images/dashboard/invoice.png';
|
||||
import user from '../../Images/dashboard/user.jpg';
|
||||
import report from '../../Images/dashboard/report.png';
|
||||
import sandClock from '../../Images/sandClock.webp';
|
||||
import Add from '../../Images/dashboard/Add.webp';
|
||||
import AddPurchase from '../../Images/dashboard/AddPurchase.webp';
|
||||
import invoice from '../../Images/dashboard/invoice.webp';
|
||||
import user from '../../Images/dashboard/user.webp';
|
||||
import report from '../../Images/dashboard/report.webp';
|
||||
|
||||
import {
|
||||
GlobalPricingAppPricingName,
|
||||
|
|
@ -55,6 +62,7 @@ import {
|
|||
GenerateLogout,
|
||||
getCompBranchData,
|
||||
getEmpAccesData,
|
||||
GlobalCompBranchData,
|
||||
GLobalSadminUserData,
|
||||
GlobalSelectedBranchId,
|
||||
PostLoginSuser,
|
||||
|
|
@ -62,9 +70,8 @@ import {
|
|||
} from '../../Features/BrachLogin/BranchLogin.js';
|
||||
import { getPurchasedAppDetails } from '../../Features/BookingScreen/Pricing/Pricing.js';
|
||||
|
||||
|
||||
const BSNavBarUserInfo = lazy(() =>
|
||||
import('../BookingScreen/Components/BSNavbar/BSNavBarUserInfo')
|
||||
const BSNavBarUserInfo = lazy(
|
||||
() => import('../BookingScreen/Components/BSNavbar/BSNavBarUserInfo')
|
||||
);
|
||||
const DefaultModal = lazy(() =>
|
||||
import('../../Components/Modal/DefaultModal').then((m) => ({
|
||||
|
|
@ -92,10 +99,12 @@ import { UserDataBasedOnBranchId } from '../../Features/Reports/Reports.js';
|
|||
import Loader from '../../Components/Loader/Loader.jsx';
|
||||
import { getUserProfile } from '../../Features/UserAccount/userData.js';
|
||||
import { Messages } from '../../Components/Notifications/Messages.jsx';
|
||||
import TabSwitcher from './TabSwitcher.jsx';
|
||||
|
||||
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const RetailDashboard = () => {
|
||||
const selection = useSelector((state) => state.DashBoard.activeTab);
|
||||
const today = new Date();
|
||||
const year = today.getFullYear();
|
||||
const month = today.getMonth();
|
||||
|
|
@ -107,11 +116,9 @@ const RetailDashboard = () => {
|
|||
const intialToDate = formatDate(today);
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const CompBranchDataGlobal = useSelector(GlobalCompBranchData);
|
||||
const { RangePicker } = DatePicker;
|
||||
const tabs = [
|
||||
{ value: 'dashboard', label: 'Dashboard' },
|
||||
{ value: 'top-selling-products', label: 'Top Selling Products' },
|
||||
];
|
||||
|
||||
const { setCollapse } = useOutletContext();
|
||||
const SessionData = useSelector(StoredSessionData, shallowEqual);
|
||||
const PricingAppPricingName = useSelector(
|
||||
|
|
@ -138,7 +145,6 @@ const RetailDashboard = () => {
|
|||
const UserType = getSession('UserType');
|
||||
const sessionId = getSession('SessionId');
|
||||
const BrLength = getSession('BranchLength');
|
||||
const [selection, setSelection] = useState('dashboard');
|
||||
const [page, setPage] = useState(1);
|
||||
const [totalPages, setTotalPages] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
|
@ -244,7 +250,6 @@ const RetailDashboard = () => {
|
|||
date: item?.SalesDate,
|
||||
};
|
||||
}) || [];
|
||||
console.log(DineInData, 'DineInData');
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getUserProfile({ UserId: UserId, ActiveStatus: 'A' })).unwrap();
|
||||
|
|
@ -258,6 +263,7 @@ const RetailDashboard = () => {
|
|||
dates?.[1]?.format('DD-MM-YYYY'),
|
||||
]);
|
||||
} else {
|
||||
// alert
|
||||
setIsInitialLoad(false);
|
||||
initializeData();
|
||||
getInitialdataForPendingBills();
|
||||
|
|
@ -294,7 +300,7 @@ const RetailDashboard = () => {
|
|||
// First fetch branch data as other calls depend on it
|
||||
await fetchBranchData();
|
||||
|
||||
// Then fetch other data that doesn't depend on branch selection
|
||||
// Then fetch other data that doesn't depend on branch
|
||||
await Promise.all([
|
||||
fetchData(),
|
||||
getAllProdId(),
|
||||
|
|
@ -560,7 +566,7 @@ const RetailDashboard = () => {
|
|||
).unwrap();
|
||||
setEmpAccess(EmpAcessRepsonse?.data?.data);
|
||||
}
|
||||
|
||||
console.log(CompBranchDataGlobal, 'CompBranchDataGlobal', branchName);
|
||||
const response = await dispatch(
|
||||
getCompBranchData({ AppId: AppId, UserId: UserId, CompId: CompId })
|
||||
).unwrap();
|
||||
|
|
@ -980,6 +986,7 @@ const RetailDashboard = () => {
|
|||
setIsLoadingDashboard(false);
|
||||
}
|
||||
};
|
||||
|
||||
const dateFormat = 'DD-MM-YYYY';
|
||||
|
||||
const onChangeBranchFilter = async (branchId) => {
|
||||
|
|
@ -1370,9 +1377,9 @@ const RetailDashboard = () => {
|
|||
</div>
|
||||
);
|
||||
|
||||
const handleSelectChange = (value) => {
|
||||
setSelection(value);
|
||||
};
|
||||
// const handleSelectChange = (value) => {
|
||||
// setSelection(value);
|
||||
// };
|
||||
|
||||
return (
|
||||
<div className="RetailDashboard-Master">
|
||||
|
|
@ -1442,15 +1449,7 @@ const RetailDashboard = () => {
|
|||
{/* <div style={{ fontSize: '18px', fontWeight: '500' }}>Dashboard</div> */}
|
||||
{/* public Login dashboard*/}
|
||||
<div className="tab-switcher">
|
||||
{tabs?.map((tab) => (
|
||||
<button
|
||||
key={tab.value}
|
||||
className={`tab-button ${selection === tab?.value ? 'active' : ''}`}
|
||||
onClick={() => handleSelectChange(tab?.value)}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
<TabSwitcher />
|
||||
</div>
|
||||
|
||||
{/* Branch Filter Dropdown */}
|
||||
|
|
@ -2381,7 +2380,7 @@ const RetailDashboard = () => {
|
|||
</Suspense>
|
||||
</>
|
||||
)}
|
||||
<Suspense fallback={null}>
|
||||
<Suspense fallback={null}>
|
||||
<DefaultModal
|
||||
open={modal}
|
||||
title="Authentication"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { setActiveTab } from '../../Features/RetailDashboard/Dashboard';
|
||||
|
||||
const TabSwitcher = ({ className = '' }) => {
|
||||
const dispatch = useDispatch();
|
||||
const activeTab = useSelector((state) => state.DashBoard.activeTab);
|
||||
const tabs = [
|
||||
{ value: 'dashboard', label: 'Dashboard' },
|
||||
{ value: 'top-selling-products', label: 'Top Selling Products' },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className={`tab-switcher ${className}`}>
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.value}
|
||||
className={`tab-button ${activeTab === tab.value ? 'active' : ''}`}
|
||||
onClick={() => dispatch(setActiveTab(tab.value))}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TabSwitcher;
|
||||
|
|
@ -25,10 +25,11 @@ import Pricing from '../Features/BookingScreen/Pricing/Pricing';
|
|||
import StockPriceUpdate from '../Features/StockPriceUpdate/StockPriceUpdateMaster';
|
||||
import taxSlice from '../Features/Tax/Tax';
|
||||
import Paymentoptions from '../Features/Payment/Paymentoptions/Paymentoptions';
|
||||
import userAccount from '../Features/UserAccount/userData.js';
|
||||
import OtherServices from "../Features/OtherServices/OtherServices.js"
|
||||
import BookingOFferNew from '../Features/Offer/Offernew/BookingOffernew.js';
|
||||
import SlotManagement from '../Features/SlotManagement/SlotManagement.js';
|
||||
import userAccount from '../Features/UserAccount/userData';
|
||||
import OtherServices from '../Features/OtherServices/OtherServices';
|
||||
import BookingOFferNew from '../Features/Offer/Offernew/BookingOffernew';
|
||||
import SlotManagement from '../Features/SlotManagement/SlotManagement';
|
||||
import DashBoard from '../Features/RetailDashboard/Dashboard';
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
Paymentoptions: Paymentoptions,
|
||||
|
|
@ -61,6 +62,7 @@ const store = configureStore({
|
|||
OtherServices: OtherServices,
|
||||
BookingOFferNew: BookingOFferNew,
|
||||
SlotManagement: SlotManagement,
|
||||
DashBoard:DashBoard,
|
||||
},
|
||||
middleware: (getDefaultMiddleware) =>
|
||||
getDefaultMiddleware({
|
||||
|
|
|
|||
|
|
@ -672,56 +672,7 @@ const Productcatlogue = lazy(
|
|||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON;
|
||||
|
||||
const fetchComponent = async () => {
|
||||
try {
|
||||
// sessionStore('AppId', 82);
|
||||
// sessionStore('BranchId', 404);
|
||||
// sessionStore('AppName', 'Sports');
|
||||
// sessionStore('CompId', 256);
|
||||
// sessionStore('MobileNo', '9698838966');
|
||||
// sessionStore('UserType', 'Admin');
|
||||
// sessionStore('UserId', 3128);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTY5ODgzODk2NiIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY3OTg0OTk1LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.dbwbvmzkddUYIDrLif1jKC8n5ZiOUqpWdW1Xeq1tGuc'
|
||||
// );
|
||||
|
||||
// sessionStore('AppId', 1);
|
||||
// sessionStore('BranchId', 121);
|
||||
// sessionStore('AppName', 'Bakery');
|
||||
// sessionStore('CompId', 72);
|
||||
// sessionStore('MobileNo', '8072329153');
|
||||
// sessionStore('UserType', 'Admin');
|
||||
// sessionStore('UserId', 39);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiODA3MjMyOTE1MyIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY3NzIzOTk0LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.Uyham6EJoEgXqhVQFyWPPcs1cclWpWT9jedyrxOzAI4'
|
||||
// );
|
||||
|
||||
// sessionStore("AppId", 1)
|
||||
// sessionStore("BranchId", 127)
|
||||
// sessionStore("AppName", "Restaraunt")
|
||||
// sessionStore("CompId", 77)
|
||||
// sessionStore("MobileNo", "9972702376")
|
||||
// sessionStore("UserType", "Admin")
|
||||
// sessionStore("UserId", 1791)
|
||||
// sessionStore("userName", "Karthiga")
|
||||
// sessionStorage.setItem('auth', "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTk3MjcwMjM3NiIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY1OTEyODgyLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.OxzLs_XOl61Rs-PgLdWAUiYscycnOcyckQ_QeviwpAY")
|
||||
|
||||
// sessionStore('AppId', 1);
|
||||
// sessionStore('BranchId', 435);
|
||||
// sessionStore('AppName', 'Bakery');
|
||||
// sessionStore('CompId', 280);
|
||||
// sessionStore('MobileNo', '9360642222');
|
||||
// sessionStore('UserType', 'Admin');
|
||||
// sessionStore('UserId', 3308);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MDY0MjIyMiIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY3OTg2MDI1LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.bHBj3BFUflN62gdSlS6qFqL6cDlGZqOwcRBJTFB-Zy8'
|
||||
// );
|
||||
const initSession = () => {
|
||||
sessionStore('AppId', 1);
|
||||
sessionStore('BranchId', 437);
|
||||
sessionStore('AppName', 'Bakery');
|
||||
|
|
@ -730,135 +681,68 @@ const fetchComponent = async () => {
|
|||
sessionStore('UserType', 'Admin');
|
||||
sessionStore('UserId', 3333);
|
||||
sessionStore('userName', 'Karthiga');
|
||||
|
||||
sessionStorage.setItem(
|
||||
'auth',
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MDY0MjI0NCIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzcwNzQ5MjkxLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.aXnhbA3ReRVyt8denDX_LK_ecVBiG5KdeHsurVR7iwQ'
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MDY0MjI0NCIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzcwOTIyMDEyLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.8iuEF8S7kW1OvVUda3YAx9v7ilp-uy9PVfbBvCPoq20'
|
||||
);
|
||||
};
|
||||
|
||||
const getAppType = async () => {
|
||||
// 🔥 If already stored, don't call API again
|
||||
const storedType = getSession('AppType');
|
||||
if (storedType) {
|
||||
return storedType === 'Wholesale';
|
||||
}
|
||||
|
||||
const AppId = getSession('AppId');
|
||||
if (AppId != null && AppId != undefined) {
|
||||
if (!AppId) return null;
|
||||
|
||||
const response = await axios.get(
|
||||
`${apiCommonUrl}/application?AppId=${AppId}`
|
||||
);
|
||||
const subCategoryName = response?.data?.data?.[0]?.SubCategoryName;
|
||||
if (subCategoryName?.toLowerCase() == 'wholesale') {
|
||||
sessionStore('AppType', 'Wholesale');
|
||||
return import('./Pages/AppPage/WholesaleAppPage.jsx');
|
||||
} else {
|
||||
sessionStore('AppType', 'Sale');
|
||||
return import('./Pages/AppPage/AppPage.jsx');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('API call failed:', error);
|
||||
return null; // Return null in case of error
|
||||
|
||||
const subCategoryName =
|
||||
response?.data?.data?.[0]?.SubCategoryName?.toLowerCase();
|
||||
|
||||
const isWholesale = subCategoryName === 'wholesale';
|
||||
|
||||
sessionStore('AppType', isWholesale ? 'Wholesale' : 'Sale');
|
||||
|
||||
return isWholesale;
|
||||
};
|
||||
|
||||
const fetchComponent = async () => {
|
||||
try {
|
||||
initSession();
|
||||
|
||||
const isWholesale = await getAppType();
|
||||
if (isWholesale === null) return null;
|
||||
|
||||
return isWholesale
|
||||
? import('./Pages/AppPage/WholesaleAppPage.jsx')
|
||||
: import('./Pages/AppPage/AppPage.jsx');
|
||||
} catch (err) {
|
||||
console.error('API call failed:', err);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const fetchHomeComponent = async () => {
|
||||
try {
|
||||
// sessionStore('AppId', 82);
|
||||
// sessionStore('BranchId', 404);
|
||||
// sessionStore('AppName', 'Sports');
|
||||
// sessionStore('CompId', 256);
|
||||
// sessionStore('MobileNo', '9698838966');
|
||||
// sessionStore('UserType', 'Admin');
|
||||
// sessionStore('UserId', 3128);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTY5ODgzODk2NiIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY3OTg0OTk1LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.dbwbvmzkddUYIDrLif1jKC8n5ZiOUqpWdW1Xeq1tGuc'
|
||||
// );
|
||||
// sessionStore('AppId', 104);
|
||||
// sessionStore('BranchId', 817);
|
||||
// sessionStore('AppName', 'Sports');
|
||||
// sessionStore('CompId', 678);
|
||||
// sessionStore('MobileNo', '9698838966');
|
||||
// sessionStore('UserType', 'Admin');
|
||||
// sessionStore('UserId', 2257);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTY5ODgzODk2NiIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwczovL2FwaS5wb3pvLmRldi9wb3pvLXJldGFpbC1hcGkiLCJodHRwczovL2FwaS5wb3pvLmRldi9wb3pvLWNvbW1vbi1hcGkiLCJodHRwczovL2FwaS5wb3pvLmRldi9wb3pvLXNtcy1lbWFpbC10ZW1wbGF0ZS1hcGkiLCJodHRwczovL2FwaS5wb3pvLmRldi9wb3pvLWNvbW1vbi1hcGkiXSwiZXhwIjoxNzY3MDQ4NjgwLCJpc3MiOiJodHRwczovL2FwaS5wb3pvLmRldi9Kd3RUb2tlbiJ9.Pi3XXzF1LmZLy8q2NDvjcK6BlUmJO4hHUAa1Rld7h6s'
|
||||
// );
|
||||
initSession();
|
||||
|
||||
// sessionStore('AppId', 26);
|
||||
// sessionStore('BranchId', 85);
|
||||
// sessionStore('AppName', 'Bakery');
|
||||
// sessionStore('CompId', 78);
|
||||
// sessionStore('MobileNo', '9362311570');
|
||||
// sessionStore('UserType', 'Super Admin');
|
||||
// sessionStore('UserId', 1);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MjMxMTU3MCIsIlBhc3N3b3JkIjoiWkB6OTM3MCIsImF1ZCI6WyJodHRwczovL2FwaS5wb3pvLmFwcC9wb3pvLWNvbW1vbi1hcGkiLCJodHRwczovL2FwaS5wb3pvLmFwcC9wb3pvLWNvbW1vbi1hcGktdGVzdCIsImh0dHBzOi8vYXBpLnBvem8uYXBwL3Bvem8tcmV0YWlsLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uYXBwL3Bvem8tc21zLWVtYWlsLXRlbXBsYXRlLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uYXBwL3Bvem8tY29tbW9uLWFwaSJdLCJleHAiOjE3NjMxOTAxMTAsImlzcyI6Imh0dHBzOi8vYXBpLnBvem8uYXBwL0p3dFRva2VuIn0.nkx5p-533gEM7Dd8J8SiTzLJrnNEMcyLp4iBdz5s8LA'
|
||||
// // );
|
||||
// sessionStore('AppId', 1);
|
||||
// sessionStore('BranchId', 121);
|
||||
// sessionStore('AppName', 'Bakery');
|
||||
// sessionStore('CompId', 72);
|
||||
// sessionStore('MobileNo', '8072329153');
|
||||
// sessionStore('UserType', 'Admin');
|
||||
// sessionStore('UserId', 39);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiODA3MjMyOTE1MyIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY3NzIzOTk0LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.Uyham6EJoEgXqhVQFyWPPcs1cclWpWT9jedyrxOzAI4'
|
||||
// );
|
||||
const isWholesale = await getAppType();
|
||||
if (isWholesale === null) return null;
|
||||
|
||||
// sessionStore('AppId', 1);
|
||||
// sessionStore('BranchId', 435);
|
||||
// sessionStore('AppName', 'Bakery');
|
||||
// sessionStore('CompId', 280);
|
||||
// sessionStore('MobileNo', '9360642222');
|
||||
// sessionStore('UserType', 'Admin');
|
||||
// sessionStore('UserId', 3308);
|
||||
// sessionStore('userName', 'Karthiga');
|
||||
// sessionStorage.setItem(
|
||||
// 'auth',
|
||||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MDY0MjIyMiIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY3OTg2MDI1LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.bHBj3BFUflN62gdSlS6qFqL6cDlGZqOwcRBJTFB-Zy8'
|
||||
// );
|
||||
// sessionStore("AppId", 1)
|
||||
// sessionStore("BranchId", 127)
|
||||
// sessionStore("AppName", "Restaraunt")
|
||||
// sessionStore("CompId", 77)
|
||||
// sessionStore("MobileNo", "9972702376")
|
||||
// sessionStore("UserType", "Admin")
|
||||
// sessionStore("UserId", 1791)
|
||||
// sessionStore("userName", "Karthiga")
|
||||
// sessionStorage.setItem('auth', "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTk3MjcwMjM3NiIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzY1OTEyODgyLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.OxzLs_XOl61Rs-PgLdWAUiYscycnOcyckQ_QeviwpAY")
|
||||
sessionStore('AppId', 1);
|
||||
sessionStore('BranchId', 437);
|
||||
sessionStore('AppName', 'Bakery');
|
||||
sessionStore('CompId', 281);
|
||||
sessionStore('MobileNo', '9360642244');
|
||||
sessionStore('UserType', 'Admin');
|
||||
sessionStore('UserId', 3333);
|
||||
sessionStore('userName', 'Karthiga');
|
||||
sessionStorage.setItem(
|
||||
'auth',
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MDY0MjI0NCIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzcwNzQ5MjkxLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.aXnhbA3ReRVyt8denDX_LK_ecVBiG5KdeHsurVR7iwQ'
|
||||
);
|
||||
|
||||
const AppId = getSession('AppId');
|
||||
if (AppId) {
|
||||
const response = await axios.get(
|
||||
`${apiCommonUrl}/application?AppId=${AppId}`
|
||||
);
|
||||
const subCategoryName = response?.data?.data?.[0]?.SubCategoryName;
|
||||
if (subCategoryName?.toLowerCase() == 'wholesale') {
|
||||
sessionStore('AppType', 'Wholesale');
|
||||
return import('./Pages/DashBoard/WholesaleDashboard.jsx');
|
||||
} else {
|
||||
sessionStore('AppType', 'Sale');
|
||||
return import('./Pages/DashBoard/RetailDashboard.jsx');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('API call failed:', error);
|
||||
return null; // Return null in case of error
|
||||
return isWholesale
|
||||
? import('./Pages/DashBoard/WholesaleDashboard.jsx')
|
||||
: import('./Pages/DashBoard/RetailDashboard.jsx');
|
||||
} catch (err) {
|
||||
console.error('API call failed:', err);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const routesConfig = [
|
||||
{ path: `${subDirectory}customer-display`, component: CustomerDisplay },
|
||||
{ path: `${subDirectory}PricingPage`, component: PricingPage },
|
||||
|
|
|
|||