| | |
| | | import { Draggable } from '@hello-pangea/dnd'; |
| | | import { Box, Card, Typography } from '@mui/material'; |
| | | import { ReferenceField, useRedirect } from 'react-admin'; |
| | | import { CompanyAvatar } from '../companies/CompanyAvatar'; |
| | | import { Deal } from '../types'; |
| | | |
| | | export const MissionCard = ({ deal, index }) => { |
| | | if (!deal) return null; |
| | | export const MissionCard = ({ mission, index }) => { |
| | | if (!mission) return null; |
| | | |
| | | return ( |
| | | <Draggable draggableId={String(deal.id)} index={index}> |
| | | <Draggable draggableId={String(mission.id)} index={index}> |
| | | {(provided, snapshot) => ( |
| | | <DealCardContent |
| | | <MissionCardContent |
| | | provided={provided} |
| | | snapshot={snapshot} |
| | | deal={deal} |
| | | mission={mission} |
| | | /> |
| | | )} |
| | | </Draggable> |
| | | ); |
| | | }; |
| | | |
| | | export const DealCardContent = ({ |
| | | export const MissionCardContent = ({ |
| | | provided, |
| | | snapshot, |
| | | deal, |
| | | mission, |
| | | }) => { |
| | | const redirect = useRedirect(); |
| | | const handleClick = () => { |
| | | redirect(`/deals/${deal.id}/show`, undefined, undefined, undefined, { |
| | | redirect(`/mission/${mission.id}/show`, undefined, undefined, undefined, { |
| | | _scrollToTop: false, |
| | | }); |
| | | }; |
| | |
| | | <Box padding={1} display="flex"> |
| | | <ReferenceField |
| | | source="company_id" |
| | | record={deal} |
| | | record={mission} |
| | | reference="companies" |
| | | link={false} |
| | | > |
| | | <CompanyAvatar width={20} height={20} /> |
| | | </ReferenceField> |
| | | <Box sx={{ marginLeft: 1 }}> |
| | | <Typography variant="body2" gutterBottom> |
| | | {deal.name} |
| | | {mission.groupNo} |
| | | </Typography> |
| | | <Typography variant="caption" color="textSecondary"> |
| | | {deal.amount.toLocaleString('en-US', { |
| | | notation: 'compact', |
| | | style: 'currency', |
| | | currency: 'USD', |
| | | currencyDisplay: 'narrowSymbol', |
| | | minimumSignificantDigits: 3, |
| | | })} |
| | | {deal.category ? `, ${deal.category}` : ''} |
| | | 1 |
| | | </Typography> |
| | | </Box> |
| | | </Box> |