pld table fix

This commit is contained in:
joseCorte-exe 2022-07-08 17:52:06 -03:00
parent 001f8530ee
commit e10c88e9cb
5 changed files with 17 additions and 15 deletions

View File

@ -72,6 +72,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
"fields": ["cod_smart_unidade", "codigo_scde"], "fields": ["cod_smart_unidade", "codigo_scde"],
"distinct": true "distinct": true
}).then(res => { }).then(res => {
console.log(res.data.data)
clients = res.data.data clients = res.data.data
}).catch(res => { }).catch(res => {
// console.log(res) // console.log(res)

View File

@ -210,13 +210,13 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
}, []) }, [])
return ( return (
<main style={{width: '100%',}}> <main style={{width: '100%'}}>
<Head> <Head>
<title>Smart Energia - PLD</title> <title>Smart Energia - PLD</title>
</Head> </Head>
<div id='title'/> <div id='title'/>
<Header name={userName}> <Header name={userName}>
<PageTitle title='PLD Histórico' subtitle='Tabela de consumo PLD'/> <PageTitle title='PLD' subtitle='Evolução PLD - Valores em R$/MWh'/>
</Header> </Header>
<TableHeader> <TableHeader>
<Tabs value={page} onChange={(e, nv) => setPage(nv)} aria-label=""> <Tabs value={page} onChange={(e, nv) => setPage(nv)} aria-label="">
@ -236,7 +236,7 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
<table className="tg"> <table className="tg">
<thead> <thead>
<tr> <tr>
<th className='tg-8oo6'>Mês<p>(R$/MWh)</p></th> <th className='tg-8oo6'>Mês</th>
<th className='tg-8oo6'>Nordeste<p>(R$/MWh)</p></th> <th className='tg-8oo6'>Nordeste<p>(R$/MWh)</p></th>
<th className='tg-8oo6'>Norte<p>(R$/MWh)</p></th> <th className='tg-8oo6'>Norte<p>(R$/MWh)</p></th>
<th className='tg-8oo6'>Sudeste<p>(R$/MWh)</p></th> <th className='tg-8oo6'>Sudeste<p>(R$/MWh)</p></th>
@ -301,7 +301,7 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
} }
</tbody> </tbody>
</table> </table>
<section> {/* <section>
<article onClick={() => setPage(1)} className="btn btn-1"> <article onClick={() => setPage(1)} className="btn btn-1">
<svg height='100px'> <svg height='100px'>
<rect x="0" y="0" fill="none" width="100%" height="100%"/> <rect x="0" y="0" fill="none" width="100%" height="100%"/>
@ -314,7 +314,7 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
</svg> </svg>
<p>Valores Horários</p> <p>Valores Horários</p>
</article> </article>
</section> </section> */}
</PldTableView> </PldTableView>
</RenderIf> </RenderIf>

View File

@ -20,7 +20,7 @@ import data from '../../services/dados.json'
import getAPIClient from '../../services/ssrApi'; import getAPIClient from '../../services/ssrApi';
import { Pagination, TableHeader, TableView } from '../../styles/layouts/ResumoOperacao/ResumoOperacaoView'; import { Pagination, TableHeader, TableView } from '../../styles/layouts/ResumoOperacao/ResumoOperacaoView';
export default function ResumoOperacao({tableData, clientsData, userName, clientMonth}: any) { export default function ResumoOperacao({tableData, clients, userName, clientMonth}: any) {
const csvData = tableData; const csvData = tableData;
const [month, setMonth] = useState(''); const [month, setMonth] = useState('');
@ -114,7 +114,7 @@ export default function ResumoOperacao({tableData, clientsData, userName, client
> >
<MenuItem key={1} value={''}>Todas</MenuItem> <MenuItem key={1} value={''}>Todas</MenuItem>
{ {
clientsData.map((value) => { clients.map((value) => {
return <MenuItem key={1} value={value.cod_smart_unidade}>{value.cod_smart_unidade}</MenuItem> return <MenuItem key={1} value={value.cod_smart_unidade}>{value.cod_smart_unidade}</MenuItem>
}) })
} }
@ -195,7 +195,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
const { ['user-name']: userName } = parseCookies(ctx) const { ['user-name']: userName } = parseCookies(ctx)
let tableData = []; let tableData = [];
let clientsData = [];
let clientMonth = []; let clientMonth = [];
await apiClient.post('/operation/summary', { await apiClient.post('/operation/summary', {
@ -206,6 +205,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
// console.log(res) // console.log(res)
}) })
let clients = [];
await apiClient.post('/units', { await apiClient.post('/units', {
"filters": [ "filters": [
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}, {"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]},
@ -215,9 +216,9 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
"distinct": true "distinct": true
}).then(res => { }).then(res => {
console.log(res.data.data) console.log(res.data.data)
clientsData = res.data.data clients = res.data.data
}).catch(res => { }).catch(res => {
console.log(res) // console.log(res)
}) })
await apiClient.post('/operation', { await apiClient.post('/operation', {
@ -244,7 +245,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
return { return {
props: { props: {
tableData, tableData,
clientsData, clients,
clientMonth, clientMonth,
userName userName
} }

View File

@ -11,7 +11,7 @@ export const PldTableView = styled.main`
} }
thead { thead {
border-radius: 8px!important; /* border-radius: 2px!important; */
} }
} }
@ -120,12 +120,12 @@ export const PldTableView = styled.main`
table, th:last-child{ table, th:last-child{
border: transparent; border: transparent;
border-top-right-radius: 20px; border-top-right-radius: 8px;
} }
table, th:first-child { table, th:first-child {
border: transparent; border: transparent;
border-top-left-radius: 20px; border-top-left-radius: 8px;
} }
h3{ h3{