fix admin tabls
This commit is contained in:
parent
4159a8096a
commit
990e47aa01
@ -12,7 +12,34 @@ import TableSortLabel from '@mui/material/TableSortLabel';
|
|||||||
import { visuallyHidden } from '@mui/utils';
|
import { visuallyHidden } from '@mui/utils';
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
|
import Snackbar from '@mui/material/Snackbar';
|
||||||
|
import MuiAlert, { AlertProps } from '@mui/material/Alert';
|
||||||
|
|
||||||
|
import Modal from '@mui/material/Modal';
|
||||||
|
|
||||||
|
|
||||||
import { TableView, StyledStatus } from './TableView';
|
import { TableView, StyledStatus } from './TableView';
|
||||||
|
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'
|
||||||
|
};
|
||||||
|
const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
||||||
|
props,
|
||||||
|
ref,
|
||||||
|
) {
|
||||||
|
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
|
||||||
|
});
|
||||||
|
|
||||||
interface Data {
|
interface Data {
|
||||||
clientCode: number,
|
clientCode: number,
|
||||||
@ -161,6 +188,37 @@ export default function ClientTable({clients, onChange}: ClientsTableInterface)
|
|||||||
const [dense, setDense] = useState<boolean>(false);
|
const [dense, setDense] = useState<boolean>(false);
|
||||||
const [rowsPerPage, setRowsPerPage] = useState<number>(5);
|
const [rowsPerPage, setRowsPerPage] = useState<number>(5);
|
||||||
|
|
||||||
|
const [openSnackError, setOpenSnackError] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const [openModalInativar, setOpenModalInativar] = useState(false)
|
||||||
|
const handleOpen = () => setOpen(true);
|
||||||
|
const handleClose = () => setOpen(false);
|
||||||
|
|
||||||
|
const [cod_client, setCod_client] = useState()
|
||||||
|
const [units, setUnits] = useState([])
|
||||||
|
|
||||||
|
function getClientUnits(client_id: number) {
|
||||||
|
api.post('/units', {
|
||||||
|
"filters": [
|
||||||
|
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": client_id}
|
||||||
|
],
|
||||||
|
"fields": ["unidade"],
|
||||||
|
"distinct": true
|
||||||
|
}).then(res => setUnits(res.data.data)).catch(res => {
|
||||||
|
setOpenSnackError(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
return units
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCloseSnack = (event?: React.SyntheticEvent | Event, reason?: string) => {
|
||||||
|
if (reason === 'clickaway') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setOpenSnackError(false);
|
||||||
|
};
|
||||||
|
|
||||||
const handleRequestSort = (
|
const handleRequestSort = (
|
||||||
event: React.MouseEvent<unknown>,
|
event: React.MouseEvent<unknown>,
|
||||||
property: keyof Data,
|
property: keyof Data,
|
||||||
@ -220,6 +278,11 @@ export default function ClientTable({clients, onChange}: ClientsTableInterface)
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TableView>
|
<TableView>
|
||||||
|
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||||
|
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
|
||||||
|
Não foi possivel encontrar unidades do client!
|
||||||
|
</Alert>
|
||||||
|
</Snackbar>
|
||||||
<Paper sx={{ width: '100%', mb: 2 }}>
|
<Paper sx={{ width: '100%', mb: 2 }}>
|
||||||
<TableContainer>
|
<TableContainer>
|
||||||
<Table
|
<Table
|
||||||
@ -270,7 +333,10 @@ export default function ClientTable({clients, onChange}: ClientsTableInterface)
|
|||||||
Client - {row.client_id}
|
Client - {row.client_id}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">{row.name}</TableCell>
|
<TableCell align="left">{row.name}</TableCell>
|
||||||
<TableCell align="left">clique aqui para ver as unidades</TableCell>
|
<TableCell align="left" style={{cursor: 'pointer'}} onClick={() => {
|
||||||
|
setOpen(true)
|
||||||
|
getClientUnits(row.client_id)
|
||||||
|
}}>clique aqui para ver as unidades</TableCell>
|
||||||
<TableCell align="left"><StyledStatus status={row.deleted_at? 'inativo' : 'ativo'}> {row.deleted_at? 'inativo' : 'ativo'}</StyledStatus></TableCell>
|
<TableCell align="left"><StyledStatus status={row.deleted_at? 'inativo' : 'ativo'}> {row.deleted_at? 'inativo' : 'ativo'}</StyledStatus></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
@ -297,6 +363,25 @@ export default function ClientTable({clients, onChange}: ClientsTableInterface)
|
|||||||
onRowsPerPageChange={handleChangeRowsPerPage}
|
onRowsPerPageChange={handleChangeRowsPerPage}
|
||||||
/>
|
/>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
onClose={handleClose}
|
||||||
|
aria-labelledby="modal-modal-title"
|
||||||
|
aria-describedby="modal-modal-description"
|
||||||
|
>
|
||||||
|
<Box sx={style}>
|
||||||
|
{
|
||||||
|
units.map((units, index) => {
|
||||||
|
return <>
|
||||||
|
<li style={{
|
||||||
|
listStyle: 'none'
|
||||||
|
}} key={index}>{units.unidade}</li>
|
||||||
|
<hr />
|
||||||
|
</>
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
</TableView>
|
</TableView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -283,7 +283,7 @@ export default function FaqTable({questionData, onChange}: FaqTableInterface) {
|
|||||||
{row.question}
|
{row.question}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">{row.answer}</TableCell>
|
<TableCell align="left">{row.answer}</TableCell>
|
||||||
<TableCell align="left"><StyledStatus status={row.deleted_at? 'ativo' : 'inativo'}> {row.deleted_at? 'ativo' : 'inativo'}</StyledStatus></TableCell>
|
<TableCell align="left"><StyledStatus status={'ativo'}> {'ativo'}</StyledStatus></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@ -290,7 +290,7 @@ export default function NotificationsTable({notifications, onChange}: Notificati
|
|||||||
{row.title}
|
{row.title}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">{'copel'}</TableCell>
|
<TableCell align="left">{'copel'}</TableCell>
|
||||||
<TableCell align="left"><StyledStatus status={row.deleted_at===null? 'ativo' : 'inativo'}>{row.deleted_at===null? 'ativo' : 'inativo'}</StyledStatus></TableCell>
|
<TableCell align="left"><StyledStatus status={'ativo'}>{'ativo'}</StyledStatus></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Button from '@mui/material/Button';
|
|
||||||
import Modal from '@mui/material/Modal';
|
import Modal from '@mui/material/Modal';
|
||||||
import TextField from '@mui/material/TextField';
|
import TextField from '@mui/material/TextField';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
|
|
||||||
import Snackbar from '@mui/material/Snackbar';
|
import Snackbar from '@mui/material/Snackbar';
|
||||||
import MuiAlert, { AlertProps } from '@mui/material/Alert';
|
import MuiAlert, { AlertProps } from '@mui/material/Alert';
|
||||||
import ClientsTable from '../../../components/administrativeTables/ClientsTable';
|
import ClientsTable from '../../../components/administrativeTables/ClientsTable';
|
||||||
@ -23,6 +21,8 @@ import { parseCookies } from 'nookies';
|
|||||||
import { GetServerSideProps } from 'next';
|
import { GetServerSideProps } from 'next';
|
||||||
import getAPIClient from '../../../services/ssrApi';
|
import getAPIClient from '../../../services/ssrApi';
|
||||||
|
|
||||||
|
import FormData from 'form-data';
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
position: 'absolute' as const,
|
position: 'absolute' as const,
|
||||||
top: '50%',
|
top: '50%',
|
||||||
@ -44,7 +44,9 @@ const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
|||||||
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
|
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function clients({clients}) {
|
export default function clients({clients, userName}) {
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
const [client, setClient] = useState<any>({
|
const [client, setClient] = useState<any>({
|
||||||
name: String,
|
name: String,
|
||||||
email: String,
|
email: String,
|
||||||
@ -52,6 +54,7 @@ export default function clients({clients}) {
|
|||||||
password_confirmation: String,
|
password_confirmation: String,
|
||||||
client_id: Number
|
client_id: Number
|
||||||
})
|
})
|
||||||
|
const [logo, setLogo] = useState(false);
|
||||||
const [selectedClients, setSelectedClients] = useState([])
|
const [selectedClients, setSelectedClients] = useState([])
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
@ -61,7 +64,6 @@ export default function clients({clients}) {
|
|||||||
|
|
||||||
const [openModal, setOpenModal] = useState(false)
|
const [openModal, setOpenModal] = useState(false)
|
||||||
|
|
||||||
//
|
|
||||||
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
||||||
const [openSnackError, setOpenSnackError] = useState<boolean>(false);
|
const [openSnackError, setOpenSnackError] = useState<boolean>(false);
|
||||||
const [openSnackSuccessDelete, setOpenSnackSuccessDelete] = useState<boolean>(false);
|
const [openSnackSuccessDelete, setOpenSnackSuccessDelete] = useState<boolean>(false);
|
||||||
@ -84,20 +86,20 @@ export default function clients({clients}) {
|
|||||||
setOpenSnackErrorDelete(false);
|
setOpenSnackErrorDelete(false);
|
||||||
setOpenSnackSuccessDelete(false);
|
setOpenSnackSuccessDelete(false);
|
||||||
};
|
};
|
||||||
//
|
|
||||||
|
function onChange(e) {
|
||||||
|
setLogo(e.target.files[0])
|
||||||
|
}
|
||||||
|
|
||||||
function handleCreateClient({name, email, password, password_confirmation, client_id}) {
|
function handleCreateClient({name, email, password, password_confirmation, client_id}) {
|
||||||
api.post('/user', {
|
formData.append('name', name)
|
||||||
name,
|
formData.append('email', email)
|
||||||
email,
|
formData.append('password', password)
|
||||||
password,
|
formData.append('password_confirmation', password_confirmation)
|
||||||
password_confirmation,
|
formData.append('client_id', client_id)
|
||||||
client_id
|
formData.append('profile_picture', logo)
|
||||||
}, {
|
|
||||||
headers: {
|
api.post('/user', formData).then(res => {
|
||||||
'Content-Type': 'multipart/form-data'
|
|
||||||
},
|
|
||||||
}).then(res => {
|
|
||||||
setOpenSnackSuccess(true)
|
setOpenSnackSuccess(true)
|
||||||
setOpenModalInativar(false)
|
setOpenModalInativar(false)
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
@ -105,7 +107,6 @@ export default function clients({clients}) {
|
|||||||
setOpenSnackError(true)
|
setOpenSnackError(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDeleteClient(id: any) {
|
async function handleDeleteClient(id: any) {
|
||||||
await id.map(client => {
|
await id.map(client => {
|
||||||
api.delete(`/user/${client}`).then(res => {
|
api.delete(`/user/${client}`).then(res => {
|
||||||
@ -118,26 +119,25 @@ export default function clients({clients}) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{display: 'flex', flexDirection: 'column', width: '100%'}}>
|
<div style={{display: 'flex', flexDirection: 'column', width: '100%'}}>
|
||||||
|
|
||||||
<Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}>
|
<Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||||
<Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}>
|
||||||
notificação cadastrada com sucesso!
|
Usuario cadastrada com sucesso!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
|
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
|
||||||
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
|
||||||
Notificação não cadastrada!
|
Usuario não cadastrada!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
|
|
||||||
<Snackbar open={openSnackSuccessDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
<Snackbar open={openSnackSuccessDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
||||||
<Alert onClose={handleCloseSnackDelete} severity="success" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnackDelete} severity="success" sx={{ width: '100%' }}>
|
||||||
notificação excluida com sucesso!
|
Usuario excluida com sucesso!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
<Snackbar open={openSnackErrorDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
<Snackbar open={openSnackErrorDelete} autoHideDuration={4000} onClose={handleCloseSnackDelete}>
|
||||||
<Alert onClose={handleCloseSnackDelete} severity="error" sx={{ width: '100%' }}>
|
<Alert onClose={handleCloseSnackDelete} severity="error" sx={{ width: '100%' }}>
|
||||||
Notificação não excluida!
|
Usuario não excluida!
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
|
|
||||||
@ -196,7 +196,8 @@ export default function clients({clients}) {
|
|||||||
client_id: value.target.value
|
client_id: value.target.value
|
||||||
})
|
})
|
||||||
}} variant="outlined" />
|
}} variant="outlined" />
|
||||||
<InputUpload />
|
<input type="file" onChange={onChange}/>
|
||||||
|
{/* <InputUpload /> */}
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<FaqButton1 title='Cancelar' onClick={() => setOpen(false)} />
|
<FaqButton1 title='Cancelar' onClick={() => setOpen(false)} />
|
||||||
<FaqButton2 title='Salvar' onClick={() => handleCreateClient(client)}/>
|
<FaqButton2 title='Salvar' onClick={() => handleCreateClient(client)}/>
|
||||||
@ -206,7 +207,6 @@ export default function clients({clients}) {
|
|||||||
<ConfirmModal open={openModalInativar} handleIsClose={(value) => {setOpenModalInativar(value)}}>
|
<ConfirmModal open={openModalInativar} handleIsClose={(value) => {setOpenModalInativar(value)}}>
|
||||||
<PageTitle title='Inativar Cliente(s)' subtitle='deseja realmente inativar os clientes selecionadas?'/>
|
<PageTitle title='Inativar Cliente(s)' subtitle='deseja realmente inativar os clientes selecionadas?'/>
|
||||||
<ConfirmModalView>
|
<ConfirmModalView>
|
||||||
|
|
||||||
<BasicButton title='Confirmar' onClick={() => handleDeleteClient(selectedClients)}/>
|
<BasicButton title='Confirmar' onClick={() => handleDeleteClient(selectedClients)}/>
|
||||||
<BasicButton title='Cancelar' onClick={() => setOpenModalInativar(false)}/>
|
<BasicButton title='Cancelar' onClick={() => setOpenModalInativar(false)}/>
|
||||||
</ConfirmModalView>
|
</ConfirmModalView>
|
||||||
@ -218,6 +218,7 @@ export default function clients({clients}) {
|
|||||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||||
const apiClient = getAPIClient(ctx)
|
const apiClient = getAPIClient(ctx)
|
||||||
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
||||||
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
|
||||||
let clients = [];
|
let clients = [];
|
||||||
|
|
||||||
@ -241,6 +242,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
clients,
|
clients,
|
||||||
|
userName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,10 @@ interface pldInterface {
|
|||||||
graphByHourData: any,
|
graphByHourData: any,
|
||||||
graphByMonthData: any
|
graphByMonthData: any
|
||||||
userName: string,
|
userName: string,
|
||||||
|
clientMonth: any
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function pld({tableData, graphByHourData, graphByMonthData, userName}: pldInterface) {
|
export default function pld({tableData, graphByHourData, graphByMonthData, userName, clientMonth}: pldInterface) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { region } = router.query
|
const { region } = router.query
|
||||||
|
|
||||||
@ -255,18 +256,17 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
label="Age"
|
label="Age"
|
||||||
|
|
||||||
>
|
>
|
||||||
<MenuItem value={'01'}>01</MenuItem>
|
<MenuItem value={'0'}>Nenhum</MenuItem>
|
||||||
<MenuItem value={'02'}>02</MenuItem>
|
{
|
||||||
<MenuItem value={'03'}>03</MenuItem>
|
clientMonth.sort((a, b) => {
|
||||||
<MenuItem value={'04'}>04</MenuItem>
|
if (parseFloat(a.mes_ref.slice(3,4)) > parseFloat(b.mes_ref.slice(3,4))) return 1
|
||||||
<MenuItem value={'05'}>05</MenuItem>
|
if (parseFloat(a.mes_ref.slice(3,4)) < parseFloat(b.mes_ref.slice(3,4))) return -1
|
||||||
<MenuItem value={'06'}>06</MenuItem>
|
|
||||||
<MenuItem value={'07'}>07</MenuItem>
|
return 0
|
||||||
<MenuItem value={'08'}>08</MenuItem>
|
}).map((data, index) => {
|
||||||
<MenuItem value={'09'}>09</MenuItem>
|
return <MenuItem key={index} value={data.mes_ref.slice(2, 4)}>{data.mes_ref.slice(2, 4)}</MenuItem>
|
||||||
<MenuItem value={'10'}>10</MenuItem>
|
})
|
||||||
<MenuItem value={'11'}>11</MenuItem>
|
}
|
||||||
<MenuItem value={'12'}>12</MenuItem>
|
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</section>
|
</section>
|
||||||
@ -288,7 +288,7 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
</section>
|
</section>
|
||||||
<LineChart data1={nordeste} data2={norte} data3={sudeste} data4={sul}
|
<LineChart data1={nordeste} data2={norte} data3={sudeste} data4={sul}
|
||||||
dataset1='NORDESTE' dataset2='NORTE' dataset3='SUDESTE' dataset4='SUL'
|
dataset1='NORDESTE' dataset2='NORTE' dataset3='SUDESTE' dataset4='SUL'
|
||||||
title={`PLD - ${date}`}
|
title={`Período - ${date}`}
|
||||||
subtitle='' label={['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']} />
|
subtitle='' label={['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']} />
|
||||||
</PldGraphView>
|
</PldGraphView>
|
||||||
</RenderIf>
|
</RenderIf>
|
||||||
@ -301,8 +301,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
||||||
const { ['user-name']: userName } = parseCookies(ctx)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
|
||||||
|
|
||||||
let tableData = [];
|
let tableData = [];
|
||||||
|
let clientMonth = [];
|
||||||
|
|
||||||
await apiClient.post('/pld/list').then(res => {
|
await apiClient.post('/pld/list').then(res => {
|
||||||
tableData = res.data
|
tableData = res.data
|
||||||
@ -310,6 +310,16 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
console.log(res)
|
console.log(res)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await apiClient.post('/pld', {
|
||||||
|
"filters": [],
|
||||||
|
"fields": ["mes_ref"],
|
||||||
|
"distinct": true
|
||||||
|
}).then(res => {
|
||||||
|
clientMonth = res.data.data
|
||||||
|
}).catch(res => {
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
@ -322,7 +332,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
tableData,
|
tableData,
|
||||||
userName
|
userName,
|
||||||
|
clientMonth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user