diff --git a/src/AuthContext.jsx b/src/AuthContext.jsx index 825ee8b..8639e99 100644 --- a/src/AuthContext.jsx +++ b/src/AuthContext.jsx @@ -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 ( { + 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; diff --git a/src/Images/dashboard/Add.png b/src/Images/dashboard/Add.png deleted file mode 100644 index 8980113..0000000 Binary files a/src/Images/dashboard/Add.png and /dev/null differ diff --git a/src/Images/dashboard/Add.webp b/src/Images/dashboard/Add.webp new file mode 100644 index 0000000..2217de7 Binary files /dev/null and b/src/Images/dashboard/Add.webp differ diff --git a/src/Images/dashboard/AddPurchase.png b/src/Images/dashboard/AddPurchase.png deleted file mode 100644 index 1be94dc..0000000 Binary files a/src/Images/dashboard/AddPurchase.png and /dev/null differ diff --git a/src/Images/dashboard/AddPurchase.webp b/src/Images/dashboard/AddPurchase.webp new file mode 100644 index 0000000..b7927fc Binary files /dev/null and b/src/Images/dashboard/AddPurchase.webp differ diff --git a/src/Images/dashboard/invoice.png b/src/Images/dashboard/invoice.png deleted file mode 100644 index 8042454..0000000 Binary files a/src/Images/dashboard/invoice.png and /dev/null differ diff --git a/src/Images/dashboard/invoice.webp b/src/Images/dashboard/invoice.webp new file mode 100644 index 0000000..3fefbcd Binary files /dev/null and b/src/Images/dashboard/invoice.webp differ diff --git a/src/Images/dashboard/report.png b/src/Images/dashboard/report.png deleted file mode 100644 index 8ee9264..0000000 Binary files a/src/Images/dashboard/report.png and /dev/null differ diff --git a/src/Images/dashboard/report.webp b/src/Images/dashboard/report.webp new file mode 100644 index 0000000..108da9a Binary files /dev/null and b/src/Images/dashboard/report.webp differ diff --git a/src/Images/dashboard/user.webp b/src/Images/dashboard/user.webp new file mode 100644 index 0000000..9ac27a5 Binary files /dev/null and b/src/Images/dashboard/user.webp differ diff --git a/src/Images/sandClock.webp b/src/Images/sandClock.webp new file mode 100644 index 0000000..4955977 Binary files /dev/null and b/src/Images/sandClock.webp differ diff --git a/src/Pages/AppPage/AppPage.jsx b/src/Pages/AppPage/AppPage.jsx index bd7ca4f..265f8e9 100644 --- a/src/Pages/AppPage/AppPage.jsx +++ b/src/Pages/AppPage/AppPage.jsx @@ -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,36 +310,57 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); getSession('UserType') === 'Super Admin' || getSession('UserType') === 'Super Admin User' ) { - 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( - changeSelectedBranchId(response?.data?.data?.[0]?.BrId) - ); + 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); + + if (response?.data?.data?.length == 1) { + await sessionStore('BranchId', response?.data?.data?.[0]?.BrId); + await dispatch( + changeSelectedBranchId(response?.data?.data?.[0]?.BrId) + ); + } } } } else if ( getSession('UserType') === 'Admin' || - getSession('UserType') === 'Admin User' - || getSession('UserType') === 'Employee' + getSession('UserType') === 'Admin User' || + getSession('UserType') === 'Employee' ) { - const response = await dispatch( - getCompBranchData({ AppId: AppId, UserId: UserId, CompId: CompId }) - ).unwrap(); - if (response?.data?.statusCode === 1) { - await sessionStore('BranchLength', response?.data?.data?.length); - 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)); - await dispatch( - changeSelectedBranchId(response?.data?.data?.[0]?.BrId) - ); + 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(); + if (response?.data?.statusCode === 1) { + await sessionStore('BranchLength', response?.data?.data?.length); + 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)); + } + await dispatch( + changeSelectedBranchId(response?.data?.data?.[0]?.BrId) + ); + } } } } @@ -397,13 +416,13 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); getsubItem('Add Rack', `${subDirectory}setting/rack-master`), ] ), - - getsubItem('Employee', `${subDirectory}employee`, null, [ - getsubItem('Add Employee', `${subDirectory}setting/employee-master`), - getsubItem('Employee Access', `${subDirectory}setting/employee-access`), - ]), - getsubItem('Common Master', `${subDirectory}setting/common-master`), - getsubItem('Tax', `${subDirectory}setting/admin-tax`), + + getsubItem('Employee', `${subDirectory}employee`, null, [ + getsubItem('Add Employee', `${subDirectory}setting/employee-master`), + getsubItem('Employee Access', `${subDirectory}setting/employee-access`), + ]), + getsubItem('Common Master', `${subDirectory}setting/common-master`), + getsubItem('Tax', `${subDirectory}setting/admin-tax`), !iswarehouse && getsubItem('Other Services', `${subDirectory}setting/other-services`), @@ -477,18 +496,24 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); `${subDirectory}setting/supplierproductmapping-master` ), ]), - !sportsAppPreference && getsubItem('Stock Transfer', `${subDirectory}setting/stocktransfer`, null, [ + !sportsAppPreference && getsubItem( - 'Create Transfer', - `${subDirectory}setting/stock-transferlist` - ), - - getsubItem( - 'Stock Dispatch', - `${subDirectory}setting/stock-dispatch` - ), - getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`), - ]), + 'Stock Transfer', + `${subDirectory}setting/stocktransfer`, + null, + [ + getsubItem( + 'Create Transfer', + `${subDirectory}setting/stock-transferlist` + ), + + getsubItem('Stock Dispatch', `${subDirectory}setting/stock-dispatch`), + getsubItem( + 'Received Stocks', + `${subDirectory}setting/receive-stocks` + ), + ] + ), getsubItem('Price Change', `${subDirectory}setting/price-change`), !sportsAppPreference && !iswarehouse && @@ -580,38 +605,37 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); 'GST Invoice Setup', `${subDirectory}setting/gst-invoice-setup` ), - (!iswarehouse) && - getsubItem('Customization', `${subDirectory}setting/Customize`, null, [ - - !iswarehouse - ? getsubItem( - 'Sales Screen', - `${subDirectory}saleslayouts/sales-selection` - ) - : '', - - !iswarehouse - ? getsubItem( - 'Print Forms', - `${subDirectory}saleslayouts/print-selection` - ) - : '', - featureaddDetails?.find( - (item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' - ) && !iswarehouse - ? getsubItem( - 'Kiosk Screen', - `${subDirectory}saleslayouts/kiosk-selection` - ) - : '', - - !iswarehouse - ? getsubItem( - 'Barcode / QR', - `${subDirectory}saleslayouts/barcode-qr-selection` - ) - : '', - ]), + !iswarehouse && + getsubItem('Customization', `${subDirectory}setting/Customize`, null, [ + !iswarehouse + ? getsubItem( + 'Sales Screen', + `${subDirectory}saleslayouts/sales-selection` + ) + : '', + + !iswarehouse + ? getsubItem( + 'Print Forms', + `${subDirectory}saleslayouts/print-selection` + ) + : '', + featureaddDetails?.find( + (item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' + ) && !iswarehouse + ? getsubItem( + 'Kiosk Screen', + `${subDirectory}saleslayouts/kiosk-selection` + ) + : '', + + !iswarehouse + ? getsubItem( + 'Barcode / QR', + `${subDirectory}saleslayouts/barcode-qr-selection` + ) + : '', + ]), //sree getsubItem('Shift', `${subDirectory}setting/shift-master`), getsubItem( @@ -1010,14 +1034,13 @@ 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`), - ]), - - getsubItem('Common Master', `${subDirectory}setting/common-master`), - getsubItem('Tax', `${subDirectory}setting/admin-tax`), + getsubItem('Employee', `${subDirectory}employee`, null, [ + getsubItem('Add Employee', `${subDirectory}setting/employee-master`), + getsubItem('Employee Access', `${subDirectory}setting/employee-access`), + ]), + + getsubItem('Common Master', `${subDirectory}setting/common-master`), + getsubItem('Tax', `${subDirectory}setting/admin-tax`), !iswarehouse && getsubItem('Other Services', `${subDirectory}setting/other-services`), @@ -1030,32 +1053,38 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); ]; const Purchase = [ - getsubItem('Automated Reorder', `${subDirectory}setting/automated-reorder`), - 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` - ), - getsubItem('Supplier', `${subDirectory}setting/supplier`, null, [ - getsubItem('Add Supplier', `${subDirectory}setting/supplier-master`), + getsubItem('Automated Reorder', `${subDirectory}setting/automated-reorder`), + 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` + ), + getsubItem('Supplier', `${subDirectory}setting/supplier`, null, [ + getsubItem('Add Supplier', `${subDirectory}setting/supplier-master`), + getsubItem( + 'Product Mapping', + `${subDirectory}setting/supplierproductmapping-master` + ), + ]), + !sportsAppPreference && + getsubItem( + 'Stock Transfer', + `${subDirectory}setting/stocktransfer`, + null, + [ getsubItem( - 'Product Mapping', - `${subDirectory}setting/supplierproductmapping-master` + 'Create Transfer', + `${subDirectory}setting/stock-transferlist` ), - ]), - !sportsAppPreference && getsubItem('Stock Transfer', `${subDirectory}setting/stocktransfer`, null, [ + getsubItem('Stock Dispatch', `${subDirectory}setting/stock-dispatch`), getsubItem( - 'Create Transfer', - `${subDirectory}setting/stock-transferlist` - ), - getsubItem( - 'Stock Dispatch', - `${subDirectory}setting/stock-dispatch` - ), - getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`), - ]), + '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( - 'Create Transfer', - `${subDirectory}setting/stock-transferlist` - ), - getsubItem( - 'Stock Dispatch', - `${subDirectory}setting/stock-dispatch` - ), - getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`), - ]), + 'Stock Transfer', + `${subDirectory}setting/stocktransfer`, + null, + [ + getsubItem( + 'Create Transfer', + `${subDirectory}setting/stock-transferlist` + ), + getsubItem('Stock Dispatch', `${subDirectory}setting/stock-dispatch`), + getsubItem( + 'Received Stocks', + `${subDirectory}setting/receive-stocks` + ), + ] + ), ]; const prodMenu = [ @@ -1302,17 +1337,15 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); 'GST Invoice Setup', `${subDirectory}setting/gst-invoice-setup` ), - ( - !iswarehouse) && + !iswarehouse && getsubItem('Customization', `${subDirectory}setting/Customize`, null, [ - !iswarehouse ? getsubItem( 'Sales Screen', `${subDirectory}saleslayouts/sales-selection` ) : '', - + !iswarehouse ? getsubItem( 'Print Forms', @@ -1327,7 +1360,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); `${subDirectory}saleslayouts/kiosk-selection` ) : '', - + !iswarehouse ? getsubItem( 'Barcode / QR', @@ -1424,7 +1457,7 @@ console.log(iswarehouse,'iswarehouseiswarehouseiswarehouse'); ) : '', ]; -const customizedmenuitem = [] + const customizedmenuitem = []; const AndroidAppMenuItem = [ getItem( 'Download', @@ -1661,26 +1694,22 @@ 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( - 'Employee Access', - `${subDirectory}setting/employee-access` - ), - // getsubItem( - // 'Commission / Incentive', - // `${subDirectory}setting/commission-or-incentive-master` - // ), - ]), + getsubItem('Employee', `${subDirectory}employee`, null, [ + // getsubItem('Shift', `${subDirectory}setting/shift-master`), + getsubItem('Add Employee', `${subDirectory}setting/employee-master`), + getsubItem( + 'Employee Access', + `${subDirectory}setting/employee-access` + ), + // getsubItem( + // 'Commission / Incentive', + // `${subDirectory}setting/commission-or-incentive-master` + // ), + ]), getsubItem('Config Type', `${subDirectory}setting/config-type`), - - getsubItem('Common Master', `${subDirectory}setting/common-master`), - getsubItem('Tax', `${subDirectory}setting/admin-tax`), + + getsubItem('Common Master', `${subDirectory}setting/common-master`), + getsubItem('Tax', `${subDirectory}setting/admin-tax`), !iswarehouse && getsubItem('Other Services', `${subDirectory}setting/other-services`), @@ -1718,22 +1747,26 @@ const customizedmenuitem = [] `${subDirectory}setting/supplierproductmapping-master` ), ]), - !sportsAppPreference && getsubItem( - 'Stock Transfer', - `${subDirectory}setting/stocktransfer`, - null, - [ - getsubItem( - 'Create Transfer', - `${subDirectory}setting/stock-transferlist` - ), + !sportsAppPreference && + getsubItem( + 'Stock Transfer', + `${subDirectory}setting/stocktransfer`, + null, + [ getsubItem( - 'Stock Dispatch', - `${subDirectory}setting/stock-dispatch` - ), - getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`), - ] - ), + 'Create Transfer', + `${subDirectory}setting/stock-transferlist` + ), + getsubItem( + 'Stock Dispatch', + `${subDirectory}setting/stock-dispatch` + ), + getsubItem( + 'Received Stocks', + `${subDirectory}setting/receive-stocks` + ), + ] + ), ]), // Production getsubItem( @@ -2220,30 +2253,25 @@ const customizedmenuitem = [] ] ), - - getsubItem('Employee', `${subDirectory}employee`, null, [ - // getsubItem('Shift', `${subDirectory}setting/shift-master`), - getsubItem( - 'Add Employee', - `${subDirectory}setting/employee-master` - ), - getsubItem( - 'Employee Access', - `${subDirectory}setting/employee-access` - ), - // getsubItem( - // 'Commission / Incentive', - // `${subDirectory}setting/commission-or-incentive-master` - // ), - ]), + getsubItem('Employee', `${subDirectory}employee`, null, [ + // getsubItem('Shift', `${subDirectory}setting/shift-master`), + getsubItem('Add Employee', `${subDirectory}setting/employee-master`), + getsubItem( + 'Employee Access', + `${subDirectory}setting/employee-access` + ), + // getsubItem( + // 'Commission / Incentive', + // `${subDirectory}setting/commission-or-incentive-master` + // ), + ]), sportsAppPreference && getsubItem( 'Membership', `${subDirectory}setting/membership-master/list` ), - - getsubItem('Common Master', `${subDirectory}setting/common-master`), + getsubItem('Common Master', `${subDirectory}setting/common-master`), getsubItem('Tax', `${subDirectory}setting/admin-tax`), !iswarehouse && @@ -2289,22 +2317,26 @@ const customizedmenuitem = [] `${subDirectory}setting/supplierproductmapping-master` ), ]), - !sportsAppPreference && getsubItem( - 'Stock Transfer', - `${subDirectory}setting/stocktransfer`, - null, - [ - getsubItem( - 'Create Transfer', - `${subDirectory}setting/stock-transferlist` - ), + !sportsAppPreference && + getsubItem( + 'Stock Transfer', + `${subDirectory}setting/stocktransfer`, + null, + [ getsubItem( - 'Stock Dispatch', - `${subDirectory}setting/stock-dispatch` - ), - getsubItem('Received Stocks', `${subDirectory}setting/receive-stocks`), - ] - ), + 'Create Transfer', + `${subDirectory}setting/stock-transferlist` + ), + getsubItem( + 'Stock Dispatch', + `${subDirectory}setting/stock-dispatch` + ), + getsubItem( + 'Received Stocks', + `${subDirectory}setting/receive-stocks` + ), + ] + ), ]), !iswarehouse && @@ -2531,22 +2563,20 @@ const customizedmenuitem = [] 'GST Invoice Setup', `${subDirectory}setting/gst-invoice-setup` ), - - !sportsAppPreference && + + !sportsAppPreference && getsubItem( 'Customization', `${subDirectory}setting/Customized`, null, [ - - !sportsAppPreference && - !iswarehouse + !sportsAppPreference && !iswarehouse ? getsubItem( 'Sales Screen', `${subDirectory}saleslayouts/sales-selection` ) : '', - + !iswarehouse ? getsubItem( 'Print Forms', @@ -2562,9 +2592,8 @@ const customizedmenuitem = [] `${subDirectory}saleslayouts/kiosk-selection` ) : '', - - !iswarehouse && - !sportsAppPreference + + !iswarehouse && !sportsAppPreference ? getsubItem( 'Barcode / QR', `${subDirectory}saleslayouts/barcode-qr-selection` @@ -2696,8 +2725,8 @@ const customizedmenuitem = [] , EmpProduction ), - (EmpSales?.length > 0 && - !iswarehouse) && + EmpSales?.length > 0 && + !iswarehouse && getItem( 'Sales', `${subDirectory}saleslist`, @@ -2706,26 +2735,27 @@ const customizedmenuitem = [] ), // EmpfilterReportMenu?.length > 0 && !iswarehouse && - getItem( - 'KOT', - `${subDirectory}kitchen`, - , - empFilteredKOTMenu - ), - (EmpfilterReportMenu ?.length > 0 ) && - getItem( - 'REPORTS', - `${subDirectory}reports`, - , - EmpfilterReportMenu - ), - (EmpSuport?.length > 0 && !iswarehouse) && - getsubItem( - 'Support', - `${subDirectory}setting/create-tickets`, - , - EmpSuport - ), + getItem( + 'KOT', + `${subDirectory}kitchen`, + , + empFilteredKOTMenu + ), + EmpfilterReportMenu?.length > 0 && + getItem( + 'REPORTS', + `${subDirectory}reports`, + , + EmpfilterReportMenu + ), + EmpSuport?.length > 0 && + !iswarehouse && + getsubItem( + 'Support', + `${subDirectory}setting/create-tickets`, + , + EmpSuport + ), EmpSettingMenu?.length > 0 && EmpSettingMenu?.[0]?.children?.length > 0 && getItem( diff --git a/src/Pages/BookingScreen/BookingPage.jsx b/src/Pages/BookingScreen/BookingPage.jsx index d2a461e..a467bdc 100644 --- a/src/Pages/BookingScreen/BookingPage.jsx +++ b/src/Pages/BookingScreen/BookingPage.jsx @@ -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')); @@ -202,7 +197,7 @@ const BookingPage = () => { // getFeatureAddonData(); } // dispatch(getConfigType({ TypeName: 'Booking Type' })).unwrap(); - + dispatch(PricingAppPricingNameData(data)).unwrap(); }, []); @@ -215,15 +210,19 @@ const BookingPage = () => { useEffect(() => { const fetchData = async (Plan) => { - if (templateLoaded) return; // STOP duplicate calls + 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' @@ -428,8 +434,12 @@ const BookingPage = () => { const hasCustomizedTemplate = FeatureAddonData?.FeatureDtls?.some( (item) => item?.FeatureAddonName?.toLowerCase() === 'customized template' ); - if (PricingAppPricingName?.length === 0) return; - console.log(PricingAppPricingName,FeatureAddonData,"FeatureAddonDataFeatureAddonData") + if (PricingAppPricingName?.length === 0) return; + console.log( + PricingAppPricingName, + FeatureAddonData, + 'FeatureAddonDataFeatureAddonData' + ); if (PricingAppPricingName?.length > 0) { if (Advance) { fetchData('Advance'); @@ -445,8 +455,8 @@ const BookingPage = () => { // if (hasCustomizedTemplate) { // fetchData('Standard'); // } else { - fetchData('Standard'); - // Professional('Standard'); + fetchData('Standard'); + // Professional('Standard'); // } } // setIsmounted(false) @@ -493,19 +503,21 @@ const BookingPage = () => { // }; if (ismounted) return ( -
+
- ) + ); return (
{Object.keys(templateData)?.length > 0 ? ( diff --git a/src/Pages/BookingScreen/Components/BSCombo/BSC1NavBar.jsx b/src/Pages/BookingScreen/Components/BSCombo/BSC1NavBar.jsx index d1333f1..5c7f72a 100644 --- a/src/Pages/BookingScreen/Components/BSCombo/BSC1NavBar.jsx +++ b/src/Pages/BookingScreen/Components/BSCombo/BSC1NavBar.jsx @@ -361,7 +361,7 @@ const BSC1NavBar = (props) => { )} {!isMobile && ( -
+
)} diff --git a/src/Pages/BookingScreen/Components/BSCombo/BSTimer.jsx b/src/Pages/BookingScreen/Components/BSCombo/BSTimer.jsx index 4fce57a..0d7cabb 100644 --- a/src/Pages/BookingScreen/Components/BSCombo/BSTimer.jsx +++ b/src/Pages/BookingScreen/Components/BSCombo/BSTimer.jsx @@ -1,21 +1,19 @@ -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 = () => { - const [currentTime, setCurrentTime] = useState(new Date()); + const [currentTime, setCurrentTime] = useState(new Date()); - useEffect(() => { - const timer = setInterval(() => setCurrentTime(new Date()), 1000); - return () => clearInterval(timer); - }, []); + useEffect(() => { + const timer = setInterval(() => setCurrentTime(new Date()), 1000); + return () => clearInterval(timer); + }, []); - return currentTime; + 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 currentTime = useCurrentTime(); - const formatTime = (date) => - date.toLocaleTimeString("en-US", { - hour12: true, - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - }); + const formatTime = (date) => + date.toLocaleTimeString('en-US', { + hour12: true, + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + }); - return ( -
- {formatTime(currentTime)} -
- ); + return
{formatTime(currentTime)}
; }; export const DateDisplay = () => { - const currentDate = useCurrentTime(); + 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 ( -
- {ExtractDateFormate(currentDate)} -
- ); + return
{ExtractDateFormate(currentDate)}
; }; - - - diff --git a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx index a763884..73cfcdb 100644 --- a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx +++ b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx @@ -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 */} -
- setMultiple(true)} /> +
+ setMultiple(true)} />
- - {!OtherServicesglobal && ( <> {navbarOptions?.map((item) => ( @@ -672,27 +656,6 @@ const BSNavbar1 = (props) => {
)} - {/* {ComboDropDown?.length >= 1 && ( -
- -
- -
- -
-
- )} */} )}
@@ -1316,9 +1279,7 @@ const BSNavbar1 = (props) => { destroyOnClose={true} children={ <> - + } /> diff --git a/src/Pages/BranchLogin/BranchLogin.jsx b/src/Pages/BranchLogin/BranchLogin.jsx index addb88c..391244f 100644 --- a/src/Pages/BranchLogin/BranchLogin.jsx +++ b/src/Pages/BranchLogin/BranchLogin.jsx @@ -503,7 +503,7 @@ const BranchLogin = () => { value: option?.UserId, label: option?.UserName, }))} - label={} + label={} className="field-DropDown" onChangeFunction={(e) => UserDropDownChange(e)} isOnchanges={selectedUserData ? true : false} diff --git a/src/Pages/DashBoard/RetailDashboard.jsx b/src/Pages/DashBoard/RetailDashboard.jsx index b38fb69..c775bd4 100644 --- a/src/Pages/DashBoard/RetailDashboard.jsx +++ b/src/Pages/DashBoard/RetailDashboard.jsx @@ -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 = () => {
); - const handleSelectChange = (value) => { - setSelection(value); - }; + // const handleSelectChange = (value) => { + // setSelection(value); + // }; return (
@@ -1421,16 +1428,16 @@ const RetailDashboard = () => {
{userprofile && ( - + )}
@@ -1442,35 +1449,27 @@ const RetailDashboard = () => { {/*
Dashboard
*/} {/* public Login dashboard*/}
- {tabs?.map((tab) => ( - - ))} +
{/* Branch Filter Dropdown */} {CompBranchData?.length > 1 && selection !== 'top-selling-products' && (
Loading...
}> - ({ - value: option.BrId, - label: option.BrName, - })), - ]} - className="branch-filter-select" - onChangeFunction={onChangeBranchFilter} - valueData={selectedBranchForFilter} - defaultValue="all" - placeholder="All Branches" - /> + ({ + value: option.BrId, + label: option.BrName, + })), + ]} + className="branch-filter-select" + onChangeFunction={onChangeBranchFilter} + valueData={selectedBranchForFilter} + defaultValue="all" + placeholder="All Branches" + /> )} @@ -2381,95 +2380,95 @@ const RetailDashboard = () => { )} - - - <> -
- ({ - value: option?.UserId, - label: option?.UserName, - }))} - label={} - className="field-DropDown" - onChangeFunction={(e) => UserDropDownChange(e)} - isOnchanges={selectedUserData ? true : false} - valueData={selectedUserData} - disabled={disabled} - /> -
-
- Loading...
}> - ChangeMethod(e)} - /> - -
-
- - {pinInput && ( -
- {[0, 1, 2, 3].map((i) => ( - (inputRefs.current[i] = el)} - className="inputNumber" - type="text" - inputMode="numeric" - pattern="[0-9]" - maxLength={1} - onChange={(e) => handleChange(i, e)} - onKeyDown={(e) => handleKeyDown(i, e)} - style={{ - textAlign: 'center', - width: '40px', - fontSize: '20px', - }} - /> - ))} -
- )} - -
- + +
- - -
+ +
); diff --git a/src/Pages/DashBoard/TabSwitcher.jsx b/src/Pages/DashBoard/TabSwitcher.jsx new file mode 100644 index 0000000..ddc9a95 --- /dev/null +++ b/src/Pages/DashBoard/TabSwitcher.jsx @@ -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 ( +
+ {tabs.map((tab) => ( + + ))} +
+ ); +}; + +export default TabSwitcher; diff --git a/src/app/store.js b/src/app/store.js index a45a701..ac19d9a 100644 --- a/src/app/store.js +++ b/src/app/store.js @@ -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({ diff --git a/src/routesConfig.jsx b/src/routesConfig.jsx index 468c7ba..d90267a 100644 --- a/src/routesConfig.jsx +++ b/src/routesConfig.jsx @@ -672,193 +672,77 @@ const Productcatlogue = lazy( const subDirectory = import.meta.env.BASE_URL; const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON; +const initSession = () => { + 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.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) return null; + + const response = await axios.get( + `${apiCommonUrl}/application?AppId=${AppId}` + ); + + const subCategoryName = + response?.data?.data?.[0]?.SubCategoryName?.toLowerCase(); + + const isWholesale = subCategoryName === 'wholesale'; + + sessionStore('AppType', isWholesale ? 'Wholesale' : 'Sale'); + + return isWholesale; +}; + 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' - // ); + initSession(); - // 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", 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' - // ); - 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 != null && AppId != undefined) { - 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 + 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 },