Skip to content

Commit

Permalink
Merge pull request #1092 from jac-uk/feature/1063-extension
Browse files Browse the repository at this point in the history
#1063 Extend Application
  • Loading branch information
lloback authored Nov 27, 2020
2 parents 9fa0072 + 1d16efa commit 5f7da3a
Show file tree
Hide file tree
Showing 16 changed files with 192 additions and 239 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
- checkout
- run:
name: 'Setup'
command: npm ci
command: |
echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_TOKEN}" > ~/.npmrc
npm ci
- persist_to_workspace:
root: .
paths:
Expand Down Expand Up @@ -54,7 +56,7 @@ jobs:
name: 'Deploy to production'
command: |
npm run build-production
node_modules/.bin/firebase target:apply hosting production-admin-app jac-apply-admin-production --project production
node_modules/.bin/firebase target:apply hosting production-admin-app jac-apply-admin-production --project production
node_modules/.bin/firebase deploy --force --token=$FIREBASE_DEPLOY_TOKEN --only hosting:production-admin-app --project production
build-and-deploy-staging:
Expand Down Expand Up @@ -117,6 +119,6 @@ workflows:
- test
filters:
branches:
only:
only:
- master
- /hotfix/.*/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://npm.pkg.github.com/jac-uk
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
'^.+\\.jsx?$': 'babel-jest',
},
transformIgnorePatterns: [
'/node_modules/',
'/node_modules/(?!@jac-uk)',
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
Expand Down
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dependencies": {
"@ckeditor/ckeditor5-build-classic": "^16.0.0",
"@ckeditor/ckeditor5-vue": "^1.0.1",
"@jac-uk/jackit": "0.0.6",
"@ministryofjustice/frontend": "0.0.17-alpha",
"@sentry/browser": "^5.20.1",
"@sentry/integrations": "^5.20.1",
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditableField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
class="edit-field"
>
<TextField
v-if="isText || isEmail"
v-if="isText || isEmail || isRoute"
:id="`editable-field-${id}`"
v-model="localField"
/>
Expand Down Expand Up @@ -94,7 +94,7 @@ export default {
default: 'value',
},
value: {
type: [String, Date, Number],
type: [String, Date, Number, Object],
default: '',
},
type: {
Expand Down
51 changes: 0 additions & 51 deletions src/components/Modal/Modal.README.md

This file was deleted.

70 changes: 0 additions & 70 deletions src/components/Modal/Modal.vue

This file was deleted.

98 changes: 98 additions & 0 deletions src/components/ModalViews/SubmissionExtension.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<template>
<div>
<div class="modal__title govuk-!-padding-2 govuk-heading-m">
Submission Extension
</div>
<div class="modal__content govuk-!-margin-6">
<div class="govuk-grid-row">
<form
ref="formRef"
>
<fieldset>
<TextField
id="date-extension-reason"
v-model="dateExtensionReason"
label="Reason for extension"
required
/>
<DateInput
id="date-extension"
v-model="dateExtension"
:value="dateExtension"
/>
</fieldset>
<button
class="govuk-button govuk-!-margin-right-3"
@click.prevent="save"
>
Save
</button>
<button
class="govuk-button govuk-button--secondary govuk-!-margin-right-3"
@click.prevent="closeModal"
>
Cancel
</button>
</form>
</div>
</div>
</div>
</template>

<script>
import firebase from '@firebase/app';
import TextField from '@/components/Form/TextField';
import DateInput from '@/components/Form/DateInput';
export default {
name: 'SubmissionExtension',
components: {
TextField,
DateInput,
},
data() {
return {
dateExtension: null,
dateExtensionReason: null,
};
},
created() {
this.dateExtension = this.$attrs.dateExtension;
},
methods: {
closeModal() {
this.$emit('close');
},
confirmModal() {
this.modalOpen = false;
this.$emit('confirmed');
document.body.style.overflow = '';
},
async save() {
const data = {
dateExtension: this.dateExtension,
};
const dataNotes = {
applicationId: this.$attrs.applicationId,
body: `Application extended to: ${this.dateExtension}: ${this.dateExtensionReason}`,
candidate: {
id: this.$attrs.userId,
},
created: firebase.firestore.FieldValue.serverTimestamp(),
};
await this.$store.dispatch('application/update', { data: data, id: this.$attrs.applicationId });
await this.$store.dispatch('notes/save', { data: dataNotes });
this.closeModal();
},
},
};
</script>

<style scoped>
fieldset {
border: none;
padding: 0;
margin: 0;
}
</style>
8 changes: 8 additions & 0 deletions src/components/Notes/Notes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default {
type: String,
default: '',
},
applicationId: {
type: String,
default: '',
},
title: {
type: String,
default: 'Notes',
Expand Down Expand Up @@ -97,6 +101,7 @@ export default {
created() {
const data = {};
data.candidateId = this.candidateId || null;
data.applicationId = this.applicationId || null;
this.$store.dispatch('notes/bind', data );
},
methods: {
Expand All @@ -107,6 +112,9 @@ export default {
id: this.candidateId || null,
};
}
if (this.applicationId) {
data.applicationId = this.applicationId;
}
this.noteSelectedObj = data;
this.notesAction = STEPS.new;
},
Expand Down
9 changes: 6 additions & 3 deletions src/store/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ const collection = firestore.collection('notes');
export default {
namespaced: true,
actions: {
bind: firestoreAction(async ({ bindFirestoreRef }, { candidateId }) => {
let firestoreRef;
bind: firestoreAction(async ({ bindFirestoreRef }, { candidateId, applicationId }) => {
let firestoreRef = collection;
if (candidateId) {
firestoreRef = collection
firestoreRef = firestoreRef
.where('candidate.id', '==', candidateId)
.orderBy('created', 'desc');
}
if (applicationId) {
firestoreRef = firestoreRef.where('applicationId', '==', applicationId);
}
if (firestoreRef) {
await bindFirestoreRef('records', firestoreRef, { serialize: vuexfireSerialize });
}
Expand Down
Loading

0 comments on commit 5f7da3a

Please sign in to comment.