Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include task list and update navigation links for draft exercises #157

Merged
merged 29 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
09ec763
Update Form to pass validation state to save method
Jan 7, 2020
7f565e7
Introduce progress object to track exercise create
Jan 7, 2020
e19b63d
Only show non-draft links for non-draft exercises
Jan 7, 2020
ca229ff
Update task list to show progress of exercise create
Jan 7, 2020
bbafb7f
Save progress for Assessment Options
Jan 7, 2020
c15e344
Save progress for Contacts
Jan 7, 2020
4366a6d
Save progress for Downloads
Jan 7, 2020
d26a3a4
Save progress for Exercise Name
Jan 7, 2020
ce74021
Save progress for Eligibility
Jan 7, 2020
bfc83ac
Save progress for Shortlisting Methods
Jan 7, 2020
57365a7
Save progress for Timeline
Jan 7, 2020
6b10c26
Save progress for Vacancy Information
Jan 7, 2020
c40329b
Save progress for Working Preferences
Jan 7, 2020
cf390ce
Save progress and state on Exercise creation
Jan 7, 2020
f53b419
Update Form to pass validation state to save method
Jan 7, 2020
81e29cd
Introduce progress object to track exercise create
Jan 7, 2020
cdd9f7a
Only show non-draft links for non-draft exercises
Jan 7, 2020
4e94b75
Update task list to show progress of exercise create
Jan 7, 2020
24836d7
Save progress for Assessment Options
Jan 7, 2020
f8c99e9
Save progress for Contacts
Jan 7, 2020
4098c30
Save progress for Downloads
Jan 7, 2020
846cd94
Save progress for Exercise Name
Jan 7, 2020
79fa0e2
Save progress for Eligibility
Jan 7, 2020
9f625a8
Save progress for Shortlisting Methods
Jan 7, 2020
6419767
Save progress for Timeline
Jan 7, 2020
795eeea
Save progress for Vacancy Information
Jan 7, 2020
cd08f1b
Save progress for Working Preferences
Jan 7, 2020
f5e60e2
Save progress and state on Exercise creation
Jan 7, 2020
7b306e1
Merge branch 'include-task-list' of https://github.com/jac-uk/apply-a…
Jan 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Form/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
async validateAndSave() {
this.validate();
if (this.isValid()) {
this.save();
this.save(true);
}
},
},
Expand Down
2 changes: 2 additions & 0 deletions src/store/exercise/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export default {
const exerciseRef = firestore.collection('exercises').doc();
transaction.update(metaRef, { exercisesCount: newExercisesCount });
data.referenceNumber = 'JAC' + (100000 + newExercisesCount).toString().substr(1);
data.progress = { started: true };
data.state = 'draft';
transaction.set(exerciseRef, data);
return exerciseRef.id;
});
Expand Down
3 changes: 2 additions & 1 deletion src/views/Exercises/Edit/AssessmentOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export default {
};
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.assessmentOptions = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-assessment-options'));
},
Expand Down
41 changes: 22 additions & 19 deletions src/views/Exercises/Edit/Contacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,26 @@ export default {
},
extends: Form,
data(){
const exercise = this.$store.getters['exerciseDocument/data']();

const defaults = {
subscriberAlertsUrl: null,
exerciseMailbox: null,
seniorSelectionExerciseManager: null,
selectionExerciseManager: null,
selectionExerciseOfficer: null,
assignedCommissioner: null,
appropriateAuthority: [],
otherAppropriateAuthority: null,
hmctsWelshGovLead: null,
judicialOfficeContact: null,
leadJudge: null,
draftingJudge: null,
statutoryConsultee: null,
progress: {},
};
const data = this.$store.getters['exerciseDocument/data']();
const exercise = { ...defaults, ...data };
return {
exercise: exercise,
patternJACEmail: { match: /@judicialappointments.(digital|gov.uk)$/, message: 'Please use a JAC email address' },
repeatableFields: {
SeniorSelectionExerciseManager,
Expand All @@ -187,26 +204,12 @@ export default {
StatutoryConsultee,
SelectionExerciseOfficer,
AssignedCommissioner,
},
exercise: {
subscriberAlertsUrl: exercise.subscriberAlertsUrl || null,
exerciseMailbox: exercise.exerciseMailbox || null,
seniorSelectionExerciseManager: exercise.seniorSelectionExerciseManager || null,
selectionExerciseManager: exercise.selectionExerciseManager || null,
selectionExerciseOfficer: exercise.selectionExerciseOfficer || null,
assignedCommissioner: exercise.assignedCommissioner || null,
appropriateAuthority: exercise.appropriateAuthority || [],
otherAppropriateAuthority: exercise.otherAppropriateAuthority|| null,
hmctsWelshGovLead: exercise.hmctsWelshGovLead || null,
judicialOfficeContact: exercise.judicialOfficeContact || null,
leadJudge: exercise.leadJudge || null,
draftingJudge: exercise.draftingJudge || null,
statutoryConsultee: exercise.statutoryConsultee || null,
},
},
};
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.contacts = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-contacts'));
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Exercises/Edit/Downloads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
},
},
methods: {
async save() {
async save(isValid) {

// check for job description file to upload
if (this.files['job-description-file']) {
Expand All @@ -120,6 +120,7 @@ export default {
await this.upload(this.files['candidate-assessment-form-file']);
}

this.exercise.progress.downloads = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-downloads'));
},
Expand Down
14 changes: 8 additions & 6 deletions src/views/Exercises/Edit/EditName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ export default {
},
extends: Form,
data(){
const exercise = this.$store.getters['exerciseDocument/data']();

const defaults = {
name: null,
};
const data = this.$store.getters['exerciseDocument/data']();
const exercise = { ...defaults, ...data };
return {
exercise: {
name: exercise.name || null,
},
exercise: exercise,
};
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.exerciseName = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push({ name: 'exercise-show-overview' });
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Exercises/Edit/Eligibility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ export default {
},
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.eligibility = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-eligibility'));
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Exercises/Edit/Shortlisting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export default {
};
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.shortlisting = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-shortlisting'));
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Exercises/Edit/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ export default {
},
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.timeline = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-timeline'));
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Exercises/Edit/Vacancy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ export default {
};
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.vacancyInformation = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-vacancy'));
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Exercises/Edit/WorkingPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export default {
};
},
methods: {
async save() {
async save(isValid) {
this.exercise.progress.workingPreferences = isValid ? true : false;
await this.$store.dispatch('exerciseDocument/save', this.exercise);
this.$router.push(this.$store.getters['exerciseCreateJourney/nextPage']('exercise-show-working-preferences'));
},
Expand Down
47 changes: 27 additions & 20 deletions src/views/Exercises/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,9 @@ export default {
AddToFavouritesButton,
},
data() {
const navPages = [
{ page: 'Overview', name: 'exercise-show-overview' },
{ page: 'Vacancy information',
name: 'exercise-show-vacancy',
children: [
{ page: 'Contacts', name: 'exercise-show-contacts' },
{ page: 'Timeline', name: 'exercise-show-timeline' },
{ page: 'Shortlisting', name: 'exercise-show-shortlisting' },
{ page: 'Eligibility information', name: 'exercise-show-eligibility' },
{ page: 'Working preferences', name: 'exercise-show-working-preferences' },
{ page: 'Assessment options', name: 'exercise-show-assessment-options' },
{ page: 'Exercise downloads', name: 'exercise-show-downloads' },
],
},
{ page: 'Applications', name: 'exercise-show-applications' },
{ page: 'Independent assessments', name: 'exercise-show-independent-assessments' },
{ page: 'Exercise reports', name: 'exercise-show-reports' },
];

return {
loaded: false,
loadFailed: false,
navPages,
};
},
computed: {
Expand All @@ -93,6 +73,33 @@ export default {
exerciseName() {
return this.exercise.name && this.exercise.name.length < 80 ? this.exercise.name : this.exercise.name.substring(0,79)+'..';
},
isDraft() {
// returns true unless exercise has a state that other than draft
if (this.exercise && this.exercise.state && this.exercise.state !== 'draft') {
return false;
}
return true;
},
navPages() {
const pages = [
{ page: 'Overview', name: 'exercise-show-overview' },
{ page: 'Vacancy information', name: 'exercise-show-vacancy' },
{ page: 'Contacts', name: 'exercise-show-contacts' },
{ page: 'Timeline', name: 'exercise-show-timeline' },
{ page: 'Shortlisting', name: 'exercise-show-shortlisting' },
{ page: 'Eligibility information', name: 'exercise-show-eligibility' },
{ page: 'Working preferences', name: 'exercise-show-working-preferences' },
{ page: 'Assessment options', name: 'exercise-show-assessment-options' },
{ page: 'Exercise downloads', name: 'exercise-show-downloads' },

];
if (!this.isDraft) {
pages.push({ page: 'Applications', name: 'exercise-show-applications' });
pages.push({ page: 'Independent assessments', name: 'exercise-show-independent-assessments' });
pages.push({ page: 'Exercise reports', name: 'exercise-show-reports' });
}
return pages;
},
goBack() {
if (this.$route.name === 'exercise-show-overview') {
return {
Expand Down
65 changes: 57 additions & 8 deletions src/views/Exercises/Show/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
</p>
</div>

<div class="background-light-grey govuk-!-padding-4 govuk-!-margin-bottom-3">
<div
v-if="!isDraft"
class="background-light-grey govuk-!-padding-4 govuk-!-margin-bottom-3"
>
<h2 class="govuk-heading-l">
Number of applications
</h2>
Expand All @@ -36,21 +39,38 @@
</RouterLink>
</div>

<div class="govuk-grid-column-full govuk-!-margin-top-5 govuk-!-margin-bottom-2">
<div
v-if="taskList"
class="govuk-grid-column-full govuk-!-margin-top-5 govuk-!-margin-bottom-2"
>
<h2 class="govuk-heading-m">
Task list
</h2>
<table class="govuk-table">
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<tr
v-for="task in taskList"
:key="task.id"
class="govuk-table__row"
>
<th class="govuk-table__header">
Name of exercise
<router-link
class="govuk-link"
:to="{name: task.id}"
>
{{ task.title }}
</router-link>
</th>
<td class="govuk-table__cell text-right">
<a
href="#"
class="govuk-link"
>Change</a>
<strong
v-if="task.done"
:id="`${task.id}-completed`"
class="govuk-tag"
>Done</strong>
<span
v-else
:id="`${task.id}-completed`"
/>
</td>
</tr>
</tbody>
Expand All @@ -72,10 +92,39 @@ export default {
exercise() {
return this.$store.getters['exerciseDocument/data']();
},
isDraft() {
// returns true unless exercise has a state that other than draft
if (this.exercise && this.exercise.state && this.exercise.state !== 'draft') {
return false;
}
return true;
},
timeline() {
let timeline = exerciseTimeline(this.exercise);
return createTimeline(timeline, 2);
},
exerciseProgress() {
if (this.exercise && this.exercise.progress) {
return this.exercise.progress;
} else {
return {};
}
},
taskList() {
let data = [];
if (this.exerciseProgress) {
data.push({ title: 'Name of exercise', id: 'exercise-edit-name', done: this.exerciseProgress.exerciseName });
data.push({ title: 'Vacancy information', id: 'exercise-edit-vacancy', done: this.exerciseProgress.vacancyInformation });
data.push({ title: 'Contacts', id: 'exercise-edit-contacts', done: this.exerciseProgress.contacts });
data.push({ title: 'Timeline', id: 'exercise-edit-timeline', done: this.exerciseProgress.timeline });
data.push({ title: 'Shortlisting', id: 'exercise-edit-shortlisting', done: this.exerciseProgress.shortlisting });
data.push({ title: 'Eligibility information', id: 'exercise-edit-eligibility', done: this.exerciseProgress.eligibility });
data.push({ title: 'Working preferences', id: 'exercise-edit-working-preferences', done: this.exerciseProgress.workingPreferences });
data.push({ title: 'Assessment options', id: 'exercise-edit-assessment-options', done: this.exerciseProgress.assessmentOptions });
data.push({ title: 'Exercise downloads', id: 'exercise-edit-downloads', done: this.exerciseProgress.downloads });
}
return data;
},
},
};
</script>