diff --git a/src/components/ProposalApplication.tsx b/src/components/ProposalApplication.tsx index bf43619..8de4026 100644 --- a/src/components/ProposalApplication.tsx +++ b/src/components/ProposalApplication.tsx @@ -1,11 +1,8 @@ -import { - IconDefinition, - faFilePdf, - faMessage, -} from '@fortawesome/free-regular-svg-icons' +import { IconDefinition, faFilePdf } from '@fortawesome/free-regular-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { H2, Table } from '@uzh-bf/design-system' +import { Button, H2, Modal, Table } from '@uzh-bf/design-system' import { add, format, parseISO } from 'date-fns' +import { useState } from 'react' import { ProposalDetails } from 'src/types/app' import { IterableElement } from 'type-fest' import ApplicationForm from './ApplicationForm' @@ -24,6 +21,8 @@ export default function ProposalApplication({ const FileTypeIconMap: Record = { 'application/pdf': faFilePdf, } + const [isOpen, setIsOpen] = useState(false) + const [updatedRow, setUpdatedRow] = useState(null) if (proposalDetails?.typeKey === 'SUPERVISOR') { return (
@@ -49,75 +48,182 @@ export default function ProposalApplication({ { label: 'Date', accessor: 'createdAt', - transformer: ({ row }) => - format(parseISO(row.createdAt), 'dd.MM.Y'), - }, - { - label: 'Status', - accessor: 'status', - sortable: true, - transformer: ({ row }) =>
{row.statusKey}
, - }, - { - label: 'Working Period', - accessor: 'plannedStartAt', sortable: true, transformer: ({ row }) => - `${format( - parseISO(row.plannedStartAt), - 'd.M.Y' - )} - ${format( - add(parseISO(row.plannedStartAt), { months: 6 }), - 'd.M.Y' - )}`, + format(parseISO(row.createdAt), 'dd.MM.yyyy'), }, + // { + // label: 'Status', + // accessor: 'status', + // sortable: true, + // transformer: ({ row }) =>
{row.statusKey}
, + // }, { - label: 'Name', - accessor: 'fullName', + label: 'Email', + accessor: 'email', sortable: true, - transformer: ({ row }) => ( - - - {row.fullName} - - ), - }, - { - label: 'Motivation', - accessor: 'motivation', - transformer: ({ row }) => ( -
{row.motivation}
- ), }, { - label: 'Attachments', - accessor: 'attachments', + label: 'Details', + accessor: 'fullName', transformer: ({ row }) => (
- {row.attachments?.map((attachment: any) => ( - -
- - {attachment.name} + ( + setUpdatedRow(row), setIsOpen(true) + )} + > + More + + } + onClose={() => setIsOpen(false)} + > + +
), }, + // { + // label: 'Working Period', + // accessor: 'plannedStartAt', + // sortable: true, + // transformer: ({ row }) => + // `${format( + // parseISO(row.plannedStartAt), + // 'd.M.Y' + // )} - ${format( + // add(parseISO(row.plannedStartAt), { months: 6 }), + // 'd.M.Y' + // )}`, + // }, + // { + // label: 'Name', + // accessor: 'fullName', + // sortable: true, + // transformer: ({ row }) => ( + // + // + // {row.email} + // + // ), + // }, + // { + // label: 'Motivation', + // accessor: 'motivation', + // transformer: ({ row }) => ( + //
{row.motivation}
+ // ), + // }, + // { + // label: 'Attachments', + // accessor: 'attachments', + // transformer: ({ row }) => ( + //
+ // {row.attachments?.map((attachment: any) => ( + // + //
+ // + // {attachment.name} + //
+ //
+ // ))} + //
+ // ), + // }, ]} data={proposalDetails.applications} />