Comentário do botão CSV EPORT

pull/20/head
adriano 2022-08-18 12:18:42 -03:00
parent aaf15a1847
commit 76bc672314
1 changed files with 38 additions and 30 deletions

View File

@ -18,7 +18,7 @@ import MaterialTable from 'material-table';
import LogoutIcon from '@material-ui/icons/CancelOutlined';
import { CSVLink } from "react-csv";
@ -474,10 +474,10 @@ const Report = () => {
setProfile('user')
}
}, [reportOption])
}, [reportOption])
const handleCSVMessages = () => {
const handleCSVMessages = () => {
const fetchQueries = async () => {
@ -485,7 +485,7 @@ const Report = () => {
const dataQuery = await api.get("/reports/messages", { params: { userId, startDate, endDate }, });
console.log('dataQuery messages: ', dataQuery.data)
console.log('dataQuery messages: ', dataQuery.data)
if (dataQuery.data.length > 0) {
@ -498,11 +498,11 @@ const Report = () => {
else {
dataCSVFormat[i].fromMe = 'Cliente'
}
}
}
setDataCSV(dataCSVFormat)
setIsMount(false);
}
setIsMount(false);
}
} catch (err) {
console.log(err);
@ -536,10 +536,10 @@ const Report = () => {
const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
socket.on("onlineStatus", (data) => {
socket.on("onlineStatus", (data) => {
let date = new Date().toLocaleDateString('pt-BR').split('/')
let dateToday = `${date[2]}-${date[1]}-${date[0]}`
let dateToday = `${date[2]}-${date[1]}-${date[0]}`
if (data.action === "logout" || (data.action === "update" &&
((`${startDate}` === `${endDate}`) && (`${endDate}` === `${dateToday}`) && (`${startDate}` === `${dateToday}`)))) {
@ -551,7 +551,7 @@ const Report = () => {
}
else if (data.action === "delete") {
dispatchQ({ type: "DELETE_USER_STATUS", payload: data.userOnlineTime });
}
}
});
@ -599,8 +599,8 @@ const Report = () => {
// )))
// }
setData(query.map((column) => { return { ...column } }))
setData(query.map((column) => { return { ...column } }))
}, [query])
@ -632,7 +632,7 @@ const Report = () => {
// ' | clientHeight: ', clientHeight,
// ' | scrollHeight - (scrollTop + 1): ', scrollHeight - (scrollTop + 1))
if (scrollHeight - (scrollTop + 1) < clientHeight) {
if (scrollHeight - (scrollTop + 1) < clientHeight) {
loadMore();
@ -667,30 +667,38 @@ const Report = () => {
{reportOption === '1' &&
<div>
<Button style={{display: "none"}}
variant="contained"
{/* <Button style={{ display: "none" }}
variant="contained"
color="primary"
onClick={(e) => {
handleCSVMessages()
onClick={(e) => {
handleCSVMessages()
}}
>
{"CSV ALL"}
</Button>
> */}
<div>
<CSVLink
data={dataCSV}
headers={columns}
filename={'Relatorio_detalhado_atendimento_atendentes.csv'}
target={'_blank'}
ref={csvLink} />
</div>
{/* <Button
variant="contained"
color="primary"
onClick={(e) => {
handleCSVMessages()
}}
>
{"CSV ALL"}
</Button> */}
<div>
<CSVLink
data={dataCSV}
headers={columns}
filename={'Relatorio_detalhado_atendimento_atendentes.csv'}
target={'_blank'}
ref={csvLink} />
</div>
</div>
}
</Item>
</Item>
</Box>