Skip to content

Commit

Permalink
Update Monitor component
Browse files Browse the repository at this point in the history
  • Loading branch information
HalcyonJAC committed Nov 21, 2023
1 parent 2423483 commit 49d2507
Show file tree
Hide file tree
Showing 2 changed files with 366 additions and 3 deletions.
140 changes: 140 additions & 0 deletions src/components/ModalViews/PreSelectionDayQuestionnairesRequests.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<template>
<div>
<div class="modal__title govuk-!-padding-2 govuk-heading-m">
Pre-selection day questionnaire consent form {{ typeOfEmail }}
</div>
<div class="modal__content govuk-!-margin-6">
<div class="govuk-grid-row">
<form
ref="formRef"
>
<div class="govuk-!-margin-bottom-5">
<span class="govuk-body-m">Before proceeding, please confirm that you wish to send a {{ typeOfEmail }} to </span>
<span class="govuk-body-m govuk-!-font-weight-bold">{{ numberOfCandidates }} candidate(s) </span>
<span class="govuk-body-m">and the email template contains all required information</span>
</div>
<ActionButton
v-if="hasPermissions([
PERMISSIONS.applications.permissions.canReadApplications.value,
PERMISSIONS.applications.permissions.canUpdateApplications.value,
PERMISSIONS.notifications.permissions.canCreateNotifications.value
])"
type="primary"
class="govuk-!-margin-right-3 govuk-!-top-3"
:action="send"
>
{{ buttonText }}
</ActionButton>
<button
class="govuk-button govuk-button--secondary govuk-!-margin-right-3"
@click.prevent="closeModal"
>
Cancel
</button>
</form>
</div>
</div>
</div>
</template>

<script>
import { functions } from '@/firebase';
import permissionMixin from '@/permissionMixin';
import ActionButton from '@jac-uk/jac-kit/draftComponents/ActionButton.vue';
export default {
name: 'PreSelectionDayQuestionnairesRequests',
components: {
ActionButton,
},
mixins: [permissionMixin],
props: {
selectedItems: {
type: Array,
required: false,
default: () => [],
},
exerciseMailbox: {
type: String,
required: true,
default: '',
},
exerciseManagerName: {
type: String,
required: true,
default: '',
},
dueDate: {
type: String,
required: true,
default: '',
},
type: {
type: String,
required: true,
default: '',
},
},
emits: ['close', 'confirmed', 'setmessage', 'reset'],
data() {
return {
processing: false,
};
},
computed: {
numberOfCandidates() {
return this.selectedItems.length;
},
typeOfEmail() {
return this.type;
},
buttonText() {
return `I confirm, please send ${this.type}`;
},
},
methods: {
closeModal() {
this.$emit('close');
},
confirmModal() {
this.modalOpen = false;
this.$emit('confirmed');
document.body.style.overflow = '';
},
async updateApplicationRecord(status) {
await this.$store.dispatch('preSelectionDayQuestionnaires/updateStatus', {
selectedItems: this.selectedItems,
newStatus: status,
});
},
async send() {
try {
const response = await functions.httpsCallable('sendPreSelectionDayQuestionnaireRequests')({
items: this.selectedItems,
type: this.type,
exerciseMailbox: this.exerciseMailbox,
exerciseManagerName: this.exerciseManagerName,
dueDate: this.dueDate,
});
if (response === false) {
this.$emit('setmessage', false, 'warning');
} else {
this.$emit('setmessage', true, this.type, 'success');
}
} catch (error) {
this.$emit('setmessage', false, this.type, 'warning');
}
this.closeModal();
this.$emit('reset');
},
},
};
</script>

<style scoped>
fieldset {
border: none;
padding: 0;
margin: 0;
}
</style>
Loading

0 comments on commit 49d2507

Please sign in to comment.