| | |
| | | |
| | | const headCells = [ |
| | | { |
| | | id: 'name', |
| | | id: 'actionType', |
| | | numeric: false, |
| | | disablePadding: true, |
| | | label: 'Dessert (100g serving)', |
| | | label: 'table.field.action.actionType', |
| | | }, |
| | | { |
| | | id: 'calories', |
| | | id: 'code', |
| | | numeric: true, |
| | | disablePadding: false, |
| | | label: 'Calories', |
| | | label: 'table.field.action.code', |
| | | }, |
| | | { |
| | | id: 'fat', |
| | | id: 'taskId', |
| | | numeric: true, |
| | | disablePadding: false, |
| | | label: 'Fat (g)', |
| | | label: 'table.field.action.taskId', |
| | | }, |
| | | { |
| | | id: 'carbs', |
| | | id: 'val', |
| | | numeric: true, |
| | | disablePadding: false, |
| | | label: 'Carbs (g)', |
| | | label: 'table.field.action.val', |
| | | }, |
| | | { |
| | | id: 'protein', |
| | | id: 'params', |
| | | numeric: true, |
| | | disablePadding: false, |
| | | label: 'Protein (g)', |
| | | label: 'table.field.action.params', |
| | | }, |
| | | ]; |
| | | |
| | | const ActionTable = ({ actionIds }) => { |
| | | const dataProvider = useDataProvider(); |
| | | const translate = useTranslate(); |
| | | const [actions, setActions] = useState([]); |
| | | const [selected, setSelected] = React.useState([]); |
| | | |
| | |
| | | return ( |
| | | <> |
| | | <Box sx={{ width: '100%' }}> |
| | | <Paper sx={{ width: '100%', mb: 2 }}> |
| | | <Paper sx={{ |
| | | width: '100%', |
| | | mb: 2, |
| | | }}> |
| | | <Toolbar |
| | | sx={[ |
| | | { |
| | | pl: { sm: 2 }, |
| | | pr: { xs: 1, sm: 1 }, |
| | | minHeight: '52.5px !important', |
| | | }, |
| | | selected.length > 0 && { |
| | | bgcolor: (theme) => |
| | |
| | | ) : ( |
| | | <Typography |
| | | sx={{ flex: '1 1 100%' }} |
| | | variant="h6" |
| | | variant="subtitle1" |
| | | id="tableTitle" |
| | | component="div" |
| | | > |
| | |
| | | align={headCell.numeric ? 'right' : 'left'} |
| | | padding={headCell.disablePadding ? 'none' : 'normal'} |
| | | > |
| | | {headCell.label} |
| | | {translate(headCell.label)} |
| | | </TableCell> |
| | | ))} |
| | | </TableRow> |
| | |
| | | scope="row" |
| | | padding="none" |
| | | > |
| | | {row.name} |
| | | [ {row.priority} ] |
| | | |
| | | {row.actionType$} |
| | | </TableCell> |
| | | <TableCell align="right">{row.calories}</TableCell> |
| | | <TableCell align="right">{row.fat}</TableCell> |
| | | <TableCell align="right">{row.carbs}</TableCell> |
| | | <TableCell align="right">{row.protein}</TableCell> |
| | | <TableCell align="right">{row.code}</TableCell> |
| | | <TableCell align="right">{row.taskId$}</TableCell> |
| | | <TableCell align="right">{row.val}</TableCell> |
| | | <TableCell align="right">{row.params}</TableCell> |
| | | </TableRow> |
| | | ); |
| | | })} |