Skip to content

Commit

Permalink
feat: new archive view (HL-908)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjturt committed Nov 9, 2023
1 parent 4107cc6 commit 8b1b7cf
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 11 deletions.
21 changes: 21 additions & 0 deletions frontend/benefit/handler/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
21 changes: 21 additions & 0 deletions frontend/benefit/handler/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
21 changes: 21 additions & 0 deletions frontend/benefit/handler/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -107,6 +108,7 @@ const ApplicationReview: React.FC = () => {
HANDLED_STATUSES.includes(application.status) && (
<HandledView data={application} />
)}
{application.archived && <ArchivedView data={application} />}
</Container>
<StickyActionBar>
{application.status === APPLICATION_STATUSES.RECEIVED && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ export const $HandledRow = styled($Grid)<HandledRowProps>`
props.largeMargin ? props.theme.spacing.l : props.theme.spacing.s}
0;
`;

export const $HandledHeader = styled.div`
display: flex;
justify-content: space-between;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<ApplicationReviewViewProps> = ({ data }) => {
const translationsBase = 'common:review.summary';
Expand All @@ -24,18 +30,17 @@ const HandledView: React.FC<ApplicationReviewViewProps> = ({ data }) => {
extractCalculatorRows(data.calculation?.rows);

return (
<ReviewSection header={t(`${translationsBase}.${data.status || ''}.title`)}>
<ReviewSection
withoutDivider
header={t(`${translationsBase}.${data.status || ''}.title`)}
>
<$HandledSection>
<$GridCell $colSpan={8}>
<$HandledHeader>
<$ViewFieldBold style={{ color: theme.colors.coatOfArms }}>
{t(`${translationsBase}.common.ready`)}
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={8}>
<$ViewFieldBold large>
{t(`${translationsBase}.${data.status || ''}.message`)}
</$ViewFieldBold>
</$GridCell>
<StatusLabel status={data.status} />
</$HandledHeader>
<$HandledHr dashed />
{data.status === APPLICATION_STATUSES.ACCEPTED && (
<$GridCell $colSpan={8}>
Expand All @@ -52,7 +57,7 @@ const HandledView: React.FC<ApplicationReviewViewProps> = ({ 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(),
Expand All @@ -76,7 +81,7 @@ const HandledView: React.FC<ApplicationReviewViewProps> = ({ data }) => {
<$HandledRow>
<$GridCell
style={{ backgroundColor: theme.colors.white }}
$colSpan={8}
$colSpan={9}
$colStart={1}
>
<$ViewField large>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ApplicationReviewViewProps> = ({ data }) => {
const translationsBase = 'common:review.summary.archived';
const { t } = useTranslation();
const theme = useTheme();

return (
<ReviewSection withoutDivider>
<$HandledSection>
<$HandledHeader>
<$ViewFieldBold style={{ color: theme.colors.coatOfArms }}>
{t(`${translationsBase}.ready`)}
</$ViewFieldBold>
<StatusLabel status={data.status} />
</$HandledHeader>
<$ViewFieldBold large>
{t(`${translationsBase}.${data.status || ''}`)}
</$ViewFieldBold>
<$HandledHr dashed />
<$HandledRow largeMargin>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t(`${translationsBase}.decisionMakerName`)}
<$ViewField topMargin>{data.batch?.decisionMakerName}</$ViewField>
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t(`${translationsBase}.decisionMakerTitle`)}
<$ViewField topMargin>
{data.batch?.decisionMakerTitle}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t(`${translationsBase}.decisionDate`)}
<$ViewField topMargin>
{convertToUIDateFormat(data.batch?.decisionDate)}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t(`${translationsBase}.sectionOfTheLaw`)}
<$ViewField topMargin>{data.batch?.sectionOfTheLaw}</$ViewField>
</$ViewFieldBold>
</$GridCell>
</$HandledRow>
<$HandledHr />

{data.batch?.p2PInspectorName && (
<>
<$HandledRow largeMargin>
<$GridCell $colSpan={12} $colStart={1}>
<$ViewFieldBold large style={{ marginBottom: theme.spacing.m }}>
{t(`${translationsBase}.p2pTitle`)}
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t(`${translationsBase}.p2pInspector`)}
<$ViewField topMargin>
{data.batch?.p2PInspectorName}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t(`${translationsBase}.p2pInspectorEmail`)}
<$ViewField topMargin>
{data.batch?.p2PInspectorEmail}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t(`${translationsBase}.p2pDecisionMaker`)}
<$ViewField topMargin>
{data.batch?.p2PCheckerName}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
</$HandledRow>
<$HandledHr />
</>
)}
{data.batch?.expertInspectorName && (
<>
<$HandledRow largeMargin>
<$GridCell $colSpan={12} $colStart={1}>
<$ViewFieldBold large style={{ marginBottom: theme.spacing.m }}>
{t(`${translationsBase}.ahjoTitle`)}
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t(`${translationsBase}.ahjoInspector`)}
<$ViewField topMargin>
{data.batch?.expertInspectorName}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t(`${translationsBase}.ahjoInspectorTitle`)}
<$ViewField topMargin>
{data.batch?.expertInspectorTitle}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t(`${translationsBase}.p2pDecisionMaker`)}
<$ViewField topMargin>
{data.batch?.p2PCheckerName}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
</$HandledRow>
<$HandledHr />
</>
)}
<$HandledRow largeMargin>
<$GridCell $colSpan={12} $colStart={1}>
<$ViewFieldBold large style={{ marginBottom: theme.spacing.m }}>
{t(`${translationsBase}.archivedTitle`)}
</$ViewFieldBold>
</$GridCell>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t(`${translationsBase}.handler`)}
<$ViewField topMargin>
{getFullName(
data.batch?.handler?.firstName,
data.batch?.handler?.lastName
)}
</$ViewField>
</$ViewFieldBold>
</$GridCell>
</$HandledRow>
</$HandledSection>
</ReviewSection>
);
};

export default ArchivedView;
5 changes: 5 additions & 0 deletions frontend/benefit/shared/src/types/application.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 8b1b7cf

Please sign in to comment.