Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rental-agreement): security deposit #16661

Open
wants to merge 1 commit into
base: rental-agreement-application
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ export const RentalPeriodAmount = buildSubSection({
space: 1,
}),
buildTextField({
id: 'rentalAmountInput',
id: 'rentalAmount.amount',
title: m.rentalAmount.inputLabel,
placeholder: m.rentalAmount.inputPlaceholder,
variant: 'currency',
maxLength: 14,
required: true,
}),
buildCheckboxField({
id: 'isRentalAmountIndexConnected',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,222 @@ import {
buildSubSection,
buildMultiField,
buildTextField,
buildSelectField,
buildDescriptionField,
buildAlertMessageField,
buildHiddenInputWithWatchedValue,
} from '@island.is/application/core'

import * as m from '../../lib/messages'
import { FormValue } from '@island.is/application/types'

const messages = m.prerequisites.intro

const securityDepositTypes = [
{
label: m.securityDeposit.typeSelectionBankGuaranteeTitle,
value: 'bankGuarantee',
},
{
label: m.securityDeposit.typeSelectionCapitalTitle,
value: 'capital',
},
{
label: m.securityDeposit.typeSelectionThirdPartyGuaranteeTitle,
value: 'thirdPartyGuarantee',
},
{
label: m.securityDeposit.typeSelectionInsuranceCompanyTitle,
value: 'insuranceCompany',
},
{
label: m.securityDeposit.typeSelectionMutualFundTitle,
value: 'mutualFund',
},
{
label: m.securityDeposit.typeSelectionOtherTitle,
value: 'other',
},
]

const rentalAmountDetails = [
{
label: m.securityDeposit.amountSelection1Month,
value: '1 month',
},
{
label: m.securityDeposit.amountSelection2Month,
value: '2 months',
},
{
label: m.securityDeposit.amountSelection3Month,
value: '3 months',
},
{
label: m.securityDeposit.amountSelectionOther,
value: 'other',
},
]

export const RentalPeriodSecurityDeposit = buildSubSection({
id: 'rentalPeriodSecurityDeposit',
title: 'Trygging',
id: 'securityDeposit.SecurityDeposit',
title: m.securityDeposit.subSectionName,
children: [
buildMultiField({
id: 'rentalPeriodSecurityDepositDetails',
title: 'LeiguTrygging multiFields',
id: 'securityDeposit.Details',
title: m.securityDeposit.pageTitle,
description: m.securityDeposit.pageDescription,
children: [
buildDescriptionField({
id: 'securityDeposit.TypeHeader',
title: m.securityDeposit.typeHeaderTitle,
titleTooltip: m.securityDeposit.typeHeaderToolTip,
titleVariant: 'h3',
}),
buildSelectField({
id: 'securityDeposit.securityType',
title: m.securityDeposit.typeSelectionTitle,
options: securityDepositTypes,
}),
// Tegund tryggingar: Bankaábyrgð
buildTextField({
id: 'securityDeposit.bankGuaranteeInfo',
title: m.securityDeposit.bankGuaranteeInfoTitle,
placeholder: m.securityDeposit.bankGuaranteeInfoPlaceholder,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
securityDeposit.securityType === 'bankGuarantee'
)
},
}),
// Tegund tryggingar: Tryggingarfé
buildDescriptionField({
id: 'securityDeposit.typeCapitalInfo',
title: '',
description: m.securityDeposit.capitalBulletPoints,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
securityDeposit.securityType === 'capital'
)
},
space: 2,
}),
// Tegund tryggingar: Sjálfskuldarábyrgð þriðja aðila
buildTextField({
id: 'securityDeposit.thirdPartyGuaranteeInfo',
title: m.securityDeposit.thirdPartyGuaranteeInfoTitle,
placeholder: m.securityDeposit.thirdPartyGuaranteeInfoPlaceholder,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
securityDeposit.securityType === 'thirdPartyGuarantee'
)
},
}),
// Tegund tryggingar: Leigugreiðslu- og viðskilnaðartrygging
buildTextField({
id: 'rentalPeriodSecurityDepositInput',
title: 'LeiguTrygging textField',
format: 'text',
id: 'securityDeposit.insuranceCompanyInfo',
title: m.securityDeposit.insuranceCompanyInfoTitle,
placeholder: m.securityDeposit.insuranceCompanyInfoPlaceholder,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
securityDeposit.securityType === 'insuranceCompany'
)
},
}),
// Tegund tryggingar: Gjald í samtryggingarsjóð leigusala
buildTextField({
id: 'securityDeposit.mutualFundInfo',
title: m.securityDeposit.mutualFundInfoTitle,
placeholder: m.securityDeposit.mutualFundInfoPlaceholder,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
securityDeposit.securityType === 'mutualFund'
)
},
}),
// Tegund tryggingar: annað
buildTextField({
id: 'securityDeposit.otherInfo',
title: m.securityDeposit.otherInfoTitle,
placeholder: m.securityDeposit.otherInfoPlaceholder,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
securityDeposit.securityType === 'other'
)
},
}),
buildDescriptionField({
id: 'securityDeposit.amountTitle',
title: m.securityDeposit.amountHeaderTitle,
titleTooltip: m.securityDeposit.amountHeaderToolTip,
titleVariant: 'h3',
space: 5,
}),
buildSelectField({
id: 'securityDeposit.securityAmount',
title: m.securityDeposit.amountSelectionTitle,
options: rentalAmountDetails,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
!securityDeposit ||
securityDeposit.securityType === undefined ||
securityDeposit.securityType !== 'mutualFund'
)
},
}),
// Tegund tryggingar: Gjald í samtryggingarsjóð leigusala
buildAlertMessageField({
id: 'securityDeposit.mutualFundAmountInfo',
title: m.securityDeposit.mutualFundAmountInfoTitle,
alertType: 'info',
message: m.securityDeposit.mutualFundAmountInfoMessage,
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue
return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
securityDeposit.securityType === 'mutualFund'
)
},
}),
buildTextField({
id: 'securityDeposit.securityAmountOther',
title: m.securityDeposit.securityAmountOtherTitle,
placeholder: m.securityDeposit.securityAmountOtherPlaceholder,
variant: 'currency',
condition: (answers) => {
const securityDeposit = answers.securityDeposit as FormValue

return (
securityDeposit &&
Boolean(securityDeposit.securityType) &&
(securityDeposit.securityType === 'mutualFund' ||
securityDeposit.securityAmount === 'other')
)
},
}),
buildHiddenInputWithWatchedValue({
id: 'securityDeposit.rentalAmount',
watchValue: 'rentalAmount.amount',
}),
],
}),
Expand Down
Loading
Loading