Skip to content

Commit

Permalink
Merge branch 'main' into feat/mms-contacts-page
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 16, 2025
2 parents 35c8d5a + caa3127 commit 213f8f4
Show file tree
Hide file tree
Showing 26 changed files with 470 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ export class UpdateCaseInput {
@Field(() => ID, { nullable: true })
readonly mergeCaseId?: string

@Allow()
@IsOptional()
@Field(() => String, { nullable: true })
readonly mergeCaseNumber?: string

@Allow()
@IsOptional()
@Field(() => String, { nullable: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ export class Case {
@Field(() => [Case], { nullable: true })
readonly mergedCases?: Case[]

@Field(() => String, { nullable: true })
readonly mergeCaseNumber?: string

@Field(() => [CivilClaimant], { nullable: true })
readonly civilClaimants?: CivilClaimant[]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.addColumn(
'case',
'merge_case_number',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction: t },
),
]),
)
},
async down(queryInterface) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.removeColumn('case', 'merge_case_number', {
transaction: t,
}),
)
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export interface UpdateCase
| 'judgeId'
| 'courtSessionType'
| 'mergeCaseId'
| 'mergeCaseNumber'
> {
type?: CaseType
state?: CaseState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,11 @@ export class UpdateCaseDto {
@ApiPropertyOptional({ type: String })
readonly mergeCaseId?: string

@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String })
readonly mergeCaseNumber?: string

@IsOptional()
@IsString()
@ApiPropertyOptional({ type: String })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const districtCourtFields: (keyof UpdateCaseDto)[] = [
'indictmentDecision',
'courtSessionType',
'mergeCaseId',
'mergeCaseNumber',
]

