diff --git a/package-lock.json b/package-lock.json index 7a76d6f..6e417c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4595,6 +4595,171 @@ "engines": { "node": ">= 6" } + }, + "node_modules/@next/swc-android-arm-eabi": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.1.6.tgz", + "integrity": "sha512-BxBr3QAAAXWgk/K7EedvzxJr2dE014mghBSA9iOEAv0bMgF+MRq4PoASjuHi15M2zfowpcRG8XQhMFtxftCleQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-android-arm64": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.1.6.tgz", + "integrity": "sha512-EboEk3ROYY7U6WA2RrMt/cXXMokUTXXfnxe2+CU+DOahvbrO8QSWhlBl9I9ZbFzJx28AGB9Yo3oQHCvph/4Lew==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.1.6.tgz", + "integrity": "sha512-P0EXU12BMSdNj1F7vdkP/VrYDuCNwBExtRPDYawgSUakzi6qP0iKJpya2BuLvNzXx+XPU49GFuDC5X+SvY0mOw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.1.6.tgz", + "integrity": "sha512-9FptMnbgHJK3dRDzfTpexs9S2hGpzOQxSQbe8omz6Pcl7rnEp9x4uSEKY51ho85JCjL4d0tDLBcXEJZKKLzxNg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm-gnueabihf": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.1.6.tgz", + "integrity": "sha512-PvfEa1RR55dsik/IDkCKSFkk6ODNGJqPY3ysVUZqmnWMDSuqFtf7BPWHFa/53znpvVB5XaJ5Z1/6aR5CTIqxPw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.1.6.tgz", + "integrity": "sha512-53QOvX1jBbC2ctnmWHyRhMajGq7QZfl974WYlwclXarVV418X7ed7o/EzGY+YVAEKzIVaAB9JFFWGXn8WWo0gQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.1.6.tgz", + "integrity": "sha512-CMWAkYqfGdQCS+uuMA1A2UhOfcUYeoqnTW7msLr2RyYAys15pD960hlDfq7QAi8BCAKk0sQ2rjsl0iqMyziohQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.1.6.tgz", + "integrity": "sha512-AC7jE4Fxpn0s3ujngClIDTiEM/CQiB2N2vkcyWWn6734AmGT03Duq6RYtPMymFobDdAtZGFZd5nR95WjPzbZAQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.1.6.tgz", + "integrity": "sha512-c9Vjmi0EVk0Kou2qbrynskVarnFwfYIi+wKufR9Ad7/IKKuP6aEhOdZiIIdKsYWRtK2IWRF3h3YmdnEa2WLUag==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.1.6.tgz", + "integrity": "sha512-3UTOL/5XZSKFelM7qN0it35o3Cegm6LsyuERR3/OoqEExyj3aCk7F025b54/707HTMAnjlvQK3DzLhPu/xxO4g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.1.6.tgz", + "integrity": "sha512-8ZWoj6nCq6fI1yCzKq6oK0jE6Mxlz4MrEsRyu0TwDztWQWe7rh4XXGLAa2YVPatYcHhMcUL+fQQbqd1MsgaSDA==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } } }, "dependencies": { @@ -7417,6 +7582,72 @@ "yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz" + }, + "@next/swc-android-arm-eabi": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.1.6.tgz", + "integrity": "sha512-BxBr3QAAAXWgk/K7EedvzxJr2dE014mghBSA9iOEAv0bMgF+MRq4PoASjuHi15M2zfowpcRG8XQhMFtxftCleQ==", + "optional": true + }, + "@next/swc-android-arm64": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.1.6.tgz", + "integrity": "sha512-EboEk3ROYY7U6WA2RrMt/cXXMokUTXXfnxe2+CU+DOahvbrO8QSWhlBl9I9ZbFzJx28AGB9Yo3oQHCvph/4Lew==", + "optional": true + }, + "@next/swc-darwin-arm64": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.1.6.tgz", + "integrity": "sha512-P0EXU12BMSdNj1F7vdkP/VrYDuCNwBExtRPDYawgSUakzi6qP0iKJpya2BuLvNzXx+XPU49GFuDC5X+SvY0mOw==", + "optional": true + }, + "@next/swc-darwin-x64": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.1.6.tgz", + "integrity": "sha512-9FptMnbgHJK3dRDzfTpexs9S2hGpzOQxSQbe8omz6Pcl7rnEp9x4uSEKY51ho85JCjL4d0tDLBcXEJZKKLzxNg==", + "optional": true + }, + "@next/swc-linux-arm-gnueabihf": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.1.6.tgz", + "integrity": "sha512-PvfEa1RR55dsik/IDkCKSFkk6ODNGJqPY3ysVUZqmnWMDSuqFtf7BPWHFa/53znpvVB5XaJ5Z1/6aR5CTIqxPw==", + "optional": true + }, + "@next/swc-linux-arm64-gnu": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.1.6.tgz", + "integrity": "sha512-53QOvX1jBbC2ctnmWHyRhMajGq7QZfl974WYlwclXarVV418X7ed7o/EzGY+YVAEKzIVaAB9JFFWGXn8WWo0gQ==", + "optional": true + }, + "@next/swc-linux-arm64-musl": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.1.6.tgz", + "integrity": "sha512-CMWAkYqfGdQCS+uuMA1A2UhOfcUYeoqnTW7msLr2RyYAys15pD960hlDfq7QAi8BCAKk0sQ2rjsl0iqMyziohQ==", + "optional": true + }, + "@next/swc-linux-x64-gnu": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.1.6.tgz", + "integrity": "sha512-AC7jE4Fxpn0s3ujngClIDTiEM/CQiB2N2vkcyWWn6734AmGT03Duq6RYtPMymFobDdAtZGFZd5nR95WjPzbZAQ==", + "optional": true + }, + "@next/swc-linux-x64-musl": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.1.6.tgz", + "integrity": "sha512-c9Vjmi0EVk0Kou2qbrynskVarnFwfYIi+wKufR9Ad7/IKKuP6aEhOdZiIIdKsYWRtK2IWRF3h3YmdnEa2WLUag==", + "optional": true + }, + "@next/swc-win32-arm64-msvc": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.1.6.tgz", + "integrity": "sha512-3UTOL/5XZSKFelM7qN0it35o3Cegm6LsyuERR3/OoqEExyj3aCk7F025b54/707HTMAnjlvQK3DzLhPu/xxO4g==", + "optional": true + }, + "@next/swc-win32-ia32-msvc": { + "version": "12.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.1.6.tgz", + "integrity": "sha512-8ZWoj6nCq6fI1yCzKq6oK0jE6Mxlz4MrEsRyu0TwDztWQWe7rh4XXGLAa2YVPatYcHhMcUL+fQQbqd1MsgaSDA==", + "optional": true } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index c097e23..cf6bbec 100644 --- a/package.json +++ b/package.json @@ -26,16 +26,21 @@ "@mui/material": "^5.6.4", "@mui/x-data-grid": "^5.11.0", "@mui/x-date-pickers": "^5.0.0-alpha.3", + "@tinymce/tinymce-react": "^4.1.0", "@types/react-csv": "^1.1.2", "@typescript-eslint/eslint-plugin": "^5.22.0", "@typescript-eslint/parser": "^5.22.0", + "axios": "^0.27.2", "chart.js": "^3.7.1", "chartjs-plugin-datalabels": "^2.0.0", "eslint-plugin-react": "^7.29.4", "eslit": "^6.0.0", "faker": "5.5.3", + "fs-extra": "^10.1.0", "install": "^0.13.0", "next": "12.1.6", + "nookies": "^2.5.2", + "notistack": "^2.0.5", "npm": "^8.10.0", "nprogress": "^0.2.0", "patternomaly": "^1.3.2", @@ -45,11 +50,13 @@ "react-csv": "^2.2.2", "react-dom": "18.1.0", "react-icons": "^4.3.1", - "styled-components": "^5.3.5" + "styled-components": "^5.3.5", + "tinymce": "^6.0.3" }, "devDependencies": { "@babel/preset-env": "^7.17.10", "@types/chartjs": "^0.0.31", + "@types/cookies": "^0.7.7", "@types/faker": "5.5.3", "@types/node": "^17.0.31", "@types/nprogress": "^0.2.0", diff --git a/src/components/NotificationQuestionsCard/NotificationQuestionsCard.tsx b/src/components/NotificationQuestionsCard/NotificationQuestionsCard.tsx new file mode 100644 index 0000000..b2e4438 --- /dev/null +++ b/src/components/NotificationQuestionsCard/NotificationQuestionsCard.tsx @@ -0,0 +1,29 @@ +import React, { useState } from 'react' +import Image from 'next/image' +import getAPIClient from '../../services/ssrApi'; +import { FaqQuestionsCardBody, FaqQuestionsCardHeader, CommonQuestionsCardView } from './NotificationQuestionsCardView' + +interface CommonsQuestionsCardInterface { + title: string, + body: string, + +} + +export default function NotificationQuestionsCard({title, body}: CommonsQuestionsCardInterface) { + const [ showCardBody, setShowCardBody ] = useState(false) + return ( + + + +

{title}

+ setShowCardBody(!showCardBody)} /> +
+ + +

+ {body} +

+
+
+ ) +} diff --git a/src/components/NotificationQuestionsCard/NotificationQuestionsCardView.ts b/src/components/NotificationQuestionsCard/NotificationQuestionsCardView.ts new file mode 100644 index 0000000..91d16dd --- /dev/null +++ b/src/components/NotificationQuestionsCard/NotificationQuestionsCardView.ts @@ -0,0 +1,45 @@ +import styled from "styled-components"; + +export const CommonQuestionsCardView = styled.article` +` + +export const FaqQuestionsCardHeader = styled.div` + display: flex; + justify-content: space-between; + align-items: center; + + flex-direction: row; + + margin-top: 53px; + + width: 100%; + + img { + cursor: pointer; + } +` +interface CardBodyInterface { + showCardBody: boolean; +} +export const FaqQuestionsCardBody = styled.div` + display: ${props => props.showCardBody? 'flex' : 'none'}; + + margin-bottom: 20px; + + p { + font-weight: 400; + font-size: 99%; + + letter-spacing: 0.5px; + + color: rgba(0, 0, 0, 0.6); + + text-align: left; + } + + @media (max-width: 1008px) { + p { + text-align: left; + } + } +` diff --git a/src/components/administrativeHeader/AdministrativeHeader.tsx b/src/components/administrativeHeader/AdministrativeHeader.tsx new file mode 100644 index 0000000..d72e521 --- /dev/null +++ b/src/components/administrativeHeader/AdministrativeHeader.tsx @@ -0,0 +1,74 @@ +import Avatar from '@mui/material/Avatar' +import FormControl from '@mui/material/FormControl'; +import InputLabel from '@mui/material/InputLabel'; +import MenuItem from '@mui/material/MenuItem'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; +import TextField from '@mui/material/TextField'; +import React, { useState } from 'react' + +import { AdministrativeHeaderView } from './AdministrativeHeaderView'; + +function stringToColor(string: string) { + let hash = 0; + let i; + + for (i = 0; i < string.length; i += 1) { + hash = string.charCodeAt(i) + ((hash << 5) - hash); + } + + let color = '#'; + + for (i = 0; i < 3; i += 1) { + const value = (hash >> (i * 8)) & 0xff; + color += `00${value.toString(16)}`.slice(-2); + } + + return color; +} + +function stringAvatar(name: string) { + return { + sx: { + bgcolor: stringToColor(name), + }, + children: `${name.split(' ')[0][0]}${name.split(' ')[1][0]}`, + }; +} + +export default function AdministrativeHeader() { + const [unity, setUnity] = useState(''); + + const handleChange = (event: SelectChangeEvent) => { + setUnity(event.target.value); + }; + + return ( + +
+ +
+
+ + + + +
+
+ ) +} diff --git a/src/components/administrativeHeader/AdministrativeHeaderView.ts b/src/components/administrativeHeader/AdministrativeHeaderView.ts new file mode 100644 index 0000000..b3bfc7f --- /dev/null +++ b/src/components/administrativeHeader/AdministrativeHeaderView.ts @@ -0,0 +1,72 @@ +import styled from "styled-components"; + +export const AdministrativeHeaderView = styled.header` + display: flex; + justify-content: space-between; + align-items: flex-start; + + align-self: center; + + margin: 10px 0 20px 0; + + width: 95%; + + /* min-height: 80px; */ + + section { + width: 30%; + + :last-child { + display: flex; + justify-content: flex-end; + align-items: flex-start; + + height: fit-content; + } + } + + .icon { + position: relative; + + display: flex; + align-items: center; + justify-content: center; + + width: 150px; + height: 40px; + + border-radius: 8px; + + background-color: #254F7F; + color: white; + + transform: translateX(12%); + + ::after { + content: ""; + position: relative; + left: 2.5rem; + background-color: #fff; + width: 45px; + height: 45px; + border-radius: 50%; + } + } + + @media (max-width: 1020px) { + .icon { + display: none; + } + section { + width: 50%; + } + } + @media (max-width: 1640px) { + .icon { + transform: translateX(6%); + } + input { + height: 2rem; + } + } +` diff --git a/src/components/administrativeTables/ClientsTable.tsx b/src/components/administrativeTables/ClientsTable.tsx new file mode 100644 index 0000000..748e87e --- /dev/null +++ b/src/components/administrativeTables/ClientsTable.tsx @@ -0,0 +1,325 @@ +import DeleteIcon from '@mui/icons-material/Delete'; +import FilterListIcon from '@mui/icons-material/FilterList'; +import Box from '@mui/material/Box'; +import Checkbox from '@mui/material/Checkbox'; +import FormControlLabel from '@mui/material/FormControlLabel'; +import IconButton from '@mui/material/IconButton'; +import Paper from '@mui/material/Paper'; +import { alpha } from '@mui/material/styles'; +import Switch from '@mui/material/Switch'; +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TablePagination from '@mui/material/TablePagination'; +import TableRow from '@mui/material/TableRow'; +import TableSortLabel from '@mui/material/TableSortLabel'; +import Toolbar from '@mui/material/Toolbar'; +import Tooltip from '@mui/material/Tooltip'; +import Typography from '@mui/material/Typography'; +import { visuallyHidden } from '@mui/utils'; +import React, { useState } from 'react'; + +import { ClientTableView, StyledStatus } from './ClientsTableView'; + +interface Data { + clientCode: number, + name: string, + unity: string, + status: string, +} + +function createData( + clientCode: number, + name: string, + unity: string, + status: string, +): Data { + return { + clientCode, + name, + unity, + status, + }; +} + +const rows = [ + createData(9500130, 'Copel', 'clique para ver unidades', 'ativo'), + createData(9500131, 'Copel', 'clique para ver unidades', 'ativo'), + createData(9500132, 'Copel', 'clique para ver unidades', 'ativo'), + createData(9500689, 'Copel', 'clique para ver unidades', 'pendente'), + createData(9500690, 'Copel', 'clique para ver unidades', 'inativo'), + createData(9500691, 'Copel', 'clique para ver unidades', 'inativo'), +]; + +function descendingComparator(a: T, b: T, orderBy: keyof T) { + if (b[orderBy] < a[orderBy]) { + return -1; + } + if (b[orderBy] > a[orderBy]) { + return 1; + } + return 0; +} + +type Order = 'asc' | 'desc'; + +function getComparator( + order: Order, + orderBy: any, +): ( + a: { [key in Key]: number | string }, + b: { [key in Key]: number | string }, +) => number { + return order === 'desc' + ? (a, b) => descendingComparator(a, b, orderBy) + : (a, b) => -descendingComparator(a, b, orderBy); +} + +function stableSort(array: readonly T[], comparator: (a: T, b: T) => number) { + const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); + stabilizedThis.sort((a, b) => { + const order = comparator(a[0], b[0]); + if (order !== 0) { + return order; + } + return a[1] - b[1]; + }); + return stabilizedThis.map((el) => el[0]); +} + +interface HeadCell { + disablePadding: boolean; + id: keyof Data | string; + label: string; + numeric: boolean; +} + +const headCells: readonly HeadCell[] = [ + { + id: 'clientCode', + numeric: false, + disablePadding: true, + label: 'código do cliente', + }, + { + id: 'name', + numeric: true, + disablePadding: false, + label: 'name', + }, + { + id: 'unity', + numeric: true, + disablePadding: false, + label: 'unity', + }, + { + id: 'status', + numeric: true, + disablePadding: false, + label: 'status', + }, +]; + +interface EnhancedTableProps { + numSelected: number; + onRequestSort: (event: React.MouseEvent, property: keyof Data) => void; + onSelectAllClick: (event: React.ChangeEvent) => void; + order: Order; + orderBy: string; + rowCount: number; +} + +function EnhancedTableHead(props: EnhancedTableProps) { + const { onSelectAllClick, order, orderBy, numSelected, rowCount, onRequestSort } = + props; + const createSortHandler = + (property: any) => (event: React.MouseEvent) => { + onRequestSort(event, property); + }; + + return ( + + + + 0 && numSelected < rowCount} + checked={rowCount > 0 && numSelected === rowCount} + onChange={onSelectAllClick} + inputProps={{ + 'aria-label': 'select all desserts', + }} + /> + + {headCells.map((headCell) => ( + + + {headCell.label} + {orderBy === headCell.id ? ( + + {order === 'desc' ? 'sorted descending' : 'sorted ascending'} + + ) : null} + + + ))} + + + ); +} + +export default function ClientTable() { + const [order, setOrder] = useState('asc'); + const [orderBy, setOrderBy] = useState('status'); + const [selected, setSelected] = useState([]); + const [page, setPage] = useState(0); + const [dense, setDense] = useState(false); + const [rowsPerPage, setRowsPerPage] = useState(5); + + const handleRequestSort = ( + event: React.MouseEvent, + property: keyof Data, + ) => { + const isAsc = orderBy === property && order === 'asc'; + setOrder(isAsc ? 'desc' : 'asc'); + setOrderBy(property); + }; + + const handleSelectAllClick = (event: React.ChangeEvent) => { + if (event.target.checked) { + const newSelecteds = rows.map((n) => n.name); + setSelected(newSelecteds); + return; + } + setSelected([]); + }; + + const handleClick = (event: React.MouseEvent, code: string) => { + const selectedIndex = selected.indexOf(code); + let newSelected: readonly string[] = []; + + if (selectedIndex === -1) { + newSelected = newSelected.concat(selected, code); + } else if (selectedIndex === 0) { + newSelected = newSelected.concat(selected.slice(1)); + } else if (selectedIndex === selected.length - 1) { + newSelected = newSelected.concat(selected.slice(0, -1)); + } else if (selectedIndex > 0) { + newSelected = newSelected.concat( + selected.slice(0, selectedIndex), + selected.slice(selectedIndex + 1), + ); + } + + setSelected(newSelected); + }; + + const handleChangePage = (event: unknown, newPage: number) => { + setPage(newPage); + }; + + const handleChangeRowsPerPage = (event: React.ChangeEvent) => { + setRowsPerPage(parseInt(event.target.value, 10)); + setPage(0); + }; + + const isSelected = (code: any) => selected.indexOf(code.toString()) !== -1; + + // Avoid a layout jump when reaching the last page with empty rows. + const emptyRows = + page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0; + + return ( + + + + + + + {stableSort(rows, getComparator(order, orderBy)) + .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + .map((row, index) => { + const isItemSelected = isSelected(row.clientCode); + const labelId = `enhanced-table-checkbox-${index}`; + + return ( + handleClick(event, row.clientCode.toString())} + role="checkbox" + aria-checked={isItemSelected} + tabIndex={-1} + key={row.clientCode} + selected={isItemSelected} + > + + + + + Unidade - {row.clientCode} + + {row.name} + {row.unity}button + {row.status} + + ); + })} + {emptyRows > 0 && ( + + + + )} + +
+
+ +
+
+ ); +} diff --git a/src/components/administrativeTables/ClientsTableView.ts b/src/components/administrativeTables/ClientsTableView.ts new file mode 100644 index 0000000..08d8daf --- /dev/null +++ b/src/components/administrativeTables/ClientsTableView.ts @@ -0,0 +1,62 @@ +import styled from "styled-components"; + +export const ClientTableView = styled.main` + width: 100%; + + color: #6A707E; + + thead { + border-radius: 16px; + background-color: #f9f9f9; + + th { + font-size: 12px; + font-family: 'inter'; + font-weight: 800; + font-style: italic; + } + } + tbody { + border-radius: 16px; + tr { + th { + font-family: 'poppins'; + font-weight: 500; + font-size: 16px; + color: #6A707E; + } + + td { + :nth-child(3) { + font-family: 'poppins'; + font-weight: 500; + font-size: 16px; + color: #6A707E; + } + :nth-child(4) { + font-family: 'poppins'; + font-weight: 400; + font-size: 12px; + color: #828282; + text-decoration: underline; + } + } + } + } +` + +export const StyledStatus = styled.div<{status: any}>` + display: flex; + align-items: center; + justify-content: center; + + width: 72px; + height: 31px; + + border-radius: 8px; + + background-color: ${props => props.status == 'ativo'? '#F0FFF8' : props.status == 'pendente'? '#FEFFE5' : '#FFF0F0'}; + color: ${props => props.status == 'ativo'? '#18AB56' : props.status == 'pendente'? '#FFBC10' : '#EB5757'}; + + text-decoration: none!important;; +` diff --git a/src/components/administrativeTables/FaqTable.tsx b/src/components/administrativeTables/FaqTable.tsx new file mode 100644 index 0000000..0b5878c --- /dev/null +++ b/src/components/administrativeTables/FaqTable.tsx @@ -0,0 +1,317 @@ +import DeleteIcon from '@mui/icons-material/Delete'; +import FilterListIcon from '@mui/icons-material/FilterList'; +import Box from '@mui/material/Box'; +import Checkbox from '@mui/material/Checkbox'; +import FormControlLabel from '@mui/material/FormControlLabel'; +import IconButton from '@mui/material/IconButton'; +import Paper from '@mui/material/Paper'; +import { alpha } from '@mui/material/styles'; +import Switch from '@mui/material/Switch'; +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TablePagination from '@mui/material/TablePagination'; +import TableRow from '@mui/material/TableRow'; +import TableSortLabel from '@mui/material/TableSortLabel'; +import { visuallyHidden } from '@mui/utils'; +import { GetServerSideProps } from 'next'; +import React, { useState } from 'react'; +import getAPIClient from '../../services/ssrApi'; + +import { ClientTableView, StyledStatus } from './ClientsTableView'; + +interface Data { + question: string, + answer: string, + status: string, +} + +function createData( + question: string, + answer: string, + status: string, +): Data { + return { + question, + answer, + status, + }; +} + +const rows = [ + createData('Como usar o sistema?', 'Você deve usar assim... e assado...', 'ativo'), + createData('Como usar o sistema', 'Você deve usar assim... e assado...', 'ativo'), + createData('Como usar o sistema?', 'Você deve usar assim... e assado...', 'ativo'), + createData('Como usar o sistema?', 'Você deve usar assim... e assado...', 'ativo'), + createData('Como usar o sistema?', 'Você deve usar assim... e assado...', 'ativo'), + createData('Como usar o sistema?', 'Você deve usar assim... e assado...', 'inativo'), +]; + +function descendingComparator(a: T, b: T, orderBy: keyof T) { + if (b[orderBy] < a[orderBy]) { + return -1; + } + if (b[orderBy] > a[orderBy]) { + return 1; + } + return 0; +} + +type Order = 'asc' | 'desc'; + +function getComparator( + order: Order, + orderBy: Key, +): ( + a: { [key in Key]: any }, + b: { [key in Key]: any }, +) => number { + return order === 'desc' + ? (a, b) => descendingComparator(a, b, orderBy) + : (a, b) => -descendingComparator(a, b, orderBy); +} + +function stableSort(array: readonly T[], comparator: (a: T, b: T) => number) { + const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); + stabilizedThis.sort((a, b) => { + const order = comparator(a[0], b[0]); + if (order !== 0) { + return order; + } + return a[1] - b[1]; + }); + return stabilizedThis.map((el) => el[0]); +} + +interface HeadCell { + disablePadding: boolean; + id: keyof Data | string; + label: string; + numeric: boolean; +} + +const headCells: readonly HeadCell[] = [ + { + id: 'question', + numeric: false, + disablePadding: true, + label: 'Pergunta', + }, + { + id: 'answer', + numeric: true, + disablePadding: false, + label: 'Resposta', + }, + { + id: 'status', + numeric: true, + disablePadding: false, + label: 'status', + }, +]; + +interface EnhancedTableProps { + numSelected: number; + onRequestSort: (event: React.MouseEvent, property: keyof Data) => void; + onSelectAllClick: (event: React.ChangeEvent) => void; + order: Order; + orderBy: string; + rowCount: number; +} + +function EnhancedTableHead(props: EnhancedTableProps) { + const { onSelectAllClick, order, orderBy, numSelected, rowCount, onRequestSort } = + props; + const createSortHandler = + (property: any) => (event: React.MouseEvent) => { + onRequestSort(event, property); + }; + + return ( + + + + 0 && numSelected < rowCount} + checked={rowCount > 0 && numSelected === rowCount} + onChange={onSelectAllClick} + inputProps={{ + 'aria-label': 'select all desserts', + }} + /> + + {headCells.map((headCell) => ( + + + {headCell.label} + {orderBy === headCell.id ? ( + + {order === 'desc' ? 'sorted descending' : 'sorted ascending'} + + ) : null} + + + ))} + + + ); +} + +export default function FaqTable({questionData}: any) { + const [order, setOrder] = useState('asc'); + const [orderBy, setOrderBy] = useState('status'); + const [selected, setSelected] = useState([]); + const [page, setPage] = useState(0); + const [dense, setDense] = useState(false); + const [rowsPerPage, setRowsPerPage] = useState(5); + + console.table(questionData) + console.table(rows) + const handleRequestSort = ( + event: React.MouseEvent, + property: keyof Data, + ) => { + const isAsc = orderBy === property && order === 'asc'; + setOrder(isAsc ? 'desc' : 'asc'); + setOrderBy(property); + }; + + const handleSelectAllClick = (event: React.ChangeEvent) => { + if (event.target.checked) { + const newSelecteds = questionData.map((n) => n.id); + setSelected(newSelecteds); + return; + } + setSelected([]); + }; + + const handleClick = (event: React.MouseEvent, name: string) => { + const selectedIndex = selected.indexOf(name); + let newSelected: readonly string[] = []; + + if (selectedIndex === -1) { + newSelected = newSelected.concat(selected, name); + } else if (selectedIndex === 0) { + newSelected = newSelected.concat(selected.slice(1)); + } else if (selectedIndex === selected.length - 1) { + newSelected = newSelected.concat(selected.slice(0, -1)); + } else if (selectedIndex > 0) { + newSelected = newSelected.concat( + selected.slice(0, selectedIndex), + selected.slice(selectedIndex + 1), + ); + } + + setSelected(newSelected); + }; + + const handleChangePage = (event: unknown, newPage: number) => { + setPage(newPage); + }; + + const handleChangeRowsPerPage = (event: React.ChangeEvent) => { + setRowsPerPage(parseInt(event.target.value, 10)); + setPage(0); + }; + + const isSelected = (name: string) => selected.indexOf(name) !== -1; + + // Avoid a layout jump when reaching the last page with empty rows. + const emptyRows = + page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0; + + return ( + + + + + + + {stableSort(questionData, getComparator(order, orderBy)) + .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + .map((row, index) => { + const isItemSelected = isSelected(row.id); + const labelId = `enhanced-table-checkbox-${index}`; + + return ( + handleClick(event, row.id)} + role="checkbox" + aria-checked={isItemSelected} + tabIndex={-1} + key={row.id} + selected={isItemSelected} + > + + + + + {row.question} + + {row.answer} + {row.deleted_at? 'ativo' : 'inativo'} + + ); + })} + {emptyRows > 0 && ( + + + + )} + +
+
+ +
+
+ ); +} + diff --git a/src/components/administrativeTables/NotificationsTable.tsx b/src/components/administrativeTables/NotificationsTable.tsx new file mode 100644 index 0000000..084ff35 --- /dev/null +++ b/src/components/administrativeTables/NotificationsTable.tsx @@ -0,0 +1,330 @@ +import DeleteIcon from '@mui/icons-material/Delete'; +import FilterListIcon from '@mui/icons-material/FilterList'; +import Box from '@mui/material/Box'; +import Checkbox from '@mui/material/Checkbox'; +import FormControlLabel from '@mui/material/FormControlLabel'; +import IconButton from '@mui/material/IconButton'; +import Paper from '@mui/material/Paper'; +import { alpha } from '@mui/material/styles'; +import Switch from '@mui/material/Switch'; +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TablePagination from '@mui/material/TablePagination'; +import TableRow from '@mui/material/TableRow'; +import TableSortLabel from '@mui/material/TableSortLabel'; +import Toolbar from '@mui/material/Toolbar'; +import Tooltip from '@mui/material/Tooltip'; +import Typography from '@mui/material/Typography'; +import { visuallyHidden } from '@mui/utils'; +import React, { useState, useEffect } from 'react'; + +import { ClientTableView, StyledStatus } from './ClientsTableView'; + +interface Data { + notification: string, + client: string, + status: string, +} + +function createData( + notification: string, + client: string, + status: string, +): Data { + return { + notification, + client, + status, + }; +} + +const rows = [ + createData('Confira tal coisa - Texto da notificação', 'Copel', 'enviada'), + createData('Confira tal coisa - Texto da notificação', 'Copel', 'enviada'), + createData('Confira tal coisa - Texto da notificação', 'Copel', 'enviada'), + createData('Confira tal coisa - Texto da notificação', 'Copel', 'falhou'), + createData('Confira tal coisa - Texto da notificação', 'Copel', 'pendente'), + createData('Confira tal coisa - Texto da notificação', 'Copel', 'enviada'), +]; + +function descendingComparator(a: T, b: T, orderBy: keyof T) { + if (b[orderBy] < a[orderBy]) { + return -1; + } + if (b[orderBy] > a[orderBy]) { + return 1; + } + return 0; +} + +type Order = 'asc' | 'desc'; + +function getComparator( + order: Order, + orderBy: Key, +): ( + a: { [key in Key]: any }, + b: { [key in Key]: any }, +) => number { + return order === 'desc' + ? (a, b) => descendingComparator(a, b, orderBy) + : (a, b) => -descendingComparator(a, b, orderBy); +} + +function stableSort(array: readonly T[], comparator: (a: T, b: T) => number) { + const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); + stabilizedThis.sort((a, b) => { + const order = comparator(a[0], b[0]); + if (order !== 0) { + return order; + } + return a[1] - b[1]; + }); + return stabilizedThis.map((el) => el[0]); +} + +interface HeadCell { + disablePadding: boolean; + id: keyof Data | string; + label: string; + numeric: boolean; +} + +const headCells: readonly HeadCell[] = [ + { + id: 'notification', + numeric: false, + disablePadding: true, + label: 'notificação', + }, + { + id: 'client', + numeric: true, + disablePadding: false, + label: 'cliente', + }, + { + id: 'status', + numeric: true, + disablePadding: false, + label: 'status', + }, +]; + +interface EnhancedTableProps { + numSelected: number; + onRequestSort: (event: React.MouseEvent, property: keyof Data) => void; + onSelectAllClick: (event: React.ChangeEvent) => void; + order: Order; + orderBy: string; + rowCount: number; +} + +function EnhancedTableHead(props: EnhancedTableProps) { + const { onSelectAllClick, order, orderBy, numSelected, rowCount, onRequestSort } = + props; + const createSortHandler = + (property: any) => (event: React.MouseEvent) => { + onRequestSort(event, property); + }; + + return ( + + + + 0 && numSelected < rowCount} + checked={rowCount > 0 && numSelected === rowCount} + onChange={onSelectAllClick} + inputProps={{ + 'aria-label': 'select all desserts', + }} + /> + + {headCells.map((headCell) => ( + + + {headCell.label} + {orderBy === headCell.id ? ( + + {order === 'desc' ? 'sorted descending' : 'sorted ascending'} + + ) : null} + + + ))} + + + ); +} + +interface NotificationData { + title: string, + body: string, + users: string + deleted_at: Date, +} + +interface NotificationsTableInterface{ + notifications: any, + onChange: any +} + +export default function NotificationsTable({notifications, onChange}: NotificationsTableInterface) { + const [order, setOrder] = useState('asc'); + const [orderBy, setOrderBy] = useState('status'); + const [selected, setSelected] = useState([]); + const [page, setPage] = useState(0); + const [dense, setDense] = useState(false); + const [rowsPerPage, setRowsPerPage] = useState(5); + + const handleRequestSort = ( + event: React.MouseEvent, + property: keyof Data, + ) => { + const isAsc = orderBy === property && order === 'asc'; + setOrder(isAsc ? 'desc' : 'asc'); + setOrderBy(property); + }; + + const handleSelectAllClick = (event: React.ChangeEvent) => { + if (event.target.checked) { + const newSelecteds = notifications.map((n) => n.id.toString()); + setSelected(newSelecteds); + return; + } + setSelected([]); + }; + + const handleClick = (event: React.MouseEvent, name: string) => { + const selectedIndex = selected.indexOf(name); + let newSelected: readonly string[] = []; + + if (selectedIndex === -1) { + newSelected = newSelected.concat(selected, name); + } else if (selectedIndex === 0) { + newSelected = newSelected.concat(selected.slice(1)); + } else if (selectedIndex === selected.length - 1) { + newSelected = newSelected.concat(selected.slice(0, -1)); + } else if (selectedIndex > 0) { + newSelected = newSelected.concat( + selected.slice(0, selectedIndex), + selected.slice(selectedIndex + 1), + ); + } + + setSelected(newSelected); + }; + + const handleChangePage = (event: unknown, newPage: number) => { + setPage(newPage); + }; + + const handleChangeRowsPerPage = (event: React.ChangeEvent) => { + setRowsPerPage(parseInt(event.target.value, 10)); + setPage(0); + }; + + const isSelected = (name: string) => selected.indexOf(name) !== -1; + + // Avoid a layout jump when reaching the last page with empty rows. + const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - notifications.length) : 0; + + useEffect(() => { + onChange(selected) + }, [selected]) + + return ( + + + + + + + {stableSort(notifications, getComparator(order, orderBy)) + .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + .map((row, index) => { + const isItemSelected = isSelected(row.id.toString()); + const labelId = `enhanced-table-checkbox-${index}`; + + return ( + handleClick(event, row.id.toString())} + role="checkbox" + aria-checked={isItemSelected} + tabIndex={-1} + key={index} + selected={isItemSelected} + > + + + + + {row.title} + + {'copel'} + {row.deleted_at===null? 'ativo' : 'inativo'} + + ); + })} + {emptyRows > 0 && ( + + + + )} + +
+
+ +
+
+ ); +} diff --git a/src/components/buttons/faqButton/FaqButton1.tsx b/src/components/buttons/faqButton/FaqButton1.tsx new file mode 100644 index 0000000..2547ab8 --- /dev/null +++ b/src/components/buttons/faqButton/FaqButton1.tsx @@ -0,0 +1,14 @@ +import React from 'react' + +import { FaqButtonView1 } from './FaqButtonView1' + +interface FaqButtonInterface { + title: string + onClick: () => void +} + +export default function FaqButton1({title, onClick}: FaqButtonInterface) { + return ( + onClick()}>{title} + ) +} diff --git a/src/components/buttons/faqButton/FaqButton2.tsx b/src/components/buttons/faqButton/FaqButton2.tsx new file mode 100644 index 0000000..a160bd8 --- /dev/null +++ b/src/components/buttons/faqButton/FaqButton2.tsx @@ -0,0 +1,14 @@ +import React from 'react' + +import { FaqButtonView2 } from './FaqButtonView2' + +interface FaqButtonInterface { + title: string + onClick: () => void +} + +export default function FaqButton2({title, onClick}: FaqButtonInterface) { + return ( + onClick()}>{title} + ) +} diff --git a/src/components/buttons/faqButton/FaqButtonView1.ts b/src/components/buttons/faqButton/FaqButtonView1.ts new file mode 100644 index 0000000..31b8458 --- /dev/null +++ b/src/components/buttons/faqButton/FaqButtonView1.ts @@ -0,0 +1,21 @@ +import styled from 'styled-components' + +export const FaqButtonView1 = styled.button` + display: flex; + justify-content: center; + align-items: center; + margin-top: 10px; + margin-left: 65px; + width: 350px; + height: 45px; + cursor: pointer; + background: #DDDDDD; + border-radius: 8px; + border-style: none; + + font-family: 'Poppins'; + font-size: 90%; + + + color: #6A707E; +` diff --git a/src/components/buttons/faqButton/FaqButtonView2.ts b/src/components/buttons/faqButton/FaqButtonView2.ts new file mode 100644 index 0000000..24a26a7 --- /dev/null +++ b/src/components/buttons/faqButton/FaqButtonView2.ts @@ -0,0 +1,22 @@ +import styled from 'styled-components' + +export const FaqButtonView2 = styled.button` + display: flex; + justify-content: center; + align-items: center; + margin-top: -46px; + margin-left: 430px; + width: 350px; + height: 45px; + cursor: pointer; + background: #254F7F; + border-radius: 8px; + border-style: none; + + font-family: 'Poppins'; + font-size: 90%; + + + + color: #FFFFFF; +` diff --git a/src/components/buttons/loginButton/LoginButton.tsx b/src/components/buttons/loginButton/LoginButton.tsx index 100b60b..ff4c08f 100644 --- a/src/components/buttons/loginButton/LoginButton.tsx +++ b/src/components/buttons/loginButton/LoginButton.tsx @@ -1,20 +1,21 @@ -import React from 'react' import Link from 'next/link' +import React from 'react' + import RenderIf from '../../../utils/renderIf' import { LoginButtonView } from './LoginButtonView' interface LoginButtonInterface { title: string, link?: boolean | undefined, - onClick?: () => void + onClick: () => void } export default function LoginButton({ title, link, onClick }: LoginButtonInterface) { return ( <> - - + + onClick()}> {title} diff --git a/src/components/faqQuestionsCard/FaqQuestionsCard.tsx b/src/components/faqQuestionsCard/FaqQuestionsCard.tsx index 343e749..5ceda20 100644 --- a/src/components/faqQuestionsCard/FaqQuestionsCard.tsx +++ b/src/components/faqQuestionsCard/FaqQuestionsCard.tsx @@ -1,21 +1,27 @@ import React, { useState } from 'react' import Image from 'next/image' - +import getAPIClient from '../../services/ssrApi'; import { FaqQuestionsCardBody, FaqQuestionsCardHeader, CommonQuestionsCardView } from './FaqQuestionsCardView' -export default function CommonsQuestionsCard() { +interface CommonsQuestionsCardInterface { + question: string, + answer: string, + +} + +export default function CommonsQuestionsCard({question, answer}: CommonsQuestionsCardInterface) { const [ showCardBody, setShowCardBody ] = useState(false) return ( + -

Lorem ipsum dolor sit amet, consectetur adipiscing elit?

+

{question}

setShowCardBody(!showCardBody)} />

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Consequat porta faucibus elementum pharetra varius + {answer}

diff --git a/src/components/graph/SingleBar.tsx b/src/components/graph/SingleBar.tsx index 7ac15a1..1585ff6 100644 --- a/src/components/graph/SingleBar.tsx +++ b/src/components/graph/SingleBar.tsx @@ -1,18 +1,11 @@ -import React from 'react'; -import { - Chart as ChartJS, - CategoryScale, - LinearScale, - BarElement, - Title, - Tooltip, - Legend, -} from 'chart.js'; -import { Bar } from 'react-chartjs-2'; +import { BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Title, Tooltip } from 'chart.js'; import ChartDataLabels from 'chartjs-plugin-datalabels'; -import { ChartView } from './ChartView'; -import ChartTitle from './ChartTitle'; import { draw, generate } from 'patternomaly' +import React from 'react'; +import { Bar } from 'react-chartjs-2'; + +import ChartTitle from './ChartTitle'; +import { ChartView } from './ChartView'; ChartJS.register( CategoryScale, @@ -57,8 +50,6 @@ export function SingleBar({ title, subtitle, dataProps, label, dataset, dataset1 const percentage = (value*100 / sum).toFixed(0)+"%"; const result = `${value}\n ${percentage}` - console.log(value) - return value==null? null : result }, display: true, diff --git a/src/components/header/Header.tsx b/src/components/header/Header.tsx index ad1ab95..22fa066 100644 --- a/src/components/header/Header.tsx +++ b/src/components/header/Header.tsx @@ -1,8 +1,7 @@ -import React from 'react' -import Image from 'next/image'; - -import TextField from '@mui/material/TextField'; import Avatar from '@mui/material/Avatar'; +import TextField from '@mui/material/TextField'; +import Image from 'next/image'; +import React from 'react' import { HeaderView } from './HeaderView' @@ -38,7 +37,6 @@ interface headerInterface { } export default function Header({ name }: headerInterface) { - return (
@@ -53,9 +51,11 @@ export default function Header({ name }: headerInterface) {
- olá, {'josé'} +

+ olá, {'josé'} +

- +
) diff --git a/src/components/header/HeaderView.ts b/src/components/header/HeaderView.ts index 736f6b4..d123174 100644 --- a/src/components/header/HeaderView.ts +++ b/src/components/header/HeaderView.ts @@ -11,58 +11,32 @@ export const HeaderView = styled.header` section { width: 30%; - :last-child { display: flex; justify-content: flex-end; - align-items: flex-start; + align-items: center; height: fit-content; } } .icon { - position: relative; - display: flex; align-items: center; - justify-content: center; + justify-content: flex-start; - width: 150px; + min-width: 120px; height: 40px; - border-radius: 8px; + border-radius: 8px 0 0 8px; background-color: #254F7F; - color: white; - transform: translateX(12%); + transform: translateX(16px); - ::after { - content: ""; - position: relative; - left: 2.5rem; - background-color: #fff; - width: 45px; - height: 45px; - border-radius: 50%; - } - } - - @media (max-width: 1020px) { - .icon { - display: none; - } - section { - width: 50%; - } - } - @media (max-width: 1640px) { - .icon { - transform: translateX(6%); - } - input { - height: 2rem; + p{ + color: white; + margin-left: 15%; } } ` diff --git a/src/components/inputUplaod/inputUpload.tsx b/src/components/inputUplaod/inputUpload.tsx new file mode 100644 index 0000000..257b836 --- /dev/null +++ b/src/components/inputUplaod/inputUpload.tsx @@ -0,0 +1,50 @@ +import React,{ useState, useEffect } from 'react' + +import { InputUploadView } from './inputUploadView' + + +export default function InputUpload() { + 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) => ( + not fount + ))} + +
+ + +
+ +
+
+
+ + +
+
+
+ +
+ ) +} diff --git a/src/components/inputUplaod/inputUploadView.ts b/src/components/inputUplaod/inputUploadView.ts new file mode 100644 index 0000000..7a244d0 --- /dev/null +++ b/src/components/inputUplaod/inputUploadView.ts @@ -0,0 +1,57 @@ +import styled from 'styled-components' + +export const InputUploadView = styled.button` + width: 350px; + margin-left: 63px; + height: 58px; + + border-radius: 5px; + background-color: #fff; + border: 1px solid #adacac; + + + margin-top: 13px; + +.imgContainer{ + max-width: 40px; + height: 30px; +} + + input[type="file"] { + display: none; + + } + label { + width: 169px; + height: 30px; + border-radius: 4px; + background-color: #254F7F; + color: white; + margin-left: 3px; + font-size: 13px; + font-weight: 600; + text-transform: uppercase; + display: flex; + text-align: center; + cursor: pointer; + } + .image{ + width:30px; + } + + .text{ + margin-left: 60px; + } + .update{ + margin-left: 160px; + margin-top: -29px; + } + .TitleButton{ + margin-left: 9px; + margin-top: 6px; + font-family: 'Poppins'; + } + + + +` diff --git a/src/components/modal/ConfirmModal.tsx b/src/components/modal/ConfirmModal.tsx new file mode 100644 index 0000000..b38e561 --- /dev/null +++ b/src/components/modal/ConfirmModal.tsx @@ -0,0 +1,50 @@ +import { ReactJSXElement } from '@emotion/react/types/jsx-namespace'; +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; +import Modal from '@mui/material/Modal'; +import Typography from '@mui/material/Typography'; +import * as React from 'react'; +import { useEffect } from 'react'; + +const style = { + // eslint-disable-next-line @typescript-eslint/prefer-as-const + position: 'absolute' as 'absolute', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: '30%', + height: '30%', + bgcolor: 'background.paper', + border: '2px solid #254F7F', + boxShadow: 24, + p: 4, +}; + +interface ConfirmModalInterface{ + open: boolean, + handleIsClose: (value: any) => void, + children: React.ReactNode +} + +export default function ConfirmModal({open, handleIsClose, children}: ConfirmModalInterface) { + const [openState, setOpenState] = React.useState(false); + const handleOpen = () => setOpenState(true); + const handleClose = () => {setOpenState(false); handleIsClose(false)} + + useEffect(() => { + setOpenState(open) + }, [open, openState]) + + return ( + + + {children} + + + ); +} diff --git a/src/components/modal/Modal.tsx b/src/components/modal/Modal.tsx index 6362e9b..a6b7957 100644 --- a/src/components/modal/Modal.tsx +++ b/src/components/modal/Modal.tsx @@ -13,14 +13,20 @@ const style = { left: '50%', transform: 'translate(-50%, -50%)', width: '80%', - height: '80%', + height: '550px', bgcolor: 'background.paper', - border: '2px solid #000', + border: '2px solid #254F7F', boxShadow: 24, p: 4, }; -export default function BasicModal({open, handleIsClose, children}: {open: boolean, handleIsClose: (value: any) => void, children: React.ReactNode}) { +interface BasicModalInterface{ + open: boolean, + handleIsClose: (value: any) => void, + children: React.ReactNode +} + +export default function BasicModal({open, handleIsClose, children}: BasicModalInterface) { const [openState, setOpenState] = React.useState(false); const handleOpen = () => setOpenState(true); const handleClose = () => {setOpenState(false); handleIsClose(false)} diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index 02d42f8..1f08998 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -1,15 +1,15 @@ -import React, { useState, useEffect } from 'react' -import { useRouter } from 'next/router' -import Image from 'next/image' -import Link from 'next/link' import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; -import Typography from '@mui/material/Typography'; import Modal from '@mui/material/Modal'; -import Stack from '@mui/material/Stack'; - - +import Typography from '@mui/material/Typography'; +import { GetServerSideProps } from 'next'; +import Image from 'next/image' +import Link from 'next/link' +import { useRouter } from 'next/router' +import { parseCookies } from 'nookies'; +import React, { useEffect, useState } from 'react' +import RenderIf from '../../utils/renderIf'; import { SidebarView } from './SidebarView' const style = { @@ -35,56 +35,99 @@ export default function Sidebar() { const router = useRouter() + const { ['user-role']: role } = parseCookies() + + console.log(role) + useEffect(() => { setViewModal(false) }, [router.pathname]) return ( - -
setViewModal(!viewModal)} > - -
-
- -
-
    -
  • {'Visão Geral'}
  • -
  • setEconomiaDrawer(!economiaDrawer)} className={router.pathname=='/grossSavings' || router.pathname=='/accumulatedSavings' || router.pathname=='/estimatedCost' || router.pathname=='/costIndicator' ? 'actualPath' : null } >{'Economia >'}
  • -
    -
  • Economia Bruta
  • -
  • Economia Acumulada
  • -
  • Custo Estimado
  • -
  • Custo R/MWh
  • + <> + + +
    setViewModal(!viewModal)} > +
    -
  • {'Telemetria >'}
  • -
  • {'Resumo de Op. '}
  • -
  • {'Notícias >'}
  • -
  • {'PLD >'}
  • -
  • {'Info Setorial >'}
  • - {/*
  • {'Consumo'}
  • */} -
  • {'Notificações >'}

    25

  • -
  • {'Sobre Nós >'}
  • -
  • {'FAQ >'}
  • - - - - - Deseja realmente sair ? - - - - - -
- -
+
+ +
+
    +
  • {'Clientes >'}
  • +
  • {'Visão Geral'}
  • +
  • {'FAQ >'}
  • +
  • {'Notificações >'}

    25

  • + + + + + Deseja realmente sair ? + + + + + +
+ + + + + +
setViewModal(!viewModal)} > + +
+
+ +
+
    +
  • {'Visão Geral'}
  • +
  • setEconomiaDrawer(!economiaDrawer)} className={router.pathname=='/grossSavings' || router.pathname=='/accumulatedSavings' || router.pathname=='/estimatedCost' || router.pathname=='/costIndicator' ? 'actualPath' : null } >{'Economia >'}
  • +
    +
  • Economia Bruta
  • +
  • Economia Acumulada
  • +
  • Custo Estimado
  • +
  • Custo R/MWh
  • +
    +
  • {'Telemetria >'}
  • +
  • {'Resumo de Op. '}
  • +
  • {'Notícias >'}
  • +
  • {'PLD >'}
  • +
  • {'Info Setorial >'}
  • + {/*
  • {'Consumo'}
  • */} +
  • {'Notificações >'}

    25

  • +
  • {'Sobre Nós >'}
  • +
  • {'FAQ >'}
  • + + + + + Deseja realmente sair ? + + + + + +
