92 lines
2.5 KiB
TypeScript
92 lines
2.5 KiB
TypeScript
import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid-premium';
|
|
import Chip from '@mui/material/Chip';
|
|
import { formatCurrency, formatDate, getStatusColor } from '../../utils/orderFormatters';
|
|
|
|
/**
|
|
* Mapeia códigos de status para texto legível.
|
|
*/
|
|
const STATUS_LABELS: Record<string, string> = {
|
|
'F': 'Faturado',
|
|
'C': 'Cancelado',
|
|
'P': 'Pendente',
|
|
};
|
|
|
|
const getStatusLabel = (status: string): string => STATUS_LABELS[status] || status;
|
|
|
|
export const createInformationPanelColumns = (): GridColDef[] => [
|
|
{
|
|
field: 'customerName',
|
|
headerName: 'Cliente',
|
|
width: 250,
|
|
description: 'Nome do cliente do pedido',
|
|
},
|
|
{
|
|
field: 'storeId',
|
|
headerName: 'Filial',
|
|
width: 80,
|
|
align: 'center',
|
|
headerAlign: 'center',
|
|
description: 'Código da filial',
|
|
},
|
|
{
|
|
field: 'createDate',
|
|
headerName: 'Data Criação',
|
|
width: 110,
|
|
align: 'center',
|
|
headerAlign: 'center',
|
|
description: 'Data de criação do pedido',
|
|
valueFormatter: (value) => formatDate(value as string),
|
|
},
|
|
{
|
|
field: 'status',
|
|
headerName: 'Situação',
|
|
width: 120,
|
|
align: 'center',
|
|
headerAlign: 'center',
|
|
description: 'Situação atual do pedido',
|
|
renderCell: (params: Readonly<GridRenderCellParams>) => (
|
|
<Chip
|
|
label={getStatusLabel(params.value as string)}
|
|
size="small"
|
|
color={getStatusColor(params.value as string)}
|
|
variant="outlined"
|
|
sx={{ height: 24 }}
|
|
/>
|
|
),
|
|
},
|
|
{
|
|
field: 'paymentName',
|
|
headerName: 'Forma Pagamento',
|
|
width: 150,
|
|
description: 'Forma de pagamento utilizada',
|
|
},
|
|
{
|
|
field: 'billingName',
|
|
headerName: 'Cond. Pagamento',
|
|
width: 150,
|
|
description: 'Condição de pagamento',
|
|
},
|
|
{
|
|
field: 'amount',
|
|
headerName: 'Valor Total',
|
|
width: 120,
|
|
align: 'right',
|
|
headerAlign: 'right',
|
|
description: 'Valor total do pedido',
|
|
valueFormatter: (value) => formatCurrency(value as number),
|
|
},
|
|
{
|
|
field: 'deliveryType',
|
|
headerName: 'Tipo Entrega',
|
|
width: 150,
|
|
description: 'Tipo de entrega selecionado',
|
|
},
|
|
{
|
|
field: 'deliveryLocal',
|
|
headerName: 'Local Entrega',
|
|
width: 200,
|
|
flex: 1,
|
|
description: 'Local de entrega do pedido',
|
|
},
|
|
];
|