New file |
| | |
| | | import { useState } from 'react'; |
| | | import { |
| | | Form, |
| | | ReferenceField, |
| | | useNotify, |
| | | useResourceContext, |
| | | useTranslate, |
| | | } from 'react-admin'; |
| | | import { |
| | | Box, |
| | | Button, |
| | | Stack, |
| | | Tooltip, |
| | | Typography, |
| | | Avatar, |
| | | } from '@mui/material'; |
| | | import { format } from 'date-fns'; |
| | | import { blueGrey } from '@mui/material/colors'; |
| | | |
| | | export const Action = ({ data }) => { |
| | | const notify = useNotify(); |
| | | const translate = useTranslate(); |
| | | |
| | | const [isHover, setHover] = useState(false); |
| | | |
| | | return ( |
| | | <Box |
| | | onMouseEnter={() => setHover(true)} |
| | | onMouseLeave={() => setHover(false)} |
| | | pb={1} |
| | | > |
| | | <Stack direction="row" spacing={1} alignItems="center" width="100%"> |
| | | <Avatar |
| | | sx={{ |
| | | width: 30, |
| | | height: 30, |
| | | bgcolor: blueGrey[500], |
| | | }} |
| | | > |
| | | {data.priority} |
| | | </Avatar> |
| | | <Typography color="text.secondary" variant="body2"> |
| | | {data.name} |
| | | </Typography> |
| | | <Box flex={1}></Box> |
| | | <Typography |
| | | color="textSecondary" |
| | | variant="body2" |
| | | component="span" |
| | | > |
| | | {format(data.ioTime, 'yyyy-MM-dd HH:mm:ss') || '-'} |
| | | </Typography> |
| | | </Stack> |
| | | <Stack |
| | | sx={{ |
| | | paddingTop: '0.5em', |
| | | display: 'flex', |
| | | '& p:empty': { |
| | | minHeight: '0.75em', |
| | | }, |
| | | }} |
| | | > |
| | | {/* {note.text |
| | | ?.split('\n') |
| | | .map((paragraph: string, index: number) => ( |
| | | <Typography |
| | | component="p" |
| | | variant="body2" |
| | | lineHeight={1.5} |
| | | margin={0} |
| | | key={index} |
| | | > |
| | | {paragraph} |
| | | </Typography> |
| | | ))} |
| | | |
| | | {note.attachments && <NoteAttachments note={note} />} */} |
| | | </Stack> |
| | | </Box> |
| | | ); |
| | | }; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { |
| | | useDataProvider, |
| | | useTranslate, |
| | | } from 'react-admin'; |
| | | import { Box, Divider, Stack, LinearProgress } from '@mui/material'; |
| | | |
| | | import { Action } from './Action'; |
| | | |
| | | export const ActionsIterator = ({ actionIds }) => { |
| | | const dataProvider = useDataProvider(); |
| | | |
| | | const [actions, setActions] = useState([]); |
| | | |
| | | useEffect(() => { |
| | | if (actionIds?.length > 0) { |
| | | dataProvider.getMany('action', { ids: actionIds }).then(res => { |
| | | if (res.data?.length > 0) { |
| | | setActions(res.data); |
| | | } |
| | | }) |
| | | } |
| | | }, [actionIds]) |
| | | |
| | | if (!actionIds?.length) return <LinearProgress />; |
| | | |
| | | return ( |
| | | <Box mt={2}> |
| | | {actions && ( |
| | | <Stack mt={2} gap={1}> |
| | | {actions.map((action, idx) => ( |
| | | <React.Fragment key={idx}> |
| | | <Action |
| | | data={action} |
| | | isLast={idx === actions.length - 1} |
| | | key={idx} |
| | | /> |
| | | {idx < actions.length - 1 && <Divider />} |
| | | </React.Fragment> |
| | | ))} |
| | | </Stack> |
| | | )} |
| | | </Box> |
| | | ); |
| | | }; |
| | |
| | | import MoveToInboxIcon from '@mui/icons-material/MoveToInbox'; |
| | | import { format } from 'date-fns'; |
| | | import { TaskList } from "./TaskList"; |
| | | import { ActionsIterator } from "../action/ActionsIterator"; |
| | | |
| | | const MissionShow = ({ open, id }) => { |
| | | const redirect = useRedirect(); |
| | |
| | | |
| | | <Box m={2}> |
| | | <Divider /> |
| | | <ActionsIterator actionIds={record.actionIds} /> |
| | | </Box> |
| | | </Box> |
| | | </Box> |
| | |
| | | |
| | | private List<String> codeList = new ArrayList<>(); |
| | | |
| | | private List<Long> actionIds = new ArrayList<>(); |
| | | |
| | | } |
| | |
| | | vo.setActionCount(actionList.size()); |
| | | vo.setTaskIds(list.stream().map(Segment::getTaskId).collect(Collectors.toList())); |
| | | vo.setCodeList(actionList.stream().map(Action::getCode).distinct().collect(Collectors.toList())); |
| | | vo.setActionIds(actionList.stream().map(Action::getId).collect(Collectors.toList())); |
| | | return vo; |
| | | } |
| | | |