+ +
+
+ ) } diff --git a/src/components/sidebar/SidebarView.ts b/src/components/sidebar/SidebarView.ts index 5bc5aba..7ab88a9 100644 --- a/src/components/sidebar/SidebarView.ts +++ b/src/components/sidebar/SidebarView.ts @@ -182,7 +182,7 @@ export const SidebarView = styled.nav` z-index: 2; - height: 5rem; + height: 3.5rem; } .imageNext { display: none; @@ -194,8 +194,8 @@ export const SidebarView = styled.nav` background-color: #FFF; li { - height: 7rem; - font-size: 170%; + height: 5rem; + font-size: 150%; } } aside { @@ -207,15 +207,17 @@ export const SidebarView = styled.nav` font-size: 14px; ul { li { - height: 2rem; + height: 3rem; + font-size: 100%; } } } @media (max-width: 1008px) { - font-size: 14px; + font-size: 26px; ul { li { - height: 6rem; + height: 7rem; + font-size: 99.98%; } } } diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx new file mode 100644 index 0000000..c422e20 --- /dev/null +++ b/src/contexts/AuthContext.tsx @@ -0,0 +1,70 @@ +import React, { createContext, useState } from "react"; +import Router from 'next/router' + +import { setCookie } from "nookies"; + +import { signInRequest } from "../services/auth"; +import { api } from "../services/api"; + +type UserType = { + name: string; + email: string; + avatar_url: string; +} + +type SignInData = { + email: string; + password: string; +} + +type AuthContextType = { + isAuthenticated: boolean; + user: UserType; + signIn: (data: SignInData) => Promise; +} + +export const AuthContext = createContext({} as AuthContextType) + +export function AuthProvider({children}: {children: React.ReactNode}) { + const [user, setUser] = useState(null) + + const isAuthenticated = !!user + + async function signIn({email, password}: SignInData) { + const { token, user, exception }: any = await signInRequest({ + email, + password + }) + + if (token) { + setCookie(undefined, '@smartAuth-token', token, { + maxAge: 60 * 60 * 1, // 1 hour + }) + } + + if (user.role) { + setCookie(undefined, 'user-role', user.role) + } + + if (!exception) { + if (user.role == 2) { + Router.push('/dashboard') + } else { + Router.push('administrative/clients') + } + return; + } else { + return + } + + api.defaults.headers['Authorization'] = `Bearer ${token}` + + setUser(user) + } + + return ( + + {children} + + ) +} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 79e4051..ed63084 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,19 +1,23 @@ -import React, { useState, useEffect } from 'react' -import { useRouter } from 'next/router' import { AppProps } from 'next/app' +import Head from 'next/head' +import { useRouter } from 'next/router' import NProgress from 'nprogress' - -// import Footer from '../components/footer/Footer' -import Sidebar from '../components/sidebar/Sidebar' -import { GlobalStyle } from '../styles/globals' -import { AppView } from '../styles/app/AppView' -import '../styles/nprogress/nprogress.css' -import '../styles/globals.ts' +import React, { useContext, useEffect, useState } from 'react' import Home from '.' -import Head from 'next/head' -import VerifyEmail from './verifyEmail' +// import Footer from '../components/footer/Footer' +import Sidebar from '../components/sidebar/Sidebar' +import { AuthContext, AuthProvider } from '../contexts/AuthContext' +import { AppView } from '../styles/app/AppView' +import { GlobalStyle } from '../styles/globals' import ForgotPassword from './forgotPassword' +import VerifyEmail from './verifyEmail' + +import '../styles/globals.ts' +import '../styles/nprogress/nprogress.css' +import { GetServerSideProps } from 'next' +import { parseCookies } from 'nookies' +import getAPIClient from '../services/ssrApi' function MyApp({ Component, pageProps }: AppProps) { const router = useRouter() @@ -40,7 +44,7 @@ function MyApp({ Component, pageProps }: AppProps) { }, [router]) return ( - <> + @@ -61,8 +65,7 @@ function MyApp({ Component, pageProps }: AppProps) { null } - {/*
*/} - + ) } diff --git a/src/pages/accumulatedSavings.tsx b/src/pages/accumulatedSavings.tsx index 52b0af1..1134f8f 100644 --- a/src/pages/accumulatedSavings.tsx +++ b/src/pages/accumulatedSavings.tsx @@ -7,7 +7,6 @@ import Header from '../components/header/Header' import PageTitle from '../components/pageTitle/PageTitle' import { EconomiaAcumulada } from '../services/economiaAcumulada' import { dataEconomiaBruta } from '../services/economiaBruta' - import { AccumulatedSavingsView } from '../styles/layouts/economy/accumulatedSavings/AccumulatedSavingsView' export default function AccumulatedSavings() { @@ -19,7 +18,8 @@ export default function AccumulatedSavings() {
- +
) diff --git a/src/pages/administrative/aboutUs/index.tsx b/src/pages/administrative/aboutUs/index.tsx new file mode 100644 index 0000000..ba84ee3 --- /dev/null +++ b/src/pages/administrative/aboutUs/index.tsx @@ -0,0 +1,64 @@ +import TextField from '@mui/material/TextField'; +import Head from 'next/head' +import Image from 'next/image' +import React from 'react' + +import AdministrativeHeader from '../../../components/administrativeHeader/AdministrativeHeader'; +import Banner from '../../../components/banner/Banner' +import Header from '../../../components/header/Header' +import { AboutUsView } from '../../../styles/layouts/aboutUs/AboutUsView' + +export default function aboutUs() { + return ( + + + Smart Energia - About Us + + + +
+

atualizar texto

+ +
+
+

A SMART ENERGIA é uma consultoria independente especializada em Gestão de Energia Elétrica, consolidada como uma das três maiores consultorias do Brasil. + Devido à grande experiência em operações na CCEE – Câmara de Comercialização de Energia Elétrica e ANEEL, entrega resultados que superam as expectativas.

+ +

Nasceu para gerenciar a compra de energia com inovação, transparência e imparcialidade sendo o elo forte e necessário entre os Consumidores e os + Vendedores de energia.

+ +

Baseada em sua experiência no setor elétrico adquirida desde 2001 e em mais de 900 unidades migradas, atua na negociação de contratos de compra e venda de + energia, na Gestão de Energia no Mercado Livre e criação de produtos diferenciados para atender as necessidades específicas dos consumidores.

+ +

Apoiada pela sólida experiência de seus gestores, conhecendo as premissas dos agentes de Comercialização e Geração para a compra e venda de energia, + aplicamos as mesmas premissas a favor dos Consumidores, disponibilizando assim um diferencial único para a tomada de decisão e elaboração das estratégias de + contratação de energia.

+
    +
  • {'Informação'}
  • +
  • {'Economia'}
  • +
  • {'Gestão de Energia'}
  • +
  • {'Imparcialidade'}
  • +
  • {'Previsão de Custos'}
  • +
  • {'Experiência'}
  • +
  • {'Relacionamento'}
  • +
+ +
+ +
+
+
+ ) +} diff --git a/src/pages/administrative/clients.tsx b/src/pages/administrative/clients.tsx index 42972a7..7d75f8c 100644 --- a/src/pages/administrative/clients.tsx +++ b/src/pages/administrative/clients.tsx @@ -1,89 +1,98 @@ +import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; +import Modal from '@mui/material/Modal'; import TextField from '@mui/material/TextField'; +import Typography from '@mui/material/Typography'; import { DataGrid, GridColDef, GridValueGetterParams } from '@mui/x-data-grid'; import React, { useState } from 'react' +import AdministrativeHeader from '../../components/administrativeHeader/AdministrativeHeader'; +import ClientsTable from '../../components/administrativeTables/ClientsTable'; import BasicButton from '../../components/buttons/basicButton/BasicButton' -import Modal from '../../components/modal/Modal'; -import PageTitle from '../../components/pageTitle/PageTitle' -import { ClientsModalView, ClientsView } from '../../styles/layouts/clients/ClientsView' +import FaqButton1 from '../../components/buttons/faqButton/FaqButton1'; +import FaqButton2 from '../../components/buttons/faqButton/FaqButton2'; +import Header from '../../components/header/Header' +import InputUpload from '../../components/inputUplaod/inputUpload'; +import { ClientsView } from '../../styles/layouts/clients/ClientsView'; +import PageTitle from '../../components/pageTitle/PageTitle'; +import ConfirmModal from '../../components/modal/ConfirmModal'; +import { ConfirmModalView } from '../../styles/layouts/modals/confirmModalView'; +import { api } from '../../services/api'; + +const style = { + position: 'absolute' as const, + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: 900, + height: 500, + bgcolor: 'background.paper', + border: '2px solid #000', + boxShadow: 24, + p: 4, + overflowY: 'scroll' +}; export default function clients() { + const [open, setOpen] = React.useState(false); + const [openModalInativar, setOpenModalInativar] = useState(false) + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); + const [openModal, setOpenModal] = useState(false) - const rows = [ - { id: 1, lastName: 'Snow', firstName: 'Jon', age: 35 }, - { id: 2, lastName: 'Lannister', firstName: 'Cersei', age: 42 }, - { id: 3, lastName: 'Lannister', firstName: 'Jaime', age: 45 }, - { id: 4, lastName: 'Stark', firstName: 'Arya', age: 16 }, - { id: 5, lastName: 'Targaryen', firstName: 'Daenerys', age: null }, - { id: 6, lastName: 'Melisandre', firstName: null, age: 150 }, - { id: 7, lastName: 'Clifford', firstName: 'Ferrara', age: 44 }, - { id: 8, lastName: 'Frances', firstName: 'Rossini', age: 36 }, - { id: 9, lastName: 'Roxie', firstName: 'Harvey', age: 65 }, - ]; - - const columns: GridColDef[] = [ - { field: 'id', headerName: 'ID', width: 70 }, - { field: 'firstName', headerName: 'First name', width: 130 }, - { field: 'lastName', headerName: 'Last name', width: 130 }, - { - field: 'age', - headerName: 'Age', - type: 'number', - width: 90, - }, - { - field: 'fullName', - headerName: 'Full name', - description: 'This column has a value getter and is not sortable.', - sortable: false, - width: 160, - valueGetter: (params: GridValueGetterParams) => - `${params.row.firstName || ''} ${params.row.lastName || ''}`, - }, - ]; + function handleCreateClient() { + api.post('', { + "name": "Teste3", + "email": "teste3@gmail.com", + "password": "password", + "password_confirmation": "password", + "client_id": 222 + }) + } return ( - <> +
+
- +
+ + +
+ + +

Adicionar Cliente

+ + Adicionar Cliente Smart Energia +
+ + + + + + +

+ console.log()} /> + console.log()}/> +
+
- setOpenModal(true)}/> - {throw new Error('fixing...')}}/> -
- -
- +
- {setOpenModal(value)}}> - - - - - - - - - - + {setOpenModalInativar(value)}}> + + setOpenModalInativar(true)}/> + setOpenModalInativar(true)}/> + + +
) } diff --git a/src/pages/administrative/faq/faqView.ts b/src/pages/administrative/faq/faqView.ts new file mode 100644 index 0000000..7680a37 --- /dev/null +++ b/src/pages/administrative/faq/faqView.ts @@ -0,0 +1,54 @@ +import styled from 'styled-components' + + + +export const FaqView = styled.nav` + display: flex; + align-items: center; + flex-direction: column; + width: 100%; + + + .btn{ + background: #254F7F; + border-radius: 8px; + color: white; + width: 164px; + height: 40px; + border: none; + + } + .btn2{ + background: #FFBC10; + border-radius: 8px; + color: white; + width: 164px; + height: 40px; + border: none; + margin-left: 3px; + } + .buttons{ + display: flex; + margin-top:50px ; + justify-content: space-between; + align-self:flex-start ; + margin-left: 20px; + } + .title{ + display: flex; + justify-content: flex-start; + align-self:flex-start ; + flex-direction: column; + margin-left: 19px; + } + +/* + .teste{ + display: flex; + justify-content: center; + align-items: center; + margin-left: 100px; + } */ + + +` diff --git a/src/pages/administrative/faq/index.tsx b/src/pages/administrative/faq/index.tsx new file mode 100644 index 0000000..d1874ad --- /dev/null +++ b/src/pages/administrative/faq/index.tsx @@ -0,0 +1,138 @@ +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; +import Modal from '@mui/material/Modal'; +import Stack from '@mui/material/Stack'; +import TextField from '@mui/material/TextField'; +import Typography from '@mui/material/Typography'; +import Head from 'next/head' +import Image from 'next/image' +import Link from 'next/link' +import { useRouter } from 'next/router' +import React, { useEffect, useState } from 'react' +import { api } from '../../../services/api'; + + +import FaqTable from '../../../components/administrativeTables/FaqTable'; +import BasicButton from '../../../components/buttons/basicButton/BasicButton'; +import FaqButton1 from '../../../components/buttons/faqButton/FaqButton1'; +import FaqButton2 from '../../../components/buttons/faqButton/FaqButton2'; +import Header from '../../../components/header/Header' +import PageTitle from '../../../components/pageTitle/PageTitle' +import { FaqView } from '../../../styles/layouts/commonQuestions/FaqView' +import getAPIClient from '../../../services/ssrApi'; +import { GetServerSideProps } from 'next'; +import { parseCookies } from 'nookies'; + +const style = { + position: 'absolute' as const, + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: 900, + height: 500, + bgcolor: 'background.paper', + border: '2px solid #000', + boxShadow: 24, + p: 4, +}; + +type FaqInterface = { + question: string; + answer: string; + +} + + +export default function Sidebar({faqData}) { + async function handleRegisterNewFaq({question, answer}: FaqInterface) { + await api.post('/faq', { + "question": question, + "answer": answer, + + }).then(res => console.log(res.data)) + } + + const [faq, setFaq] = useState({ + question: '', + answer: '', + }) + + + const [open, setOpen] = React.useState(false); + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); + + return ( + <> + +
+ + + +
+ + + +
+ + +

Adicionar/Editar Pergunta

+ + Adicionar/Editar Pergunta + +
+ + setFaq({...faq, question:value.target.value})} sx={{width:710, ml:8}} variant="outlined" />

