diff --git a/web-ui/web-react/public/assets/themes/khaki/theme.css b/web-ui/web-react/public/assets/themes/khaki/theme.css index 10393ffd..cbdfe8aa 100644 --- a/web-ui/web-react/public/assets/themes/khaki/theme.css +++ b/web-ui/web-react/public/assets/themes/khaki/theme.css @@ -7156,4 +7156,11 @@ .status.status--1 { background: #565656; color: #f7f9f7; +} + + +.login-wrapper { + display: flex; + flex-direction: column; + align-items: center; } \ No newline at end of file diff --git a/web-ui/web-react/public/images/Logo_Katoikia.png b/web-ui/web-react/public/images/Logo_Katoikia.png new file mode 100644 index 00000000..d59e2c9a Binary files /dev/null and b/web-ui/web-react/public/images/Logo_Katoikia.png differ diff --git a/web-ui/web-react/public/images/Logo_Katoikia.svg b/web-ui/web-react/public/images/Logo_Katoikia.svg new file mode 100644 index 00000000..1416dbb0 --- /dev/null +++ b/web-ui/web-react/public/images/Logo_Katoikia.svg @@ -0,0 +1,9 @@ + diff --git a/web-ui/web-react/src/App.js b/web-ui/web-react/src/App.js index eecc9d49..ef05324a 100644 --- a/web-ui/web-react/src/App.js +++ b/web-ui/web-react/src/App.js @@ -1,6 +1,6 @@ import React, { useState, useEffect, useRef } from 'react'; import classNames from 'classnames'; -import { Route, useLocation } from 'react-router-dom'; +import { BrowserRouter, Switch, Route, useLocation } from 'react-router-dom'; import { CSSTransition } from 'react-transition-group'; import { AppTopbar } from './AppTopbar'; @@ -50,407 +50,483 @@ import './assets/demo/flags/flags.css'; import './assets/demo/Demos.scss'; import './assets/layout/layout.scss'; import './App.scss'; -import LogIn from './components/LogIn'; import { PrimeIcons } from 'primereact/api'; import AreasComunes from './components/AreasComunes'; +import { useCookies } from "react-cookie"; +import LogInUser from './components/LogInUser'; +import Page404 from './components/Page404' + const App = () => { - const [layoutMode, setLayoutMode] = useState('static'); - const [layoutColorMode, setLayoutColorMode] = useState('light'); - const [inputStyle, setInputStyle] = useState('outlined'); - const [ripple, setRipple] = useState(true); - const [staticMenuInactive, setStaticMenuInactive] = useState(false); - const [overlayMenuActive, setOverlayMenuActive] = useState(false); - const [mobileMenuActive, setMobileMenuActive] = useState(false); - const [mobileTopbarMenuActive, setMobileTopbarMenuActive] = useState(false); - const copyTooltipRef = useRef(); - const location = useLocation(); + const [layoutMode, setLayoutMode] = useState('static'); + const [layoutColorMode, setLayoutColorMode] = useState('light') + const [inputStyle, setInputStyle] = useState('outlined'); + const [ripple, setRipple] = useState(true); + const [staticMenuInactive, setStaticMenuInactive] = useState(false); + const [overlayMenuActive, setOverlayMenuActive] = useState(false); + const [mobileMenuActive, setMobileMenuActive] = useState(false); + const [mobileTopbarMenuActive, setMobileTopbarMenuActive] = useState(false); + const copyTooltipRef = useRef(); + const location = useLocation(); + const [cookies, setCookies] = useCookies(); + const [logged, setLogged] = useState() - PrimeReact.ripple = true; + PrimeReact.ripple = true; - let menuClick = false; - let mobileTopbarMenuClick = false; + let menuClick = false; + let mobileTopbarMenuClick = false; - useEffect(() => { - if (mobileMenuActive) { - addClass(document.body, 'body-overflow-hidden'); - } else { - removeClass(document.body, 'body-overflow-hidden'); - } - }, [mobileMenuActive]); + useEffect(() => { + if (mobileMenuActive) { + addClass(document.body, 'body-overflow-hidden'); + } else { + removeClass(document.body, 'body-overflow-hidden'); + } + }, [mobileMenuActive]); - useEffect(() => { - copyTooltipRef && - copyTooltipRef.current && - copyTooltipRef.current.updateTargetEvents(); - }, [location]); + useEffect(() => { + copyTooltipRef && + copyTooltipRef.current && + copyTooltipRef.current.updateTargetEvents(); + }, [location]); - const onInputStyleChange = (inputStyle) => { - setInputStyle(inputStyle); - }; - const onRipple = (e) => { - PrimeReact.ripple = e.value; - setRipple(e.value); - }; - const onLayoutModeChange = (mode) => { - setLayoutMode(mode); - }; - const onColorModeChange = (mode) => { - setLayoutColorMode(mode); - }; - const onWrapperClick = (event) => { - if (!menuClick) { - setOverlayMenuActive(false); - setMobileMenuActive(false); - } - if (!mobileTopbarMenuClick) { - setMobileTopbarMenuActive(false); - } - mobileTopbarMenuClick = false; - menuClick = false; - }; + const onInputStyleChange = (inputStyle) => { + setInputStyle(inputStyle); + }; - const onToggleMenuClick = (event) => { - menuClick = true; + const onRipple = (e) => { + PrimeReact.ripple = e.value; + setRipple(e.value); + }; - if (isDesktop()) { - if (layoutMode === 'overlay') { - if (mobileMenuActive === true) { - setOverlayMenuActive(true); + const onLayoutModeChange = (mode) => { + setLayoutMode(mode); + }; + + const onColorModeChange = (mode) => { + setLayoutColorMode(mode); + }; + + const onWrapperClick = (event) => { + if (!menuClick) { + setOverlayMenuActive(false); + setMobileMenuActive(false); } - setOverlayMenuActive((prevState) => !prevState); - setMobileMenuActive(false); - } else if (layoutMode === 'static') { - setStaticMenuInactive((prevState) => !prevState); - } - } else { - setMobileMenuActive((prevState) => !prevState); + if (!mobileTopbarMenuClick) { + setMobileTopbarMenuActive(false); + } + + mobileTopbarMenuClick = false; + menuClick = false; + }; + + const onToggleMenuClick = (event) => { + menuClick = true; + + if (isDesktop()) { + if (layoutMode === 'overlay') { + if (mobileMenuActive === true) { + setOverlayMenuActive(true); + } + + setOverlayMenuActive((prevState) => !prevState); + setMobileMenuActive(false); + } else if (layoutMode === 'static') { + setStaticMenuInactive((prevState) => !prevState); + } + } else { + setMobileMenuActive((prevState) => !prevState); + } + + event.preventDefault(); + }; + + const onSidebarClick = () => { + menuClick = true; + }; + + const onMobileTopbarMenuClick = (event) => { + mobileTopbarMenuClick = true; + + setMobileTopbarMenuActive((prevState) => !prevState); + event.preventDefault(); + }; + + const onMobileSubTopbarMenuClick = (event) => { + mobileTopbarMenuClick = true; + + event.preventDefault(); + }; + + const onMenuItemClick = (event) => { + if (!event.item.items) { + setOverlayMenuActive(false); + setMobileMenuActive(false); + } + }; + const isDesktop = () => { + return window.innerWidth >= 992; + }; + + const menu2 = [ + { + label: 'Inicio', + items: [ + { label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/' }, + { label: 'Administradores del sistema', icon: PrimeIcons.USERS, to: '/administradoresSistema' }, + { label: 'Administradores de comunidad', icon: PrimeIcons.USERS, to: '/administradoresComunidad' }, + { label: 'Comunidades', icon: PrimeIcons.BUILDING, to: '/comunidadesViviendas' }, + ] + } + ] + + + const menu3 = [ + { + label: 'Inicio', + items: [ + { label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/' }, + { label: 'Inquilinos', icon: PrimeIcons.USERS, to: '/inquilinos' }, + { label: 'Guardas de seguridad', icon: PrimeIcons.LOCK, to: '/guardasSeguridad' }, + { + label: 'Áreas Comunes de Comunidad', + icon: PrimeIcons.BUILDING, + to: '/areasComunes', + }, + ] + }, + ] + + const menuLogin = [ + { + label: 'Inicio', + items: [ + { + label: 'Inicio de sesion', + icon: PrimeIcons.BUILDING, + to: '/login' + }, + ] + }, + ] + + function menu4() { + if (cookies.type == '1') { + return menu2; + } else if (cookies.type == '2') { + return menu3; + } else { + return menuLogin; + } } - event.preventDefault(); - }; - - const onSidebarClick = () => { - menuClick = true; - }; - - const onMobileTopbarMenuClick = (event) => { - mobileTopbarMenuClick = true; - - setMobileTopbarMenuActive((prevState) => !prevState); - event.preventDefault(); - }; - - const onMobileSubTopbarMenuClick = (event) => { - mobileTopbarMenuClick = true; - - event.preventDefault(); - }; - - const onMenuItemClick = (event) => { - if (!event.item.items) { - setOverlayMenuActive(false); - setMobileMenuActive(false); - } - }; - const isDesktop = () => { - return window.innerWidth >= 992; - }; - - const menu = [ - { - label: 'Home', - items: [ - { label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/' }, + const menu = [ { - label: 'Administradores del sistema', - icon: PrimeIcons.USERS, - to: '/administradoresSistema', + label: 'Inicio', + items: + [ + { + label: 'Administradores del sistema', + icon: PrimeIcons.USERS, + to: '/administradoresSistema', + }, + { + label: 'Administradores de comunidad', + icon: PrimeIcons.USERS, + to: '/administradoresComunidad', + }, + { + label: 'Guardas de seguridad', + icon: PrimeIcons.LOCK, + to: '/guardasSeguridad', + }, + { + label: 'Comunidades', + icon: PrimeIcons.BUILDING, + to: '/comunidadesViviendas', + }, + { + label: 'Inquilinos', + icon: PrimeIcons.USER, + to: '/inquilinos' + }, + { + label: 'Áreas Comunes de Comunidad', + icon: PrimeIcons.BUILDING, + to: '/areasComunes', + }, + { label: 'Log in', icon: 'pi pi-fw pi-id-card', to: '/logIn' }, + ], }, { - label: 'Administradores de comunidad', - icon: PrimeIcons.USERS, - to: '/administradoresComunidad', + label: 'UI Components', + icon: 'pi pi-fw pi-sitemap', + items: [ + { + label: 'Form Layout', + icon: 'pi pi-fw pi-id-card', + to: '/formlayout', + }, + { label: 'Input', icon: 'pi pi-fw pi-check-square', to: '/input' }, + { + label: 'Float Label', + icon: 'pi pi-fw pi-bookmark', + to: '/floatlabel', + }, + { + label: 'Invalid State', + icon: 'pi pi-fw pi-exclamation-circle', + to: 'invalidstate', + }, + { label: 'Button', icon: 'pi pi-fw pi-mobile', to: '/button' }, + { label: 'Table', icon: 'pi pi-fw pi-table', to: '/table' }, + { label: 'List', icon: 'pi pi-fw pi-list', to: '/list' }, + { label: 'Tree', icon: 'pi pi-fw pi-share-alt', to: '/tree' }, + { label: 'Panel', icon: 'pi pi-fw pi-tablet', to: '/panel' }, + { label: 'Overlay', icon: 'pi pi-fw pi-clone', to: '/overlay' }, + { label: 'Media', icon: 'pi pi-fw pi-image', to: '/media' }, + { label: 'Menu', icon: 'pi pi-fw pi-bars', to: '/menu' }, + { label: 'Message', icon: 'pi pi-fw pi-comment', to: '/messages' }, + { label: 'File', icon: 'pi pi-fw pi-file', to: '/file' }, + { label: 'Chart', icon: 'pi pi-fw pi-chart-bar', to: '/chart' }, + { label: 'Misc', icon: 'pi pi-fw pi-circle-off', to: '/misc' }, + ], }, { - label: 'Guardas de seguridad', - icon: PrimeIcons.LOCK, - to: '/guardasSeguridad', + label: 'UI Blocks', + items: [ + { + label: 'Free Blocks', + icon: 'pi pi-fw pi-eye', + to: '/blocks', + badge: 'NEW', + }, + { + label: 'All Blocks', + icon: 'pi pi-fw pi-globe', + url: 'https://www.primefaces.org/primeblocks-react', + }, + ], }, { - label: 'Comunidades', - icon: PrimeIcons.BUILDING, - to: '/comunidadesViviendas', + label: 'Icons', + items: [{ label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', to: '/icons' }], }, { - label: 'Inquilinos', - icon: PrimeIcons.USER, - to: '/inquilinos' + label: 'Pages', + icon: 'pi pi-fw pi-clone', + items: [ + { label: 'Crud', icon: 'pi pi-fw pi-user-edit', to: '/crud' }, + { label: 'Timeline', icon: 'pi pi-fw pi-calendar', to: '/timeline' }, + { label: 'Empty', icon: 'pi pi-fw pi-circle-off', to: '/empty' }, + ], }, { - label: 'Áreas Comunes de Comunidad', - icon: PrimeIcons.BUILDING, - to: '/areasComunes', + label: 'Menu Hierarchy', + icon: 'pi pi-fw pi-search', + items: [ + { + label: 'Submenu 1', + icon: 'pi pi-fw pi-bookmark', + items: [ + { + label: 'Submenu 1.1', + icon: 'pi pi-fw pi-bookmark', + items: [ + { label: 'Submenu 1.1.1', icon: 'pi pi-fw pi-bookmark' }, + { label: 'Submenu 1.1.2', icon: 'pi pi-fw pi-bookmark' }, + { label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' }, + ], + }, + { + label: 'Submenu 1.2', + icon: 'pi pi-fw pi-bookmark', + items: [ + { label: 'Submenu 1.2.1', icon: 'pi pi-fw pi-bookmark' }, + { label: 'Submenu 1.2.2', icon: 'pi pi-fw pi-bookmark' }, + ], + }, + ], + }, + { + label: 'Submenu 2', + icon: 'pi pi-fw pi-bookmark', + items: [ + { + label: 'Submenu 2.1', + icon: 'pi pi-fw pi-bookmark', + items: [ + { label: 'Submenu 2.1.1', icon: 'pi pi-fw pi-bookmark' }, + { label: 'Submenu 2.1.2', icon: 'pi pi-fw pi-bookmark' }, + { label: 'Submenu 2.1.3', icon: 'pi pi-fw pi-bookmark' }, + ], + }, + { + label: 'Submenu 2.2', + icon: 'pi pi-fw pi-bookmark', + items: [ + { label: 'Submenu 2.2.1', icon: 'pi pi-fw pi-bookmark' }, + { label: 'Submenu 2.2.2', icon: 'pi pi-fw pi-bookmark' }, + ], + }, + ], + }, + ], }, - { label: 'Log in', icon: 'pi pi-fw pi-id-card', to: '/logIn' }, - ], - }, - { - label: 'UI Components', - icon: 'pi pi-fw pi-sitemap', - items: [ - { - label: 'Form Layout', - icon: 'pi pi-fw pi-id-card', - to: '/formlayout', - }, - { label: 'Input', icon: 'pi pi-fw pi-check-square', to: '/input' }, - { - label: 'Float Label', - icon: 'pi pi-fw pi-bookmark', - to: '/floatlabel', - }, - { - label: 'Invalid State', - icon: 'pi pi-fw pi-exclamation-circle', - to: 'invalidstate', - }, - { label: 'Button', icon: 'pi pi-fw pi-mobile', to: '/button' }, - { label: 'Table', icon: 'pi pi-fw pi-table', to: '/table' }, - { label: 'List', icon: 'pi pi-fw pi-list', to: '/list' }, - { label: 'Tree', icon: 'pi pi-fw pi-share-alt', to: '/tree' }, - { label: 'Panel', icon: 'pi pi-fw pi-tablet', to: '/panel' }, - { label: 'Overlay', icon: 'pi pi-fw pi-clone', to: '/overlay' }, - { label: 'Media', icon: 'pi pi-fw pi-image', to: '/media' }, - { label: 'Menu', icon: 'pi pi-fw pi-bars', to: '/menu' }, - { label: 'Message', icon: 'pi pi-fw pi-comment', to: '/messages' }, - { label: 'File', icon: 'pi pi-fw pi-file', to: '/file' }, - { label: 'Chart', icon: 'pi pi-fw pi-chart-bar', to: '/chart' }, - { label: 'Misc', icon: 'pi pi-fw pi-circle-off', to: '/misc' }, - ], - }, - { - label: 'UI Blocks', - items: [ - { - label: 'Free Blocks', - icon: 'pi pi-fw pi-eye', - to: '/blocks', - badge: 'NEW', - }, - { - label: 'All Blocks', - icon: 'pi pi-fw pi-globe', - url: 'https://www.primefaces.org/primeblocks-react', - }, - ], - }, - { - label: 'Icons', - items: [{ label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', to: '/icons' }], - }, - { - label: 'Pages', - icon: 'pi pi-fw pi-clone', - items: [ - { label: 'Crud', icon: 'pi pi-fw pi-user-edit', to: '/crud' }, - { label: 'Timeline', icon: 'pi pi-fw pi-calendar', to: '/timeline' }, - { label: 'Empty', icon: 'pi pi-fw pi-circle-off', to: '/empty' }, - ], - }, - { - label: 'Menu Hierarchy', - icon: 'pi pi-fw pi-search', - items: [ - { - label: 'Submenu 1', - icon: 'pi pi-fw pi-bookmark', - items: [ - { - label: 'Submenu 1.1', - icon: 'pi pi-fw pi-bookmark', - items: [ - { label: 'Submenu 1.1.1', icon: 'pi pi-fw pi-bookmark' }, - { label: 'Submenu 1.1.2', icon: 'pi pi-fw pi-bookmark' }, - { label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' }, - ], - }, - { - label: 'Submenu 1.2', - icon: 'pi pi-fw pi-bookmark', - items: [ - { label: 'Submenu 1.2.1', icon: 'pi pi-fw pi-bookmark' }, - { label: 'Submenu 1.2.2', icon: 'pi pi-fw pi-bookmark' }, - ], - }, - ], - }, - { - label: 'Submenu 2', - icon: 'pi pi-fw pi-bookmark', - items: [ - { - label: 'Submenu 2.1', - icon: 'pi pi-fw pi-bookmark', - items: [ - { label: 'Submenu 2.1.1', icon: 'pi pi-fw pi-bookmark' }, - { label: 'Submenu 2.1.2', icon: 'pi pi-fw pi-bookmark' }, - { label: 'Submenu 2.1.3', icon: 'pi pi-fw pi-bookmark' }, - ], - }, - { - label: 'Submenu 2.2', - icon: 'pi pi-fw pi-bookmark', - items: [ - { label: 'Submenu 2.2.1', icon: 'pi pi-fw pi-bookmark' }, - { label: 'Submenu 2.2.2', icon: 'pi pi-fw pi-bookmark' }, - ], - }, - ], - }, - ], - }, - ]; + ]; - const addClass = (element, className) => { - if (element.classList) element.classList.add(className); - else element.className += ' ' + className; - }; + const addClass = (element, className) => { + if (element.classList) element.classList.add(className); + else element.className += ' ' + className; + }; - const removeClass = (element, className) => { - if (element.classList) element.classList.remove(className); - else - element.className = element.className.replace( - new RegExp( - '(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', - 'gi', - ), - ' ', - ); - }; + const removeClass = (element, className) => { + if (element.classList) element.classList.remove(className); + else + element.className = element.className.replace( + new RegExp( + '(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', + 'gi', + ), + ' ', + ); + }; - const wrapperClass = classNames('layout-wrapper', { - 'layout-overlay': layoutMode === 'overlay', - 'layout-static': layoutMode === 'static', - 'layout-static-sidebar-inactive': - staticMenuInactive && layoutMode === 'static', - 'layout-overlay-sidebar-active': - overlayMenuActive && layoutMode === 'overlay', - 'layout-mobile-sidebar-active': mobileMenuActive, - 'p-input-filled': inputStyle === 'filled', - 'p-ripple-disabled': ripple === false, - 'layout-theme-light': layoutColorMode === 'light', - }); + const wrapperClass = classNames('layout-wrapper', { + 'layout-overlay': layoutMode === 'overlay', + 'layout-static': layoutMode === 'static', + 'layout-static-sidebar-inactive': + staticMenuInactive && layoutMode === 'static', + 'layout-overlay-sidebar-active': + overlayMenuActive && layoutMode === 'overlay', + 'layout-mobile-sidebar-active': mobileMenuActive, + 'p-input-filled': inputStyle === 'filled', + 'p-ripple-disabled': ripple === false, + 'layout-theme-light': layoutColorMode === 'light', + }); - return ( -