From a0c4461c81f93ab7e0fcd06cc13afed5fa2486fc Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 12:32:05 +0100 Subject: [PATCH 01/11] applications with issues cant be moved to handover --- src/store/stage/handover.js | 2 +- src/store/stage/recommended.js | 2 +- src/store/stage/review.js | 2 +- src/store/stage/selected.js | 2 +- src/store/stage/shortlisted.js | 4 +- src/views/Exercises/Stages/ReviewEdit.vue | 2 +- src/views/Exercises/Stages/SelectedEdit.vue | 21 +++++++- src/views/Sandbox.vue | 59 +-------------------- 8 files changed, 27 insertions(+), 67 deletions(-) diff --git a/src/store/stage/handover.js b/src/store/stage/handover.js index 7bf618bf2..ba4e429b7 100644 --- a/src/store/stage/handover.js +++ b/src/store/stage/handover.js @@ -3,7 +3,7 @@ import firebase from '@firebase/app'; import { firestore } from '@/firebase'; import { firestoreAction } from 'vuexfire'; import vuexfireSerialize from '@/helpers/vuexfireSerialize'; -import { EXERCISE_STAGE } from '../../helpers/constants'; +import { EXERCISE_STAGE } from '@/helpers/constants'; const collectionRef = firestore.collection('applicationRecords'); diff --git a/src/store/stage/recommended.js b/src/store/stage/recommended.js index 6fecca772..7f2e5b2de 100644 --- a/src/store/stage/recommended.js +++ b/src/store/stage/recommended.js @@ -3,7 +3,7 @@ import firebase from '@firebase/app'; import { firestore } from '@/firebase'; import { firestoreAction } from 'vuexfire'; import vuexfireSerialize from '@/helpers/vuexfireSerialize'; -import { EXERCISE_STAGE, APPLICATION_STATUS } from '../../helpers/constants'; +import { EXERCISE_STAGE, APPLICATION_STATUS } from '@/helpers/constants'; import { lookup } from '@/filters'; const collectionRef = firestore.collection('applicationRecords'); diff --git a/src/store/stage/review.js b/src/store/stage/review.js index ccf05d864..30e7eaa83 100644 --- a/src/store/stage/review.js +++ b/src/store/stage/review.js @@ -3,7 +3,7 @@ import firebase from '@firebase/app'; import { firestore } from '@/firebase'; import { firestoreAction } from 'vuexfire'; import vuexfireSerialize from '@/helpers/vuexfireSerialize'; -import { EXERCISE_STAGE, APPLICATION_STATUS, SHORTLISTING } from '../../helpers/constants'; +import { EXERCISE_STAGE, APPLICATION_STATUS, SHORTLISTING } from '@/helpers/constants'; import { lookup } from '@/filters'; const collectionRef = firestore.collection('applicationRecords'); diff --git a/src/store/stage/selected.js b/src/store/stage/selected.js index df2bbca5c..9a4665c17 100644 --- a/src/store/stage/selected.js +++ b/src/store/stage/selected.js @@ -3,7 +3,7 @@ import firebase from '@firebase/app'; import { firestore } from '@/firebase'; import { firestoreAction } from 'vuexfire'; import vuexfireSerialize from '@/helpers/vuexfireSerialize'; -import { EXERCISE_STAGE, APPLICATION_STATUS } from '../../helpers/constants'; +import { EXERCISE_STAGE, APPLICATION_STATUS } from '@/helpers/constants'; import { lookup } from '@/filters'; const collectionRef = firestore.collection('applicationRecords'); diff --git a/src/store/stage/shortlisted.js b/src/store/stage/shortlisted.js index c813c757e..829ca1ce1 100644 --- a/src/store/stage/shortlisted.js +++ b/src/store/stage/shortlisted.js @@ -3,8 +3,8 @@ import firebase from '@firebase/app'; import { firestore } from '@/firebase'; import { firestoreAction } from 'vuexfire'; import vuexfireSerialize from '@/helpers/vuexfireSerialize'; -import { EXERCISE_STAGE, APPLICATION_STATUS } from '../../helpers/constants'; -import { lookup } from '../../filters'; +import { EXERCISE_STAGE, APPLICATION_STATUS } from '@/helpers/constants'; +import { lookup } from '@/filters'; const collectionRef = firestore.collection('applicationRecords'); diff --git a/src/views/Exercises/Stages/ReviewEdit.vue b/src/views/Exercises/Stages/ReviewEdit.vue index 400fe9d93..699c8e8ff 100644 --- a/src/views/Exercises/Stages/ReviewEdit.vue +++ b/src/views/Exercises/Stages/ReviewEdit.vue @@ -42,7 +42,7 @@ import RadioGroup from '@/components/Form/RadioGroup'; import RadioItem from '@/components/Form/RadioItem'; import CheckboxGroup from '@/components/Form/CheckboxGroup'; import CheckboxItem from '@/components/Form/CheckboxItem'; -import { EXERCISE_STAGE } from '../../../helpers/constants'; +import { EXERCISE_STAGE } from '@/helpers/constants'; export default { components: { diff --git a/src/views/Exercises/Stages/SelectedEdit.vue b/src/views/Exercises/Stages/SelectedEdit.vue index 383c31c2b..7a8494eaa 100644 --- a/src/views/Exercises/Stages/SelectedEdit.vue +++ b/src/views/Exercises/Stages/SelectedEdit.vue @@ -52,6 +52,9 @@ export default { const selectedItems = this.$store.state.stageSelected.selectedItems; return selectedItems; }, + warningMessage() { + return 'This application has issues'; + }, }, created() { // on refresh if there's no IDs to change => redirect to the list @@ -60,9 +63,23 @@ export default { } }, methods: { + hasIssues(applicationId) { + const individualApplication = this.applicationRecords.filter(item => item.application.id === applicationId)[0]; + return (individualApplication.flags.eligibilityIssues || individualApplication.flags.characterIssues); + }, + confirm(){ + this.confirmedSave = true; + }, + cancel(){ + this.showWarning = false; + }, async save() { - await this.$store.dispatch('stageSelected/updateStatus', { status: this.newSelectedStatus }); - this.$router.push({ name: 'exercise-stages-selected-list' }); + if (!this.confirmedSave && this.hasIssues(this.applicationId)){ + this.showWarning = true; + } else { + await this.$store.dispatch('stageSelected/updateStatus', { applicationId: this.applicationId, status: this.newSelectedStatus }); + this.$router.push({ name: 'exercise-stages-selected-list' }); + } }, }, }; diff --git a/src/views/Sandbox.vue b/src/views/Sandbox.vue index c17eefa39..3ba2ab81d 100644 --- a/src/views/Sandbox.vue +++ b/src/views/Sandbox.vue @@ -1,62 +1,5 @@ From a0f319497ad3e075656d3f6dcec6c654e77f2295 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 12:51:28 +0100 Subject: [PATCH 02/11] applications with issues cant be moved to handover --- src/components/Page/Banner.vue | 26 ++++++++-------- .../Exercises/Stages/RecommendedEdit.vue | 30 +++++++++++++++++-- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/components/Page/Banner.vue b/src/components/Page/Banner.vue index 1284917ff..792a896dd 100644 --- a/src/components/Page/Banner.vue +++ b/src/components/Page/Banner.vue @@ -3,20 +3,20 @@ v-if="message" class="moj-banner moj-banner--success" > + + +
- - - - success{{ message }} + success {{ message }}
diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index 4ac03ef74..0ceb5da27 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -1,5 +1,12 @@ + + diff --git a/src/views/Sandbox.vue b/src/views/Sandbox.vue index 3ba2ab81d..2b358f2e6 100644 --- a/src/views/Sandbox.vue +++ b/src/views/Sandbox.vue @@ -1,5 +1,14 @@ From e56e9f5fc4f98f56dd21086bbf706aa62a87af4c Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 14:01:21 +0100 Subject: [PATCH 04/11] fix linting errors --- src/views/Sandbox.vue | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/views/Sandbox.vue b/src/views/Sandbox.vue index 2b358f2e6..38532de6c 100644 --- a/src/views/Sandbox.vue +++ b/src/views/Sandbox.vue @@ -1,14 +1,8 @@ From 3dfc99eb28c2fdf336d16f9d9d866b6b9c088482 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 15:49:35 +0100 Subject: [PATCH 05/11] #463 prevent applications w/ issues moving to handover --- src/views/Exercises/Stages/RecommendedEdit.vue | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index 0ceb5da27..97009ea66 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -66,7 +66,7 @@ export default { return selectedItems; }, warningMessage() { - return 'This application has issues'; + return this.itemsHaveIssues > 1 ? `${this.itemsHaveIssues()} candidates have issues` : '1 candidate has issues' }, }, created() { @@ -76,18 +76,16 @@ export default { } }, methods: { - hasIssues(applicationId) { - const individualApplication = this.applicationRecords.filter(item => item.application.id === applicationId)[0]; - return (individualApplication.flags.eligibilityIssues || individualApplication.flags.characterIssues); + itemsHaveIssues() { + const selectedApplications = this.applicationRecords.filter(item => this.itemsToChange.indexOf(item.application.id) >= 0); + return selectedApplications.filter(item => item.flags.eligibilityIssues || item.flags.characterIssues).length; }, async save() { - if (this.itemsToChange.some((item) => { - this.hasIssues(item) === false; - })) { + if (this.itemsHaveIssues()) { + this.showWarning = true; + } else { await this.$store.dispatch('stageRecommended/updateStatus', { status: this.newSelectedStatus }); this.$router.push({ name: 'exercise-stages-recommended-list' }); - } else { - this.showWarning = true; } }, }, From 567a6ffbc057ed50304e6e93b57645d87e93bb1c Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 15:51:27 +0100 Subject: [PATCH 06/11] #463 prevent applications w/ issues moving to handover --- src/views/Exercises/Stages/RecommendedEdit.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index 97009ea66..d91a357db 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -66,7 +66,7 @@ export default { return selectedItems; }, warningMessage() { - return this.itemsHaveIssues > 1 ? `${this.itemsHaveIssues()} candidates have issues` : '1 candidate has issues' + return this.itemsHaveIssues > 1 ? `${this.itemsHaveIssues()} candidates have issues` : '1 candidate has issues'; }, }, created() { From 4e6200f473ef229982f5d5d192db9b44940cc7b4 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 16:38:53 +0100 Subject: [PATCH 07/11] slight fix --- src/views/Exercises/Stages/RecommendedEdit.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index d91a357db..e23fe5c17 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -66,7 +66,7 @@ export default { return selectedItems; }, warningMessage() { - return this.itemsHaveIssues > 1 ? `${this.itemsHaveIssues()} candidates have issues` : '1 candidate has issues'; + return (this.itemsWithIssues() > 1) ? `${this.itemsWithIssues()} candidates have issues` : '1 candidate has issues'; }, }, created() { @@ -76,16 +76,18 @@ export default { } }, methods: { - itemsHaveIssues() { + itemsWithIssues() { const selectedApplications = this.applicationRecords.filter(item => this.itemsToChange.indexOf(item.application.id) >= 0); + console.log(selectedApplications.filter(item => item.flags.eligibilityIssues || item.flags.characterIssues).length); return selectedApplications.filter(item => item.flags.eligibilityIssues || item.flags.characterIssues).length; }, async save() { - if (this.itemsHaveIssues()) { + if (this.itemsWithIssues()) { this.showWarning = true; } else { - await this.$store.dispatch('stageRecommended/updateStatus', { status: this.newSelectedStatus }); - this.$router.push({ name: 'exercise-stages-recommended-list' }); + console.log('gabe'); + // await this.$store.dispatch('stageRecommended/updateStatus', { status: this.newSelectedStatus }); + // this.$router.push({ name: 'exercise-stages-recommended-list' }); } }, }, From e636129947cc1d61c64b119a9969d2efd40247b1 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 16:40:58 +0100 Subject: [PATCH 08/11] remove console logs --- src/views/Exercises/Stages/RecommendedEdit.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index e23fe5c17..661edf459 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -78,16 +78,14 @@ export default { methods: { itemsWithIssues() { const selectedApplications = this.applicationRecords.filter(item => this.itemsToChange.indexOf(item.application.id) >= 0); - console.log(selectedApplications.filter(item => item.flags.eligibilityIssues || item.flags.characterIssues).length); return selectedApplications.filter(item => item.flags.eligibilityIssues || item.flags.characterIssues).length; }, async save() { if (this.itemsWithIssues()) { this.showWarning = true; } else { - console.log('gabe'); - // await this.$store.dispatch('stageRecommended/updateStatus', { status: this.newSelectedStatus }); - // this.$router.push({ name: 'exercise-stages-recommended-list' }); + await this.$store.dispatch('stageRecommended/updateStatus', { status: this.newSelectedStatus }); + this.$router.push({ name: 'exercise-stages-recommended-list' }); } }, }, From 05d09fda2a17dda95c7a826f69167137ce063c74 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Jun 2020 17:38:41 +0100 Subject: [PATCH 09/11] warnings show correctly --- .../Exercises/Stages/RecommendedEdit.vue | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index 661edf459..11f9f5f50 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -7,6 +7,22 @@ :message="warningMessage" /> +
+ + +
@@ -49,6 +65,8 @@ export default { return { newSelectedStatus: null, showWarning: false, + confirmedSave: false, + askForConfirmation: false, }; }, computed: { @@ -80,8 +98,19 @@ export default { const selectedApplications = this.applicationRecords.filter(item => this.itemsToChange.indexOf(item.application.id) >= 0); return selectedApplications.filter(item => item.flags.eligibilityIssues || item.flags.characterIssues).length; }, + confirm(){ + this.confirmedSave = true; + }, + cancel(){ + this.showWarning = false; + this.askForConfirmation = false; + }, async save() { - if (this.itemsWithIssues()) { + if (this.itemsWithIssues() && this.newSelectedStatus === 'approvedForImmediateAppointment'){ + this.askForConfirmation = false; + this.showWarning = true; + } else if (!this.confirmedSave && this.itemsWithIssues()) { + this.askForConfirmation = true; this.showWarning = true; } else { await this.$store.dispatch('stageRecommended/updateStatus', { status: this.newSelectedStatus }); From c548f5639ec2e4d84fd764ba40e68dd13d011d70 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Thu, 4 Jun 2020 11:45:18 +0100 Subject: [PATCH 10/11] prevent users with issues progressing --- .../Exercises/Stages/RecommendedEdit.vue | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index 11f9f5f50..98f8fdc71 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -7,22 +7,6 @@ :message="warningMessage" /> -
- - -
@@ -66,7 +50,6 @@ export default { newSelectedStatus: null, showWarning: false, confirmedSave: false, - askForConfirmation: false, }; }, computed: { @@ -103,14 +86,9 @@ export default { }, cancel(){ this.showWarning = false; - this.askForConfirmation = false; }, async save() { if (this.itemsWithIssues() && this.newSelectedStatus === 'approvedForImmediateAppointment'){ - this.askForConfirmation = false; - this.showWarning = true; - } else if (!this.confirmedSave && this.itemsWithIssues()) { - this.askForConfirmation = true; this.showWarning = true; } else { await this.$store.dispatch('stageRecommended/updateStatus', { status: this.newSelectedStatus }); From 3169bed2c692d818ea0ef482ccde9f1dd3ad977d Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Thu, 4 Jun 2020 12:54:38 +0100 Subject: [PATCH 11/11] resolved PR comments --- src/views/Exercises/Stages/RecommendedEdit.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/Exercises/Stages/RecommendedEdit.vue b/src/views/Exercises/Stages/RecommendedEdit.vue index 98f8fdc71..46959b996 100644 --- a/src/views/Exercises/Stages/RecommendedEdit.vue +++ b/src/views/Exercises/Stages/RecommendedEdit.vue @@ -31,6 +31,7 @@