+ setFaq({...faq, answer:value.target.value})} sx={{width:710, ml:8}} variant="outlined" /> + +

+ + handleRegisterNewFaq(faq)} + + /> +
+ +
+ + + + + ) +} + +export const getServerSideProps: GetServerSideProps = async (ctx) => { + const apiClient = getAPIClient(ctx) + const { ['@smartAuth-token']: token } = parseCookies(ctx) + console.log('teste') + let faqData = []; + + +await apiClient.get('/faq').then(res => { + faqData = res.data +}).catch(res => { + console.log(res) +}) + console.table(faqData); + + if (!token) { + return { + redirect: { + destination: '/', + permanent: false + } + } + } + + return { + props: { + faqData + } + } +} diff --git a/src/pages/administrative/general.tsx b/src/pages/administrative/general.tsx new file mode 100644 index 0000000..b45eead --- /dev/null +++ b/src/pages/administrative/general.tsx @@ -0,0 +1,86 @@ +import FormControl from '@mui/material/FormControl'; +import InputLabel from '@mui/material/InputLabel'; +import MenuItem from '@mui/material/MenuItem'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; +import TextField from '@mui/material/TextField'; +import { Editor } from '@tinymce/tinymce-react' +import React, { useRef, useState } from 'react' + +import Header from '../../components/header/Header'; +import { GeneralView } from '../../styles/layouts/general/GeneralView' + +export default function index() { + const editorRef = useRef(null); + const [text, setText] = useState(''); + + const log = () => { + if (editorRef.current) { + console.log(editorRef.current.getContent()); + } + }; + + const handleChange = (event: SelectChangeEvent) => { + setText(event.target.value); + }; + + return ( + +
+
+ + + +
+ editorRef.current = editor} + initialValue='

A SMART ENERGIA é uma consultoria independente especializada em Gestão de Energia Elétrica, consolidada como uma das três maiores consultorias do Brasil. + Devido à grande experiência em operações na CCEE – Câmara de Comercialização de Energia Elétrica e ANEEL, entrega resultados que superam as expectativas.

+ +

Nasceu para gerenciar a compra de energia com inovação, transparência e imparcialidade sendo o elo forte e necessário entre os Consumidores e os + Vendedores de energia.

+ +

Baseada em sua experiência no setor elétrico adquirida desde 2001 e em mais de 900 unidades migradas, atua na negociação de contratos de compra e venda de + energia, na Gestão de Energia no Mercado Livre e criação de produtos diferenciados para atender as necessidades específicas dos consumidores.

+ +

Apoiada pela sólida experiência de seus gestores, conhecendo as premissas dos agentes de Comercialização e Geração para a compra e venda de energia, + aplicamos as mesmas premissas a favor dos Consumidores, disponibilizando assim um diferencial único para a tomada de decisão e elaboração das estratégias de + contratação de energia.

+
    +
  • Informação
  • +
  • Economia
  • +
  • Gestão de Energia
  • +
  • Imparcialidade
  • +
  • Previsão de Custos
  • +
  • Experiência
  • +
  • Relacionamento
  • +
' + init={{ + height: 500, + width: '100%', + menubar: false, + plugins: [ + 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', + 'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen', + 'insertdatetime', 'media', 'table', 'preview', 'help', 'wordcount' + ], + toolbar: 'undo redo | blocks | ' + + 'bold italic forecolor | alignleft aligncenter ' + + 'alignright alignjustify | bullist numlist outdent indent | ' + + 'removeformat | help', + content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }' + }} + /> + + + ) +} diff --git a/src/pages/administrative/index.tsx b/src/pages/administrative/index.tsx index 90fbab8..17fa2cd 100644 --- a/src/pages/administrative/index.tsx +++ b/src/pages/administrative/index.tsx @@ -1,7 +1,74 @@ -import React from 'react' +import Button from '@mui/material/Button'; +import TextField from '@mui/material/TextField'; +import { DataGrid, GridColDef, GridValueGetterParams } from '@mui/x-data-grid'; +import React, { useState } from 'react' + +import AdministrativeHeader from '../../components/administrativeHeader/AdministrativeHeader'; +import ClientsTable from '../../components/administrativeTables/ClientsTable'; +import BasicButton from '../../components/buttons/basicButton/BasicButton' +import Header from '../../components/header/Header' +import ConfirmModal from '../../components/modal/ConfirmModal'; +import Modal from '../../components/modal/Modal'; +import PageTitle from '../../components/pageTitle/PageTitle' +import { ClientsModalView, ClientsView, ConfirmModalView } from '../../styles/layouts/clients/ClientsView' + +export default function clients() { + const [openModal, setOpenModal] = useState(false) + const [openModalInativar, setOpenModalInativar] = useState(false) -export default function index() { return ( -
index
+
+ +
+ + +
+ setOpenModal(true)}/> + setOpenModalInativar(true)}/> +
+ +
+ {/* */} + +
+ + + {setOpenModal(value)}}> + + +
+ + + + + console.log()}/> + +
+
+
+ + {setOpenModalInativar(value)}}> + + setOpenModalInativar(true)}/> + setOpenModalInativar(true)}/> + + +
) } diff --git a/src/pages/administrative/notification/index.tsx b/src/pages/administrative/notification/index.tsx new file mode 100644 index 0000000..dc142d6 --- /dev/null +++ b/src/pages/administrative/notification/index.tsx @@ -0,0 +1,280 @@ +import CheckBoxIcon from '@mui/icons-material/CheckBox'; +import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank'; +import Autocomplete from '@mui/material/Autocomplete'; +import Box from '@mui/material/Box'; +import Checkbox from '@mui/material/Checkbox'; +import FormControl from '@mui/material/FormControl'; +import Modal from '@mui/material/Modal'; +import TextField from '@mui/material/TextField'; +import Typography from '@mui/material/Typography'; +import Head from 'next/head' +import React, { useEffect, useState } from 'react' + +import NotificationsTable from '../../../components/administrativeTables/NotificationsTable' +import FaqButton1 from '../../../components/buttons/faqButton/FaqButton1'; +import FaqButton2 from '../../../components/buttons/faqButton/FaqButton2'; +import Header from '../../../components/header/Header' +import PageTitle from '../../../components/pageTitle/PageTitle' +import { api } from '../../../services/api'; +import { FaqView } from '../../../styles/layouts/commonQuestions/FaqView' + +import Radio from '@mui/material/Radio'; +import RadioGroup from '@mui/material/RadioGroup'; +import FormControlLabel from '@mui/material/FormControlLabel'; +import getAPIClient from '../../../services/ssrApi'; +import { GetServerSideProps } from 'next'; +import { parseCookies } from 'nookies'; +import Snackbar from '@mui/material/Snackbar'; +import MuiAlert, { AlertProps } from '@mui/material/Alert'; +import BasicButton from '../../../components/buttons/basicButton/BasicButton'; +import { ConfirmModalView } from '../../../styles/layouts/modals/confirmModalView'; +import ConfirmModal from '../../../components/modal/ConfirmModal'; +import { JsxElement } from 'typescript'; + +const style = { + position: 'absolute' as const, + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: 900, + height: 500, + bgcolor: 'background.paper', + border: '2px solid #000', + boxShadow: 24, + p: 4, + overflowY: 'scroll' +}; + +const Alert = React.forwardRef(function Alert( + props, + ref, +) { + return ; +}); + +const icon = ; +const checkedIcon = ; + +interface NotificationInterface { + title: string, + body: string, + users: object[] +} + +export default function notification({clients, notifications}) { + + const [notification, setNotification] = useState({ + title: '', + body: '', + users: [] + }) + const [selectedNotifications, setSelectedNotifications] = useState([]) + + const [open, setOpen] = useState(false); + const [openModalInativar, setOpenModalInativar] = useState(false) + const [openSnackSuccess, setOpenSnackSuccess] = useState(false); + const [openSnackError, setOpenSnackError] = useState(false); + const [openSnackSuccessDelete, setOpenSnackSuccessDelete] = useState(false); + const [openSnackErrorDelete, setOpenSnackErrorDelete] = useState(false); + + const [radiusValue, setRadiusValue] = useState('all'); + + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); + + const handleCloseSnack = (event?: React.SyntheticEvent | Event, reason?: string) => { + if (reason === 'clickaway') { + return; + } + + setOpenSnackError(false); + setOpenSnackSuccess(false); + }; + + const handleCloseSnackDelete = (event?: React.SyntheticEvent | Event, reason?: string) => { + if (reason === 'clickaway') { + return; + } + + setOpenSnackErrorDelete(false); + setOpenSnackSuccessDelete(false); + }; + + async function handleRegisterNewNotification({title, body, users}: NotificationInterface) { + await api.post('/notification', { + title, + body, + users + }).then(res => setOpenSnackSuccess(true)).catch(res => setOpenSnackError(true)) + } + async function handleDeleteNotification(id: any) { + await id.map((value) => { + api.delete(`/notification/${value}`).then(res => { + setOpenSnackSuccessDelete(true) + setOpenModalInativar(false) + window.location.reload() + }).catch(res => setOpenSnackErrorDelete(true)) + }) + } + + return ( + + + Smart Energia - Notificações + +
+ + + + + notificação cadastrada com sucesso! + + + + + Notificação não cadastrada! + + + + + + notificação excluida com sucesso! + + + + + Notificação não excluida! + + + +
+ + + +
+ setSelectedNotifications(value)}/> + + +

