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,75 +6,46 @@ 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},
{ {
field: 'fromMe', title: 'Atendente/Cliente',
title: 'user/client', field: 'fromMe',
type: 'bool',
width: 100,
flex: 1,
editable: false,
sortable: false
},
{
field: 'body',
title: 'message',
type: 'string',
//width: 150,
flex: 1,
editable: false,
sortable: false
}, },
/* {
field: 'mediaType',
headerName: 'media type',
//width: 110,
flex: 1,
editable: false,
},
{ {
field: 'mediaUrl', title: 'Mensagem',
headerName: 'media url', field: 'body',
type: 'string', cellStyle: {whiteSpace: 'nowrap'},
//width: 110, },
flex: 1,
editable: false, { title: 'Criado', field: 'createdAt' }
},
{ /*cellStyle: {
field: 'read', backgroundColor: '#039be5',
headerName: 'tead', color: '#FFF'
type: 'bool', },
//width: 110, headerStyle: {
flex: 1, backgroundColor: '#039be5',
editable: false, fontSize: 12
},*/ }*/
{
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>