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): Project structure & minimal functionality #16214

Open
wants to merge 107 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
b9803ad
Init rental-agreement project
hebaulf Sep 13, 2024
fc43b61
Merge from main and fix conflict.
hebaulf Sep 18, 2024
fda88fb
Modify rental agreement template to appear on web, wip.
hebaulf Sep 18, 2024
35e9a6e
Update templates and fileds. wip.
hebaulf Sep 19, 2024
3cf51da
Update rental-agreement template, translations, states etc. WIP.
hebaulf Sep 23, 2024
24cc4c2
Merge branch 'main' into rental-agreement-application
hebaulf Sep 23, 2024
31da123
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Sep 24, 2024
a8e7ea4
Revert "Modify rental agreement template to appear on web, wip."
hebaulf Sep 24, 2024
6382775
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Sep 24, 2024
04f47a0
Reverted rental-agreement src files to previous commit to fix error.
hebaulf Sep 25, 2024
90bc1a3
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Sep 25, 2024
e24c4c2
Populate form. Add basic dataSchema
hebaulf Sep 25, 2024
976e653
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Sep 25, 2024
d8e8710
Broke the form down into smaller files.
addi Sep 26, 2024
5f12e17
Reconfigure and split translations/messages files.
hebaulf Sep 26, 2024
9644487
Merge branch 'rental-agreement-application' of github.com:island-is/i…
hebaulf Sep 26, 2024
2e09c87
Rename messages folder and files. Remove unused imports from form.ts
hebaulf Sep 26, 2024
576ba16
Update message file names to represent its form counterpart. Change h…
hebaulf Sep 26, 2024
51cbdaf
Add feature flag for application.
hebaulf Sep 27, 2024
6d4d8c8
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Sep 27, 2024
d6dde5c
Remvoed vite / vitetest
addi Sep 30, 2024
4cf1116
chore: nx format:write update dirty files
andes-it Sep 30, 2024
d856e4c
fix import path in summary.ts.
hebaulf Oct 1, 2024
b760c36
Merge branch 'main' into rental-agreement-application
addi Oct 1, 2024
4cc9e59
Updated institution ids.
addi Oct 2, 2024
e69240f
Merge branch 'main' into rental-agreement-application
addi Oct 2, 2024
67575de
feat(rental-agreement): Register property section flow (#16259)
hebaulf Oct 7, 2024
75487eb
feat(rental-agreement): External data (#16290)
hebaulf Oct 7, 2024
ec87bb9
Merge branch 'main' into rental-agreement-application
addi Oct 7, 2024
7cffdc8
Merge branch 'main' into rental-agreement-application
addi Oct 8, 2024
80ef756
Update landlord and tenant subsections. Minor fixes on property info.…
hebaulf Oct 9, 2024
1ea4b72
Merge branch 'main' into rental-agreement-application
addi Oct 9, 2024
c2d2f06
feat(rental-agreement-application): Rental agreement form split (#16339)
hebaulf Oct 9, 2024
f28468f
feat(rental-agreement-application): Special provisions subsection (#1…
hebaulf Oct 10, 2024
552aafd
feat(rental-agreement-application): Added fire protections. (#16366)
addi Oct 14, 2024
97d5fc3
feat(rental-agreement-application): Property condition subsection (#1…
hebaulf Oct 16, 2024
ff9a101
chore(rental-agreement-application): Enums for filed option values (#…
hebaulf Oct 16, 2024
a2a5a80
Merge branch 'main' into rental-agreement-application
addi Oct 17, 2024
12777a1
Merge branch 'main' into rental-agreement-application
addi Oct 17, 2024
0adf4d4
added support for rental period. (#16434)
addi Oct 17, 2024
f207ada
Fixed typos and added number only to fields. (#16460)
addi Oct 18, 2024
ef97cf9
Merge branch 'main' into rental-agreement-application
addi Oct 18, 2024
6624078
Merge branch 'main' into rental-agreement-application
addi Oct 18, 2024
315fb89
Merge branch 'rental-agreement-application' of https://github.com/isl…
addi Oct 18, 2024
198dfa4
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Oct 21, 2024
ec89c6b
Remove unused form
hebaulf Oct 21, 2024
9cd101f
feat(rental-agreement-application): Rental amount subsection (#16482)
hebaulf Oct 22, 2024
f7920e4
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Oct 30, 2024
e1d99a8
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Oct 30, 2024
fbd631d
feat(rental-agreement-application): Other fees subsection (#16650)
hebaulf Oct 31, 2024
506ab90
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Oct 31, 2024
fe956de
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Oct 31, 2024
aa5bb74
feat(rental-agreement): security deposit (#16661)
addi Oct 31, 2024
5004b3d
Merge branch 'main' into rental-agreement-application
addi Nov 4, 2024
3707ee2
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Nov 5, 2024
e818471
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Nov 6, 2024
f8727fd
chore(rental-agreement-application): Coordinate build components id's…
hebaulf Nov 6, 2024
b05d407
feat(rental-agreement-application): Validation for rental period (#16…
hebaulf Nov 11, 2024
dff1989
feat(rental-agreement-application): Register property-class-group val…
hebaulf Nov 11, 2024
53e8bbb
Merge from main
hebaulf Nov 11, 2024
de9c16e
Add validation for rentalAmount.indexValsue field (#16798)
hebaulf Nov 12, 2024
3e7fdff
Merge branch 'main' into rental-agreement-application
addi Nov 12, 2024
ff08c9e
Fixed ui and bugs. (#16819)
addi Nov 12, 2024
4b67282
Update rentalPeriodSecurityDeposit.ts
addi Nov 12, 2024
fd91f74
Merge branch 'main' into rental-agreement-application
addi Nov 13, 2024
814de03
Merge branch 'main' into rental-agreement-application
addi Nov 13, 2024
4821053
Merge branch 'main' into rental-agreement-application
addi Nov 14, 2024
f52b2a7
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Nov 17, 2024
f213a09
Merge branch 'main' into rental-agreement-application
addi Nov 18, 2024
475d89c
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Nov 19, 2024
32a7663
feat(rental-agreement): Summary (#16911)
hebaulf Nov 21, 2024
f41c994
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Nov 25, 2024
7a2d65d
Merge branch 'main' into rental-agreement-application
addi Nov 25, 2024
a29ef22
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Nov 25, 2024
c529e7c
Merge branch 'rental-agreement-application' of github.com:island-is/i…
hebaulf Nov 25, 2024
f567154
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Nov 26, 2024
d312318
feat(rental-agreement): Updates for summary (#17016)
hebaulf Nov 27, 2024
e9161ac
Added user role screen. (#17080)
addi Nov 28, 2024
bbdeac6
feat(rental-agreement): Summary updates (#17066)
hebaulf Nov 29, 2024
5e5d008
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 2, 2024
b074142
Merge branch 'rental-agreement-application' of github.com:island-is/i…
hebaulf Dec 2, 2024
15275d2
Merge from main and fix type error
hebaulf Dec 2, 2024
3e71ba1
Remove code snippet giving error
hebaulf Dec 2, 2024
ff92781
Fix error and update landlord info section
hebaulf Dec 2, 2024
d6c62be
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 2, 2024
861e5c8
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 2, 2024
fab7e30
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 5, 2024
fa8f6ba
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 5, 2024
893357e
feat(rental-agreement): NationalIdWithName in repeatableTableField (#…
hebaulf Dec 6, 2024
7779943
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 11, 2024
887b460
Merge branch 'main' into rental-agreement-application
addi Dec 12, 2024
1b22da7
Merge branch 'main' into rental-agreement-application
addi Dec 12, 2024
27d3b06
Merge branch 'rental-agreement-application' of github.com:island-is/i…
hebaulf Dec 13, 2024
f571f40
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 13, 2024
cc6c951
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 16, 2024
35b6634
Merge branch 'main' into rental-agreement-application
addi Dec 16, 2024
27d3613
Merge branch 'main' into rental-agreement-application
addi Dec 16, 2024
09a4567
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 16, 2024
8d84276
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Dec 18, 2024
8014252
feat(rental-agreement): Summary change form buttons (#17286)
hebaulf Dec 19, 2024
12bc699
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Jan 2, 2025
330c08b
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Jan 3, 2025
93f5628
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Jan 6, 2025
627293f
feat(rental-agreement): Continue to signing screen (#17392)
hebaulf Jan 6, 2025
b83fb2e
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Jan 7, 2025
328f857
Merge branch 'main' of github.com:island-is/island.is into rental-agr…
hebaulf Jan 8, 2025
a1627ee
Merge from main and fix conflicts.
hebaulf Jan 10, 2025
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
2 changes: 2 additions & 0 deletions libs/application/template-loader/src/lib/templateLoaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ const templates: Record<ApplicationTypes, () => Promise<unknown>> = {
import('@island.is/application/templates/new-primary-school'),
[ApplicationTypes.MACHINE_REGISTRATION]: () =>
import('@island.is/application/templates/aosh/register-new-machine'),
[ApplicationTypes.RENTAL_AGREEMENT]: () =>
import('@island.is/application/templates/rental-agreement'),
[ApplicationTypes.SECONDARY_SCHOOL]: () =>
import('@island.is/application/templates/secondary-school'),
}
Expand Down
4 changes: 4 additions & 0 deletions libs/application/templates/rental-agreement/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@nx/react/babel"],
"plugins": []
}
10 changes: 10 additions & 0 deletions libs/application/templates/rental-agreement/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:@nx/react", "../../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"rules": {},
"overrides": [
{ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "rules": {} },
{ "files": ["*.ts", "*.tsx"], "rules": {} },
{ "files": ["*.js", "*.jsx"], "rules": {} }
]
}
7 changes: 7 additions & 0 deletions libs/application/templates/rental-agreement/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# application-templates-rental-agreement

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test application-templates-rental-agreement` to execute the unit tests via [Vitest](https://vitest.dev/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
]
}
16 changes: 16 additions & 0 deletions libs/application/templates/rental-agreement/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
export default {
preset: './jest.preset.js',
rootDir: '../../../..',
roots: [__dirname],
transform: {
'^.+\\.[tj]sx?$': [
'babel-jest',
{ cwd: __dirname, configFile: `${__dirname}/babel-jest.config.json` },
],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory:
'<rootDir>/coverage/libs/application/templates/rental-agreement',
displayName: 'application-templates-rental-agreement',
}
28 changes: 28 additions & 0 deletions libs/application/templates/rental-agreement/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "application-templates-rental-agreement",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/application/templates/rental-agreement/src",
"projectType": "library",
"tags": ["scope:application-system", "lib:application-system"],
"generators": {},
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "libs/application/templates/rental-agreement/jest.config.ts"
},
"outputs": [
"{workspaceRoot}/coverage/libs/application/templates/rental-agreement"
]
},
"extract-strings": {
"executor": "nx:run-commands",
"options": {
"command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract libs/application/templates/rental-agreement/src/lib/messages.ts"
}
}
}
}
20 changes: 20 additions & 0 deletions libs/application/templates/rental-agreement/src/assets/Logo.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export {
UserProfileApi,
NationalRegistryUserApi,
NationalRegistrySpouseApi,
} from '@island.is/application/types'
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
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 './components/KeyValue'
import { SummaryCardRow } from './components/SummaryCardRow'
import { SummaryCard } from './components/SummaryCard'

interface Props extends FieldBaseProps {
goToScreen?: (id: string) => void
landlordsRoute?: Routes
tenantsRoute?: Routes
}

export const ApplicantsRepresentativesSummary: FC<Props> = ({ ...props }) => {
const { formatMessage } = useLocale()
const { application, goToScreen, landlordsRoute, tenantsRoute } = props
const answers = application.answers as RentalAgreement

const landlordListHasRepresentatives = answers.landlordInfo.table.some(
(landlord) =>
landlord.isRepresentative && landlord.isRepresentative.length > 0,
)
const tenantListHasRepresentatives = answers.tenantInfo.table.some(
(tenant) => tenant.isRepresentative && tenant.isRepresentative.length > 0,
)

const landlordRepresentatives = answers.landlordInfo.table?.filter(
(landlordRep) =>
landlordRep.isRepresentative && landlordRep.isRepresentative.length > 0,
)
const tenantRepresentatives = answers.tenantInfo.table.filter(
(tenantRep) =>
tenantRep.isRepresentative && tenantRep.isRepresentative.length > 0,
)

if (landlordListHasRepresentatives || tenantListHasRepresentatives) {
return (
<>
{landlordListHasRepresentatives ? (
<SummaryCard
cardLabel={formatMessage(summary.landlordsRepresentativeLabel)}
>
{landlordRepresentatives?.map((landlordRep) => {
return (
<SummaryCardRow
key={landlordRep.nationalIdWithName?.nationalId}
editAction={goToScreen}
route={landlordsRoute}
>
<GridColumn span={['12/12']}>
<KeyValue
labelVariant="h5"
labelAs="p"
label={landlordRep.nationalIdWithName?.name as string}
value={`${formatMessage(
summary.nationalIdLabel,
)}${formatNationalId(
landlordRep.nationalIdWithName?.nationalId || '-',
)}`}
gap={'smallGutter'}
/>
</GridColumn>

<GridColumn span={['12/12', '8/12']}>
<KeyValue
label={summary.emailLabel}
value={landlordRep.email || '-'}
/>
</GridColumn>
<GridColumn span={['12/12', '4/12']}>
<KeyValue
label={summary.phoneNumberLabel}
value={formatPhoneNumber(landlordRep.phone || '-')}
/>
</GridColumn>
</SummaryCardRow>
)
})}
</SummaryCard>
) : (
''
)}
{tenantListHasRepresentatives ? (
<SummaryCard
cardLabel={formatMessage(summary.tenantsRepresentativeLabel)}
>
{tenantRepresentatives.map((tenantRep) => {
return (
<SummaryCardRow
key={tenantRep.nationalIdWithName?.nationalId}
editAction={props.goToScreen}
route={tenantsRoute}
>
<GridColumn span={['12/12']}>
<KeyValue
labelVariant="h5"
labelAs="p"
label={tenantRep.nationalIdWithName?.name as string}
value={`${formatMessage(
summary.nationalIdLabel,
)}${formatNationalId(
tenantRep.nationalIdWithName?.nationalId || '-',
)}`}
gap={'smallGutter'}
/>
</GridColumn>
<GridColumn span={['12/12', '8/12']}>
<KeyValue
label={summary.emailLabel}
value={tenantRep.email || '-'}
/>
</GridColumn>
<GridColumn span={['12/12', '4/12']}>
<KeyValue
label={summary.phoneNumberLabel}
value={formatPhoneNumber(tenantRep.phone || '-')}
/>
</GridColumn>
</SummaryCardRow>
)
})}
</SummaryCard>
) : (
''
)}
</>
)
} else {
return ''
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { GridColumn } from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { RentalAgreement } from '../../lib/dataSchema'
import { Routes } from '../../lib/constants'
import { formatNationalId, formatPhoneNumber } from '../../lib/utils'
import { KeyValue } from './components/KeyValue'
import { SummaryCard } from './components/SummaryCard'
import { SummaryCardRow } from './components/SummaryCardRow'
import { summary } from '../../lib/messages'

type Props = {
answers: RentalAgreement
goToScreen?: (id: string) => void
landlordsRoute?: Routes
tenantsRoute?: Routes
}

export const ApplicantsSummary = ({
answers,
goToScreen,
landlordsRoute,
tenantsRoute,
}: Props) => {
const { formatMessage } = useLocale()

const landlordListWithoutRepresentatives = answers.landlordInfo.table.filter(
(landlord) =>
!landlord.isRepresentative || landlord.isRepresentative.length === 0,
)

const tenantListWithoutRepresentatives = answers.tenantInfo.table.filter(
(tenant) =>
!tenant.isRepresentative || tenant.isRepresentative.length === 0,
)

return (
<>
<SummaryCard
cardLabel={
landlordListWithoutRepresentatives &&
landlordListWithoutRepresentatives.length > 1
? formatMessage(summary.landlordsHeaderPlural)
: formatMessage(summary.landlordsHeader)
}
>
{landlordListWithoutRepresentatives?.map((landlord) => {
return (
<SummaryCardRow
key={landlord.nationalIdWithName?.nationalId}
editAction={goToScreen}
route={landlordsRoute}
>
<GridColumn span={['12/12']}>
<KeyValue
labelVariant="h5"
labelAs="p"
label={landlord.nationalIdWithName?.name as string}
value={`${formatMessage(
summary.nationalIdLabel,
)}${formatNationalId(
landlord.nationalIdWithName?.nationalId || '-',
)}`}
gap={'smallGutter'}
/>
</GridColumn>
<GridColumn span={['12/12', '8/12']}>
<KeyValue
label={summary.emailLabel}
value={landlord.email || ''}
/>
</GridColumn>
<GridColumn span={['12/12', '4/12']}>
<KeyValue
label={summary.phoneNumberLabel}
value={formatPhoneNumber(landlord.phone || '-')}
/>
</GridColumn>
</SummaryCardRow>
)
})}
</SummaryCard>

<SummaryCard
cardLabel={
tenantListWithoutRepresentatives.length > 1
? formatMessage(summary.tenantsHeaderPlural)
: formatMessage(summary.tenantsHeader)
}
>
{tenantListWithoutRepresentatives.map((tenant) => {
return (
<SummaryCardRow
key={tenant.nationalIdWithName?.nationalId}
editAction={goToScreen}
route={tenantsRoute}
>
<GridColumn span={['12/12']}>
<KeyValue
labelVariant="h5"
labelAs="p"
label={tenant.nationalIdWithName?.name as string}
value={`${formatMessage(
summary.nationalIdLabel,
)}${formatNationalId(
tenant.nationalIdWithName?.nationalId || '-',
)}`}
gap={'smallGutter'}
/>
</GridColumn>
<GridColumn span={['12/12', '8/12']}>
<KeyValue
label={summary.emailLabel}
value={tenant.email || '-'}
/>
</GridColumn>
<GridColumn span={['12/12', '4/12']}>
<KeyValue
label={summary.phoneNumberLabel}
value={formatPhoneNumber(tenant.phone || '-')}
/>
</GridColumn>
</SummaryCardRow>
)
})}
</SummaryCard>
</>
)
}
Loading
Loading