Alteraçao no modal para que as colunas de mensagem não seja ordenadas

pull/1/head
adriano 2022-01-26 09:47:52 -03:00
parent 50afb25704
commit 66da6a9d59
3 changed files with 31 additions and 9 deletions

View File

@ -23,9 +23,11 @@ const MTable = (props) => {
return ( <div style={{ maxWidth: "100%", fontSize:10}}> return ( <div style={{ maxWidth: "100%", fontSize:10}}>
<MaterialTable <MaterialTable
title='Relatorio' title= {props.table_title}
columns={columnsLoad} columns={columnsLoad}
data={dataLoad} data={dataLoad}
onRowClick={(evt, selectedRow) => { onRowClick={(evt, selectedRow) => {
@ -34,8 +36,12 @@ const MTable = (props) => {
console.log(selectedRow); console.log(selectedRow);
console.log(selectedRow.messages); console.log(selectedRow.messages);
setSelectedRow(selectedRow.tableData.id) setSelectedRow(selectedRow.tableData.id)
render(<Modal data={selectedRow.messages}/>) if(props.hasChild) {
render(<Modal data={selectedRow.messages} hasChild={false} modal_header={'Chat do atendimento pelo Whatsapp'}/>)
}
console.log('props.hasChild: ', props.hasChild)
//evt.stopPropagation() //evt.stopPropagation()
} }
@ -46,6 +52,7 @@ const MTable = (props) => {
selection: false, selection: false,
paging: false, paging: false,
padding: 'dense', padding: 'dense',
sorting: true ? props.hasChild: false,
//loadingType: 'linear', //loadingType: 'linear',
searchFieldStyle: { searchFieldStyle: {
width: 300, width: 300,
@ -53,8 +60,7 @@ const MTable = (props) => {
rowStyle: rowData => ({ rowStyle: rowData => ({
fontSize: 12, fontSize: 12,
backgroundColor: backgroundColor: selectedRow === rowData.tableData.id ? '#ec5114' : '#FFF'
selectedRow === rowData.tableData.id ? '#ec5114' : '#FFF'
}) })
}} }}
/> />

View File

@ -3,6 +3,10 @@ import Button from '@mui/material/Button';
import Dialog from '@mui/material/Dialog'; import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions'; import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import DataGridTable from '../Table'; import DataGridTable from '../Table';
import MTable from "../MTable"; import MTable from "../MTable";
@ -10,12 +14,13 @@ let columns = [
{ {
title: 'Atendente/Cliente', title: 'Atendente/Cliente',
field: 'fromMe', field: 'fromMe',
}, },
{ {
title: 'Mensagem', title: 'Mensagem',
field: 'body', field: 'body',
cellStyle: {whiteSpace: 'nowrap'}, //cellStyle: {whiteSpace: 'nowrap'},
}, },
{ title: 'Criado', field: 'createdAt' } { title: 'Criado', field: 'createdAt' }
@ -73,10 +78,21 @@ const Modal = (props) => {
scroll={scroll} scroll={scroll}
aria-labelledby="scroll-dialog-title" aria-labelledby="scroll-dialog-title"
aria-describedby="scroll-dialog-description" aria-describedby="scroll-dialog-description"
> >
<MTable data={dataChat} columns={columns} /> <DialogTitle id="scroll-dialog-title">{props.modal_header}</DialogTitle>
<DialogContent dividers={scroll === 'paper'}>
<DialogContentText
id="scroll-dialog-description"
ref={descriptionElementRef}
tabIndex={-1}
>
<MTable data={dataChat} columns={columns} table_title={''} hasChild={false}/>
</DialogContentText>
</DialogContent>
<DialogActions> <DialogActions>
<Button onClick={handleClose}>Ok</Button> <Button onClick={handleClose}>Ok</Button>
</DialogActions> </DialogActions>

View File

@ -296,7 +296,7 @@ console.log('XXXXXXXXX: ', query)
display: 'grid', display: 'grid',
}}> }}>
<Item sx={{ gridColumn: '1', gridRow: 'span 1' }}> <Item sx={{ gridColumn: '1', gridRow: 'span 1' }}>
<MTable data={query} columns={columnsData}/> <MTable data={query} columns={columnsData} hasChild={true} table_title={'Relatório de atendimento por atendentes'}/>
</Item> </Item>
</Box> </Box>