Merge branch 'administativePages' into 'dev'
Administative pages See merge request kluppsoftware/smart-energia-web!87
This commit is contained in:
commit
a4a5f90392
@ -48,7 +48,10 @@ export default function Chart({ title, data1, data2, label, subtitle, dataset1,
|
||||
plugins: {
|
||||
datalabels: {
|
||||
display: true,
|
||||
color: barLabel? 'black' : "rgba(255, 255, 255, 0)",
|
||||
color: (value, ctx) => {
|
||||
console.log(value)
|
||||
return value.dataset.label==='2021'? 'black' : 'white'
|
||||
},
|
||||
formatter: (value, ctx) => {
|
||||
let sum = 0;
|
||||
const dataArr = ctx.chart.data.datasets[0].data;
|
||||
@ -59,11 +62,13 @@ export default function Chart({ title, data1, data2, label, subtitle, dataset1,
|
||||
|
||||
return value==null? null : result
|
||||
},
|
||||
anchor: "end",
|
||||
offset: -20,
|
||||
align: "start",
|
||||
anchor: "start",
|
||||
offset: 20,
|
||||
align: "end",
|
||||
rotation: -90,
|
||||
font: {
|
||||
size: 12
|
||||
size: 14,
|
||||
weight: 800
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
|
||||
@ -28,8 +28,6 @@ interface SingleBarInterface{
|
||||
}
|
||||
|
||||
export function SingleBar({ title, subtitle, dataProps, label, dataset, barLabel, brutoAnual }: SingleBarInterface) {
|
||||
const currentTime = new Date();
|
||||
|
||||
const options: object = {
|
||||
responsive: true,
|
||||
series: {
|
||||
|
||||
@ -3,10 +3,10 @@ import Head from 'next/head'
|
||||
import Image from 'next/image'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
import Banner from '../components/banner/Banner'
|
||||
import Header from '../components/header/Header'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import { AboutUsView } from '../styles/layouts/aboutUs/AboutUsView'
|
||||
import Banner from '../../components/banner/Banner'
|
||||
import Header from '../../components/header/Header'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
import { AboutUsView } from '../../styles/layouts/aboutUs/AboutUsView'
|
||||
|
||||
export default function aboutUs({userName, text}) {
|
||||
return (
|
||||
@ -3,14 +3,14 @@ import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
|
||||
import Chart from '../components/graph/Chart'
|
||||
import { SingleBar } from '../components/graph/SingleBar'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { EconomiaAcumulada } from '../services/economiaAcumulada'
|
||||
import { dataEconomiaBruta } from '../services/economiaBruta'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import { AccumulatedSavingsView } from '../styles/layouts/economy/accumulatedSavings/AccumulatedSavingsView'
|
||||
import Chart from '../../components/graph/Chart'
|
||||
import { SingleBar } from '../../components/graph/SingleBar'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import { EconomiaAcumulada } from '../../services/economiaAcumulada'
|
||||
import { dataEconomiaBruta } from '../../services/economiaBruta'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
import { AccumulatedSavingsView } from '../../styles/layouts/economy/accumulatedSavings/AccumulatedSavingsView'
|
||||
|
||||
export default function AccumulatedSavings({graphData, years, userName}: any) {
|
||||
return (
|
||||
@ -22,12 +22,7 @@ export default function AccumulatedSavings({graphData, years, userName}: any) {
|
||||
<PageTitle title='Economia Bruta Mensal' subtitle='Economia Bruta Estimada e Acumulada mensal - Valores em R$ mil' />
|
||||
<section>
|
||||
<SingleBar title='' subtitle='' dataset='Consolidada'
|
||||
dataProps={graphData.sort((a, b) => {
|
||||
if (parseFloat(a.mes.slice(0,2)) > parseFloat(b.mes.slice(1,2))) return 1
|
||||
if (parseFloat(a.mes.slice(0,2)) < parseFloat(b.mes.slice(1,2))) return -1
|
||||
|
||||
return 0
|
||||
})}
|
||||
dataProps={graphData}
|
||||
label={years} barLabel/>
|
||||
</section>
|
||||
</AccumulatedSavingsView>
|
||||
@ -1,15 +1,15 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { SingleBar } from '../components/graph/SingleBar'
|
||||
import { ChatTelemetryView } from '../styles/layouts/ChatTelemetry/ChatTelemetryView'
|
||||
import { SingleBar } from '../../components/graph/SingleBar'
|
||||
import { ChatTelemetryView } from '../../styles/layouts/ChatTelemetry/ChatTelemetryView'
|
||||
// import router, { useRouter } from 'next/router'
|
||||
|
||||
import { FatorPotencia } from '../services/fatorPotencia'
|
||||
import { ConsumoDecretizadoBar } from '../services/consumoDiscretizadoBar'
|
||||
import { ConsumoDecretizadoLine } from '../services/consumoDiscretizadoLine'
|
||||
import LineChart from '../components/graph/LineChart'
|
||||
import { LineBarChart } from '../components/graph/LineBarChart'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { FatorPotencia } from '../../services/fatorPotencia'
|
||||
import { ConsumoDecretizadoBar } from '../../services/consumoDiscretizadoBar'
|
||||
import { ConsumoDecretizadoLine } from '../../services/consumoDiscretizadoLine'
|
||||
import LineChart from '../../components/graph/LineChart'
|
||||
import { LineBarChart } from '../../components/graph/LineBarChart'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import Head from 'next/head'
|
||||
|
||||
import Box from '@mui/material/Box';
|
||||
@ -18,14 +18,14 @@ import Typography from '@mui/material/Typography';
|
||||
import Modal from '@mui/material/Modal';
|
||||
import { GetServerSideProps } from 'next'
|
||||
import { parseCookies } from 'nookies'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import { api } from '../services/api'
|
||||
import FatorPotenciaChart from '../components/graph/fatorPotenciaChart'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
import { api } from '../../services/api'
|
||||
import FatorPotenciaChart from '../../components/graph/fatorPotenciaChart'
|
||||
// import { DemRegXDemConChart } from '../components/graph/demRegXDemConChart'
|
||||
import { DiscretizedConsumptionChart } from '../components/graph/DiscretizedConsumptionChart'
|
||||
import DiscretizedConsumptionChartLine from '../components/graph/DiscretizedConsumptionChartLine'
|
||||
import { DiscretizedConsumptionChart } from '../../components/graph/DiscretizedConsumptionChart'
|
||||
import DiscretizedConsumptionChartLine from '../../components/graph/DiscretizedConsumptionChartLine'
|
||||
import router, { useRouter } from 'next/router'
|
||||
import { DemRegXDemConChart } from '../components/graph/DemRegXDemConChart'
|
||||
import { DemRegXDemConChart } from '../../components/graph/DemRegXDemConChart'
|
||||
|
||||
const style = {
|
||||
display: 'flex',
|
||||
@ -2,11 +2,11 @@ import { GetServerSideProps } from 'next'
|
||||
import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
import Chart from '../components/graph/Chart'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { dataEconomiaIndicador } from '../services/economiaIndicador'
|
||||
import { ConsumptionView } from '../styles/layouts/consumption/ConsumptionView'
|
||||
import Chart from '../../components/graph/Chart'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import { dataEconomiaIndicador } from '../../services/economiaIndicador'
|
||||
import { ConsumptionView } from '../../styles/layouts/consumption/ConsumptionView'
|
||||
|
||||
export default function Consumption({userName}: any) {
|
||||
return (
|
||||
@ -3,11 +3,11 @@ import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
|
||||
import Chart from '../components/graph/Chart'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import { CostIndicatorView } from '../styles/layouts/economy/costIndicator/CostIndicatorView'
|
||||
import Chart from '../../components/graph/Chart'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
import { CostIndicatorView } from '../../styles/layouts/economy/costIndicator/CostIndicatorView'
|
||||
|
||||
export default function CostIndicator({graphData, userName}: any) {
|
||||
return (
|
||||
@ -1,27 +1,27 @@
|
||||
import React from 'react'
|
||||
|
||||
import { DashboardView } from '../styles/layouts/dashboard/DashboardView'
|
||||
import { DashboardView } from '../../styles/layouts/dashboard/DashboardView'
|
||||
|
||||
import MapCard from '../components/mapCard/MapCard'
|
||||
import GraphCard from '../components/graph/graphCard/ChartCard'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import MapCard from '../../components/mapCard/MapCard'
|
||||
import GraphCard from '../../components/graph/graphCard/ChartCard'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import Link from 'next/link'
|
||||
import LineChart from '../components/graph/LineChart'
|
||||
import { SingleBar } from '../components/graph/SingleBar'
|
||||
import LineChart from '../../components/graph/LineChart'
|
||||
import { SingleBar } from '../../components/graph/SingleBar'
|
||||
|
||||
import { dataEconomiaBruta } from '../services/economiaBruta'
|
||||
import { dataEconomiaIndicador } from '../services/economiaIndicador'
|
||||
import { EconomiaAcumulada } from '../services/economiaAcumulada'
|
||||
import Chart from '../components/graph/Chart'
|
||||
import { LineBarChart } from '../components/graph/LineBarChart'
|
||||
import { LineBarChart2 } from '../components/graph/LineBarChart2'
|
||||
import { ConsumoEstimado } from '../services/consumoEstimado'
|
||||
import { dataEconomiaBruta } from '../../services/economiaBruta'
|
||||
import { dataEconomiaIndicador } from '../../services/economiaIndicador'
|
||||
import { EconomiaAcumulada } from '../../services/economiaAcumulada'
|
||||
import Chart from '../../components/graph/Chart'
|
||||
import { LineBarChart } from '../../components/graph/LineBarChart'
|
||||
import { LineBarChart2 } from '../../components/graph/LineBarChart2'
|
||||
import { ConsumoEstimado } from '../../services/consumoEstimado'
|
||||
import Head from 'next/head'
|
||||
import recoverUserInformation from '../services/auth'
|
||||
import recoverUserInformation from '../../services/auth'
|
||||
import { parseCookies } from 'nookies'
|
||||
import { GetServerSideProps } from 'next'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
|
||||
export default function Dashboard({grossAnualGraph, grossAnualYears, grossMensalGraph, grossMensalYears, acumulatedGraph, mapsInfo, userName, costIndicator} : any) {
|
||||
return (
|
||||
@ -3,14 +3,14 @@ import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
|
||||
import Chart from '../components/graph/Chart'
|
||||
import { LineBarChart } from '../components/graph/LineBarChart'
|
||||
import { LineBarChart2 } from '../components/graph/LineBarChart2'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { ConsumoEstimado } from '../services/consumoEstimado'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import { EstimatedCostView } from '../styles/layouts/economy/estimatedCost/EstimatedCostView'
|
||||
import Chart from '../../components/graph/Chart'
|
||||
import { LineBarChart } from '../../components/graph/LineBarChart'
|
||||
import { LineBarChart2 } from '../../components/graph/LineBarChart2'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import { ConsumoEstimado } from '../../services/consumoEstimado'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
import { EstimatedCostView } from '../../styles/layouts/economy/estimatedCost/EstimatedCostView'
|
||||
|
||||
export default function EstimatedCost({graphData, userName}: any) {
|
||||
return (
|
||||
@ -2,12 +2,12 @@ import { GetServerSideProps } from 'next'
|
||||
import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
import CommonQuestionsCard from '../components/faqQuestionsCard/FaqQuestionsCard'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { api } from '../services/api'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import { FaqView } from '../styles/layouts/commonQuestions/FaqView'
|
||||
import CommonQuestionsCard from '../../components/faqQuestionsCard/FaqQuestionsCard'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import { api } from '../../services/api'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
import { FaqView } from '../../styles/layouts/commonQuestions/FaqView'
|
||||
|
||||
|
||||
export default function commonQuestions({faqData, userName}) {
|
||||
@ -1,67 +0,0 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
import LoginButton from '../components/buttons/loginButton/LoginButton';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import { ForgotPasswordContainer, ForgotPasswordView } from '../styles/layouts/forgotPassword/ForgotPasswordView';
|
||||
import RenderIf from '../utils/renderIf';
|
||||
import Alert from '@mui/material/Alert';
|
||||
import Head from 'next/head';
|
||||
|
||||
export default function ForgotPassword() {
|
||||
const router = useRouter()
|
||||
const rota = router.pathname
|
||||
|
||||
const [password, setPassword] = useState<string>('')
|
||||
const [confirmPassword, setConfirmPassword] = useState<string>('')
|
||||
const [same, setSame] = useState<boolean>(false)
|
||||
|
||||
useEffect(() => {
|
||||
setPassword('')
|
||||
setConfirmPassword('')
|
||||
setSame(false)
|
||||
}, [rota])
|
||||
|
||||
function handleChangePassword() {
|
||||
if (same) {
|
||||
router.push('/')
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (password == confirmPassword && password != '') {
|
||||
setSame(false)
|
||||
} else {
|
||||
setSame(true)
|
||||
}
|
||||
}, [password])
|
||||
|
||||
return (
|
||||
<ForgotPasswordView auth={rota} >
|
||||
<Head>
|
||||
<title>Smart Energia</title>
|
||||
</Head>
|
||||
<Image src='/assets/marca1.svg' width={350} height={350} />
|
||||
<ForgotPasswordContainer>
|
||||
<h1>Bem-Vindo</h1>
|
||||
<h2>Estratégias Inteligentes em<br /> Gestão de Energia</h2>
|
||||
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }} value={password} label="Senha" onChange={value => setPassword(value.target.value)} variant="outlined"/>
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }} value={confirmPassword} label="Confirmar Senha" onChange={value => setConfirmPassword(value.target.value)} variant="outlined"/>
|
||||
|
||||
<LoginButton title='Redefinir Senha' onClick={() => handleChangePassword()} />
|
||||
|
||||
<fieldset className="line">
|
||||
<legend className="text">Ou</legend>
|
||||
</fieldset>
|
||||
|
||||
<p><a href='tel:+55(41) 3012-5900' >+55(41) 3012-5900</a><br/><a href='https://www.energiasmart.com.br' >www.energiasmart.com.br</a></p>
|
||||
|
||||
</ForgotPasswordContainer>
|
||||
</ForgotPasswordView>
|
||||
)
|
||||
}
|
||||
|
||||
116
src/pages/forgotPassword/index.tsx
Normal file
116
src/pages/forgotPassword/index.tsx
Normal file
@ -0,0 +1,116 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/router'
|
||||
import FormData from 'form-data';
|
||||
import Snackbar from '@mui/material/Snackbar';
|
||||
import LoginButton from '../../components/buttons/loginButton/LoginButton';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import { ForgotPasswordContainer, ForgotPasswordView } from '../../styles/layouts/forgotPassword/ForgotPasswordView';
|
||||
import RenderIf from '../../utils/renderIf';
|
||||
import Alert from '@mui/material/Alert';
|
||||
import Head from 'next/head';
|
||||
import { GetServerSideProps } from 'next';
|
||||
import { parseCookies } from 'nookies';
|
||||
import getAPIClient from '../../services/ssrApi';
|
||||
import { api } from '../../services/api';
|
||||
|
||||
export default function ForgotPassword() {
|
||||
const router = useRouter()
|
||||
const rota = router.pathname
|
||||
const formData = new FormData();
|
||||
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
||||
const [openSnackError, setOpenSnackError] = useState<boolean>(false);
|
||||
const [password, setPassword] = useState<string>('')
|
||||
const [confirmPassword, setConfirmPassword] = useState<string>('')
|
||||
const [same, setSame] = useState<boolean>(false)
|
||||
const [email, setEmail] = useState<any>();
|
||||
|
||||
useEffect(() => {
|
||||
setPassword('')
|
||||
setConfirmPassword('')
|
||||
setSame(false)
|
||||
}, [rota])
|
||||
|
||||
|
||||
const handleCloseSnack = (event?: React.SyntheticEvent | Event, reason?: string) => {
|
||||
if (reason === 'clickaway') {
|
||||
return;
|
||||
}
|
||||
setOpenSnackError(false);
|
||||
setOpenSnackSuccess(false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (password == confirmPassword && password != '') {
|
||||
setSame(false)
|
||||
} else {
|
||||
setSame(true)
|
||||
}
|
||||
}, [password])
|
||||
|
||||
function handleSendEmail() {
|
||||
formData.append('email', email)
|
||||
api.post('/auth/forgot-password', formData).then(res => {
|
||||
setOpenSnackSuccess(true)
|
||||
}).catch(res => {
|
||||
setOpenSnackError(true)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<ForgotPasswordView auth={rota}>
|
||||
<Head>
|
||||
<title>Smart Energia</title>
|
||||
</Head>
|
||||
<Image src='/assets/marca1.svg' width={350} height={350} />
|
||||
<ForgotPasswordContainer>
|
||||
<h1>Bem-Vindo</h1>
|
||||
<h2>Estratégias Inteligentes em<br /> Gestão de Energia</h2>
|
||||
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }} value={password} label="Senha" onChange={value => setPassword(value.target.value)} variant="outlined"/>
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }} value={confirmPassword} label="Confirmar Senha" onChange={value => setConfirmPassword(value.target.value)} variant="outlined"/>
|
||||
|
||||
<LoginButton title='Redefinir Senha' onClick={() => handleSendEmail()} />
|
||||
|
||||
<Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||
<Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}>
|
||||
PDF enviado com Sucesso!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
|
||||
Falha ao enviar PDF!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
|
||||
<fieldset className="line">
|
||||
<legend className="text">Ou</legend>
|
||||
</fieldset>
|
||||
|
||||
<p><a href='tel:+55(41) 3012-5900' >+55(41) 3012-5900</a><br/><a href='https://www.energiasmart.com.br' >www.energiasmart.com.br</a></p>
|
||||
|
||||
</ForgotPasswordContainer>
|
||||
</ForgotPasswordView>
|
||||
)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,14 +3,14 @@ import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
|
||||
import Chart from '../components/graph/Chart'
|
||||
import { SingleBar } from '../components/graph/SingleBar'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { dataEconomiaBruta } from '../services/economiaBruta'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import Chart from '../../components/graph/Chart'
|
||||
import { SingleBar } from '../../components/graph/SingleBar'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import { dataEconomiaBruta } from '../../services/economiaBruta'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
|
||||
import { GrossSavingsView } from '../styles/layouts/economy/grossSavings/GrossSavings'
|
||||
import { GrossSavingsView } from '../../styles/layouts/economy/grossSavings/GrossSavings'
|
||||
|
||||
export default function GrossSavings({graphData, years, userName}: any) {
|
||||
return (
|
||||
@ -2,11 +2,11 @@ import { GetServerSideProps } from 'next'
|
||||
import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React, { useState } from 'react'
|
||||
import BasicButton from '../components/buttons/basicButton/BasicButton'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { api } from '../services/api'
|
||||
import { IndustryInfoView } from '../styles/layouts/industryInfo/IndustryInfoView'
|
||||
import BasicButton from '../../components/buttons/basicButton/BasicButton'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import { api } from '../../services/api'
|
||||
import { IndustryInfoView } from '../../styles/layouts/industryInfo/IndustryInfoView'
|
||||
|
||||
import Snackbar from '@mui/material/Snackbar';
|
||||
import MuiAlert, { AlertProps } from '@mui/material/Alert';
|
||||
@ -6,11 +6,11 @@ import { Router } from 'next/router';
|
||||
import { parseCookies } from 'nookies';
|
||||
import React from 'react'
|
||||
|
||||
import Banner from '../components/banner/Banner'
|
||||
import BasicButton from '../components/buttons/basicButton/BasicButton';
|
||||
import Header from '../components/header/Header'
|
||||
import getAPIClient from '../services/ssrApi';
|
||||
import { Button, NewsView } from '../styles/layouts/news/NewsView'
|
||||
import Banner from '../../components/banner/Banner'
|
||||
import BasicButton from '../../components/buttons/basicButton/BasicButton';
|
||||
import Header from '../../components/header/Header'
|
||||
import getAPIClient from '../../services/ssrApi';
|
||||
import { Button, NewsView } from '../../styles/layouts/news/NewsView'
|
||||
|
||||
export default function aboutUs({userName, news}: any) {
|
||||
console.log(news.channel.item)
|
||||
@ -2,12 +2,12 @@ import { GetServerSideProps } from 'next'
|
||||
import Head from 'next/head'
|
||||
import { parseCookies } from 'nookies'
|
||||
import React from 'react'
|
||||
import NotificationQuestionsCard from '../components/NotificationQuestionsCard/NotificationQuestionsCard'
|
||||
import Header from '../components/header/Header'
|
||||
import PageTitle from '../components/pageTitle/PageTitle'
|
||||
import { api } from '../services/api'
|
||||
import getAPIClient from '../services/ssrApi'
|
||||
import { FaqView } from '../styles/layouts/commonQuestions/FaqView'
|
||||
import NotificationQuestionsCard from '../../components/NotificationQuestionsCard/NotificationQuestionsCard'
|
||||
import Header from '../../components/header/Header'
|
||||
import PageTitle from '../../components/pageTitle/PageTitle'
|
||||
import { api } from '../../services/api'
|
||||
import getAPIClient from '../../services/ssrApi'
|
||||
import { FaqView } from '../../styles/layouts/commonQuestions/FaqView'
|
||||
|
||||
export default function Notifications({notificationData, userName}: any) {
|
||||
return (
|
||||
@ -10,15 +10,15 @@ import React, { useEffect, useState } from 'react';
|
||||
// import Teste from '../files/teste.csv';
|
||||
import { CSVDownload, CSVLink } from "react-csv";
|
||||
|
||||
import BasicButton from '../components/buttons/basicButton/BasicButton';
|
||||
import Header from '../components/header/Header';
|
||||
import PageTitle from '../components/pageTitle/PageTitle';
|
||||
import Sidebar from '../components/sidebar/Sidebar';
|
||||
import { api } from '../services/api';
|
||||
import BasicButton from '../../components/buttons/basicButton/BasicButton';
|
||||
import Header from '../../components/header/Header';
|
||||
import PageTitle from '../../components/pageTitle/PageTitle';
|
||||
import Sidebar from '../../components/sidebar/Sidebar';
|
||||
import { api } from '../../services/api';
|
||||
// import { dados } from '../services/DadosTabelaResumoOperacao';
|
||||
import data from '../services/dados.json'
|
||||
import getAPIClient from '../services/ssrApi';
|
||||
import { Pagination, TableView } from '../styles/layouts/ResumoOperacao/ResumoOperacaoView';
|
||||
import data from '../../services/dados.json'
|
||||
import getAPIClient from '../../services/ssrApi';
|
||||
import { Pagination, TableView } from '../../styles/layouts/ResumoOperacao/ResumoOperacaoView';
|
||||
|
||||
export default function ResumoOperacao({tableData, clientsData, userName, clientMonth}: any) {
|
||||
const csvData = tableData;
|
||||
@ -1,9 +1,9 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import Banner from '../components/banner/Banner';
|
||||
import { TelemetriaView, Buttons} from '../styles/layouts/Telemetria/TelemetriaView';
|
||||
import GradientButton from '../components/buttons/gradientButton/GradientButton'
|
||||
import Header from '../components/header/Header';
|
||||
import Banner from '../../components/banner/Banner';
|
||||
import { TelemetriaView, Buttons} from '../../styles/layouts/Telemetria/TelemetriaView';
|
||||
import GradientButton from '../../components/buttons/gradientButton/GradientButton'
|
||||
import Header from '../../components/header/Header';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import InputLabel from '@mui/material/InputLabel';
|
||||
import FormControl from '@mui/material/FormControl';
|
||||
@ -11,15 +11,15 @@ import Select, { SelectChangeEvent } from '@mui/material/Select';
|
||||
import Link from 'next/link';
|
||||
import Head from 'next/head';
|
||||
import { start } from 'nprogress';
|
||||
import LineChart from '../components/graph/LineChart';
|
||||
import { FatorPotencia } from '../services/fatorPotencia';
|
||||
import RenderIf from '../utils/renderIf';
|
||||
import LineChart from '../../components/graph/LineChart';
|
||||
import { FatorPotencia } from '../../services/fatorPotencia';
|
||||
import RenderIf from '../../utils/renderIf';
|
||||
import { GetServerSideProps } from 'next';
|
||||
import { parseCookies } from 'nookies';
|
||||
import { api } from '../services/api';
|
||||
import { api } from '../../services/api';
|
||||
import Snackbar from '@mui/material/Snackbar'
|
||||
import MuiAlert, { AlertProps } from '@mui/material/Alert'
|
||||
import getAPIClient from '../services/ssrApi';
|
||||
import getAPIClient from '../../services/ssrApi';
|
||||
|
||||
const style = {
|
||||
position: 'absolute' as const,
|
||||
@ -1,81 +0,0 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
import LoginButton from '../components/buttons/loginButton/LoginButton';
|
||||
import TextField from '@mui/material/TextField';
|
||||
|
||||
import Alert from '@mui/material/Alert';
|
||||
|
||||
import { VerifyEmailContainer, VerifyEmailView } from '../styles/layouts/forgotPassword/verifyEmail';
|
||||
import RenderIf from '../utils/renderIf';
|
||||
import Head from 'next/head';
|
||||
|
||||
export default function VerifyEmail() {
|
||||
const [sent, setSent]=useState(false);
|
||||
const [code, setCode]=useState<string>('')
|
||||
const [codeStatus, setCodeStatus]=useState<boolean>(null)
|
||||
|
||||
const [values, setValues] = React.useState({
|
||||
password: '',
|
||||
showPassword: false,
|
||||
});
|
||||
|
||||
const router = useRouter()
|
||||
const rota = router.pathname
|
||||
|
||||
useEffect(() => {
|
||||
setCode('')
|
||||
setSent(false)
|
||||
setCodeStatus(null)
|
||||
}, [rota])
|
||||
|
||||
function verifyConfirmationCode() {
|
||||
if (code === '0000') {
|
||||
setTimeout(() => {
|
||||
router.push('/forgotPassword')
|
||||
}, 2500);
|
||||
setCodeStatus(true)
|
||||
} else {
|
||||
setCodeStatus(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<VerifyEmailView auth={rota} >
|
||||
<Head>
|
||||
<title>Smart Energia - Verificar Email</title>
|
||||
</Head>
|
||||
<Image style={{cursor:'pointer'}} src='/assets/marca1.png' width={500} height={340} onClick={() => router.push('/')} />
|
||||
<VerifyEmailContainer>
|
||||
<h1>Bem-Vindo</h1>
|
||||
<h2>Estratégias Inteligentes em<br /> Gestão de Energia</h2>
|
||||
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }}label="Email" variant="outlined"/>
|
||||
<RenderIf isTrue={sent? false : true}>
|
||||
<LoginButton title='Enviar Email' onClick={() => setSent(true)} />
|
||||
</RenderIf>
|
||||
|
||||
|
||||
<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)} />
|
||||
<LoginButton title='Continuar' onClick={() => {verifyConfirmationCode()}} />
|
||||
<RenderIf isTrue={codeStatus===true? true : false} >
|
||||
<Alert severity="success">Codigo de veerificação aceito — aguarde um instante!</Alert>
|
||||
</RenderIf>
|
||||
<RenderIf isTrue={codeStatus===false? true : false} >
|
||||
<Alert severity="warning">Codigo de verificação invalido — tente outro!</Alert>
|
||||
</RenderIf>
|
||||
</RenderIf>
|
||||
|
||||
<fieldset className="line">
|
||||
<legend className="text">Ou</legend>
|
||||
</fieldset>
|
||||
|
||||
<p><a href='tel:+55(41)3012-5900' >+55(41) 3012-5900</a><br/><a href='https://www.energiasmart.com.br' >www.energiasmart.com.br</a></p>
|
||||
|
||||
</VerifyEmailContainer>
|
||||
</VerifyEmailView>
|
||||
)
|
||||
}
|
||||
193
src/pages/verifyEmail/index.tsx
Normal file
193
src/pages/verifyEmail/index.tsx
Normal file
@ -0,0 +1,193 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/router'
|
||||
import FormData from 'form-data';
|
||||
import LoginButton from '../../components/buttons/loginButton/LoginButton';
|
||||
import TextField from '@mui/material/TextField';
|
||||
|
||||
import Snackbar from '@mui/material/Snackbar'
|
||||
import MuiAlert, { AlertProps } from '@mui/material/Alert'
|
||||
|
||||
import { VerifyEmailContainer, VerifyEmailView } from '../../styles/layouts/forgotPassword/verifyEmail';
|
||||
import RenderIf from '../../utils/renderIf';
|
||||
import Head from 'next/head';
|
||||
import { api } from '../../services/api';
|
||||
import { GetServerSideProps } from 'next';
|
||||
import { parseCookies } from 'nookies';
|
||||
|
||||
const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
||||
props,
|
||||
ref
|
||||
) {
|
||||
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />
|
||||
})
|
||||
|
||||
export default function VerifyEmail() {
|
||||
const [sent, setSent]=useState(false);
|
||||
const [code, setCode]=useState<string>('')
|
||||
|
||||
const [codeStatus, setCodeStatus]=useState<boolean>(null)
|
||||
|
||||
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
||||
const [openSnackError, setOpenSnackError] = useState<boolean>(false);
|
||||
const [openSnackSuccessPassword, setOpenSnackSuccessPassword] = useState<boolean>(false);
|
||||
const [openSnackErrorPassword, setOpenSnackErrorPassword] = useState<boolean>(false);
|
||||
|
||||
const [email, setEmail] = useState<any>();
|
||||
const [token, setToken] = useState<any>();
|
||||
const [password, setPassword] = useState<any>();
|
||||
const [password_confirmation, setPassword_confirmation] = useState<any>();
|
||||
|
||||
const router = useRouter()
|
||||
const rota = router.pathname
|
||||
|
||||
const handleCloseSnack = (
|
||||
event?: React.SyntheticEvent | Event,
|
||||
reason?: string
|
||||
) => {
|
||||
if (reason === 'clickaway') {
|
||||
return
|
||||
}
|
||||
|
||||
setOpenSnackError(false)
|
||||
setOpenSnackSuccess(false)
|
||||
setOpenSnackErrorPassword(false)
|
||||
setOpenSnackSuccessPassword(false)
|
||||
}
|
||||
|
||||
function handleSendEmail() {
|
||||
api.post('/auth/forgot-password', {
|
||||
email
|
||||
}).then(res => {
|
||||
setSent(true)
|
||||
setOpenSnackSuccess(true)
|
||||
}).catch(res => {
|
||||
setOpenSnackError(true)
|
||||
})
|
||||
}
|
||||
|
||||
function verifyConfirmationCode() {
|
||||
api.post('/auth/reset-password', {
|
||||
email,
|
||||
password,
|
||||
password_confirmation,
|
||||
token
|
||||
}).then(res => {
|
||||
setSent(true)
|
||||
setOpenSnackSuccessPassword(true)
|
||||
setTimeout(() => {
|
||||
router.push('/')
|
||||
}, 2000);
|
||||
}).catch(res => {
|
||||
setOpenSnackErrorPassword(true)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setCode('')
|
||||
setSent(false)
|
||||
setCodeStatus(null)
|
||||
}, [rota])
|
||||
|
||||
return (
|
||||
<VerifyEmailView auth={rota} >
|
||||
<Head>
|
||||
<title>Smart Energia - Verificar Email</title>
|
||||
</Head>
|
||||
<Snackbar
|
||||
open={openSnackSuccess}
|
||||
autoHideDuration={4000}
|
||||
onClose={handleCloseSnack}
|
||||
>
|
||||
<Alert
|
||||
onClose={handleCloseSnack}
|
||||
severity="success"
|
||||
sx={{ width: '100%' }}
|
||||
>
|
||||
Email enviado com sucesso!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
<Snackbar
|
||||
open={openSnackError}
|
||||
autoHideDuration={4000}
|
||||
onClose={handleCloseSnack}
|
||||
>
|
||||
<Alert
|
||||
onClose={handleCloseSnack}
|
||||
severity="error"
|
||||
sx={{ width: '100%' }}
|
||||
>
|
||||
Email não enviado!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
<Snackbar
|
||||
open={openSnackSuccessPassword}
|
||||
autoHideDuration={4000}
|
||||
onClose={handleCloseSnack}
|
||||
>
|
||||
<Alert
|
||||
onClose={handleCloseSnack}
|
||||
severity="success"
|
||||
sx={{ width: '100%' }}
|
||||
>
|
||||
Senha alterada com sucesso!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
<Snackbar
|
||||
open={openSnackErrorPassword}
|
||||
autoHideDuration={4000}
|
||||
onClose={handleCloseSnack}
|
||||
>
|
||||
<Alert
|
||||
onClose={handleCloseSnack}
|
||||
severity="error"
|
||||
sx={{ width: '100%' }}
|
||||
>
|
||||
Senha não alterada!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
|
||||
<Image style={{cursor:'pointer'}} src='/assets/marca1.png' width={500} height={340} onClick={() => router.push('/')} />
|
||||
<VerifyEmailContainer>
|
||||
<h1>Bem-Vindo</h1>
|
||||
<h2>Estratégias Inteligentes em<br /> Gestão de Energia</h2>
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }} label="Email" onChange={value => setEmail(value.target.value)} variant="outlined"/>
|
||||
<RenderIf isTrue={sent? false : true}>
|
||||
<LoginButton title='Enviar Email' onClick={() => {
|
||||
handleSendEmail()
|
||||
}} />
|
||||
</RenderIf>
|
||||
|
||||
<RenderIf isTrue={sent? true : false}>
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }}label="Nova Senha" variant="outlined" onChange={value => setPassword(value.target.value)}/>
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }}label="Confirme sua senha" variant="outlined" onChange={value => setPassword_confirmation(value.target.value)}/>
|
||||
|
||||
<TextField id="outlined-basic" sx={{ m: 1, width: '90%' }}label="Codigo de verificação" variant="outlined" onChange={value => setToken(value.target.value)}/>
|
||||
<LoginButton title='Continuar' onClick={() => {verifyConfirmationCode()}} />
|
||||
<RenderIf isTrue={codeStatus===true? true : false} >
|
||||
<Alert severity="success">Codigo de veerificação aceito — aguarde um instante!</Alert>
|
||||
</RenderIf>
|
||||
|
||||
<RenderIf isTrue={codeStatus===false? true : false} >
|
||||
<Alert severity="warning">Codigo de verificação invalido — tente outro!</Alert>
|
||||
</RenderIf>
|
||||
</RenderIf>
|
||||
|
||||
<fieldset className="line">
|
||||
<legend className="text">Ou</legend>
|
||||
</fieldset>
|
||||
|
||||
<p><a href='tel:+55(41)3012-5900' >+55(41) 3012-5900</a><br/><a href='https://www.energiasmart.com.br' >www.energiasmart.com.br</a></p>
|
||||
|
||||
</VerifyEmailContainer>
|
||||
</VerifyEmailView>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
|
||||
return {
|
||||
props: {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,6 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
|
||||
|
||||
.someCSSModulesClass :global .any-global-class {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import { createGlobalStyle } from 'styled-components'
|
||||
|
||||
export const GlobalStyle = createGlobalStyle`
|
||||
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
|
||||
|
||||
body::-webkit-scrollbar {
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user