From b3e832bb517381107dd2072fe9b2bc58f4c472ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20J=C3=B3nsson?= Date: Tue, 12 Nov 2024 13:46:58 +0100 Subject: [PATCH] Fixed ui and bugs. --- .../rentalPeriod/rentalPeriodSecurityDeposit.ts | 15 ++++++--------- .../rental-agreement/src/lib/dataSchema.ts | 2 +- .../lib/messages/rentalInfo/securityDeposit.ts | 13 +++++++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodSecurityDeposit.ts b/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodSecurityDeposit.ts index 5421a4c20bff..71b030f86957 100644 --- a/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodSecurityDeposit.ts +++ b/libs/application/templates/rental-agreement/src/forms/rentalPeriod/rentalPeriodSecurityDeposit.ts @@ -6,6 +6,7 @@ import { buildDescriptionField, buildAlertMessageField, buildHiddenInputWithWatchedValue, + buildRadioField, } from '@island.is/application/core' import { FormValue } from '@island.is/application/types' import { @@ -37,6 +38,7 @@ export const RentalPeriodSecurityDeposit = buildSubSection({ id: 'securityDeposit.securityType', title: m.securityDeposit.typeSelectionTitle, options: getSecurityDepositTypeOptions, + placeholder: m.securityDeposit.typeSelectionPlaceholder, }), // Tegund tryggingar: Bankaábyrgð @@ -134,16 +136,12 @@ export const RentalPeriodSecurityDeposit = buildSubSection({ ) }, }), - buildDescriptionField({ - id: 'securityDeposit.amountTitle', - title: m.securityDeposit.amountHeaderTitle, - titleVariant: 'h3', - space: 5, - }), - buildSelectField({ + buildRadioField({ id: 'securityDeposit.securityAmount', - title: m.securityDeposit.amountSelectionTitle, + title: m.securityDeposit.amountRadioFieldTitle, options: getSecurityAmountOptions, + width: 'half', + space: 3, condition: (answers) => { const securityDeposit = answers.securityDeposit as FormValue return ( @@ -181,7 +179,6 @@ export const RentalPeriodSecurityDeposit = buildSubSection({ return ( securityDeposit && - Boolean(securityDeposit.securityType) && (securityDeposit.securityType === SecurityDepositTypeOptions.MUTUAL_FUND || securityDeposit.securityAmount === diff --git a/libs/application/templates/rental-agreement/src/lib/dataSchema.ts b/libs/application/templates/rental-agreement/src/lib/dataSchema.ts index bfa136568f5d..6b0dc4fdb1de 100644 --- a/libs/application/templates/rental-agreement/src/lib/dataSchema.ts +++ b/libs/application/templates/rental-agreement/src/lib/dataSchema.ts @@ -172,7 +172,7 @@ const securityDeposit = z (data.securityType === SecurityDepositTypeOptions.CAPITAL || data.securityType === SecurityDepositTypeOptions.THIRD_PARTY_GUARANTEE) && - Number(data.rentalAmount) * 3 < Number(data.securityAmount) + Number(data.rentalAmount) * 3 < Number(data.securityAmountOther) ) { ctx.addIssue({ code: z.ZodIssueCode.custom, diff --git a/libs/application/templates/rental-agreement/src/lib/messages/rentalInfo/securityDeposit.ts b/libs/application/templates/rental-agreement/src/lib/messages/rentalInfo/securityDeposit.ts index 1444ec5a383b..595e220dfeab 100644 --- a/libs/application/templates/rental-agreement/src/lib/messages/rentalInfo/securityDeposit.ts +++ b/libs/application/templates/rental-agreement/src/lib/messages/rentalInfo/securityDeposit.ts @@ -33,6 +33,11 @@ export const securityDeposit = defineMessages({ defaultMessage: 'Tegund tryggingar', description: 'security deposit type selection title', }, + typeSelectionPlaceholder: { + id: 'ra.application:securityDeposit.typeSelectionPlaceholder', + defaultMessage: 'Veldu tegund', + description: 'security deposit type selection placeholder', + }, typeSelectionBankGuaranteeTitle: { id: 'ra.application:securityDeposit.typeSelectionBankGuaranteeTitle', defaultMessage: 'Bankaábyrgð', @@ -125,10 +130,10 @@ export const securityDeposit = defineMessages({ defaultMessage: 'Upphæð tryggingar', description: 'security deposit amount header title', }, - amountSelectionTitle: { - id: 'ra.application:securityDeposit.amountSelectionTitle', - defaultMessage: 'Upphæð tryggingar', - description: 'security deposit amount selection title', + amountRadioFieldTitle: { + id: 'ra.application:securityDeposit.amountRadioFieldTitle', + defaultMessage: 'Veldu upphæð', + description: 'security deposit amount radio field title', }, amountSelection1Month: { id: 'ra.application:securityDeposit.amountSelection1Month',