Alteração no modal do chat

pull/1/head
adriano 2022-01-26 00:38:09 -03:00
parent 2e0f41769b
commit 50afb25704
1 changed files with 31 additions and 60 deletions

View File

@ -6,74 +6,45 @@ import DialogActions from '@mui/material/DialogActions';
import DataGridTable from '../Table'; import DataGridTable from '../Table';
import MTable from "../MTable"; import MTable from "../MTable";
//let columns = [{ title: 'Chat', field: 'messages.body' },]; let columns = [
// { title: 'Atendente', field: 'user.name' },
const columns = [
{ field: 'id',
title: 'ID',
width: 50,
sortable: false},
{ {
title: 'Atendente/Cliente',
field: 'fromMe', field: 'fromMe',
title: 'user/client',
type: 'bool',
width: 100,
flex: 1,
editable: false,
sortable: false
}, },
{ {
title: 'Mensagem',
field: 'body', field: 'body',
title: 'message', cellStyle: {whiteSpace: 'nowrap'},
type: 'string',
//width: 150,
flex: 1,
editable: false,
sortable: false
}, },
/* { { title: 'Criado', field: 'createdAt' }
field: 'mediaType',
headerName: 'media type', /*cellStyle: {
//width: 110, backgroundColor: '#039be5',
flex: 1, color: '#FFF'
editable: false, },
}, headerStyle: {
{ backgroundColor: '#039be5',
field: 'mediaUrl', fontSize: 12
headerName: 'media url', }*/
type: 'string',
//width: 110, ]
flex: 1,
editable: false,
},
{
field: 'read',
headerName: 'tead',
type: 'bool',
//width: 110,
flex: 1,
editable: false,
},*/
{
field: 'createdAt',
title: 'created at',
type: 'dateTime',
//width: 110,
flex: 1,
editable: false,
sortable: false
}
];
const Modal = (props) => { const Modal = (props) => {
const [open, setOpen] = React.useState(true); const [open, setOpen] = React.useState(true);
const [scroll, setScroll] = React.useState('paper'); const [scroll, setScroll] = React.useState('paper');
const dataChat = props.data.map((dt) => {
return {
'fromMe': dt.fromMe ? 'Atendente' : 'Cliente',
'body': dt.body,
'createdAt': dt.createdAt
}
});
const handleClose = () => { const handleClose = () => {
setOpen(false); setOpen(false);
@ -104,7 +75,7 @@ const Modal = (props) => {
aria-describedby="scroll-dialog-description" aria-describedby="scroll-dialog-description"
> >
<MTable data={props.data} columns={columns} /> <MTable data={dataChat} columns={columns} />
<DialogActions> <DialogActions>
<Button onClick={handleClose}>Ok</Button> <Button onClick={handleClose}>Ok</Button>