fix units
This commit is contained in:
parent
4861eee0ad
commit
4401878f24
@ -95,7 +95,8 @@ 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)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
const { ['user-client_id']: id } = parseCookies(ctx)
|
const { ['user-client_id']: client_id } = parseCookies(ctx)
|
||||||
|
|
||||||
|
|
||||||
let graphData = [];
|
let graphData = [];
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
|
|
||||||
await apiClient.post('/units', {
|
await apiClient.post('/units', {
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": 180201211},
|
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": client_id},
|
||||||
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
|
|||||||
@ -190,6 +190,7 @@ 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)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
const { ['user-client_id']: client_id } = parseCookies(ctx)
|
||||||
|
|
||||||
let anual = [];
|
let anual = [];
|
||||||
|
|
||||||
@ -217,7 +218,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
|
|
||||||
await apiClient.post('/units', {
|
await apiClient.post('/units', {
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": 180201211},
|
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": client_id},
|
||||||
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
|
|||||||
@ -76,14 +76,14 @@ 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)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
const { ['user-client_id']: id } = parseCookies(ctx)
|
const { ['user-client_id']: client_id } = parseCookies(ctx)
|
||||||
|
|
||||||
let graphData = [];
|
let graphData = [];
|
||||||
let clients = [];
|
let clients = [];
|
||||||
|
|
||||||
await apiClient.post('/units', {
|
await apiClient.post('/units', {
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": 180201211},
|
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": client_id},
|
||||||
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
|
|||||||
@ -20,6 +20,10 @@ import data from '../../services/dados.json'
|
|||||||
import getAPIClient from '../../services/ssrApi';
|
import getAPIClient from '../../services/ssrApi';
|
||||||
import { Pagination, TableBodyView, TableHeader, TableView } from '../../styles/layouts/ResumoOperacao/ResumoOperacaoView';
|
import { Pagination, TableBodyView, TableHeader, TableView } from '../../styles/layouts/ResumoOperacao/ResumoOperacaoView';
|
||||||
|
|
||||||
|
import Fab from '@mui/material/Fab';
|
||||||
|
|
||||||
|
import NavigationIcon from '@mui/icons-material/Navigation';
|
||||||
|
|
||||||
export default function ResumoOperacao({tableData, clients, userName, clientMonth}: any) {
|
export default function ResumoOperacao({tableData, clients, userName, clientMonth}: any) {
|
||||||
const csvData = tableData;
|
const csvData = tableData;
|
||||||
|
|
||||||
@ -38,6 +42,13 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
|
|||||||
setUnidade(event.target.value);
|
setUnidade(event.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [ pageYPosition, setPageYPosition ] = useState(0);
|
||||||
|
|
||||||
|
function getPageYAfterScroll(){
|
||||||
|
setPageYPosition(window.scrollY);
|
||||||
|
console.log(window.scrollY)
|
||||||
|
}
|
||||||
|
|
||||||
function downloadCSVFile(csv, filename) {
|
function downloadCSVFile(csv, filename) {
|
||||||
const csv_file = new Blob(["\ufeff",csv], {type: "text/csv"});
|
const csv_file = new Blob(["\ufeff",csv], {type: "text/csv"});
|
||||||
const download_link = document.createElement("a");
|
const download_link = document.createElement("a");
|
||||||
@ -88,6 +99,10 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
|
|||||||
}
|
}
|
||||||
}, [month, unidade])
|
}, [month, unidade])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window?.addEventListener('scroll', getPageYAfterScroll);
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableView>
|
<TableView>
|
||||||
<Head>
|
<Head>
|
||||||
@ -97,7 +112,7 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
|
|||||||
<PageTitle title='Resumo de Operações' subtitle='Operações de compra e venda - Mensal' />
|
<PageTitle title='Resumo de Operações' subtitle='Operações de compra e venda - Mensal' />
|
||||||
</Header>
|
</Header>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
<article>
|
<article id='select'>
|
||||||
<div className='select'>
|
<div className='select'>
|
||||||
<div>
|
<div>
|
||||||
<FormControl fullWidth>
|
<FormControl fullWidth>
|
||||||
@ -173,7 +188,7 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{
|
||||||
tableDataState.map((value, index) => {
|
tableDataState?.map((value, index) => {
|
||||||
if (value.mes.slice(4,7) != '2020')
|
if (value.mes.slice(4,7) != '2020')
|
||||||
return <tr>
|
return <tr>
|
||||||
<td key={value.mes} className='tg-gceh'>{value.mes}</td>
|
<td key={value.mes} className='tg-gceh'>{value.mes}</td>
|
||||||
@ -189,6 +204,11 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</TableBodyView>
|
</TableBodyView>
|
||||||
|
{pageYPosition > 300 && <a href="#select" style={{position: 'fixed', right: '50px', bottom: '100px'}}>
|
||||||
|
<Fab aria-label="add">
|
||||||
|
<NavigationIcon />
|
||||||
|
</Fab>
|
||||||
|
</a>}
|
||||||
</TableView>
|
</TableView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -196,7 +216,7 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
|
|||||||
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-id']: id } = parseCookies(ctx)
|
const { ['user-client_id']: client_id } = parseCookies(ctx)
|
||||||
const { ['user-name']: userName } = parseCookies(ctx)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
|
||||||
let tableData = [];
|
let tableData = [];
|
||||||
@ -222,7 +242,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
|
|
||||||
await apiClient.post('/units', {
|
await apiClient.post('/units', {
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": 180201211},
|
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": client_id},
|
||||||
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
|
|||||||
@ -412,14 +412,15 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
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)
|
||||||
const { ['user-client_id']: id } = parseCookies(ctx)
|
const { ['user-client_id']: client_id } = parseCookies(ctx)
|
||||||
|
|
||||||
const apiClient = getAPIClient(ctx)
|
const apiClient = getAPIClient(ctx)
|
||||||
|
|
||||||
let clients = []
|
let clients = []
|
||||||
|
|
||||||
await apiClient.post('/units', {
|
await apiClient.post('/units', {
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": 180201211},
|
{"type" : "=", "field": "dados_cadastrais.cod_smart_cliente", "value": client_id},
|
||||||
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
{"type" : "not_in", "field": "dados_cadastrais.codigo_scde", "value":["0P"]}
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user