diff --git a/frontend/benefit/handler/public/locales/en/common.json b/frontend/benefit/handler/public/locales/en/common.json index 045a359e85..1c7f4d99eb 100644 --- a/frontend/benefit/handler/public/locales/en/common.json +++ b/frontend/benefit/handler/public/locales/en/common.json @@ -765,9 +765,30 @@ "description": "", "commentsTitle": "Syy peruutukseen" }, + "archived": { + "ready": "Päätös tehty", + "accepted": "Hakemus hyväksyttiin", + "rejected": "Hakemusta ei hyväksytty ", + "cancelled": "Hakemus peruttiin", + "decisionMakerName": "Päättäjä", + "decisionMakerTitle": "Päättäjän titteli", + "decisionDate": "Päätöspäivämäärä", + "sectionOfTheLaw": "Pykälä", + "p2pTitle": "P2P-tarkastuksen tiedot", + "p2pInspector": "Tarkastaja, P2P", + "p2pInspectorEmail": "Tarkastajan sähköposti", + "ahjoTitle": "Ahjo-tarkastuksen tiedot", + "ahjoInspector": "Tarkastaja, Ahjo", + "ahjoInspectorTitle": "Tarkastajan titteli", + "p2pDecisionMaker": "Hyväksyjän nimi, P2P", + "archivedTitle": "Arkistointi", + "archivedDate": "Arkistointipäivä", + "handler": "Käsittelijä" + }, "common": { "handler": "Käsittelijä", "handledAt": "Käsittelypäivämäärä", + "inAhjo": "Viety Ahjoon", "ready": "Käsittely valmis", "dateRange": "Helsinki-lisä kuukaudessa {{dateRange}}", "total": "Helsinki-lisä yhteensä koko ajalta ({{months}} kk)" diff --git a/frontend/benefit/handler/public/locales/fi/common.json b/frontend/benefit/handler/public/locales/fi/common.json index 045a359e85..1c7f4d99eb 100644 --- a/frontend/benefit/handler/public/locales/fi/common.json +++ b/frontend/benefit/handler/public/locales/fi/common.json @@ -765,9 +765,30 @@ "description": "", "commentsTitle": "Syy peruutukseen" }, + "archived": { + "ready": "Päätös tehty", + "accepted": "Hakemus hyväksyttiin", + "rejected": "Hakemusta ei hyväksytty ", + "cancelled": "Hakemus peruttiin", + "decisionMakerName": "Päättäjä", + "decisionMakerTitle": "Päättäjän titteli", + "decisionDate": "Päätöspäivämäärä", + "sectionOfTheLaw": "Pykälä", + "p2pTitle": "P2P-tarkastuksen tiedot", + "p2pInspector": "Tarkastaja, P2P", + "p2pInspectorEmail": "Tarkastajan sähköposti", + "ahjoTitle": "Ahjo-tarkastuksen tiedot", + "ahjoInspector": "Tarkastaja, Ahjo", + "ahjoInspectorTitle": "Tarkastajan titteli", + "p2pDecisionMaker": "Hyväksyjän nimi, P2P", + "archivedTitle": "Arkistointi", + "archivedDate": "Arkistointipäivä", + "handler": "Käsittelijä" + }, "common": { "handler": "Käsittelijä", "handledAt": "Käsittelypäivämäärä", + "inAhjo": "Viety Ahjoon", "ready": "Käsittely valmis", "dateRange": "Helsinki-lisä kuukaudessa {{dateRange}}", "total": "Helsinki-lisä yhteensä koko ajalta ({{months}} kk)" diff --git a/frontend/benefit/handler/public/locales/sv/common.json b/frontend/benefit/handler/public/locales/sv/common.json index 045a359e85..1c7f4d99eb 100644 --- a/frontend/benefit/handler/public/locales/sv/common.json +++ b/frontend/benefit/handler/public/locales/sv/common.json @@ -765,9 +765,30 @@ "description": "", "commentsTitle": "Syy peruutukseen" }, + "archived": { + "ready": "Päätös tehty", + "accepted": "Hakemus hyväksyttiin", + "rejected": "Hakemusta ei hyväksytty ", + "cancelled": "Hakemus peruttiin", + "decisionMakerName": "Päättäjä", + "decisionMakerTitle": "Päättäjän titteli", + "decisionDate": "Päätöspäivämäärä", + "sectionOfTheLaw": "Pykälä", + "p2pTitle": "P2P-tarkastuksen tiedot", + "p2pInspector": "Tarkastaja, P2P", + "p2pInspectorEmail": "Tarkastajan sähköposti", + "ahjoTitle": "Ahjo-tarkastuksen tiedot", + "ahjoInspector": "Tarkastaja, Ahjo", + "ahjoInspectorTitle": "Tarkastajan titteli", + "p2pDecisionMaker": "Hyväksyjän nimi, P2P", + "archivedTitle": "Arkistointi", + "archivedDate": "Arkistointipäivä", + "handler": "Käsittelijä" + }, "common": { "handler": "Käsittelijä", "handledAt": "Käsittelypäivämäärä", + "inAhjo": "Viety Ahjoon", "ready": "Käsittely valmis", "dateRange": "Helsinki-lisä kuukaudessa {{dateRange}}", "total": "Helsinki-lisä yhteensä koko ajalta ({{months}} kk)" diff --git a/frontend/benefit/handler/src/components/applicationReview/ApplicationReview.tsx b/frontend/benefit/handler/src/components/applicationReview/ApplicationReview.tsx index 30fa80356b..d6aa778545 100644 --- a/frontend/benefit/handler/src/components/applicationReview/ApplicationReview.tsx +++ b/frontend/benefit/handler/src/components/applicationReview/ApplicationReview.tsx @@ -24,6 +24,7 @@ import CoOperationNegotiationsView from './coOperationNegotiationsView/CoOperati import DeminimisView from './deminimisView/DeminimisView'; import EmployeeView from './employeeView/EmployeeView'; import EmploymentView from './employmentView/EmpoymentView'; +import ArchivedView from './handledView/archivedView/ArchivedView'; import HandledView from './handledView/HandledView'; import NotificationView from './notificationView/NotificationView'; import PaperView from './paperView/PaperView'; @@ -107,6 +108,7 @@ const ApplicationReview: React.FC = () => { HANDLED_STATUSES.includes(application.status) && ( )} + {application.archived && } {application.status === APPLICATION_STATUSES.RECEIVED && ( diff --git a/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.sc.ts b/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.sc.ts index 3d7fe46961..50aaacb841 100644 --- a/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.sc.ts +++ b/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.sc.ts @@ -30,3 +30,8 @@ export const $HandledRow = styled($Grid)` props.largeMargin ? props.theme.spacing.l : props.theme.spacing.s} 0; `; + +export const $HandledHeader = styled.div` + display: flex; + justify-content: space-between; +`; diff --git a/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.tsx b/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.tsx index c367d196c9..339899f2de 100644 --- a/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.tsx +++ b/frontend/benefit/handler/src/components/applicationReview/handledView/HandledView.tsx @@ -3,6 +3,7 @@ import { $ViewFieldBold, } from 'benefit/handler/components/newApplication/ApplicationForm.sc'; import ReviewSection from 'benefit/handler/components/reviewSection/ReviewSection'; +import StatusLabel from 'benefit/handler/components/statusLabel/StatusLabel'; import { ApplicationReviewViewProps } from 'benefit/handler/types/application'; import { extractCalculatorRows } from 'benefit/handler/utils/calculator'; import { APPLICATION_STATUSES } from 'benefit-shared/constants'; @@ -14,7 +15,12 @@ import { convertToUIDateFormat } from 'shared/utils/date.utils'; import { formatFloatToCurrency } from 'shared/utils/string.utils'; import { useTheme } from 'styled-components'; -import { $HandledHr, $HandledRow, $HandledSection } from './HandledView.sc'; +import { + $HandledHeader, + $HandledHr, + $HandledRow, + $HandledSection, +} from './HandledView.sc'; const HandledView: React.FC = ({ data }) => { const translationsBase = 'common:review.summary'; @@ -24,18 +30,17 @@ const HandledView: React.FC = ({ data }) => { extractCalculatorRows(data.calculation?.rows); return ( - + <$HandledSection> - <$GridCell $colSpan={8}> + <$HandledHeader> <$ViewFieldBold style={{ color: theme.colors.coatOfArms }}> {t(`${translationsBase}.common.ready`)} - - <$GridCell $colSpan={8}> - <$ViewFieldBold large> - {t(`${translationsBase}.${data.status || ''}.message`)} - - + + <$HandledHr dashed /> {data.status === APPLICATION_STATUSES.ACCEPTED && ( <$GridCell $colSpan={8}> @@ -52,7 +57,7 @@ const HandledView: React.FC = ({ data }) => { dateRangeRows.length === helsinkiBenefitMonthlyRows.length && dateRangeRows.map((row, index) => ( <$HandledRow key={row.id}> - <$GridCell $colSpan={8} $colStart={1}> + <$GridCell $colSpan={9} $colStart={1}> <$ViewField large> {t(`${translationsBase}.common.dateRange`, { dateRange: row.descriptionFi.toLocaleLowerCase(), @@ -76,7 +81,7 @@ const HandledView: React.FC = ({ data }) => { <$HandledRow> <$GridCell style={{ backgroundColor: theme.colors.white }} - $colSpan={8} + $colSpan={9} $colStart={1} > <$ViewField large> diff --git a/frontend/benefit/handler/src/components/applicationReview/handledView/archivedView/ArchivedView.tsx b/frontend/benefit/handler/src/components/applicationReview/handledView/archivedView/ArchivedView.tsx new file mode 100644 index 0000000000..4556273aac --- /dev/null +++ b/frontend/benefit/handler/src/components/applicationReview/handledView/archivedView/ArchivedView.tsx @@ -0,0 +1,167 @@ +import { + $ViewField, + $ViewFieldBold, +} from 'benefit/handler/components/newApplication/ApplicationForm.sc'; +import ReviewSection from 'benefit/handler/components/reviewSection/ReviewSection'; +import StatusLabel from 'benefit/handler/components/statusLabel/StatusLabel'; +import { ApplicationReviewViewProps } from 'benefit/handler/types/application'; +import { useTranslation } from 'next-i18next'; +import * as React from 'react'; +import { $GridCell } from 'shared/components/forms/section/FormSection.sc'; +import { getFullName } from 'shared/utils/application.utils'; +import { convertToUIDateFormat } from 'shared/utils/date.utils'; +import { useTheme } from 'styled-components'; + +import { + $HandledHeader, + $HandledHr, + $HandledRow, + $HandledSection, +} from '../HandledView.sc'; + +const ArchivedView: React.FC = ({ data }) => { + const translationsBase = 'common:review.summary.archived'; + const { t } = useTranslation(); + const theme = useTheme(); + + return ( + + <$HandledSection> + <$HandledHeader> + <$ViewFieldBold style={{ color: theme.colors.coatOfArms }}> + {t(`${translationsBase}.ready`)} + + + + <$ViewFieldBold large> + {t(`${translationsBase}.${data.status || ''}`)} + + <$HandledHr dashed /> + <$HandledRow largeMargin> + <$GridCell $colSpan={3} $colStart={1}> + <$ViewFieldBold> + {t(`${translationsBase}.decisionMakerName`)} + <$ViewField topMargin>{data.batch?.decisionMakerName} + + + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t(`${translationsBase}.decisionMakerTitle`)} + <$ViewField topMargin> + {data.batch?.decisionMakerTitle} + + + + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t(`${translationsBase}.decisionDate`)} + <$ViewField topMargin> + {convertToUIDateFormat(data.batch?.decisionDate)} + + + + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t(`${translationsBase}.sectionOfTheLaw`)} + <$ViewField topMargin>{data.batch?.sectionOfTheLaw} + + + + <$HandledHr /> + + {data.batch?.p2PInspectorName && ( + <> + <$HandledRow largeMargin> + <$GridCell $colSpan={12} $colStart={1}> + <$ViewFieldBold large style={{ marginBottom: theme.spacing.m }}> + {t(`${translationsBase}.p2pTitle`)} + + + <$GridCell $colSpan={3} $colStart={1}> + <$ViewFieldBold> + {t(`${translationsBase}.p2pInspector`)} + <$ViewField topMargin> + {data.batch?.p2PInspectorName} + + + + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t(`${translationsBase}.p2pInspectorEmail`)} + <$ViewField topMargin> + {data.batch?.p2PInspectorEmail} + + + + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t(`${translationsBase}.p2pDecisionMaker`)} + <$ViewField topMargin> + {data.batch?.p2PCheckerName} + + + + + <$HandledHr /> + + )} + {data.batch?.expertInspectorName && ( + <> + <$HandledRow largeMargin> + <$GridCell $colSpan={12} $colStart={1}> + <$ViewFieldBold large style={{ marginBottom: theme.spacing.m }}> + {t(`${translationsBase}.ahjoTitle`)} + + + <$GridCell $colSpan={3} $colStart={1}> + <$ViewFieldBold> + {t(`${translationsBase}.ahjoInspector`)} + <$ViewField topMargin> + {data.batch?.expertInspectorName} + + + + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t(`${translationsBase}.ahjoInspectorTitle`)} + <$ViewField topMargin> + {data.batch?.expertInspectorTitle} + + + + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t(`${translationsBase}.p2pDecisionMaker`)} + <$ViewField topMargin> + {data.batch?.p2PCheckerName} + + + + + <$HandledHr /> + + )} + <$HandledRow largeMargin> + <$GridCell $colSpan={12} $colStart={1}> + <$ViewFieldBold large style={{ marginBottom: theme.spacing.m }}> + {t(`${translationsBase}.archivedTitle`)} + + + <$GridCell $colSpan={3} $colStart={1}> + <$ViewFieldBold> + {t(`${translationsBase}.handler`)} + <$ViewField topMargin> + {getFullName( + data.batch?.handler?.firstName, + data.batch?.handler?.lastName + )} + + + + + + + ); +}; + +export default ArchivedView; diff --git a/frontend/benefit/shared/src/types/application.d.ts b/frontend/benefit/shared/src/types/application.d.ts index 2585637006..61911966ed 100644 --- a/frontend/benefit/shared/src/types/application.d.ts +++ b/frontend/benefit/shared/src/types/application.d.ts @@ -159,7 +159,12 @@ export type Batch = { decisionDate?: string; expertInspectorName?: string; expertInspectorEmail?: string; + expertInspectorTitle?: string; + p2PCheckerName?: string; + p2PInspectorName?: string; + p2PInspectorEmail?: string; createdAt: string; + handler?: HandlerDetails; }; export type HandlerDetails = {