diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsRepresentativesSummary.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsRepresentativesSummary.tsx index 79e3a24586e0..322132de0876 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsRepresentativesSummary.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsRepresentativesSummary.tsx @@ -1,14 +1,14 @@ import { FC } from 'react' import { GridColumn } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' +import { FieldBaseProps } from '@island.is/application/types' import { RentalAgreement } from '../../lib/dataSchema' import { summary } from '../../lib/messages' +import { Routes } from '../../lib/constants' import { formatNationalId, formatPhoneNumber } from '../../lib/utils' -import { KeyValue } from './KeyValue' -import { SummarySection } from './SummarySection' -import { FieldBaseProps } from '@island.is/application/types' +import { KeyValue } from './components/KeyValue' import { SummaryCardRow } from './components/SummaryCardRow' -import { Routes } from '../../lib/constants' +import { SummaryCard } from './components/SummaryCard' interface Props extends FieldBaseProps { goToScreen?: (id: string) => void @@ -42,8 +42,8 @@ export const ApplicantsRepresentativesSummary: FC = ({ ...props }) => { return ( <> {landlordListHasRepresentatives ? ( - {landlordRepresentatives?.map((landlordRep) => { return ( @@ -81,13 +81,13 @@ export const ApplicantsRepresentativesSummary: FC = ({ ...props }) => { ) })} - + ) : ( '' )} {tenantListHasRepresentatives ? ( - {tenantRepresentatives.map((tenantRep) => { return ( @@ -124,7 +124,7 @@ export const ApplicantsRepresentativesSummary: FC = ({ ...props }) => { ) })} - + ) : ( '' )} diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsSummary.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsSummary.tsx index b641521f245b..cbafb43d77b1 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsSummary.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/ApplicantsSummary.tsx @@ -1,12 +1,12 @@ import { GridColumn } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' -import { summary } from '../../lib/messages' +import { RentalAgreement } from '../../lib/dataSchema' +import { Routes } from '../../lib/constants' import { formatNationalId, formatPhoneNumber } from '../../lib/utils' -import { KeyValue } from './KeyValue' +import { KeyValue } from './components/KeyValue' import { SummaryCard } from './components/SummaryCard' import { SummaryCardRow } from './components/SummaryCardRow' -import { Routes } from '../../lib/constants' -import { RentalAgreement } from '../../lib/dataSchema' +import { summary } from '../../lib/messages' type Props = { answers: RentalAgreement diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/LandlordInfoSummary.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/LandlordInfoSummary.tsx deleted file mode 100644 index c1a0cd6d7980..000000000000 --- a/libs/application/templates/rental-agreement/src/fields/Summary/LandlordInfoSummary.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Fragment } from 'react' -import { GridColumn, GridRow } from '@island.is/island-ui/core' -import { RentalAgreement } from '../../lib/dataSchema' -import { summary } from '../../lib/messages' -import { divider, gridRow } from './summaryStyles.css' -import { KeyValue } from './KeyValue' -import { useLocale } from '@island.is/localization' -import { formatNationalId } from '../../lib/utils' -import { formatPhoneNumber } from '@island.is/application/ui-components' -import { SummarySection } from './SummarySection' - -type Props = { - answers: RentalAgreement -} - -export const LandlordInfoSummary = ({ answers }: Props) => { - const { formatMessage } = useLocale() - - const landlordsWithoutRepresentatives = answers.landlordInfo.table.filter( - (landlord) => - !landlord.isRepresentative || landlord.isRepresentative.length === 0, - ) - - return ( - 1 - ? formatMessage(summary.landlordsHeaderPlural) - : formatMessage(summary.landlordsHeader) - } - > - {landlordsWithoutRepresentatives.map((landlord) => { - return ( - - - - - - - - - - - - -
- - ) - })} - - ) -} diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/OtherFeesSummary.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/OtherFeesSummary.tsx index ae83ce664d08..c535ad1024c8 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/OtherFeesSummary.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/OtherFeesSummary.tsx @@ -7,10 +7,10 @@ import { formatDate, getRentalOtherFeesPayeeOptions, } from '../../lib/utils' -import { summary } from '../../lib/messages' -import { KeyValue } from './KeyValue' -import { SummarySection } from './SummarySection' +import { KeyValue } from './components/KeyValue' import { SummaryCardRow } from './components/SummaryCardRow' +import { SummaryCard } from './components/SummaryCard' +import { summary } from '../../lib/messages' type Props = { answers: RentalAgreement @@ -34,12 +34,8 @@ export const OtherFeesSummary = ({ answers, goToScreen, route }: Props) => { const tenantPaysHeating = answers.rentOtherFees.heatingCost === RentOtherFeesPayeeOptions.TENANT - console.log('isTenantPayinhHouseFund', tenantPaysHouseFund) - console.log('isTenantPayingElectricity', tenantPaysElectricity) - console.log('isTenantPayingHeating', tenantPaysHeating) - return ( - + { !tenantPaysHouseFund && !tenantPaysElectricity && !tenantPaysHeating } > - + { } /> - + { } /> - + { route={route} isLast={!tenantPaysHouseFund && !tenantPaysHeating} > - + - + - + { route={route} isLast={!tenantPaysHouseFund} > - + - + - + { )} - + ) } diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/PropertyInfoSummary.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/PropertyInfoSummary.tsx index b8eea1d00ad8..1a2978f80fb7 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/PropertyInfoSummary.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/PropertyInfoSummary.tsx @@ -1,4 +1,4 @@ -import { GridColumn, Link, Text } from '@island.is/island-ui/core' +import { Box, GridColumn, Link, Text } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' import { RentalAgreement } from '../../lib/dataSchema' import { @@ -11,11 +11,12 @@ import { getPropertyClassOptions, getPropertyClassGroupOptions, } from '../../lib/utils' -import { summary } from '../../lib/messages' -import { KeyValue } from './KeyValue' -import { SummarySection } from './SummarySection' -import { fileLink, fileLinksList } from './summaryStyles.css' +import { KeyValue } from './components/KeyValue' import { SummaryCardRow } from './components/SummaryCardRow' +import { SummaryCard } from './components/SummaryCard' + +import { fileLink, fileLinksList } from './summaryStyles.css' +import { summary } from '../../lib/messages' type Props = { answers: RentalAgreement @@ -61,7 +62,7 @@ export const PropertyInfoSummary = ({ } return ( - + 0 && ( - - {formatMessage(summary.fileUploadLabel)} - -
    - {answers.condition.resultsFiles.map((file) => ( -
  • - - {file.name} - -
  • - ))} -
+ + + {formatMessage(summary.fileUploadLabel)} + +
    + {answers.condition.resultsFiles.map((file) => ( +
  • + + {file.name} + +
  • + ))} +
+
) @@ -220,6 +223,6 @@ export const PropertyInfoSummary = ({ />
-
+ ) } diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/RentalInfoSummary.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/RentalInfoSummary.tsx index cfecf2b520b9..06d616f26b84 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/RentalInfoSummary.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/RentalInfoSummary.tsx @@ -16,10 +16,10 @@ import { getSecurityAmountOptions, getSecurityDepositTypeOptions, } from '../../lib/utils' -import { summary } from '../../lib/messages' -import { KeyValue } from './KeyValue' -import { SummarySection } from './SummarySection' +import { SummaryCard } from './components/SummaryCard' import { SummaryCardRow } from './components/SummaryCardRow' +import { KeyValue } from './components/KeyValue' +import { summary } from '../../lib/messages' type Props = { answers: RentalAgreement @@ -89,7 +89,7 @@ export const RentalInfoSummary = ({ } return ( - + {/* Property Address */} @@ -234,6 +234,6 @@ export const RentalInfoSummary = ({ )} )} - + ) } diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/TenantInfoSummary.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/TenantInfoSummary.tsx deleted file mode 100644 index 1c733b30e5c3..000000000000 --- a/libs/application/templates/rental-agreement/src/fields/Summary/TenantInfoSummary.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Fragment } from 'react' -import { GridColumn, GridRow } from '@island.is/island-ui/core' -import { RentalAgreement } from '../../lib/dataSchema' -import { summary } from '../../lib/messages' -import { divider, gridRow } from './summaryStyles.css' -import { KeyValue } from './KeyValue' -import { useLocale } from '@island.is/localization' -import { formatNationalId } from '../../lib/utils' -import { formatPhoneNumber } from '@island.is/application/ui-components' -import { SummarySection } from './SummarySection' - -type Props = { - answers: RentalAgreement -} - -export const TenantInfoSummary = ({ answers }: Props) => { - const { formatMessage } = useLocale() - - const tenantsWithoutRepresentatives = answers.tenantInfo.table.filter( - (tenant) => - !tenant.isRepresentative || tenant.isRepresentative.length === 0, - ) - - return ( - 1 - ? formatMessage(summary.tenantsHeaderPlural) - : formatMessage(summary.tenantsHeader) - } - > - {tenantsWithoutRepresentatives.map((tenant) => { - return ( - - - - - - - - - - - - -
- - ) - })} - - ) -} diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/Divider.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/components/Divider.tsx similarity index 60% rename from libs/application/templates/rental-agreement/src/fields/Summary/Divider.tsx rename to libs/application/templates/rental-agreement/src/fields/Summary/components/Divider.tsx index 0bcc49e4a709..17bb9550fe2c 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/Divider.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/components/Divider.tsx @@ -1,4 +1,4 @@ -import { divider } from './summaryStyles.css' +import { divider } from '../summaryStyles.css' export const Divider = () => { return
diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/KeyValue.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/components/KeyValue.tsx similarity index 100% rename from libs/application/templates/rental-agreement/src/fields/Summary/KeyValue.tsx rename to libs/application/templates/rental-agreement/src/fields/Summary/components/KeyValue.tsx diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/components/SummaryCardRow.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/components/SummaryCardRow.tsx index f27ef91d4968..bae6b583d28a 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/components/SummaryCardRow.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/components/SummaryCardRow.tsx @@ -1,10 +1,10 @@ import { ReactNode } from 'react' import { useLocale } from '@island.is/localization' import { Button, GridRow } from '@island.is/island-ui/core' -import { Divider } from '../Divider' -import { gridRow, changeButton } from '../summaryStyles.css' import { summary } from '../../../lib/messages' import { Routes } from '../../../lib/constants' +import { Divider } from './Divider' +import { gridRow, changeButton } from '../summaryStyles.css' interface SummaryCardProps { children: ReactNode diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/SummarySection.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/components/SummarySection.tsx similarity index 100% rename from libs/application/templates/rental-agreement/src/fields/Summary/SummarySection.tsx rename to libs/application/templates/rental-agreement/src/fields/Summary/components/SummarySection.tsx diff --git a/libs/application/templates/rental-agreement/src/fields/Summary/index.tsx b/libs/application/templates/rental-agreement/src/fields/Summary/index.tsx index 405fdf459a13..f540d5ae3306 100644 --- a/libs/application/templates/rental-agreement/src/fields/Summary/index.tsx +++ b/libs/application/templates/rental-agreement/src/fields/Summary/index.tsx @@ -1,84 +1,172 @@ -import { FC } from 'react' +import { FC, useEffect } from 'react' import { useLocale } from '@island.is/localization' -import { Box, Text } from '@island.is/island-ui/core' import { ApplicationConfigurations, FieldBaseProps, } from '@island.is/application/types' +import { + AlertMessage, + Box, + Bullet, + BulletList, + Button, + Text, +} from '@island.is/island-ui/core' import { CopyLink } from '@island.is/application/ui-components' import { RentalAgreement } from '../../lib/dataSchema' -import { summary } from '../../lib/messages' -import { PropertyInfoSummary } from './PropertyInfoSummary' -import { OtherFeesSummary } from './OtherFeesSummary' -import { RentalInfoSummary } from './RentalInfoSummary' +import { Routes } from '../../lib/constants' import { ApplicantsRepresentativesSummary } from './ApplicantsRepresentativesSummary' -import { SummarySection } from './SummarySection' import { ApplicantsSummary } from './ApplicantsSummary' +import { OtherFeesSummary } from './OtherFeesSummary' +import { PropertyInfoSummary } from './PropertyInfoSummary' +import { RentalInfoSummary } from './RentalInfoSummary' +import { SummaryCard } from './components/SummaryCard' + import { summaryWrap } from './summaryStyles.css' -import { Routes } from '../../lib/constants' +import { summary } from '../../lib/messages' export const Summary: FC> = ({ ...props }) => { - const { application, field, goToScreen } = props + const { application, field, goToScreen, setSubmitButtonDisabled } = props const { formatMessage } = useLocale() const answers = application.answers as RentalAgreement + const isFireProtectionsPresent = + answers.fireProtections.smokeDetectors && + answers.fireProtections.fireExtinguisher && + answers.fireProtections.exits + + const isConditionPresent = answers.condition.resultsDescription + + const isOtherFeesPresent = + answers.rentOtherFees.electricityCost && + answers.rentOtherFees.heatingCost && + answers.rentOtherFees.housingFund + + const AlertMessageConditions = [ + { + isFilled: isFireProtectionsPresent, + route: Routes.FIREPROTECTIONS, + message: summary.alertMissingInfoFireProtections, + }, + { + isFilled: isConditionPresent, + route: Routes.CONDITION, + message: summary.alertMissingInfoCondition, + }, + { + isFilled: isOtherFeesPresent, + route: Routes.OTHERFEES, + message: summary.alertMissingInfoOtherFees, + }, + ] + + const unfilledConditions = AlertMessageConditions.filter( + (condition) => !condition.isFilled, + ) + + useEffect(() => { + if (unfilledConditions && unfilledConditions.length > 0) { + setSubmitButtonDisabled && setSubmitButtonDisabled(true) + } else { + setSubmitButtonDisabled && setSubmitButtonDisabled(false) + } + + return () => { + setSubmitButtonDisabled && setSubmitButtonDisabled(false) + } + }, [unfilledConditions, setSubmitButtonDisabled]) + return ( - - - - {formatMessage(summary.pageTitle)} - - {formatMessage(summary.pageDescription)} - - - - - - - - + + + + {formatMessage(summary.pageTitle)} + + {formatMessage(summary.pageDescription)} + + - - + + + + + + + + + {!isFireProtectionsPresent || + !isConditionPresent || + !isOtherFeesPresent ? ( + + + {unfilledConditions.map((condition, index) => ( + + + + ))} + + } + /> + + ) : ( + '' + )} + + ) } diff --git a/libs/application/templates/rental-agreement/src/forms/prerequisites/externalData.ts b/libs/application/templates/rental-agreement/src/forms/prerequisites/externalData.ts index d4218b4753f4..1a4959da219c 100644 --- a/libs/application/templates/rental-agreement/src/forms/prerequisites/externalData.ts +++ b/libs/application/templates/rental-agreement/src/forms/prerequisites/externalData.ts @@ -4,8 +4,8 @@ import { buildSection, buildSubmitField, } from '@island.is/application/core' -import { UserProfileApi, NationalRegistryUserApi } from '../../dataProviders' import { DefaultEvents } from '@island.is/application/types' +import { UserProfileApi, NationalRegistryUserApi } from '../../dataProviders' import { prerequisites } from '../../lib/messages' export const externalData = buildSection({ diff --git a/libs/application/templates/rental-agreement/src/forms/rentalAgreementForm.ts b/libs/application/templates/rental-agreement/src/forms/rentalAgreementForm.ts index 8d9b556bb973..3577bdb9d508 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalAgreementForm.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalAgreementForm.ts @@ -7,6 +7,7 @@ import { RentalPeriod } from './rentalPeriod' import { Summary } from './summary/summary' import { application } from '../lib/messages' +import { Signature } from './signature/signature' export const RentalAgreementForm: Form = buildForm({ id: 'RentalAgreementApplication', @@ -15,5 +16,5 @@ export const RentalAgreementForm: Form = buildForm({ mode: FormModes.DRAFT, renderLastScreenButton: true, renderLastScreenBackButton: true, - children: [RentalHousingInfo, RentalPeriod, Summary], + children: [RentalHousingInfo, RentalPeriod, Summary, Signature], }) diff --git a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingFireProtections.ts b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingFireProtections.ts index 75ed2ac8a68d..787f0af704f2 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingFireProtections.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingFireProtections.ts @@ -4,8 +4,8 @@ import { buildDescriptionField, buildTextField, } from '@island.is/application/core' -import { housingFireProtections } from '../../lib/messages' import { Routes } from '../../lib/constants' +import { housingFireProtections } from '../../lib/messages' export const RentalHousingFireProtections = buildSubSection({ id: Routes.FIREPROTECTIONS, diff --git a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingLandlordInfo.ts b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingLandlordInfo.ts index 2314a8617e61..c89304cbb0c9 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingLandlordInfo.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingLandlordInfo.ts @@ -5,8 +5,8 @@ import { } from '@island.is/application/core' import { formatNationalId, formatPhoneNumber } from '../../lib/utils' import { IS_REPRESENTATIVE } from '../../lib/constants' -import { landlordDetails } from '../../lib/messages' import { Routes } from '../../lib/constants' +import { landlordDetails } from '../../lib/messages' export const RentalHousingLandlordInfo = buildSubSection({ id: Routes.LANDLORDINFORMATION, diff --git a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingSpecialProvisions.ts b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingSpecialProvisions.ts index 1673cb2aa480..6ab6c7a26923 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingSpecialProvisions.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingSpecialProvisions.ts @@ -4,8 +4,8 @@ import { buildDescriptionField, buildTextField, } from '@island.is/application/core' -import { specialProvisions } from '../../lib/messages' import { Routes } from '../../lib/constants' +import { specialProvisions } from '../../lib/messages' export const RentalHousingSpecialProvisions = buildSubSection({ id: Routes.SPECIALPROVISIONS, diff --git a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingTenantInfo.ts b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingTenantInfo.ts index 685967be8019..f6310f3e1981 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingTenantInfo.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingTenantInfo.ts @@ -5,8 +5,8 @@ import { } from '@island.is/application/core' import { formatNationalId, formatPhoneNumber } from '../../lib/utils' import { IS_REPRESENTATIVE } from '../../lib/constants' -import { tenantDetails } from '../../lib/messages' import { Routes } from '../../lib/constants' +import { tenantDetails } from '../../lib/messages' export const RentalHousingTenantInfo = buildSubSection({ id: Routes.TENANTINFORMATION, diff --git a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingUserRole.ts b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingUserRole.ts index 254b8ce44a06..6ccee848c559 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingUserRole.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalHousingInfo/rentalHousingUserRole.ts @@ -3,9 +3,8 @@ import { buildMultiField, buildRadioField, } from '@island.is/application/core' - -import { userRole } from '../../lib/messages' import { getUserRoleOptions } from '../../lib/utils' +import { userRole } from '../../lib/messages' export const RentalHousingUserRole = buildSubSection({ id: 'userRole', diff --git a/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodAmount.ts b/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodAmount.ts index a2872d5aa684..c83b0018d052 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodAmount.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodAmount.ts @@ -62,14 +62,6 @@ export const RentalPeriodAmount = buildSubSection({ options: getRentalAmountIndexTypes(), defaultValue: RentalAmountIndexTypes.CONSUMER_PRICE_INDEX, condition: rentalAmountConnectedToIndex, - width: 'half', - }), - buildTextField({ - id: 'rentalAmount.indexValue', - title: rentalAmount.indexValueLabel, - placeholder: rentalAmount.indexValuePlaceholder, - width: 'half', - condition: rentalAmountConnectedToIndex, }), buildCheckboxField({ id: 'rentalAmount.isIndexConnected', diff --git a/libs/application/templates/rental-agreement/src/forms/signature/signature.ts b/libs/application/templates/rental-agreement/src/forms/signature/signature.ts new file mode 100644 index 000000000000..7bbb61be1d49 --- /dev/null +++ b/libs/application/templates/rental-agreement/src/forms/signature/signature.ts @@ -0,0 +1,25 @@ +import { + buildDescriptionField, + buildMultiField, + buildSection, +} from '@island.is/application/core' +import { signature } from '../../lib/messages' + +export const Signature = buildSection({ + id: 'signature', + title: signature.sectionName, + children: [ + buildMultiField({ + id: 'signature', + title: signature.pageTitle, + description: signature.pageDescription, + children: [ + buildDescriptionField({ + id: 'signature.description', + title: 'signature.signatureDescription', + titleVariant: 'h3', + }), + ], + }), + ], +}) diff --git a/libs/application/templates/rental-agreement/src/forms/summary/summary.ts b/libs/application/templates/rental-agreement/src/forms/summary/summary.ts index 5a1f198bcae6..c08784ca7ba2 100644 --- a/libs/application/templates/rental-agreement/src/forms/summary/summary.ts +++ b/libs/application/templates/rental-agreement/src/forms/summary/summary.ts @@ -1,14 +1,24 @@ -import { buildCustomField, buildSection } from '@island.is/application/core' +import { + buildCustomField, + buildMultiField, + buildSection, +} from '@island.is/application/core' import { summary } from '../../lib/messages' export const Summary = buildSection({ id: 'summary', title: summary.sectionName, children: [ - buildCustomField({ - id: 'summaryComponent', + buildMultiField({ + id: 'summary', title: '', - component: 'Summary', + children: [ + buildCustomField({ + id: 'summaryComponent', + title: '', + component: 'Summary', + }), + ], }), ], }) diff --git a/libs/application/templates/rental-agreement/src/lib/dataSchema.ts b/libs/application/templates/rental-agreement/src/lib/dataSchema.ts index cc7b92d9d2a4..88d364b5b613 100644 --- a/libs/application/templates/rental-agreement/src/lib/dataSchema.ts +++ b/libs/application/templates/rental-agreement/src/lib/dataSchema.ts @@ -22,11 +22,6 @@ const isValidMeterStatus = (value: string) => { return meterStatusRegex.test(value) } -const isValidIndexValue = (value: string) => { - const indexValueRegex = /^\d{1,10}(\.\d{3})*(,\d)?$/ - return indexValueRegex.test(value) -} - const checkIfNegative = (inputNumber: string) => { if (Number(inputNumber) < 0) { return false @@ -258,25 +253,6 @@ const rentalAmount = z isPaymentInsuranceRequired: z.string().array().optional(), }) .superRefine((data, ctx) => { - if (data.isIndexConnected && data.isIndexConnected.includes(TRUE)) { - if (!data.indexValue?.trim().length) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Custom error message', - params: m.rentalAmount.indexValueRequiredError, - path: ['indexValue'], - }) - } - if (data.indexValue && !isValidIndexValue(data.indexValue)) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Custom error message', - params: m.rentalAmount.indexValueValidationError, - path: ['indexValue'], - }) - } - } - if ( data.paymentDateOptions && data.paymentDateOptions.includes(RentalAmountPaymentDateOptions.OTHER) && diff --git a/libs/application/templates/rental-agreement/src/lib/messages/signature.ts b/libs/application/templates/rental-agreement/src/lib/messages/signature.ts index 81ad4f332d02..7f9a0c62d445 100644 --- a/libs/application/templates/rental-agreement/src/lib/messages/signature.ts +++ b/libs/application/templates/rental-agreement/src/lib/messages/signature.ts @@ -1,5 +1,20 @@ import { defineMessages } from 'react-intl' export const signature = defineMessages({ - // TODO: Add translations + sectionName: { + id: 'ra.application:summary.sectionName', + defaultMessage: 'Undirritun', + description: 'Name of the summary section', + }, + pageTitle: { + id: 'ra.application:summary.pageTitle', + defaultMessage: 'Undirritun', + description: 'Title of the summary page', + }, + pageDescription: { + id: 'ra.application:summary.pageDescription', + defaultMessage: + 'Þegar samningur er sendur í undirritun fá aðilar samnings SMS og tölvupóst frá HMS með beiðni um rafræna undirritun. Þegar allir aðilar hafa undirritað er samningurinn fullkláraður og skráist sjálfkrafa í leiguskrá HMS.', + description: 'Description of the summary page', + }, }) diff --git a/libs/application/templates/rental-agreement/src/lib/messages/summary.ts b/libs/application/templates/rental-agreement/src/lib/messages/summary.ts index 327fc990e08b..0b6ad279ed59 100644 --- a/libs/application/templates/rental-agreement/src/lib/messages/summary.ts +++ b/libs/application/templates/rental-agreement/src/lib/messages/summary.ts @@ -331,4 +331,27 @@ export const summary = defineMessages({ defaultMessage: 'Afrita hlekk', description: 'Share link copy button label', }, + + // Alert message for missing information + alertMissingInfoTitle: { + id: 'ra.application:summary.alertMissingInfoTitle', + defaultMessage: + 'Ekki er hægt að halda áfram í undirritun fyrr en eftirfarandi upplýsingar hafa verið fylltar út:', + description: 'Missing information alert title', + }, + alertMissingInfoFireProtections: { + id: 'ra.application:summary.alertMissingInfoFireProtections', + defaultMessage: 'Staða brunavarna í húsnæðinu', + description: 'Missing information alert fire protections', + }, + alertMissingInfoCondition: { + id: 'ra.application:summary.alertMissingInfoCondition', + defaultMessage: 'Ástand húsnæðis', + description: 'Missing information alert condition', + }, + alertMissingInfoOtherFees: { + id: 'ra.application:summary.alertMissingInfoOtherFees', + defaultMessage: 'Önnur gjöld', + description: 'Missing information alert other fees', + }, })