Disparar Notificações

+ + Pode ser que todas as notificaçõs demorem alguns minutos para estarem disponíveis +
+ { + setNotification({ + ...notification, + title: value.target.value + }) + }} variant="outlined" />

+ { + setNotification({ + ...notification, + body: value.target.value + }) + }} variant="outlined" />

+ +
+ + + } checked={radiusValue==='all'? true : false}onChange={(value: React.ChangeEvent) => { + setRadiusValue(value.target.value) + }} label="Disparar para todos os clientes" /> + } checked={radiusValue==='some'? true : false} onChange={(value: React.ChangeEvent) => { + setRadiusValue(value.target.value) + }} label="Disparar somente para alguns clientes" /> + + +
+ + { + radiusValue === 'some'? + { + setNotification({...notification, users: newValue.map((el) => {return {"user_id": el.id}})}); + }} + getOptionLabel={(option) => option.name} + renderOption={(props, option, { selected }) => ( +
  • + + {option.name} +
  • + )} + sx={{ml:8}} + style={{ width: 700 }} + renderInput={(params) => ( + + )} + /> : + null + } + + {setOpen(false)}} /> + { + handleRegisterNewNotification(notification)}} + /> +
    +
    + {setOpenModalInativar(value)}}> + + + handleDeleteNotification(selectedNotifications)}/> + setOpenModalInativar(false)}/> + + + + ) +} + +export const getServerSideProps: GetServerSideProps = async (ctx) => { + const apiClient = getAPIClient(ctx) + const { ['@smartAuth-token']: token } = parseCookies(ctx) + + let clients = []; + let notifications = []; + + await apiClient.get('/user').then(res => { + clients = res.data + }).catch(res => { + console.log(res) + }) + + await apiClient.get('/notification').then(res => { + notifications = res.data + }).catch(res => { + console.log(res) + }) + + if (!token) { + return { + redirect: { + destination: '/', + permanent: false + } + } + } + + return { + props: { + clients, + notifications + } + } +} diff --git a/src/pages/administrative/notification/notificationView.ts b/src/pages/administrative/notification/notificationView.ts new file mode 100644 index 0000000..cc0aca2 --- /dev/null +++ b/src/pages/administrative/notification/notificationView.ts @@ -0,0 +1,83 @@ +import styled from 'styled-components' + + + +export const NotificationView = styled.nav` + display: flex; + align-items: center; + + flex-direction: column; + + width: 100%; + + h1 { + font-weight: 700; + font-size: calc(90% + 2rem); + line-height: 72px; + text-align: center; + letter-spacing: 0.5px; + } + + p { + font-weight: 400; + font-size: 99.98%; + line-height: 21px; + text-align: center; + letter-spacing: 0.5px; + + color: #AAAAAA; + } + + .CommonQuestionsSection { + width: 80%; + } + + hr { + border: 1px solid #DDDDDD; + } + + /* .modal{ + display: flex; + justify-self: flex-end; + align-self: center; + margin-left: 100px; + + } */ + .btn2{ + background: #254F7F; + border-radius: 8px; + color: white; + width: 164px; + height: 45px; + border: none; + margin-top: 10px; + } + .btn1{ + background:#FFBC10; + border-radius: 8px; + color: white; + width: 164px; + height: 45px; + border: none; + margin-top: 10px; + margin-left: 6px; + } + .buttons{ + display: flex; + justify-content: flex-start; + align-self: flex-start; + margin-top: 45px; + margin-left: 16px; + + } + .title{ + display: flex; + justify-content: flex-start; + align-self: flex-start; + margin-left: 16px; + } + + + + +` diff --git a/src/pages/areaTest.tsx b/src/pages/areaTest.tsx index 626b721..dcd051c 100644 --- a/src/pages/areaTest.tsx +++ b/src/pages/areaTest.tsx @@ -1,23 +1,24 @@ -import React from 'react' +import Box from '@mui/material/Box'; +import FilledInput from '@mui/material/FilledInput'; +import FormControl from '@mui/material/FormControl'; +import FormHelperText from '@mui/material/FormHelperText'; +import IconButton from '@mui/material/IconButton'; +import Input from '@mui/material/Input'; +import InputAdornment from '@mui/material/InputAdornment'; +import InputLabel from '@mui/material/InputLabel'; +import OutlinedInput from '@mui/material/OutlinedInput'; +import TextField from '@mui/material/TextField'; import Image from 'next/image' +import React from 'react' + import BasicButton from '../components/buttons/basicButton/BasicButton' import GradientButton from '../components/buttons/gradientButton/GradientButton' import Graph from '../components/graph/Chart' -import Box from '@mui/material/Box'; -import IconButton from '@mui/material/IconButton'; -import Input from '@mui/material/Input'; -import FilledInput from '@mui/material/FilledInput'; -import OutlinedInput from '@mui/material/OutlinedInput'; -import InputLabel from '@mui/material/InputLabel'; -import InputAdornment from '@mui/material/InputAdornment'; -import FormHelperText from '@mui/material/FormHelperText'; -import FormControl from '@mui/material/FormControl'; -import TextField from '@mui/material/TextField'; import LineChart from '../components/graph/LineChart' + // import Footer from '../components/footer/footer' export default function areaTest() { - const [values, setValues] = React.useState({ amount: '', password: '', diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 999cacb..a5ff7c6 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -17,6 +17,10 @@ import Chart from '../components/graph/Chart' import { LineBarChart } from '../components/graph/LineBarChart' import { ConsumoEstimado } from '../services/consumoEstimado' import Head from 'next/head' +import recoverUserInformation from '../services/auth' +import { parseCookies } from 'nookies' +import { GetServerSideProps } from 'next' +import getAPIClient from '../services/ssrApi' export default function Dashboard() { @@ -53,9 +57,27 @@ export default function Dashboard() {
    + - - - ) } + +export const getServerSideProps: GetServerSideProps = async (ctx) => { + const { ['@smartAuth-token']: token } = parseCookies(ctx) + + if (!token) { + return { + redirect: { + destination: '/', + permanent: false + } + } + } + + return { + props: {} + } +} diff --git a/src/pages/estimatedCost.tsx b/src/pages/estimatedCost.tsx index 76326cc..614aa40 100644 --- a/src/pages/estimatedCost.tsx +++ b/src/pages/estimatedCost.tsx @@ -6,7 +6,6 @@ import { LineBarChart } from '../components/graph/LineBarChart' import Header from '../components/header/Header' import PageTitle from '../components/pageTitle/PageTitle' import { ConsumoEstimado } from '../services/consumoEstimado' - import { EstimatedCostView } from '../styles/layouts/economy/estimatedCost/EstimatedCostView' export default function EstimatedCost() { @@ -16,7 +15,7 @@ export default function EstimatedCost() { Smart Energia - Custos Estimados
    - +
    diff --git a/src/pages/faq.tsx b/src/pages/faq.tsx index aecee8f..c1e3a41 100644 --- a/src/pages/faq.tsx +++ b/src/pages/faq.tsx @@ -1,10 +1,15 @@ +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 { api } from '../services/api' +import getAPIClient from '../services/ssrApi' import { FaqView } from '../styles/layouts/commonQuestions/FaqView' -export default function commonQuestions() { + +export default function commonQuestions({faqData}) { return ( @@ -14,17 +19,44 @@ export default function commonQuestions() {

    Perguntas Frequentes

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    - -
    - -
    - -
    - -
    - -
    + { + faqData.map((value, index ) => { + return <> + +
    + + }) + }
    ) } +export const getServerSideProps: GetServerSideProps = async (ctx) => { + const apiClient = getAPIClient(ctx) + const { ['@smartAuth-token']: token } = parseCookies(ctx) + console.log('teste') + let faqData = []; + + +await apiClient.get('/faq').then(res => { + faqData = res.data +}).catch(res => { + console.log(res) +}) + console.table(faqData); + + if (!token) { + return { + redirect: { + destination: '/', + permanent: false + } + } + } + + return { + props: { + faqData + } + } +} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index fb138c3..dbfbe9a 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,33 +1,38 @@ -import React, { useState } from 'react' +import FormControl from '@mui/material/FormControl'; +import IconButton from '@mui/material/IconButton'; +import InputAdornment from '@mui/material/InputAdornment'; +import InputLabel from '@mui/material/InputLabel'; +import OutlinedInput from '@mui/material/OutlinedInput'; +import TextField from '@mui/material/TextField'; +import Head from 'next/head'; import Image from 'next/image'; import Link from 'next/link'; import { useRouter } from 'next/router' -import OutlinedInput from '@mui/material/OutlinedInput'; -import InputLabel from '@mui/material/InputLabel'; -import InputAdornment from '@mui/material/InputAdornment'; +import React, { useContext, useState } from 'react' +import { AiOutlineEye, AiOutlineEyeInvisible } from 'react-icons/ai'; + import LoginButton from '../components/buttons/loginButton/LoginButton'; -import FormControl from '@mui/material/FormControl'; -import IconButton from '@mui/material/IconButton'; -import TextField from '@mui/material/TextField'; - -import {AiOutlineEyeInvisible, AiOutlineEye} from 'react-icons/ai'; - -import { LoginView, LoginContainer } from '../styles/layouts/login/LoginView'; -import Head from 'next/head'; +import { AuthContext } from '../contexts/AuthContext'; +import { api } from '../services/api'; +import { LoginContainer, LoginView } from '../styles/layouts/login/LoginView'; +import Dashboard from './dashboard'; export default function Home() { - const [state, setstate]=useState(false); + const [state, setstate] = useState(false); - const [values, setValues] = React.useState({ + const [values, setValues] = useState({ password: '', showPassword: false, }); + const [email, setEmail] = useState() + const [password, setPassword] = useState() const router = useRouter() const rota = router.pathname const handleChange = (prop) => (event) => { setValues({ ...values, [prop]: event.target.value }); + setPassword(event.target.value); }; const handleClickShowPassword = () => { @@ -41,6 +46,12 @@ export default function Home() { event.preventDefault(); }; + const { signIn } = useContext(AuthContext) + + async function handleSignIn() { + await signIn({email, password}) + } + return ( @@ -48,14 +59,16 @@ export default function Home() {
    - +

    Bem-Vindo

    Estratégias Inteligentes em
    Gestão de Energia

    - + { + setEmail(value.target.value) + }}/> Password Esqueceu a senha ? - + handleSignIn()}/>
    Ou

    +55(41) 3012-5900
    www.energiasmart.com.br

    -
    diff --git a/src/pages/news.tsx b/src/pages/news.tsx index 8452cb2..6039ad3 100644 --- a/src/pages/news.tsx +++ b/src/pages/news.tsx @@ -1,10 +1,11 @@ -import React from 'react' -import Banner from '../components/banner/Banner' -import Header from '../components/header/Header' -import BasicButton from '../components/buttons/basicButton/BasicButton'; -import { NewsView, Button } from '../styles/layouts/news/NewsView' import Head from 'next/head'; import Link from 'next/link' +import React from 'react' + +import Banner from '../components/banner/Banner' +import BasicButton from '../components/buttons/basicButton/BasicButton'; +import Header from '../components/header/Header' +import { Button, NewsView } from '../styles/layouts/news/NewsView' export default function aboutUs() { return ( @@ -26,7 +27,7 @@ export default function aboutUs() { Os itens que mais impactaram a correção foram os encargos setoriais, os custos de distribuição, a retirada dos componentes financeiros..

    @@ -40,15 +41,15 @@ export default function aboutUs() { Os itens que mais impactaram a correção foram os encargos setoriais, os custos de distribuição, a retirada dos componentes financeiros..

    + target={"_blank"} + rel={"noreferrer"}> console.log()}/> ) } diff --git a/src/pages/notifications.tsx b/src/pages/notifications.tsx index 64c81d6..2c1e8f7 100644 --- a/src/pages/notifications.tsx +++ b/src/pages/notifications.tsx @@ -1,11 +1,15 @@ +import { GetServerSideProps } from 'next' import Head from 'next/head' +import { parseCookies } from 'nookies' import React from 'react' -import CommonQuestionsCard from '../components/faqQuestionsCard/FaqQuestionsCard' +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() { +export default function Notifications({notificationData}: any) { return ( @@ -15,17 +19,44 @@ export default function Notifications() {

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    - -
    - -
    - -
    - -
    - -
    + { + notificationData.map((value, index ) => { + return <> + +
    + + }) + }
    ) } +export const getServerSideProps: GetServerSideProps = async (ctx) => { + const apiClient = getAPIClient(ctx) + const { ['@smartAuth-token']: token } = parseCookies(ctx) + console.log('teste') + let notificationData = []; + + +await apiClient.get('/notification').then(res => { + notificationData = res.data +}).catch(res => { + console.log(res) +}) + console.table(notificationData); + + if (!token) { + return { + redirect: { + destination: '/', + permanent: false + } + } + } + + return { + props: { + notificationData + } + } +} diff --git a/src/pages/pld/index.tsx b/src/pages/pld/index.tsx index 5cf2ccc..75b29fb 100644 --- a/src/pages/pld/index.tsx +++ b/src/pages/pld/index.tsx @@ -1,22 +1,20 @@ -import React, { useEffect, useState } from 'react' -import { useRouter } from 'next/router' - -import Header from '../../components/header/Header' import MenuItem from '@mui/material/MenuItem'; import Select, { SelectChangeEvent } from '@mui/material/Select'; +import Head from 'next/head'; +import Link from 'next/link'; +import { useRouter } from 'next/router' +import React, { useEffect, useState } from 'react' -import { GoBack, PldGraphView, PldTableView } from '../../styles/layouts/pld/PldView' - -import RenderIf from '../../utils/renderIf' import BasicButton from '../../components/buttons/basicButton/BasicButton'; import Chart from '../../components/graph/Chart'; -import PageTitle from '../../components/pageTitle/PageTitle'; -import Link from 'next/link'; -import LineChart from '../../components/graph/LineChart'; import { LineBarChart } from '../../components/graph/LineBarChart'; +import LineChart from '../../components/graph/LineChart'; +import Header from '../../components/header/Header' +import PageTitle from '../../components/pageTitle/PageTitle'; import { EconomiaAcumulada } from '../../services/economiaAcumulada'; import { EvolucaoPld } from '../../services/evolucaoPld'; -import Head from 'next/head'; +import { GoBack, PldGraphView, PldTableView } from '../../styles/layouts/pld/PldView' +import RenderIf from '../../utils/renderIf' export default function region() { const router = useRouter() @@ -36,7 +34,7 @@ export default function region() { function handleGreen(minimo, mi, ma, maximo) { if (minimo - mi >= 100 && minimo - mi < 200) { return 'green' - } else if ( mi*2 >= 200 && mi*2 <250 ) { + } else if ( mi*2 >= 200 && mi*2 < 250 ) { return'dullGreen' } else if ( (ma-mi)/2 >=250 && (ma-mi)/2 < 300 ) { return 'white' @@ -56,8 +54,8 @@ export default function region() {
    - {'< voltar para visão geral'} - + {'< Voltar para Visão Geral'} + @@ -186,7 +184,7 @@ export default function region() {
    setPage('perMouth')}> -

    Valores Diarios

    +

    Valores Diários

    setPage('perDate')}>

    Valores Horários

    @@ -196,8 +194,8 @@ export default function region() { - setPage('table')}>{'< voltar para tabela pld'} - + setPage('table')}>{'< voltar para tabela PLD'} +
    @@ -209,26 +207,26 @@ export default function region() { width: '100%' }} > - Filial 3 - Filial 3 - Twenty - Thirty + Norte + Nordeste + Sul + Sudeste
    - + console.log()}/>
    - setPage('table')}>{'< voltar para tabela pld'} + setPage('table')}>{'< voltar para tabela PLD'} - +
    - + console.log()}/>
    diff --git a/src/pages/resumoOperacao.tsx b/src/pages/resumoOperacao.tsx index 4c61655..a64cb7b 100644 --- a/src/pages/resumoOperacao.tsx +++ b/src/pages/resumoOperacao.tsx @@ -1,22 +1,20 @@ +import Box from '@mui/material/Box'; +import FormControl from '@mui/material/FormControl'; +import InputLabel from '@mui/material/InputLabel'; +import MenuItem from '@mui/material/MenuItem'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; +import Head from 'next/head'; import React, { useEffect } 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 BasicButton from '../components/buttons/basicButton/BasicButton'; import Sidebar from '../components/sidebar/Sidebar'; // import { dados } from '../services/DadosTabelaResumoOperacao'; import data from '../services/dados.json' -import InputLabel from '@mui/material/InputLabel'; -import MenuItem from '@mui/material/MenuItem'; -import FormControl from '@mui/material/FormControl'; -import Select, { SelectChangeEvent } from '@mui/material/Select'; -import Box from '@mui/material/Box'; -// import Teste from '../files/teste.csv'; -import { CSVLink, CSVDownload } from "react-csv"; - - - import { Pagination, TableView } from '../styles/layouts/ResumoOperacao/ResumoOperacaoView'; -import Head from 'next/head'; export default function ResumoOperacao() { const csvData = [ @@ -55,7 +53,6 @@ export default function ResumoOperacao() { console.log(data.unidades.filter((value, index)=> value.value.includes(unidade))) }, [month, unidade]) - return( @@ -65,52 +62,49 @@ export default function ResumoOperacao() {

    Seletor Mês

    -
    +
    + + Unidades + + - - Unidades - - - - - - - Mês - - + + Mês + +
    @@ -147,22 +141,14 @@ export default function ResumoOperacao() { } }) } -
    - - {/* */} - {/* */} - {/* */} - - + console.log()}/> -
    - ) } diff --git a/src/pages/telemetria.tsx b/src/pages/telemetria.tsx index eb351f6..c20530f 100644 --- a/src/pages/telemetria.tsx +++ b/src/pages/telemetria.tsx @@ -56,12 +56,14 @@ export default function Telemetria() { fullWidth > - None + Nenhum - 07/09/2021 - Filial 3 - Twenty - Thirty + + Unidade 1 + Unidade 2 + Unidade 3 + Unidade 4 + Unidade 5
    @@ -79,12 +81,13 @@ export default function Telemetria() { fullWidth > - None + Nenhum - 07/09/2021 - Filial 3 - Twenty - Thirty + 20/05/2022 + 10/06/2022 + 05/06/2021 + 05/06/2021 + 05/06/2021 @@ -102,12 +105,13 @@ export default function Telemetria() { fullWidth > - None + Nenhum - 07/09/2021 - Filial 3 - Twenty - Thirty + 20/05/2022 + 10/06/2022 + 05/06/2021 + 05/06/2021 + 05/06/2021 @@ -125,7 +129,7 @@ export default function Telemetria() { fullWidth > - None + Nenhum 07/09/2021 Filial 3 diff --git a/src/services/api.ts b/src/services/api.ts new file mode 100644 index 0000000..c858653 --- /dev/null +++ b/src/services/api.ts @@ -0,0 +1,3 @@ +import getAPIClient from "./ssrApi"; + +export const api = getAPIClient() diff --git a/src/services/auth.ts b/src/services/auth.ts new file mode 100644 index 0000000..52640dc --- /dev/null +++ b/src/services/auth.ts @@ -0,0 +1,79 @@ +import { api } from "./api"; + +export const TOKEN_KEY = "@smartAuth-token"; + +export const logout = () => { + localStorage.removeItem(TOKEN_KEY); +}; + +interface SignInRequestData { + email: string, + password: string +} + +type UserObjectType = { + name: string; + email: string; + client_id: number + id: number, + role: number +} + +export async function signInRequest(data: SignInRequestData) { + let user: UserObjectType, token: string, exception: any = null + + await api.post('/auth/login', { + "email": data.email, + "password": data.password, + "device_name": "test" + }).then(res => { + token = res.data.token + user = { + name: res.data.user.name, + email: res.data.user.email, + client_id: res.data.user.client_id, + id: res.data.user.id, + role: res.data.user.roles[0].pivot.role_id + } + }).catch(res => { + exception = res + }) + + return { + token, + user: { + name: user?.name, + email: user?.email, + client_id: user?.client_id, + id: user?.id, + role: user?.role + }, + exception + } +} + +export default async function recoverUserInformation(id) { + let user: UserObjectType + + await api.get(`/user/${id}`).then(res => { + console.log(res) + user = { + name: res.data.user.name, + email: res.data.user.email, + client_id: res.data.user.client_id, + id: res.data.user.id, + role: res.data.user.roles[0].pivot.role_id + } + }).catch(res => { + console.log(res) + }) + + return { + user: { + name: user?.name, + email: user?.email, + client_id: user?.client_id, + id: user?.id + } + } +} diff --git a/src/services/ssrApi.ts b/src/services/ssrApi.ts new file mode 100644 index 0000000..0be3e3e --- /dev/null +++ b/src/services/ssrApi.ts @@ -0,0 +1,29 @@ +import axios, { AxiosRequestConfig } from "axios"; +import * as cookie from 'cookie'; +import * as express from 'express'; +import * as next from 'next'; +import { parseCookies } from "nookies"; + +export default function getAPIClient(ctx?: Pick | { + req: next.NextApiRequest; +} | { + req: express.Request; +} | null | undefined) { + + const { '@smartAuth-token': token } = parseCookies(ctx) + + const api = axios.create({ + baseURL: "https://smart-energia-api.herokuapp.com/api", + }); + + api.interceptors.request.use(config => { + return config; + }, + ); + + if (token) { + api.defaults.headers['Authorization'] = `Bearer ${token}` + } + + return api +} diff --git a/src/styles/globals.ts b/src/styles/globals.ts index 3fb50fd..f70de8e 100644 --- a/src/styles/globals.ts +++ b/src/styles/globals.ts @@ -10,6 +10,10 @@ export const GlobalStyle = createGlobalStyle` main { padding: 2.5rem; + + button { + cursor: pointer + } } a { diff --git a/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts b/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts index 94a909a..c059741 100644 --- a/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts +++ b/src/styles/layouts/ResumoOperacao/ResumoOperacaoView.ts @@ -1,6 +1,5 @@ import styled from 'styled-components' - export const TableView = styled.div` display: flex; padding: 2.5rem; @@ -21,21 +20,16 @@ export const TableView = styled.div` .select{ display: flex; - margin-bottom: 25px; width: 20rem; } - .titleUnidade{ - - } .tg{ border-collapse:collapse; border-spacing:0; font-family:Poppins; width: 100%; - } .tg td{ @@ -49,7 +43,6 @@ export const TableView = styled.div` word-break:normal; } - .tg th{ border-color:#DDDFE1; border-style:solid; @@ -134,8 +127,27 @@ export const Pagination = styled.div` .numberColor{ color: #ABAFB3; } +` +export const NewTableLine = styled.section` + display: flex; + justify-content: center; + align-items: flex-start; + flex-direction: column; -`; + margin: 0 0 15px 0; + width: 100%; + article { + display: flex; + justify-content: space-between; + align-items: center; + + flex-direction: row; + + width: 100%; + + margin: 0 0 10px 0; + } +` diff --git a/src/styles/layouts/Telemetria/TelemetriaView.ts b/src/styles/layouts/Telemetria/TelemetriaView.ts index f380774..b7ddc00 100644 --- a/src/styles/layouts/Telemetria/TelemetriaView.ts +++ b/src/styles/layouts/Telemetria/TelemetriaView.ts @@ -1,12 +1,10 @@ - import styled from 'styled-components'; - export const TelemetriaView = styled.main` padding: 20px ; width: 100%; - .title{ + .title { color: black; font-weight: 600; font-size: 14px; @@ -14,7 +12,7 @@ export const TelemetriaView = styled.main` margin: 0 0 0 10px; } - span{ + span { font-family: 'Inter'; font-style: normal; font-weight: 500; @@ -23,14 +21,14 @@ export const TelemetriaView = styled.main` color: #667085; } - .titleMenuItem{ + .titleMenuItem { color: #667085; font-family: Inter; font-size: 14px; font-weight: 600; } - .paragraph{ + .paragraph { color: #22d1f0; text-align: center; margin-top: 60px; @@ -55,14 +53,27 @@ export const TelemetriaView = styled.main` export const Buttons = styled.div` display: flex; - min-width: 14rem; - cursor: pointer; - margin-top: 5rem; - padding-left: 100px; - padding-right: 100px; justify-content: space-evenly; flex-direction: row; + + min-width: 14rem; height: 6rem; + + margin-top: 5rem; + + padding-left: 100px; + padding-right: 100px; + +`; + +export const Uploads = styled.div` + display: flex; + justify-content: space-evenly; + + flex-direction: row; + + padding-left: 100px; + padding-right: 100px; `; diff --git a/src/styles/layouts/clients/ClientsView.ts b/src/styles/layouts/clients/ClientsView.ts index 1faa23b..4d61b0b 100644 --- a/src/styles/layouts/clients/ClientsView.ts +++ b/src/styles/layouts/clients/ClientsView.ts @@ -4,29 +4,61 @@ export const ClientsView = styled.main` display: flex; flex-direction: column; + width: 100%; + section { display: flex; width: 100%; - :nth-child(2) { + :nth-child(3) { justify-content: space-between; width: 18rem; margin: 45px 0 22px 0; } + } + .btn2{ + background: #254F7F; + border-radius: 8px; + color: white; + width: 164px; + height: 48px; + border: none; + margin-top: 10px; + } + .btn1{ + background:#FFBC10; + border-radius: 8px; + color: white; + width: 164px; + height: 48px; + border: none; + margin-top: 10px; + margin-left: 4px; + } + .buttons{ + display: flex; + margin-top: 40px; - :last-child { - width: 50rem; - height: 30rem; - } } ` export const ClientsModalView = styled.main` - display: grid; + display: flex; + flex-direction: column; - grid-template-columns: 100% 100%; - grid-template-rows: 100% 100% 100% 100%; + width: 70%; + article { + display: grid; + + align-self: flex-start; + width: 100%; + + grid-template-columns: 80% 80%; + grid-template-rows: 50% 50%; + + margin-top: 70px + } ` diff --git a/src/styles/layouts/clientsAdmin/clientsAdminView.ts b/src/styles/layouts/clientsAdmin/clientsAdminView.ts new file mode 100644 index 0000000..f4ae876 --- /dev/null +++ b/src/styles/layouts/clientsAdmin/clientsAdminView.ts @@ -0,0 +1,60 @@ +import styled from 'styled-components' + + + +export const NotificationView = styled.nav` + display: flex; + align-items: center; + flex-direction: column; + width: 100%; + + + .btn{ + background: #254F7F; + border-radius: 8px; + color: white; + width: 164px; + height: 40px; + border: none; + + } + .btn2{ + background: #FFBC10; + border-radius: 8px; + color: white; + width: 164px; + height: 40px; + border: none; + margin-left: 3px; + } + .buttons{ + display: flex; + margin-top:50px ; + justify-content: space-between; + align-self:flex-start ; + margin-left: 20px; + } + .title{ + display: flex; + justify-content: flex-start; + align-self:flex-start ; + flex-direction: column; + margin-left: 19px; + } + +/* + .teste{ + display: flex; + justify-content: center; + align-items: center; + margin-left: 100px; + } */ + .text1{ + margin-left: 70px; + } + .header{ + margin-top: 8px; + } + + +` diff --git a/src/styles/layouts/commonQuestions/FaqView.ts b/src/styles/layouts/commonQuestions/FaqView.ts index 32d9b16..b4975b6 100644 --- a/src/styles/layouts/commonQuestions/FaqView.ts +++ b/src/styles/layouts/commonQuestions/FaqView.ts @@ -33,4 +33,40 @@ export const FaqView = styled.main` hr { border: 1px solid #DDDDDD; } + + /* .modal{ + display: flex; + justify-self: flex-end; + align-self: center; + margin-left: 100px; + + } */ + .btn2{ + background: #254F7F; + border-radius: 8px; + color: white; + width: 164px; + height: 45px; + border: none; + margin-top: 10px; + } + .btn1{ + background:#FFBC10; + border-radius: 8px; + color: white; + width: 164px; + height: 45px; + border: none; + margin-top: 10px; + margin-left: 6px; + } + .buttons{ + display: flex; + justify-content: flex-start; + align-self: flex-start; + margin-top: 45px; + + } + + ` diff --git a/src/styles/layouts/general/GeneralView.tsx b/src/styles/layouts/general/GeneralView.tsx new file mode 100644 index 0000000..2c32b08 --- /dev/null +++ b/src/styles/layouts/general/GeneralView.tsx @@ -0,0 +1,11 @@ +import styled from "styled-components"; + +export const GeneralView = styled.main` + display: flex; + align-items: center; + justify-content: center; + + flex-direction: column; + + width: 100%; +` diff --git a/src/styles/layouts/industryInfo/IndustryInfoView.ts b/src/styles/layouts/industryInfo/IndustryInfoView.ts index c57df2b..e3bedb9 100644 --- a/src/styles/layouts/industryInfo/IndustryInfoView.ts +++ b/src/styles/layouts/industryInfo/IndustryInfoView.ts @@ -12,7 +12,7 @@ export const IndustryInfoView = styled.main` button{ height:60px; width: 22%; - margin-top: 17rem; + margin-top: 12rem; cursor: pointer; background: #254F7F; border-radius: 8px; diff --git a/src/styles/layouts/modals/confirmModalView.ts b/src/styles/layouts/modals/confirmModalView.ts new file mode 100644 index 0000000..b3cea70 --- /dev/null +++ b/src/styles/layouts/modals/confirmModalView.ts @@ -0,0 +1,13 @@ +import styled from "styled-components"; + +export const ConfirmModalView = styled.main` + display: flex; + align-items: center; + justify-content: space-around; + + margin: 0; + padding: 0; + + width: 100%; + height: 100%; +` diff --git a/src/styles/layouts/news/NewsView.ts b/src/styles/layouts/news/NewsView.ts index 74b35c5..992fc0b 100644 --- a/src/styles/layouts/news/NewsView.ts +++ b/src/styles/layouts/news/NewsView.ts @@ -3,6 +3,8 @@ import styled from "styled-components"; export const NewsView = styled.main` width: 100%; + margin-bottom: 100px; + p { font-family: 'Poppins'; font-style: normal; @@ -22,20 +24,20 @@ export const NewsView = styled.main` margin-bottom: 8px; } button{ - display: flex; - justify-content: center; - align-items: center; - margin-top: 10px; - width: 140px; - height: 45px; - cursor: pointer; - background: #254F7F; - border-radius: 8px; - border-style: none; - font-family: 'Poppins'; - font-size: 90%; - color: #FFFFFF; - } + display: flex; + justify-content: center; + align-items: center; + margin-top: 10px; + width: 140px; + height: 45px; + cursor: pointer; + background: #254F7F; + border-radius: 8px; + border-style: none; + font-family: 'Poppins'; + font-size: 90%; + color: #FFFFFF; + } } section { @@ -54,9 +56,8 @@ export const NewsView = styled.main` flex-direction: column; } } - - -}`; + } +`; export const Button = styled.div` display: flex; diff --git a/src/styles/layouts/pld/PldView.ts b/src/styles/layouts/pld/PldView.ts index 8997fdc..3b7def4 100644 --- a/src/styles/layouts/pld/PldView.ts +++ b/src/styles/layouts/pld/PldView.ts @@ -203,5 +203,28 @@ export const PldGraphView = styled.main` ` export const GoBack = styled.label` - cursor: pointer + cursor: pointer; +` + +export const NewTableLine = styled.section` + display: flex; + justify-content: center; + align-items: flex-start; + + flex-direction: column; + + margin: 50px 0px 0px 0; + + width: 100%; + article { + display: flex; + justify-content: space-between; + align-items: center; + + flex-direction: row; + + width: 100%; + + margin: 0 0 10px 0; + } ` diff --git a/yarn.lock b/yarn.lock index a5e2773..ed043f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1382,14 +1382,60 @@ version "1.1.3" resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.1.3.tgz" +"@tinymce/tinymce-react@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@tinymce/tinymce-react/-/tinymce-react-4.1.0.tgz#e2a5e289dc1af03837365bebe969b1a722bf6d99" + dependencies: + prop-types "^15.6.2" + tinymce "^6.0.0 || ^5.5.1" + "@tootallnate/once@2": version "2.0.0" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" +"@types/body-parser@*": + version "1.19.2" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" + dependencies: + "@types/connect" "*" + "@types/node" "*" + "@types/chartjs@^0.0.31": version "0.0.31" resolved "https://registry.npmjs.org/@types/chartjs/-/chartjs-0.0.31.tgz" +"@types/connect@*": + version "3.4.35" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1" + dependencies: + "@types/node" "*" + +"@types/cookies@^0.7.7": + version "0.7.7" + resolved "https://registry.yarnpkg.com/@types/cookies/-/cookies-0.7.7.tgz#7a92453d1d16389c05a5301eef566f34946cfd81" + dependencies: + "@types/connect" "*" + "@types/express" "*" + "@types/keygrip" "*" + "@types/node" "*" + +"@types/express-serve-static-core@^4.17.18": + version "4.17.28" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz#c47def9f34ec81dc6328d0b1b5303d1ec98d86b8" + dependencies: + "@types/node" "*" + "@types/qs" "*" + "@types/range-parser" "*" + +"@types/express@*": + version "4.17.13" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.13.tgz#a76e2995728999bab51a33fabce1d705a3709034" + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "^4.17.18" + "@types/qs" "*" + "@types/serve-static" "*" + "@types/faker@5.5.3": version "5.5.3" resolved "https://registry.npmjs.org/@types/faker/-/faker-5.5.3.tgz" @@ -1409,6 +1455,18 @@ version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" +"@types/keygrip@*": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/keygrip/-/keygrip-1.0.2.tgz#513abfd256d7ad0bf1ee1873606317b33b1b2a72" + +"@types/mime@^1": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" + +"@types/node@*": + version "17.0.42" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.42.tgz#d7e8f22700efc94d125103075c074396b5f41f9b" + "@types/node@^17.0.31": version "17.0.31" resolved "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz" @@ -1425,6 +1483,14 @@ version "15.7.5" resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz" +"@types/qs@*": + version "6.9.7" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb" + +"@types/range-parser@*": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" + "@types/react-csv@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@types/react-csv/-/react-csv-1.1.2.tgz#a5694d7e5cbf4bc1d4baa178a3fa7ac3466ea8c5" @@ -1455,6 +1521,13 @@ version "0.16.2" resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz" +"@types/serve-static@*": + version "1.13.10" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.10.tgz#f5e0ce8797d2d7cc5ebeda48a52c96c4fa47a8d9" + dependencies: + "@types/mime" "^1" + "@types/node" "*" + "@types/styled-components@^5.1.25": version "5.1.25" resolved "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.25.tgz" @@ -1681,10 +1754,21 @@ astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz" +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + axe-core@^4.3.5: version "4.4.1" resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.4.1.tgz" +axios@^0.27.2: + version "0.27.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" + dependencies: + follow-redirects "^1.14.9" + form-data "^4.0.0" + axobject-query@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz" @@ -1910,7 +1994,7 @@ clone@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" -clsx@^1.0.4, clsx@^1.1.1: +clsx@^1.0.4, clsx@^1.1.0, clsx@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz" @@ -1955,6 +2039,12 @@ columnify@^1.6.0: strip-ansi "^6.0.1" wcwidth "^1.0.0" +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + dependencies: + delayed-stream "~1.0.0" + commander@^8.3.0: version "8.3.0" resolved "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz" @@ -1977,6 +2067,10 @@ convert-source-map@^1.5.0, convert-source-map@^1.7.0: dependencies: safe-buffer "~5.1.1" +cookie@^0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" + core-js-compat@^3.21.0, core-js-compat@^3.22.1: version "3.22.5" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.22.5.tgz#7fffa1d20cb18405bd22756ca1353c6f1a0e8614" @@ -2076,6 +2170,10 @@ define-properties@^1.1.3, define-properties@^1.1.4: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" @@ -2498,6 +2596,26 @@ flatted@^3.1.0: version "3.2.5" resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz" +follow-redirects@^1.14.9: + version "1.15.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5" + +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +fs-extra@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-minipass@^2.0.0, fs-minipass@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" @@ -2638,7 +2756,7 @@ globby@^11.0.4: merge2 "^1.4.1" slash "^3.0.0" -graceful-fs@^4.1.2, graceful-fs@^4.2.10, graceful-fs@^4.2.6: +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.10, graceful-fs@^4.2.6: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" @@ -2973,6 +3091,14 @@ json5@^2.2.1: version "2.2.1" resolved "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz" +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + jsonparse@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" @@ -3299,6 +3425,16 @@ micromatch@^4.0.4: braces "^3.0.2" picomatch "^2.3.1" +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + dependencies: + mime-db "1.52.0" + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" @@ -3454,6 +3590,13 @@ node-releases@^2.0.3: version "2.0.4" resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.4.tgz" +nookies@^2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/nookies/-/nookies-2.5.2.tgz#cc55547efa982d013a21475bd0db0c02c1b35b27" + dependencies: + cookie "^0.4.1" + set-cookie-parser "^2.4.6" + nopt@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" @@ -3473,6 +3616,13 @@ normalize-path@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" +notistack@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/notistack/-/notistack-2.0.5.tgz#8eb53720453f6e02182cd0e6784ced630a7bb7e6" + dependencies: + clsx "^1.1.0" + hoist-non-react-statics "^3.3.0" + npm-audit-report@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/npm-audit-report/-/npm-audit-report-3.0.0.tgz#1bf3e531208b5f77347c8d00c3d9badf5be30cd6" @@ -4144,6 +4294,10 @@ set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" +set-cookie-parser@^2.4.6: + version "2.5.0" + resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.5.0.tgz#96b59525e1362c94335c3c761100bb6e8f2da4b0" + shallowequal@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz" @@ -4401,6 +4555,10 @@ tiny-warning@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" +"tinymce@^6.0.0 || ^5.5.1", tinymce@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-6.0.3.tgz#993db09afa473a764ad8b594cdaf744b2c7e2e74" + to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" @@ -4496,6 +4654,10 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz"