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

Feature/2192 Monitor candidate data #2223

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
137 changes: 137 additions & 0 deletions src/components/ModalViews/CandidateFormNotification.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<template>
<div>
<div class="modal__title govuk-!-padding-2 govuk-heading-m">
{{ $filters.lookup(type) }} consent form {{ notificationType }}
</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 {{ notificationType }} 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: 'CandidateFormNotification',
components: {
ActionButton,
},
mixins: [permissionMixin],
props: {
type: {
type: String,
required: true,
default: '',
},
notificationType: {
type: String,
required: true,
default: '',
},
selectedItems: {
type: Array,
required: false,
default: () => [],
},
exercise: {
type: Object,
default: null,
},
dueDate: {
type: String,
required: true,
default: '',
},
},
emits: ['close', 'confirmed', 'setmessage', 'reset'],
data() {
return {
processing: false,
};
},
computed: {
exerciseMailbox() {
return this.exercise?.exerciseMailbox || '';
},
exerciseManagerName() {
return this.exercise?.emailSignatureName || '';
},
numberOfCandidates() {
return this.selectedItems.length;
},
buttonText() {
return `I confirm, please send ${this.notificationType}`;
},
},
methods: {
closeModal() {
this.$emit('close');
},
confirmModal() {
this.modalOpen = false;
this.$emit('confirmed');
document.body.style.overflow = '';
},
async send() {
try {
const response = await functions.httpsCallable('sendCandidateFormNotifications')({
type: this.type,
notificationType: this.notificationType,
items: this.selectedItems,
exerciseMailbox: this.exerciseMailbox,
exerciseManagerName: this.exerciseManagerName,
dueDate: this.dueDate,
});
if (response === false) {
this.$emit('setmessage', false, 'warning');
} else {
this.$emit('setmessage', true, this.notificationType, 'success');
}
} catch (error) {
this.$emit('setmessage', false, this.notificationType, 'warning');
}
this.closeModal();
this.$emit('reset');
},
},
};
</script>

<style scoped>
fieldset {
border: none;
padding: 0;
margin: 0;
}
</style>
2 changes: 1 addition & 1 deletion src/helpersTMP/Timeline/exerciseTimeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const exerciseTimeline = (data) => {
);
}

if (data.preSelectionDayQuestionnaireSendDate) {
if (data.selectionDayQuestionnaireSendDate) {
timeline.push(
{
entry: 'Pre Selection Day Questionnaire - sent',
Expand Down
2 changes: 2 additions & 0 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import panellist from '@/store/panellists/document';
import checks from '@/store/checks/collection';
// import candidateForms from '@/store/candidateForms/collection';
import candidateForm from '@/store/candidateForms/document';
import candidateFormRecords from '@/store/candidateForms/records';

import exerciseDiversity from '@/store/exercise/diversity/document';
import messageBase from '@/store/baseClasses/messageBase';
Expand All @@ -55,6 +56,7 @@ const store = createStore({
auth,
candidateApplications,
candidateForm,
candidateFormRecords,
candidates,
characterChecks,
checks,
Expand Down
33 changes: 33 additions & 0 deletions src/store/candidateForms/records.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { firestore } from '@/firebase';
import { firestoreAction } from '@/helpers/vuexfireJAC';
import vuexfireSerialize from '@jac-uk/jac-kit/helpers/vuexfireSerialize';
import tableQuery from '@jac-uk/jac-kit/components/Table/tableQuery';

const collectionRef = firestore.collection('applicationRecords');

export default {
namespaced: true,
actions: {
bind: firestoreAction(async ({ bindFirestoreRef, state }, { type, ...params }) => {
let firestoreRef = collectionRef
.where('exercise.id', '==', params.exerciseId)
.where('active', '==', true);

firestoreRef = firestoreRef.where(`${type}.status`, '==', params.status);
firestoreRef = await tableQuery(state.records, firestoreRef, params);
return bindFirestoreRef('records', firestoreRef, { serialize: vuexfireSerialize });
}),
unbind: firestoreAction(({ unbindFirestoreRef }) => {
unbindFirestoreRef('records');
return true;
}),
},
mutations: {
set(state, { name, value }) {
state[name] = value;
},
},
state: {
records: [],
},
};
Loading
Loading