diff --git a/public/assets/iconePDF.png b/public/assets/iconePDF.png new file mode 100644 index 0000000..38e28b2 Binary files /dev/null and b/public/assets/iconePDF.png differ diff --git a/src/components/header/Header.tsx b/src/components/header/Header.tsx index db21a84..1fba829 100644 --- a/src/components/header/Header.tsx +++ b/src/components/header/Header.tsx @@ -45,12 +45,12 @@ export default function Header({ name, admin }: headerInterface) {
- { + {/* { !admin? : null - } + } */}

olá, {name} diff --git a/src/components/inputUplaod/inputUpload.tsx b/src/components/inputUploadImg/inputUpload.tsx similarity index 96% rename from src/components/inputUplaod/inputUpload.tsx rename to src/components/inputUploadImg/inputUpload.tsx index dad71d1..34daa86 100644 --- a/src/components/inputUplaod/inputUpload.tsx +++ b/src/components/inputUploadImg/inputUpload.tsx @@ -3,7 +3,7 @@ import React,{ useState, useEffect } from 'react' import { InputUploadView } from './inputUploadView' -export default function InputUpload() { +export default function InputUploadPdf() { const [images, setImages] = useState([] as any); const [imageURLS, setImageURLs] = useState([]); @@ -34,6 +34,7 @@ export default function InputUpload() {

+
diff --git a/src/components/inputUplaod/inputUploadView.ts b/src/components/inputUploadImg/inputUploadView.ts similarity index 100% rename from src/components/inputUplaod/inputUploadView.ts rename to src/components/inputUploadImg/inputUploadView.ts diff --git a/src/components/inputUploadPdf/inputUpload.tsx b/src/components/inputUploadPdf/inputUpload.tsx new file mode 100644 index 0000000..96866c0 --- /dev/null +++ b/src/components/inputUploadPdf/inputUpload.tsx @@ -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 ( + + +
+ + {imageURLS.map((imageSrc, index) => ( + + ))} + + + + +
+ +
+ + +
+ + +
+ +
+
+ ) +} diff --git a/src/components/inputUploadPdf/inputUploadView.ts b/src/components/inputUploadPdf/inputUploadView.ts new file mode 100644 index 0000000..fed659c --- /dev/null +++ b/src/components/inputUploadPdf/inputUploadView.ts @@ -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; +} + + + +` diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index 186c956..3e777ff 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -59,6 +59,7 @@ export default function Sidebar() {
  • {'Sobre Nós'}
  • {'FAQ >'}
  • {'Notificações >'}
  • +
  • {'Info Setorial'}
  • - Usuario cadastrada com sucesso! + Cliente cadastrada com Sucesso! - Usuario não cadastrada! + Cliente não cadastrado! - Usuario excluida com sucesso! + Cliente excluido com sucesso! - Usuario não excluida! + Cliente não excluido! @@ -219,7 +219,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { const apiClient = getAPIClient(ctx) const { ['@smartAuth-token']: token } = parseCookies(ctx) const { ['user-name']: userName } = parseCookies(ctx) - let clients = []; await apiClient.get('/user').then(res => { diff --git a/src/pages/administrative/industryInfo/index.tsx b/src/pages/administrative/industryInfo/index.tsx new file mode 100644 index 0000000..17d3d4d --- /dev/null +++ b/src/pages/administrative/industryInfo/index.tsx @@ -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 ( + + + Smart Energia - Info de Setor + +
    +
    + + +
    + + + + + + ) +} + +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 + } + } +} + diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 614c0e7..a95fd64 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -10,9 +10,6 @@ import Link from 'next/link'; import { useRouter } from 'next/router' import React, { useContext, useState, useEffect,useCallback } from 'react' 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 Snackbar from '@mui/material/Snackbar'; @@ -23,7 +20,6 @@ import { LoginContainer, LoginView } from '../styles/layouts/login/LoginView'; import Dashboard from './dashboard'; import MuiAlert, { AlertProps } from '@mui/material/Alert'; - const Alert = React.forwardRef(function Alert( props, ref, @@ -31,7 +27,6 @@ const Alert = React.forwardRef(function Alert( return ; }); - export default function Home() { const [openSnackSuccess, setOpenSnackSuccess] = useState(false); const [openSnackError, setOpenSnackError] = useState(false); @@ -74,11 +69,19 @@ export default function Home() { if (email === "" || password === ""){ setOpenSnackError(true) }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') { return; } @@ -89,7 +92,7 @@ export default function Home() { useEffect(() => { setValues({ - password: "", + password: null, showPassword: false, }); setEmail("") diff --git a/src/pages/verifyEmail.tsx b/src/pages/verifyEmail.tsx index e26c3d0..99591f9 100644 --- a/src/pages/verifyEmail.tsx +++ b/src/pages/verifyEmail.tsx @@ -56,7 +56,9 @@ export default function VerifyEmail() { setSent(true)} /> + + setCode(value.target.value)} /> {verifyConfirmationCode()}} />