const courtOfAppealsFields: (keyof UpdateCaseDto)[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1061,13 +1061,21 @@ export class Case extends Model {
@ApiPropertyOptional({ type: () => Case })
mergeCase?: Case

// /**********
// * The cases that have been merged in to the current case - only used if the case was merged
// **********/
/**********
* The cases that have been merged in to the current case - only used if the case was merged
**********/
@HasMany(() => Case, 'mergeCaseId')
@ApiPropertyOptional({ type: () => Case })
mergedCases?: Case[]

/**********
* The court case number this case was merged in to - only used if the case was merged
* with a case that is not in RVG
**********/
@Column({ type: DataType.STRING, allowNull: true })
@ApiPropertyOptional({ type: String })
mergeCaseNumber?: string

/**********
* Indicates whether a case should include any civil claims -
* optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ query Case($input: CaseQueryInput!) {
caseFilesSharedWithSpokesperson
isSpokespersonConfirmed
}
mergeCaseNumber
civilDemands
hasCivilClaims
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,6 @@ mutation UpdateCase($input: UpdateCaseInput!) {
mergeCase {
id
}
mergeCaseNumber
}
}
2 changes: 1 addition & 1 deletion apps/native/app/src/messages/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ export const is = {
'health.overview.insuredFrom': 'Sjúkratrygging frá',
'health.overview.status': 'Staða',
'health.overview.notInsured': 'Þú ert ekki með sjúkratryggingu',
'health.overview.coPayments': 'Greiðsluþáttaka',
'health.overview.coPayments': 'Greiðsluþátttaka',
'health.overview.maxMonthlyPayment': 'Hámarksgreiðslan þín á mánuði',
'health.overview.paymentLimit': 'Greiðslumark',
'health.overview.paymentCredit': 'Inneign',
Expand Down
2 changes: 2 additions & 0 deletions libs/application/core/src/lib/fieldBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export const buildAsyncSelectField = (
backgroundColor = 'blue',
isSearchable,
isMulti,
updateOnSelect,
} = data

return {
Expand All @@ -255,6 +256,7 @@ export const buildAsyncSelectField = (
backgroundColor,
isSearchable,
isMulti,
updateOnSelect,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const childSupportPayments = {
alert: {
id: 'crc.application:section.arrangement.childSupportPayment.alert',
defaultMessage:
'Ef um samkomulag um framfærslu er að ræða þá er hvorki hægt að krefjast milligöngu Tryggingastofnunar eða krefjast fjarnáms fyrir meðlagsgreiðslum.',
'Ef um samkomulag um framfærslu er að ræða þá er hvorki hægt að krefjast milligöngu Tryggingastofnunar krefjast fjarnáms fyrir meðlagsgreiðslum.',
description: 'Child support payments page alert',
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { getApplicationAnswers } from '../../lib/newPrimarySchoolUtils'

import { AllergiesAndIntolerances } from './review-groups/AllergiesAndIntolerances'
import { Child } from './review-groups/Child'
import { FreeSchoolMeal } from './review-groups/FreeSchoolMeal'
import { Languages } from './review-groups/Languages'
import { Parents } from './review-groups/Parents'
import { ReasonForApplication } from './review-groups/ReasonForApplication'
Expand Down Expand Up @@ -166,6 +167,7 @@ export const Review: FC<ReviewScreenProps> = ({
)}
<School {...childProps} />
<Languages {...childProps} />
<FreeSchoolMeal {...childProps} />
<AllergiesAndIntolerances {...childProps} />
<Support {...childProps} />
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { coreErrorMessages } from '@island.is/application/core'
import { YES } from '@island.is/application/types'
import {
DataValue,
RadioValue,
ReviewGroup,
} from '@island.is/application/ui-components'
import {
GridColumn,
GridRow,
SkeletonLoader,
Stack,
} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { useFriggOptions } from '../../../hooks/useFriggOptions'
import { OptionsType } from '../../../lib/constants'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import {
getApplicationAnswers,
getSelectedOptionLabel,
} from '../../../lib/newPrimarySchoolUtils'
import { ReviewGroupProps } from './props'

export const FreeSchoolMeal = ({
application,
editable,
goToScreen,
}: ReviewGroupProps) => {
const { formatMessage } = useLocale()
const { acceptFreeSchoolLunch, hasSpecialNeeds, specialNeedsType } =
getApplicationAnswers(application.answers)

const {
options: specialNeedsTypeOptions,
loading,
error,
} = useFriggOptions(OptionsType.ALLERGY) // TODO: Update when Júní has updated key-options

return (
<ReviewGroup
isEditable={editable}
editAction={() => goToScreen?.('freeSchoolMeal')}
>
<Stack space={2}>
{acceptFreeSchoolLunch === YES && hasSpecialNeeds === YES && loading ? (
<SkeletonLoader height={40} width="80%" borderRadius="large" />
) : (
<>
<GridRow>
<GridColumn span="10/12">
<RadioValue
label={formatMessage(
newPrimarySchoolMessages.differentNeeds
.acceptFreeSchoolLunch,
)}
value={acceptFreeSchoolLunch}
/>
</GridColumn>
</GridRow>
{acceptFreeSchoolLunch === YES && (
<GridRow>
<GridColumn span="12/12">
<RadioValue
label={formatMessage(
newPrimarySchoolMessages.differentNeeds.hasSpecialNeeds,
)}
value={hasSpecialNeeds}
/>
</GridColumn>
</GridRow>
)}
{acceptFreeSchoolLunch === YES && hasSpecialNeeds === YES && (
<GridRow>
<GridColumn span="12/12">
<DataValue
label={formatMessage(
newPrimarySchoolMessages.differentNeeds.specialNeedsType,
)}
value={getSelectedOptionLabel(
specialNeedsTypeOptions,
specialNeedsType,
)}
error={
error
? formatMessage(coreErrorMessages.failedDataProvider)
: undefined
}
/>
</GridColumn>
</GridRow>
)}
</>
)}
</Stack>
</ReviewGroup>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import {
buildAlertMessageField,
buildCustomField,
buildMultiField,
buildRadioField,
buildSubSection,
} from '@island.is/application/core'
import { NO, YES } from '@island.is/application/types'
import { OptionsType } from '../../../lib/constants'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import { getApplicationAnswers } from '../../../lib/newPrimarySchoolUtils'

export const freeSchoolMealSubSection = buildSubSection({
id: 'freeSchoolMealSubSection',
title: newPrimarySchoolMessages.differentNeeds.freeSchoolMealSubSectionTitle,
children: [
buildMultiField({
id: 'freeSchoolMeal',
title:
newPrimarySchoolMessages.differentNeeds.freeSchoolMealSubSectionTitle,
description:
newPrimarySchoolMessages.differentNeeds.freeSchoolMealDescription,
children: [
buildRadioField({
id: 'freeSchoolMeal.acceptFreeSchoolLunch',
title: newPrimarySchoolMessages.differentNeeds.acceptFreeSchoolLunch,
width: 'half',
required: true,
options: [
{
label: newPrimarySchoolMessages.shared.yes,
value: YES,
},
{
label: newPrimarySchoolMessages.shared.no,
value: NO,
},
],
}),
buildRadioField({
id: 'freeSchoolMeal.hasSpecialNeeds',
title: newPrimarySchoolMessages.differentNeeds.hasSpecialNeeds,
width: 'half',
required: true,
space: 4,
options: [
{
label: newPrimarySchoolMessages.shared.yes,
value: YES,
},
{
label: newPrimarySchoolMessages.shared.no,
value: NO,
},
],
condition: (answers) => {
const { acceptFreeSchoolLunch } = getApplicationAnswers(answers)

return acceptFreeSchoolLunch === YES
},
}),
buildCustomField(
{
id: 'freeSchoolMeal.specialNeedsType',
title: newPrimarySchoolMessages.differentNeeds.specialNeedsType,
component: 'FriggOptionsAsyncSelectField',
condition: (answers) => {
const { acceptFreeSchoolLunch, hasSpecialNeeds } =
getApplicationAnswers(answers)

return acceptFreeSchoolLunch === YES && hasSpecialNeeds === YES
},
},
{
optionsType: OptionsType.ALLERGY, // TODO: Update when Júní has updated key-options
placeholder:
newPrimarySchoolMessages.differentNeeds
.specialNeedsTypePlaceholder,
},
),
buildAlertMessageField({
id: 'freeSchoolMeal.foodAllergiesAlertMessage',
title: newPrimarySchoolMessages.shared.alertTitle,
message:
newPrimarySchoolMessages.differentNeeds.foodAllergiesAlertMessage,
doesNotRequireAnswer: true,
alertType: 'info',
condition: (answers) => {
const { acceptFreeSchoolLunch, hasSpecialNeeds } =
getApplicationAnswers(answers)

return acceptFreeSchoolLunch === YES && hasSpecialNeeds === YES
},
}),
],
}),
],
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ReasonForApplicationOptions } from '../../../lib/constants'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import { getApplicationAnswers } from '../../../lib/newPrimarySchoolUtils'
import { allergiesAndIntolerancesSubSection } from './allergiesAndIntolerancesSubSection'
import { freeSchoolMealSubSection } from './freeSchoolMealSubSection'
import { languageSubSection } from './languageSubSection'
import { supportSubSection } from './supportSubSection'

Expand All @@ -16,6 +17,7 @@ export const differentNeedsSection = buildSection({
},
children: [
languageSubSection,
freeSchoolMealSubSection,
allergiesAndIntolerancesSubSection,
supportSubSection,
],
Expand Down
Loading

0 comments on commit 213f8f4

Please sign in to comment.