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

488 assessments changes #499

Merged
merged 5 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 23 additions & 3 deletions src/components/ActionButton.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<button
class="govuk-button govuk-button--secondary jac-actionbutton"
class="govuk-button jac-actionbutton"
:class="computedClasses"
:disabled="isLoading"
v-on="listeners"
>
<span
v-if="isLoading"
class="spinner-border spinner-border-sm"
class="spinner spinner-border spinner-border-sm"
/>
<slot
v-else-if="isSuccess"
Expand All @@ -21,7 +21,12 @@
>
Error!
</slot>
<slot>Submit</slot>
<span
v-if="!(isSuccess || hasError)"
:class="{ loading: isLoading }"
>
<slot>Submit</slot>
</span>
</button>
</template>
<script>
Expand All @@ -32,6 +37,10 @@ export default {
type: Number,
default: 2000,
},
type: {
type: String,
default: 'secondary',
},
},
data: () => ({
isLoading: false,
Expand All @@ -50,6 +59,7 @@ export default {
'jac-actionbutton--warning': this.hasError,
'jac-actionbutton--success': this.isSuccess,
'jac-actionbutton--loading': this.isLoading,
'govuk-button--secondary': this.type === 'secondary',
};
},
},
Expand All @@ -76,3 +86,13 @@ export default {
},
};
</script>

<style scoped>
.spinner {
position: absolute;
right: 50%;
}
.loading {
visibility: hidden;
}
</style>
2 changes: 2 additions & 0 deletions src/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const formatDate = (value, type) => {
return `${objDate.toLocaleString('en-GB', { month: 'long' })} ${objDate.getUTCFullYear()}`;
case 'datetime':
return objDate.toLocaleString('en-GB');
case 'long':
return objDate.toLocaleDateString('en-GB', { year: 'numeric', month: 'long', day: 'numeric' });
default:
return objDate.toLocaleDateString('en-GB');
}
Expand Down
60 changes: 46 additions & 14 deletions src/views/Exercises/Show/IndependentAssessments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Contact date
</dt>
<dd class="govuk-summary-list__value">
{{ exercise.contactIndependentAssessors | formatDate }}
{{ exercise.contactIndependentAssessors | formatDate('long') }}
</dd>
<dd class="govuk-summary-list__actions">
<strong
Expand All @@ -26,16 +26,17 @@
Due date
</dt>
<dd class="govuk-summary-list__value">
{{ exercise.independentAssessmentsReturnDate | formatDate }}
{{ exercise.independentAssessmentsReturnDate | formatDate('long') }}
</dd>
<dd class="govuk-summary-list__actions" />
</div>
</dl>

<div
v-if="!(exercise.assessments && exercise.assessments.initialised)"
v-if="!hasInitialisedAssessments"
>
<ActionButton
type="primary"
@click="initialiseAssessments()"
>
Start Assessments
Expand All @@ -44,6 +45,7 @@

<div v-else>
<ActionButton
type="primary"
@click="sendRequests()"
>
Send to all
Expand Down Expand Up @@ -137,23 +139,34 @@
{{ assessment.candidate.fullName }}
</td>
<td class="govuk-table__cell">
<p class="govuk-body">
<a
:href="`mailto:${assessment.assessor.email}`"
class="govuk-link govuk-link--no-visited-state"
target="_blank"
>
{{ assessment.assessor.fullName }}
</a>
</p>
<a
:href="`mailto:${assessment.assessor.email}`"
class="govuk-link govuk-link--no-visited-state"
target="_blank"
>
{{ assessment.assessor.fullName }}
</a>
</td>
<td class="govuk-table__cell">
{{ assessment.status | lookup }}
</td>
<td class="govuk-table__cell">
<td
class="govuk-table__cell govuk-!-padding-top-0"
>
<div class="moj-button-menu">
<div
v-if="assessment.status === 'completed'"
v-if="!hasStartedSending"
class="moj-button-menu__wrapper"
>
<ActionButton
class="moj-button-menu__item"
@click="testRequest(assessment.id)"
>
Test Request
</ActionButton>
</div>
<div
v-else-if="assessment.status === 'completed'"
class="moj-button-menu__wrapper"
>
<DownloadLink
Expand Down Expand Up @@ -188,6 +201,7 @@
</div>
<br>
<a
v-if="onStaging"
target="_blank"
:href="`https://assessments-staging.judicialappointments.digital/sign-in?email=${assessment.assessor.email}&ref=assessments/${assessment.id}`"
class="govuk-link"
Expand Down Expand Up @@ -224,6 +238,15 @@ export default {
contactOverdue() {
return !this.assessments.length && !isDateInFuture(this.exercise.contactIndependentAssessors);
},
hasInitialisedAssessments() {
return this.exercise.assessments && this.exercise.assessments.initialised;
},
hasStartedSending() {
return this.exercise.assessments && this.exercise.assessments.sent;
},
onStaging() {
return window.location.href.indexOf('admin-staging') > 0;
},
},
created() {
this.$store.dispatch('assessments/bind', { exerciseId: this.exercise.id });
Expand All @@ -245,7 +268,16 @@ export default {
async sendReminder(assessmentId) {
await functions.httpsCallable('sendAssessmentReminders')({ exerciseId: this.exercise.id, assessmentId: assessmentId });
},
async testRequest(assessmentId) {
await functions.httpsCallable('testAssessmentNotification')({ assessmentId: assessmentId, notificationType: 'request' });
},
},
};
</script>

<style scoped>
.govuk-table__cell,
.govuk-table__header {
vertical-align: middle;
}
</style>