From 0656cda2ece82b87d8e5c79b51fa20eab760c795 Mon Sep 17 00:00:00 2001 From: ferdiansyah783 Date: Sun, 3 Aug 2025 11:14:55 +0700 Subject: [PATCH] add superadmin authentication --- src/InitialPage/Sidebar/Sidebar.jsx | 17 +- src/Router/all_routes.jsx | 4 +- src/Router/router.jsx | 27 +- src/Router/router.link.jsx | 19 + src/components/GuestRoute.jsx | 15 + src/components/ProtectedRoute.jsx | 9 +- src/core/json/siderbar_data.jsx | 1580 +++++++++++------ src/core/redux/actions/organizationActions.js | 132 ++ .../redux/actions/paymentMethodActions.js | 126 ++ src/core/redux/reducer.jsx | 4 + .../redux/reducers/organizationReducer.js | 212 +++ .../redux/reducers/paymentMethodReducer.js | 106 ++ .../FinanceAccounts/paymentmethodlist.jsx | 387 ++++ src/feature-module/inventory/addproduct.jsx | 23 +- src/feature-module/inventory/editproduct.jsx | 11 +- src/feature-module/pages/login/signin.jsx | 33 +- src/feature-module/sales/saleslist.jsx | 375 ++-- src/feature-module/superadmin/companylist.jsx | 396 +++++ src/services/categoriesApi.js | 14 - src/services/organizationsApi.js | 91 + src/services/paymentMethodsApi.js | 91 + src/utils/date.js | 6 +- 22 files changed, 2887 insertions(+), 791 deletions(-) create mode 100644 src/components/GuestRoute.jsx create mode 100644 src/core/redux/actions/organizationActions.js create mode 100644 src/core/redux/actions/paymentMethodActions.js create mode 100644 src/core/redux/reducers/organizationReducer.js create mode 100644 src/core/redux/reducers/paymentMethodReducer.js create mode 100644 src/feature-module/FinanceAccounts/paymentmethodlist.jsx create mode 100644 src/feature-module/superadmin/companylist.jsx create mode 100644 src/services/organizationsApi.js create mode 100644 src/services/paymentMethodsApi.js diff --git a/src/InitialPage/Sidebar/Sidebar.jsx b/src/InitialPage/Sidebar/Sidebar.jsx index c403b04..b5d03a5 100644 --- a/src/InitialPage/Sidebar/Sidebar.jsx +++ b/src/InitialPage/Sidebar/Sidebar.jsx @@ -1,19 +1,16 @@ -import React, { useState } from "react"; +import { useState } from "react"; import Scrollbars from "react-custom-scrollbars-2"; -// import { useSelector } from "react-redux"; import { Link, useLocation } from "react-router-dom"; import { SidebarData } from "../../core/json/siderbar_data"; -import HorizontalSidebar from "./horizontalSidebar"; import CollapsedSidebar from "./collapsedSidebar"; +import HorizontalSidebar from "./horizontalSidebar"; +import { useSelector } from "react-redux"; const Sidebar = () => { - // const SidebarData = useSelector((state) => state.sidebar_data); - // console.log(sidebarData, "sidebar"); + const { user } = useSelector((state) => state.auth); const Location = useLocation(); - console.log("Location.pathname", Location.pathname); - const [subOpen, setSubopen] = useState(""); const [subsidebar, setSubsidebar] = useState(""); @@ -46,6 +43,12 @@ const Sidebar = () => {