update
This commit is contained in:
parent
19f4c6ce23
commit
0192b2bb28
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}
|
||||||
|
|||||||
@ -13,7 +13,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';
|
||||||
@ -44,7 +44,7 @@ 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 clients({clients}) {
|
export default function clients({clients, userName}) {
|
||||||
const [client, setClient] = useState<any>({
|
const [client, setClient] = useState<any>({
|
||||||
name: String,
|
name: String,
|
||||||
email: String,
|
email: String,
|
||||||
@ -121,23 +121,23 @@ export default function clients({clients}) {
|
|||||||
|
|
||||||
<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%' }}>
|
||||||
notificação 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%' }}>
|
||||||
Notificação 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%' }}>
|
||||||
notificação 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%' }}>
|
||||||
Notificação não excluida!
|
Cliente não excluido!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ export default function clients({clients}) {
|
|||||||
client_id: value.target.value
|
client_id: value.target.value
|
||||||
})
|
})
|
||||||
}} variant="outlined" />
|
}} variant="outlined" />
|
||||||
<InputUpload />
|
<InputUploadImg />
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<FaqButton1 title='Cancelar' onClick={() => setOpen(false)} />
|
<FaqButton1 title='Cancelar' onClick={() => setOpen(false)} />
|
||||||
<FaqButton2 title='Salvar' onClick={() => handleCreateClient(client)}/>
|
<FaqButton2 title='Salvar' onClick={() => handleCreateClient(client)}/>
|
||||||
@ -218,7 +218,7 @@ export default function clients({clients}) {
|
|||||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
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)
|
||||||
let clients = [];
|
let clients = [];
|
||||||
|
|
||||||
await apiClient.get('/user').then(res => {
|
await apiClient.get('/user').then(res => {
|
||||||
@ -241,6 +241,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
clients,
|
clients,
|
||||||
|
userName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ 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))
|
await signIn({email, password})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ export default function Home() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValues({
|
setValues({
|
||||||
password: "",
|
password: null,
|
||||||
showPassword: false,
|
showPassword: false,
|
||||||
});
|
});
|
||||||
setEmail("")
|
setEmail("")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user