-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/mms-contacts-page
- Loading branch information
Showing
26 changed files
with
470 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
apps/judicial-system/backend/migrations/20250115095654-update-case.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}), | ||
) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,5 +224,6 @@ mutation UpdateCase($input: UpdateCaseInput!) { | |
mergeCase { | ||
id | ||
} | ||
mergeCaseNumber | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...plication/templates/new-primary-school/src/fields/Review/review-groups/FreeSchoolMeal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
98 changes: 98 additions & 0 deletions
98
...y-school/src/forms/NewPrimarySchoolForm/differentNeedsSection/freeSchoolMealSubSection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}, | ||
}), | ||
], | ||
}), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.