fixing login pages
This commit is contained in:
commit
e40626f859
BIN
public/assets/iconePDF.png
Normal file
BIN
public/assets/iconePDF.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@ -45,12 +45,12 @@ export default function Header({ name, admin }: headerInterface) {
|
|||||||
<section>
|
<section>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
{
|
{/* {
|
||||||
!admin?
|
!admin?
|
||||||
<Image src='/assets/png/copel.png' width={170} height={50} />
|
<Image src='/assets/png/copel.png' width={170} height={50} />
|
||||||
:
|
:
|
||||||
null
|
null
|
||||||
}
|
} */}
|
||||||
<div className='icon' >
|
<div className='icon' >
|
||||||
<p>
|
<p>
|
||||||
olá, {name}
|
olá, {name}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import React,{ useState, useEffect } from 'react'
|
|||||||
import { InputUploadView } from './inputUploadView'
|
import { InputUploadView } from './inputUploadView'
|
||||||
|
|
||||||
|
|
||||||
export default function InputUpload() {
|
export default function InputUploadPdf() {
|
||||||
const [images, setImages] = useState([] as any);
|
const [images, setImages] = useState([] as any);
|
||||||
const [imageURLS, setImageURLs] = useState([]);
|
const [imageURLS, setImageURLs] = useState([]);
|
||||||
|
|
||||||
@ -34,6 +34,7 @@ export default function InputUpload() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="update">
|
<div className="update">
|
||||||
|
|
||||||
<form action="">
|
<form action="">
|
||||||
<div >
|
<div >
|
||||||
<label htmlFor="arquivo"> <p className='TitleButton'> Enviar foto de Perfil </p> </label>
|
<label htmlFor="arquivo"> <p className='TitleButton'> Enviar foto de Perfil </p> </label>
|
||||||
49
src/components/inputUploadPdf/inputUpload.tsx
Normal file
49
src/components/inputUploadPdf/inputUpload.tsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import React,{ useState, useEffect } from 'react'
|
||||||
|
import Image from 'next/image';
|
||||||
|
|
||||||
|
|
||||||
|
import { InputUploadView } from './inputUploadView'
|
||||||
|
|
||||||
|
|
||||||
|
export default function InputUploadPdf() {
|
||||||
|
const [images, setImages] = useState([] as any);
|
||||||
|
const [imageURLS, setImageURLs] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (images.length < 1) return;
|
||||||
|
const newImageUrls: any = [];
|
||||||
|
images.forEach((image:any) => newImageUrls.push(URL.createObjectURL(image)));
|
||||||
|
setImageURLs(newImageUrls);
|
||||||
|
}, [images]);
|
||||||
|
|
||||||
|
function onImageChange(e: any) {
|
||||||
|
setImages([...e.target.files]);
|
||||||
|
// console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<InputUploadView>
|
||||||
|
|
||||||
|
<div className='imgContainer'>
|
||||||
|
|
||||||
|
{imageURLS.map((imageSrc, index) => (
|
||||||
|
<Image src='/assets/iconePDf.png' key={index} width={30} height={30} className="image" />
|
||||||
|
))}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="update">
|
||||||
|
|
||||||
|
<form action="">
|
||||||
|
<div className='testess'>
|
||||||
|
<label htmlFor="arquivo"> <p className='TitleButton'> Enviar PDF </p> </label>
|
||||||
|
<input type="file" name='arquivo' id='arquivo' onChange={onImageChange} />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</InputUploadView>
|
||||||
|
)
|
||||||
|
}
|
||||||
51
src/components/inputUploadPdf/inputUploadView.ts
Normal file
51
src/components/inputUploadPdf/inputUploadView.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import styled from 'styled-components'
|
||||||
|
|
||||||
|
export const InputUploadView = styled.div`
|
||||||
|
|
||||||
|
border-radius: 4px;
|
||||||
|
border:1px solid gray ;
|
||||||
|
background-color: white;
|
||||||
|
width: 300px;
|
||||||
|
height: 50px;
|
||||||
|
|
||||||
|
input[type="file"] {
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
width: 140px;
|
||||||
|
height: 30px;
|
||||||
|
margin-top: -30px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-left: 69px;
|
||||||
|
background-color: #254F7F;
|
||||||
|
color: white;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
display: flex;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.TitleButton{
|
||||||
|
margin-top: 4px;
|
||||||
|
margin-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testess{
|
||||||
|
margin-left: 80px;
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgContainer{
|
||||||
|
max-width: 40px;
|
||||||
|
margin-top: 9px;
|
||||||
|
margin-left: 4px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
@ -59,6 +59,7 @@ export default function Sidebar() {
|
|||||||
<Link href='/administrative/general'><li className={router.pathname=='/administrative/general'? 'actualPath' : null} ><Image src='/assets/sidebar/aboutUs.svg' width={25} height={25} />{'Sobre Nós'}</li></Link>
|
<Link href='/administrative/general'><li className={router.pathname=='/administrative/general'? 'actualPath' : null} ><Image src='/assets/sidebar/aboutUs.svg' width={25} height={25} />{'Sobre Nós'}</li></Link>
|
||||||
<Link href='/administrative/faq'><li className={router.pathname=='/administrative/faq' ? 'actualPath' : null } ><Image src='/assets/sidebar/saqIcon.svg' width={25} height={25} />{'FAQ >'}</li></Link>
|
<Link href='/administrative/faq'><li className={router.pathname=='/administrative/faq' ? 'actualPath' : null } ><Image src='/assets/sidebar/saqIcon.svg' width={25} height={25} />{'FAQ >'}</li></Link>
|
||||||
<Link href='/administrative/notification'><li className={router.pathname=='/administrative/notification'? 'actualPath' : null}><Image src='/assets/sidebar/notificationsIcon.svg' width={25} height={25} />{'Notificações >'}</li></Link>
|
<Link href='/administrative/notification'><li className={router.pathname=='/administrative/notification'? 'actualPath' : null}><Image src='/assets/sidebar/notificationsIcon.svg' width={25} height={25} />{'Notificações >'}</li></Link>
|
||||||
|
<Link href='/administrative/industryInfo'><li className={router.pathname=='/administrative/general'? 'actualPath' : null} ><Image src='/assets/sidebar/aboutUs.svg' width={25} height={25} />{'Info Setorial'}</li></Link>
|
||||||
<button onClick={handleOpen}><Image src='/assets/logout.svg' width={25} height={25} />{'Sair'}</button>
|
<button onClick={handleOpen}><Image src='/assets/logout.svg' width={25} height={25} />{'Sair'}</button>
|
||||||
<Modal
|
<Modal
|
||||||
open={open}
|
open={open}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export function AuthProvider({children}: {children: React.ReactNode}) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
return
|
return exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import BasicButton from '../../../components/buttons/basicButton/BasicButton'
|
|||||||
import FaqButton1 from '../../../components/buttons/faqButton/FaqButton1';
|
import FaqButton1 from '../../../components/buttons/faqButton/FaqButton1';
|
||||||
import FaqButton2 from '../../../components/buttons/faqButton/FaqButton2';
|
import FaqButton2 from '../../../components/buttons/faqButton/FaqButton2';
|
||||||
import Header from '../../../components/header/Header'
|
import Header from '../../../components/header/Header'
|
||||||
import InputUpload from '../../../components/inputUplaod/inputUpload';
|
import InputUploadImg from '../../../components/inputUploadImg/inputUpload';
|
||||||
import { ClientsView } from '../../../styles/layouts/clients/ClientsView';
|
import { ClientsView } from '../../../styles/layouts/clients/ClientsView';
|
||||||
import PageTitle from '../../../components/pageTitle/PageTitle';
|
import PageTitle from '../../../components/pageTitle/PageTitle';
|
||||||
import ConfirmModal from '../../../components/modal/ConfirmModal';
|
import ConfirmModal from '../../../components/modal/ConfirmModal';
|
||||||
@ -121,23 +121,23 @@ export default function clients({clients, userName}) {
|
|||||||
<div style={{display: 'flex', flexDirection: 'column', width: '100%'}}>
|
<div style={{display: 'flex', flexDirection: 'column', width: '100%'}}>
|
||||||
<Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}>
|
<Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||||
<Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}>
|
||||||
Usuario cadastrada com sucesso!
|
Cliente cadastrada com Sucesso!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
|
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||||
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
|
||||||
Usuario não cadastrada!
|
Cliente não cadastrado!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
|
|
||||||
<Snackbar open={openSnackSuccessDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
<Snackbar open={openSnackSuccessDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
||||||
<Alert onClose={handleCloseSnackDelete} severity="success" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnackDelete} severity="success" sx={{ width: '100%' }}>
|
||||||
Usuario excluida com sucesso!
|
Cliente excluido com sucesso!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
<Snackbar open={openSnackErrorDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
<Snackbar open={openSnackErrorDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
||||||
<Alert onClose={handleCloseSnackDelete} severity="error" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnackDelete} severity="error" sx={{ width: '100%' }}>
|
||||||
Usuario não excluida!
|
Cliente não excluido!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
|
|
||||||
@ -219,7 +219,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
const apiClient = getAPIClient(ctx)
|
const apiClient = getAPIClient(ctx)
|
||||||
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
||||||
const { ['user-name']: userName } = parseCookies(ctx)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
|
||||||
let clients = [];
|
let clients = [];
|
||||||
|
|
||||||
await apiClient.get('/user').then(res => {
|
await apiClient.get('/user').then(res => {
|
||||||
|
|||||||
49
src/pages/administrative/industryInfo/index.tsx
Normal file
49
src/pages/administrative/industryInfo/index.tsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import { GetServerSideProps } from 'next'
|
||||||
|
import Head from 'next/head'
|
||||||
|
import { parseCookies } from 'nookies'
|
||||||
|
import React from 'react'
|
||||||
|
import BasicButton from '../../../components/buttons/basicButton/BasicButton'
|
||||||
|
import Header from '../../../components/header/Header'
|
||||||
|
import PageTitle from '../../../components/pageTitle/PageTitle'
|
||||||
|
import { IndustryInfoView } from '../../../styles/layouts/industryInfo/IndustryInfoView'
|
||||||
|
import InputUploadPdf from '../../../components/inputUploadPdf/inputUpload';
|
||||||
|
|
||||||
|
export default function industryInfo({userName}: any) {
|
||||||
|
return (
|
||||||
|
<IndustryInfoView>
|
||||||
|
<Head>
|
||||||
|
<title>Smart Energia - Info de Setor</title>
|
||||||
|
</Head>
|
||||||
|
<Header name={userName} />
|
||||||
|
<div className='title'>
|
||||||
|
<PageTitle title='Info Setorial' subtitle='Realize o upload da última versão de info setorial' />
|
||||||
|
<InputUploadPdf/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<BasicButton onClick={("")} title='Atualizar'/>
|
||||||
|
|
||||||
|
|
||||||
|
</IndustryInfoView>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||||
|
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
||||||
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
return {
|
||||||
|
redirect: {
|
||||||
|
destination: '/',
|
||||||
|
permanent: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
userName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -10,9 +10,6 @@ import Link from 'next/link';
|
|||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import React, { useContext, useState, useEffect,useCallback } from 'react'
|
import React, { useContext, useState, useEffect,useCallback } from 'react'
|
||||||
import { AiOutlineEye, AiOutlineEyeInvisible } from 'react-icons/ai';
|
import { AiOutlineEye, AiOutlineEyeInvisible } from 'react-icons/ai';
|
||||||
import * as yup from 'yup';
|
|
||||||
import { yupResolver } from '@hookform/resolvers/yup';
|
|
||||||
import { useForm } from 'react-hook-form';
|
|
||||||
import RenderIf from '../utils/renderIf';
|
import RenderIf from '../utils/renderIf';
|
||||||
import Snackbar from '@mui/material/Snackbar';
|
import Snackbar from '@mui/material/Snackbar';
|
||||||
|
|
||||||
@ -23,7 +20,6 @@ import { LoginContainer, LoginView } from '../styles/layouts/login/LoginView';
|
|||||||
import Dashboard from './dashboard';
|
import Dashboard from './dashboard';
|
||||||
import MuiAlert, { AlertProps } from '@mui/material/Alert';
|
import MuiAlert, { AlertProps } from '@mui/material/Alert';
|
||||||
|
|
||||||
|
|
||||||
const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
||||||
props,
|
props,
|
||||||
ref,
|
ref,
|
||||||
@ -31,7 +27,6 @@ const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
|||||||
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
|
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
||||||
const [openSnackError, setOpenSnackError] = useState<boolean>(false);
|
const [openSnackError, setOpenSnackError] = useState<boolean>(false);
|
||||||
@ -74,11 +69,19 @@ export default function Home() {
|
|||||||
if (email === "" || password === ""){
|
if (email === "" || password === ""){
|
||||||
setOpenSnackError(true)
|
setOpenSnackError(true)
|
||||||
}else{
|
}else{
|
||||||
await signIn({email, password}).then(res => {console.log('')}).catch(res => setOpenSnackError(true))
|
try {
|
||||||
|
await signIn({email, password}).then((res: any) => {
|
||||||
|
if (res.response.status === 422) {
|
||||||
|
setOpenSnackError(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (exception){
|
||||||
|
console.log(exception)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCloseSnack = (event?: React.SyntheticEvent | Event, reason?: string) => {
|
const handleCloseSnack = (event?: React.SyntheticEvent | Event, reason?: string) => {
|
||||||
if (reason === 'clickaway') {
|
if (reason === 'clickaway') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -89,7 +92,7 @@ export default function Home() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValues({
|
setValues({
|
||||||
password: "",
|
password: null,
|
||||||
showPassword: false,
|
showPassword: false,
|
||||||
});
|
});
|
||||||
setEmail("")
|
setEmail("")
|
||||||
|
|||||||
@ -56,7 +56,9 @@ export default function VerifyEmail() {
|
|||||||
<LoginButton title='Enviar Email' onClick={() => setSent(true)} />
|
<LoginButton title='Enviar Email' onClick={() => setSent(true)} />
|
||||||
</RenderIf>
|
</RenderIf>
|
||||||
|
|
||||||
|
|
||||||
<RenderIf isTrue={sent? true : false}>
|
<RenderIf isTrue={sent? true : false}>
|
||||||
|
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }}label="Nova Senha" variant="outlined"/>
|
||||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }}label="Codigo de verificação" variant="outlined" onChange={value => setCode(value.target.value)} />
|
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }}label="Codigo de verificação" variant="outlined" onChange={value => setCode(value.target.value)} />
|
||||||
<LoginButton title='Continuar' onClick={() => {verifyConfirmationCode()}} />
|
<LoginButton title='Continuar' onClick={() => {verifyConfirmationCode()}} />
|
||||||
<RenderIf isTrue={codeStatus===true? true : false} >
|
<RenderIf isTrue={codeStatus===true? true : false} >
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user