diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 00000000..6aa57f7b Binary files /dev/null and b/public/logo.png differ diff --git a/src/App.js b/src/App.js index a6d479d5..c06f9a32 100644 --- a/src/App.js +++ b/src/App.js @@ -1,21 +1,77 @@ -import React from "react"; +import React, { useState } from "react"; +import { BrowserRouter, Routes, Route } from "react-router-dom"; + import Sidebar from "./components/Sidebar"; import Topbar from "./components/Topbar"; -import Contacts from "./components/Contacts"; -import ContactsList from './pages/contacts/list/List' -import ContactFormPage from './pages/contacts/form/ContactFormPage' +// CONTACTS +import ContactsList from "./pages/contacts/list/List"; +import ContactFormPage from "./pages/contacts/form/ContactFormPage"; +import ContactEditPage from "./pages/contacts/form/ContactFormPage"; + +// ACCOUNTS +import AccountList from "./pages/accounts/list/List"; +import AccountForm from "./pages/accounts/form/AccountFormPage"; +import AccountEdit from "./pages/accounts/form/AccountFormPage"; + +// EMPLOYEES +import EmployeeList from "./pages/employees/list/List"; +import EmployeeForm from "./pages/employees/form/EmployeeFormPage"; +import EmployeeEdit from "./pages/employees/form/EmployeeFormPage"; + +// FOLLOW UPS +import FollowUpList from "./pages/followup/list/List"; +import FollowUpForm from "./pages/followup/form/FollowUpFormPage"; +import FollowUpEdit from "./pages/followup/form/FollowUpFormPage"; + +// PM SCHEDULES +import PMScheduleList from "./pages/PmSchedule/list/List"; +import PMScheduleForm from "./pages/PmSchedule/form/PmScheduleFormPage"; +import PMScheduleEdit from "./pages/PmSchedule/form/PmScheduleFormPage"; export default function App() { + const [navCollapsed, setNavCollapsed] = useState(false); + return ( -
- -
- -
- + +
+ + +
+ setNavCollapsed(v => !v)} /> + +
+ + + {/* CONTACTS ROUTES */} + } /> + } /> + } /> + + {/* ACCOUNTS ROUTES */} + } /> + } /> + } /> + + {/* EMPLOYEES ROUTES */} + } /> + } /> + } /> + + {/* FOLLOW UPS */} + } /> + } /> + } /> + + {/* PM SCHEDULES */} + } /> + } /> + } /> + + +
-
+ ); -} \ No newline at end of file +} diff --git a/src/apiUtil.js b/src/apiUtil.js index 6a6a1c24..c2b1e150 100644 --- a/src/apiUtil.js +++ b/src/apiUtil.js @@ -23,7 +23,7 @@ export const get = (url) => }) .then(handleHttpResponse) .catch((ex) => { - throw new Error(ex.message || API_ERROR_MESSAGE); + // throw new Error(ex.message || API_ERROR_MESSAGE); }); export const post = (url, payload) => @@ -34,7 +34,7 @@ export const post = (url, payload) => }) .then(handleHttpResponse) .catch((ex) => { - throw new Error(ex.message || API_ERROR_MESSAGE); + // throw new Error(ex.message || API_ERROR_MESSAGE); }); export const postFormBody = (url, payload) => { @@ -53,7 +53,7 @@ export const post = (url, payload) => }) .then(handleHttpResponse) .catch((ex) => { - throw new Error(ex.message || API_ERROR_MESSAGE); + // throw new Error(ex.message || API_ERROR_MESSAGE); }); }; @@ -65,7 +65,7 @@ export const put = (url, payload) => }) .then(handleHttpResponse) .catch((ex) => { - throw new Error(ex.message || API_ERROR_MESSAGE); + // throw new Error(ex.message || API_ERROR_MESSAGE); }); export const putFormBody = (url, payload) => { @@ -84,7 +84,7 @@ export const putFormBody = (url, payload) => { }) .then(handleHttpResponse) .catch((ex) => { - throw new Error(ex.message || API_ERROR_MESSAGE); + // throw new Error(ex.message || API_ERROR_MESSAGE); }); } export const deleteItem = (url, payload) => @@ -95,14 +95,14 @@ export const deleteItem = (url, payload) => }) .then(handleHttpResponse) .catch((ex) => { - throw new Error(ex.message || API_ERROR_MESSAGE); + // throw new Error(ex.message || API_ERROR_MESSAGE); }); const handleHttpResponse = (response) => { if (response.ok) return response.json(); else if (response.status === 401) { - throw new Error("You are not authorized to access this page."); + //throw new Error("You are not authorized to access this page."); } throw new Error(API_ERROR_MESSAGE); }; diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index ba98f9e3..a5f0e553 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -1,4 +1,5 @@ import React from "react"; +import { NavLink } from "react-router-dom"; import { FaTachometerAlt, FaCalendarAlt, @@ -15,143 +16,49 @@ import { } from "react-icons/fa"; const navItems = [ - { label: "Dashboard", icon: }, - { label: "Calendar", icon: }, - { label: "Documents", icon: }, - { label: "Employees", icon: }, - { label: "Accounts", icon: }, - { label: "Contacts", icon: }, - { label: "Reports", icon: }, - { label: "Work Orders", icon: }, - { label: "Follow Ups", icon: }, - { label: "PM Schedules", icon: }, - { label: "Assets", icon: }, - { label: "Locations", icon: }, + { label: "Dashboard", icon: , path: "/" }, + { label: "Calendar", icon: , path: "/calendar" }, + { label: "Documents", icon: , path: "/documents" }, + { label: "Employees", icon: , path: "/employees" }, + { label: "Accounts", icon: , path: "/accounts" }, + { label: "Contacts", icon: , path: "/contacts" }, + { label: "Reports", icon: , path: "/reports" }, + { label: "Work Orders", icon: , path: "/workorders" }, + { label: "Follow Ups", icon: , path: "/followups" }, + { label: "PM Schedules", icon: , path: "/pmschedules" }, + { label: "Assets", icon: , path: "/assets" }, + { label: "Locations", icon: , path: "/locations" }, ]; export default function Sidebar() { - const [selected, setSelected] = React.useState("Contacts"); - return ( -