Skip to content

Commit

Permalink
Feat/admin 2551 update application view in line with character update…
Browse files Browse the repository at this point in the history
…s in application form (#2578)

* update qualification info fields

* amend character information wordings

* fix
  • Loading branch information
KoWeiJAC authored Oct 9, 2024
1 parent d72d0b0 commit dd4bfb1
Show file tree
Hide file tree
Showing 5 changed files with 806 additions and 6 deletions.
13 changes: 12 additions & 1 deletion src/components/Page/InformationReviewSectionRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
v-if="key != 'taskDetails' && key != 'judicialFunctions' && key != 'details' && key != 'startDate' || (edit && key == 'startDate' && showDateRange)"
class="govuk-summary-list__key widerColumn"
>
{{ $filters.lookup(key) }}
{{ lookup(key) }}
</dt>
<dt
v-else-if="key == 'details'"
Expand Down Expand Up @@ -456,6 +456,11 @@ export default {
required: false,
default: true,
},
customisedLookup: {
type: Object,
required: false,
default: () => {},
},
},
emits: ['changeField', 'changeTaskDetails', 'changeJudicialFunctions', 'addField', 'removeField'],
data() {
Expand Down Expand Up @@ -523,6 +528,12 @@ export default {
this.currentIndex = index;
this.$refs.removeModal.openModal();
},
lookup(key) {
if (this.customisedLookup && this.customisedLookup[key]) {
return this.customisedLookup[key];
}
return this.$filters.lookup(key);
},
},
};
</script>
Expand Down
8 changes: 7 additions & 1 deletion src/views/Exercise/Applications/Application.vue
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ export default {
return isNonLegal(this.exercise);
},
correctCharacterInformation() {
if (this.applicationVersion >= 2) {
if (this.characterInformationVersion === 3) {
return this.application.characterInformationV3 || {};
} else if (this.applicationVersion >= 2) {
return this.application.characterInformationV2 || {};
} else {
return this.application.characterInformation || {};
Expand All @@ -454,6 +456,10 @@ export default {
return this.exercise._applicationVersion || 1;
},
characterInformationVersion() {
// All exercises launching on or after 15/10/24 use the V3 Character questions
if (this.exercise.applicationOpenDate > new Date('2023-10-15')) {
return 3;
}
return this.applicationVersion >= 2 ? 2 : 1;
},
applications() {
Expand Down
26 changes: 22 additions & 4 deletions src/views/InformationReview/CharacterInformationSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@
/>
</div>
</dl>
<dl
v-else-if="isVersion3"
class="govuk-summary-list"
>
<div>
<CharacterInformationSummaryV3
:form-data="characterInformation || {}"
:edit="editable"
:is-asked="isAsked"
@change-info="changeCharacterInfo"
/>
</div>
</dl>
<dl v-else>
<div>
<CharacterInformationSummaryV1
Expand All @@ -47,12 +60,14 @@
<script>
import CharacterInformationSummaryV1 from '@/views/InformationReview/CharacterInformationSummaryV1.vue';
import CharacterInformationSummaryV2 from '@/views/InformationReview/CharacterInformationSummaryV2.vue';
import CharacterInformationSummaryV3 from '@/views/InformationReview/CharacterInformationSummaryV3.vue';
export default {
name: 'CharacterInformationSummary',
components: {
CharacterInformationSummaryV1,
CharacterInformationSummaryV2,
CharacterInformationSummaryV3,
},
props: {
characterInformation: {
Expand All @@ -77,6 +92,9 @@ export default {
},
emits: ['updateApplication'],
computed: {
isVersion3() {
return this.version === 3;
},
isVersion2() {
return this.version === 2;
},
Expand All @@ -93,12 +111,12 @@ export default {
}
},
changeCharacterInfo(obj) {
let myCharacterInfo;
if (this.isVersion2) {
myCharacterInfo = { ...this.characterInformation, ...obj };
const myCharacterInfo = { ...this.characterInformation, ...obj };
if (this.isVersion3) {
this.$emit('updateApplication', { characterInformationV3: myCharacterInfo });
} else if (this.isVersion2) {
this.$emit('updateApplication', { characterInformationV2: myCharacterInfo });
} else {
myCharacterInfo = { ...this.characterInformation, ...obj };
this.$emit('updateApplication', { characterInformation: myCharacterInfo });
}
},
Expand Down
Loading

0 comments on commit dd4bfb1

Please sign in to comment.