Skip to content

Commit

Permalink
#2154 Configure working preferences questions (#2207)
Browse files Browse the repository at this point in the history
* #2154 Configure working preferences questions

* Working preferences. Additional config and tabs

* #2154 Configure working preferences questions

* Fix lint error

* Multiple choice shouldn't have the All option

* Added support for required fields.
Added support for specifying a minumum number of answers for a question.

* Upgraded jac-kit to fix RepeatableFields for linked questions

* Updated lock file

* Generate IDs for questions and answers

* Fix lint error :)

* Fix linked questions data model

* View linked question

* 1072/working prefs (#2340)

* wip

* all broken

* Fix location preferences, the rest to do (#2334)

* fix display issues

* fix display issues

* 1072/rebasing off main (#2341)

* Feature/2276 Make candidate responses to bespoke question on Ex.187 visible (#2277)

* add Resignation from the Department for Work and Pensions (DWP) to application view

* fix bug

* add missing question and answer

* check env

* Bump version number to 1.22.0

* #2091/self assessment document extraction (#2235)

* wip

* working proto

* use new jac kit

* Update package-lock

* Ensure application process is marked as done

* update jac-kit

* add content to review page

* wip test

* Removed test commit

* working

* tidy

---------

Co-authored-by: warrensearle <warren@precise-minds.co.uk>
Co-authored-by: drieJac <jac.drie@digitalteam.uk>

* Bump version number to 1.23.0

* Bugfix/New user missing uid (#2289)

* Added google analytics (#2292)

* #2246 Disable Relevant Qualifications being added to application process for non-legal exercises (#2286)

Co-authored-by: halcyonjac <halcyon@judicialappointments.digital>

* Bump version number to 1.24.0

* Feature/2283 Add MS Word guidance to Self-assessment Exercise Downloads (#2288)

* Feature/2230 Character declaration updates (#2278)

* fix bugs and update wording

* make current issues visible

* remove 'All' options

* fix no data issue when page loaded

* Add labels to stage, status dropdown

* change label and wording

* change layout

* filter available stage and status by application number

* Update coding format

* update coding format

* fix stage, status dropdowns

* fix loading issue

* Fix text input

* Epic/2150 issue ticketing system (#2299)

* #2095 issue ticketing system (#2117)

* Added feedback link.
Added modal with basic feedback form.

* Added feedback form with broswer info preloaded and if the user selects email as their contact details it preloads their email address.

* Prepopularted display name and url

* Disabled prepopulated fields.
Using new jac-kit which allows disabling a text input.
Added user id to the form data.
Removed unnecessary styling.
Left aligning modal form content.

* Upgraded the jac-kit package

* Added upload a screenshot.
Added a list of contacts to be looped in.
Now using getters for user details so no errors if form is called prior to login.
Added criticality.
Added previous action.
Left aligned title.
Added confirmation modal on submit.

* Removed previous action as not needed

* Show the feedback link for logged in users only

* Removed selection of contact type, using email only.

* Modified form to add/remove fields.
Added a ticket number to the confirmation screen.

* Update FeedbackForm.vue

* Taking screenshots of canvas and displaying a thumbnail.
Added icon to prevent text overlap for feedback button.

* Added linkin title section to close modal.
Re-using single modal.
Make modal fixed width.

* Use jac kit's modal

* Added ability for the user to add feedback for a third part user, specifying their details.
Move screenshot capture into its own component.

* updated package lock after merge

* Adding exercise id to the formData if available.
Added bugReport collection and document store.
Saving formData to the collection.

* Modified text from applicant to candidate.
Added warnings.
Added a prompt for the user to check i the candidate is on a CPS machine.
Display ticket number.
Added code to create the bugreport record in the backend.

* Renamed some of the attributes of the form.
Added exercise ref.
Now storing the exercise as an object.

* Added application details to the bug report.

* Replace feedback link with new one at bottom of page.
Store screenshot in firestore storage and reference in bugReport document.
Allow screenshot in the page to be removed.
Display error if there is one uploading the screenshot.
Removed old image.
Upgraded to vue 3.26 to support expose functionality allowing parent component to call a method in the child.

* Replaced capture screenshot image

* Ensuring the new feedback link sits at a consistent distance from the bottom of the screen, accounting for the footer when fully scrolled.

* Adjusted bottom position to account for the footer

* Modified CPS question and nudged fixed link position.

* updated package lock

* Added call to callable function to create ZH issue.
Added permission.
Save downloadUrl and filepath in bugReport record.

* Updated package lock file

* Feedback link sticky with bottom footer

* Updated package lock

* Added observer to recalcuate link position when content of main-content div change.
Refactored components.

* Moved link html and css into dedicated component

* Disable lint no-unused-vars for two lines

* Added emits to component

* Updated emit

* Refactored

* Updated vite with the port for local development

* Remove unnecessary permissions for zenhub

* Added fix for creating issue without screenshot

---------

Co-authored-by: warrensearle <warren@precise-minds.co.uk>

* Fixed an error in candidate submission due to there being no screenshot component present. (#2264)

* Feature/2150 testing hooks (#2279)

* Added hooks

* WIP

* Added lookup for slack member and custom error class.

* Modified display of slack lookup form input

* Pass the reporter userId in the callable function

* Removed hardcoding

* Added action button

* Remove BR_ number from modal message

* Added extra detail to the criticality types

* Added logging to help identify bug.
Added criticality mappings.

* Added console logging to clicking feedback link

* Added possible fix to sign user out if not signed in when click the feedback link

* wip

* removed unnecessary debugging in app.vue.
Added checks for uid in feedback form with appropriate error.
Added new error class.

* Removed debugging

* Updated package lock

---------

Co-authored-by: warrensearle <warren@precise-minds.co.uk>

* Feat/2285 remedy issues with character checks (#2298)

* make character check records searchable

* close modal if success

---------

Co-authored-by: halcyonjac <halcyon@judicialappointments.digital>

* Bump version number to 1.25.0

* Change EMP tie-breaker entry status to be 'Only 'SCC to reconsider' applications will be included'.
Updated package lock.

* Revert "Change EMP tie-breaker entry status to be 'Only 'SCC to reconsider' applications will be included'."

This reverts commit 484bc29.

* Upgrade Admin to use the latest Firebase library#1898 (#2287)

* Refactor firebase app initialization to module API

* tag TODOs

* WIP

* WIP: upgrade to module APIs

* WIP: upgrade to module APIs

* WIP: upgrade to module APIs

* Upgrade to module APIs and fix user store

* fix firestore query not loaded

* Upgrade to module APIs

* Upgrade to module APIs (httpsCallable)

* Upgrade to module APIs

* fix firestore query error

* Fix create exercise

* fix exercise._applications undefined error

* add upgrade note

* upgrade jac-kit

* fix unit test of exercise document store

* Upgrade to modular API

* Upgrade to firebase modular APIs

---------

Co-authored-by: halcyonjac <halcyon@judicialappointments.digital>

* Change EMP tie-breaker entry status to be 'Only SCC to reconsider applications will be included'. (#2307)

* Bugfix/User role with Microsoft email address (#2308)

* add debugging logs

* add logs

* fix bug

* remove console logs

* Bump version number to 1.26.0

* Update issue templates

* #2312 Enable vuexfire to handle collections (#2313)

* Feature/qt 45 feedback report email (#2309)

* wip

* Added computed props and condition for displaying the button

* Added exerciseId computed prop

* Added ActionButton and ensuring it returns true immediately so just fires and forgets (as api call could take a while!)

* Bump version number to 1.27.0

* Feat/2254 streamlined publication of external adverts (#2301)

* Refactor firebase app initialization to module API

* tag TODOs

* WIP

* WIP: upgrade to module APIs

* WIP: upgrade to module APIs

* WIP: upgrade to module APIs

* Upgrade to module APIs and fix user store

* fix firestore query not loaded

* Upgrade to module APIs

* Upgrade to module APIs (httpsCallable)

* Upgrade to module APIs

* fix firestore query error

* Fix create exercise

* fix exercise._applications undefined error

* add upgrade note

* upgrade jac-kit

* fix unit test of exercise document store

* Upgrade to modular API

* Upgrade to firebase modular APIs

* WIP: add external exercise preview page

* WIP: redirect to external page if created

* external vacancy overview

* external exercise edit page

* fix router

* fix file not found error

* fix external vacancy form

* fix

* modify layout

* fix upload file

* remove isExternalVacancy

* allow to switch advert type

* add back link

* fix back button

---------

Co-authored-by: halcyonjac <halcyon@judicialappointments.digital>

* Feature/2275 Update reports which include stage status (#2295)

* update diversity report

* update outreach report

* update diversity report on dashboard

* update constant

* use constant

* update title using lookup

* update hard-coded status

* update status

* update status

* update status

* update headers in the reports

* remove empty status filter

* Ticketing System #198 - BugFix MOJ Image Not Found As Not part Of Build (#2317)

* Replace use of background image with alternative css solution to ensure the down arrow appears on the button.

* Modified to use unicode for the arrow

* Added the optional chaining operator on the attriburte and find method so that it works when no commissionerConflicts in additionalInfo. (#2316)

* Feature/2281 Update Filters on Live Exercises index page (#2330)

* update filters in exercise list

* update jac kit to 4.0.1

* remove console.log

* use arrayEmpty

* update jac-kit to 4.0.2

* Bump version number to 1.28.0

* Feature/2280 Embed new version of application form for future exercises (#2310)

* use application version 3

* fix working basis

* check application version

* fix total days

* fix character information version

* move workingBasisOptions to data object

* Bugfix/Issue-190 Self assessment extraction (#2315)

* add white-space pre-line to extracted content

* fix bugs

* improve naming

* add order

* update width

* turn question to a dropdown

* update questions

* Bump version number to 1.29.0

* Bugfix/TS 199 Character Issues Report No Data (#2336)

* fix firestore query

* fix empty data when first loaded

* renaming

* Bump version number to 1.30.0

* Fix/2306 firebase permission error (#2335)

* log errors of vuexfireJAC

* fix firestore permission error

* The uploadBytes function no longer returns the state in its response so even though the file upload was working the check for the state was returning undefined so an error was being erroneously displayed. (#2338)

* Bump version number to 1.31.0

* #2154 Configure working preferences questions

* Working preferences. Additional config and tabs

* #2154 Configure working preferences questions

* Fix lint error

* Multiple choice shouldn't have the All option

* wip

* all broken

* Fix location preferences, the rest to do (#2334)

* fix display issues

* fix display issues

* wip

* success

* lint issue

* testing issues

---------

Co-authored-by: HalcyonJAC <79906532+HalcyonJAC@users.noreply.github.com>
Co-authored-by: warrensearle <warren@precise-minds.co.uk>
Co-authored-by: drieJac <jac.drie@digitalteam.uk>
Co-authored-by: KoWeiJAC <156695133+KoWeiJAC@users.noreply.github.com>
Co-authored-by: halcyonjac <halcyon@judicialappointments.digital>
Co-authored-by: nickaddy <138654969+nickaddy@users.noreply.github.com>

* force reset

* Update package-lock

* wip mess

* WIP less mess

* 😫

* jurisdiction questions partial

* Include local question renderer, for now

* remove non-relevant config

* add spacing between form field and save button

* sort answers of multiple choice

* fix display of linked question

* fix display of additional preferences

* fix display of no information

* save answers of ranked choice correctly

* fix warnings

---------

Co-authored-by: warrensearle <warren@precise-minds.co.uk>
Co-authored-by: HalcyonJAC <79906532+HalcyonJAC@users.noreply.github.com>
Co-authored-by: drieJac <jac.drie@digitalteam.uk>
Co-authored-by: KoWeiJAC <156695133+KoWeiJAC@users.noreply.github.com>
Co-authored-by: halcyonjac <halcyon@judicialappointments.digital>
Co-authored-by: nickaddy <138654969+nickaddy@users.noreply.github.com>

* used jac-kit components

* Update to use Tom's jac-kit components

* Update to use fixed jac-kit

* Update text for question about whether answers are required

* Bug fixes

* Fix editing and add backwards support for v1 data

* Tidy up

* Lint fixes

* Support linked questions for master jurisdictions

* Display 'other' jurisdiction from master list

* Update package-lock

* Update package-lock

* Update package-lock

---------

Co-authored-by: drieJac <jac.drie@digitalteam.uk>
Co-authored-by: tomlovesgithub <44227249+tomlovesgithub@users.noreply.github.com>
Co-authored-by: HalcyonJAC <79906532+HalcyonJAC@users.noreply.github.com>
Co-authored-by: KoWeiJAC <156695133+KoWeiJAC@users.noreply.github.com>
Co-authored-by: halcyonjac <halcyon@judicialappointments.digital>
Co-authored-by: nickaddy <138654969+nickaddy@users.noreply.github.com>
Co-authored-by: Tom Russell <TR115251@hotmail.co.uk>
  • Loading branch information
8 people authored Jul 1, 2024
1 parent f45971e commit 8c2df30
Show file tree
Hide file tree
Showing 27 changed files with 3,495 additions and 840 deletions.
745 changes: 382 additions & 363 deletions package-lock.json

Large diffs are not rendered by default.

748 changes: 748 additions & 0 deletions src/assets/welsh.json

Large diffs are not rendered by default.

636 changes: 636 additions & 0 deletions src/components/Page/EditableField.vue

Large diffs are not rendered by default.

26 changes: 23 additions & 3 deletions src/components/Page/InformationReviewRenderer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div>
<div v-if="!questionConfig">
<div
v-if="isDate"
>
Expand Down Expand Up @@ -141,11 +141,26 @@
/>
</div>
</div>
<div v-else>
<EditableField
:edit-mode="edit"
:value="data"
:field="field"
:index="index"
:type="type"
:extension="extension"
:options="options"
:is-asked="isAsked"
:config="questionConfig"
@change-field="changeField"
/>
</div>
</div>
</template>

<script>
import EditableField from '@jac-uk/jac-kit/draftComponents/EditableField.vue';
// import EditableField from '@jac-uk/jac-kit/draftComponents/EditableField.vue';
import EditableField from './EditableField.vue';
import * as filters from '@jac-uk/jac-kit/filters/filters';
export default {
Expand Down Expand Up @@ -196,7 +211,7 @@ export default {
default: () => '',
},
data: {
type: [String, Date, Boolean, Array],
type: [String, Date, Boolean, Array, Object],
required: false,
default: () => null,
},
Expand All @@ -219,6 +234,11 @@ export default {
required: false,
default: true,
},
questionConfig: {
type: Object,
required: false,
default: () => { false; },
},
disableSubmitOnError: {
type: Boolean,
required: false,
Expand Down
159 changes: 159 additions & 0 deletions src/components/QuestionConfig/View.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<template>
<div
v-if="shouldRenderQuestion"
class="govuk-summary-list__row"
>
<dt
class="govuk-summary-list__key"
>
<span v-if="currentItem.topic">{{ currentItem.topic }}<br></span>
{{ currentItem.question }}
<span
class="govuk-hint"
>
{{ $filters.lookup(currentItem.questionType) }}
{{ currentItem.groupAnswers ? ' - Grouped Answers' : '' }}
{{ currentItem.minimumAnswerMode === 'some' ? ` - ${currentItem.minimumAnswerQuantity} Answer minimum` : '' }}
{{ currentItem.allowEqualRanking ? ' - Allow Equal Rank' : '' }}
{{ currentItem.allowLinkedQuestions ? ' - has linked Questions' : '' }}
</span>
</dt>
<template
v-if="currentItem.groupAnswers"
>
<dd
class="govuk-summary-list__value"
>
<!-- Render grouped multiple-choice answers -->
<p
v-for="(group) in currentItem.answers"
:key="group"
class="govuk-body"
>
<strong>
{{ group.group }} -
</strong>
<span
v-for="(answer, idx) in group.answers"
:key="answer"
>
{{ answer.answer }}{{ idx + 1 < group.answers.length ? ', ' : '' }}
</span>
<br>
</p>
</dd>
</template>
<template v-else-if="currentItem.answerSource === 'jurisdiction'">
<dd
class="govuk-summary-list__value"
>
<p
v-for="answer in exercise.jurisdiction"
:key="answer"
class="govuk-body"
>
<span v-if="answer == 'other'">
{{ exercise.otherJurisdiction }}
</span>
<span v-else>
{{ $filters.lookup(answer) }}
</span>
</p>
</dd>
</template>
<template v-else>
<dd
class="govuk-summary-list__value"
>
<p
v-for="answer in currentItem.answers"
:key="answer"
class="govuk-body"
>
{{ answer.answer }}
</p>
</dd>
</template>
</div>
</template>

<script>
export default {
name: 'QuestionConfigView',
props: {
section: {
type: String,
required: true,
},
index: {
type: Number,
required: true,
},
application: {
type: Object,
required: false,
default: null,
},
review: {
type: Boolean,
required: true,
},
exercise: {
type: Object,
required: true,
},
},
computed: {
currentItem() {
return this.exercise[this.section][this.index];
},
shouldRenderQuestion() {
if (this.review) {
// If there's a linked question and its answer doesn't match this question's linked answer, do not render the question
if (this.currentItem.linkedQuestion && this.currentItem.linkedAnswer) {
return this.isLinkedByAnswer;
}
// If there's no linked question, render the question
}
return true;
},
isLinkedByAnswer() {
// find the linked question
const linkedQuestion = Object.keys(this.application[this.section]).find(question => question === this.currentItem.linkedQuestion);
if (linkedQuestion) {
// check if the answer given for the linked question matches this questions linked answer
const linkedAnswer = this.application[this.section][linkedQuestion];
return linkedAnswer === this.currentItem.linkedAnswer;
} else {
return false;
}
},
},
methods: {
sortRankedSelection(dataset) {
return Object.fromEntries(Object.entries(dataset).sort((a, b) => a[1] - b[1]));
},
sortEqualRankedSelection(dataset) {
const groups = {};
Object.entries(dataset).forEach(([answer, rank]) => {
if (!groups[rank]) {
groups[rank] = [];
}
groups[rank].push(answer);
});
return Object.entries(groups).map(([rank, answers]) => ({ rank, answers }));
},
findGroupByAnswer(dataset, targetAnswer) {
for (const question of dataset) {
if (question.answers.some(answerObj => answerObj.answer === targetAnswer)) {
return question.group;
}
}
return null; // Return null if the answer is not found in any group
},
},
};
</script>
4 changes: 4 additions & 0 deletions src/components/RepeatableFields/Answer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<script>
import TextField from '@jac-uk/jac-kit/draftComponents/Form/TextField.vue';
import { getRandomString } from '@/helpers/helpers';
export default {
name: 'Answer',
Expand All @@ -37,5 +38,8 @@ export default {
default: 'Answer option',
},
},
created() {
if (!this.row.hasOwnProperty('id')) this.row.id = getRandomString(3);
},
};
</script>
66 changes: 66 additions & 0 deletions src/components/RepeatableFields/AnswerGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<template>
<div>
<TextField
:id="`answer_group_${id}_${index}`"
v-model="row.group"
:label="`${label} ${1 + index}`"
/>
<slot name="removeButton" />

<div class="govuk-!-margin-left-8">
<RepeatableFields
v-model="row.answers"
:component="repeatableFields.Answer"
ident="answer"
type-name="answer"
required
/>
</div>
</div>
</template>

<script>
import TextField from '@jac-uk/jac-kit/draftComponents/Form/TextField.vue';
import RepeatableFields from '@jac-uk/jac-kit/draftComponents/RepeatableFields.vue';
import Answer from '@/components/RepeatableFields/Answer.vue';
import { shallowRef } from 'vue';
import { getRandomString } from '@/helpers/helpers';
export default {
name: 'AnswerGroup',
components: {
TextField,
RepeatableFields,
},
props: {
row: {
required: true,
type: Object,
},
index: {
required: true,
type: Number,
},
id: {
required: false,
type: String,
default: '',
},
label: {
required: false,
type: String,
default: 'Answer option',
},
},
data() {
return {
repeatableFields: shallowRef({
Answer,
}),
};
},
created() {
if (!this.row.hasOwnProperty('id')) this.row.id = getRandomString(3);
},
};
</script>
Loading

0 comments on commit 8c2df30

Please sign in to comment.