diff --git a/backend/src/components/requests.js b/backend/src/components/requests.js index 3265103a6..782f22931 100644 --- a/backend/src/components/requests.js +++ b/backend/src/components/requests.js @@ -23,18 +23,13 @@ function getAllRequests(requestType) { const statusFilters = req.query.statusFilters; if (req.query.headerFilters) { - let headerFilters = JSON.parse(req.query.headerFilters); + let headerFilters = req.query.headerFilters; Object.keys(headerFilters).forEach(element => { let operation = 'like_ignore_case'; let valueType = 'STRING'; if (element === 'initialSubmitDate') { - headerFilters[element].forEach((date, index) => { - headerFilters[element][index] = date + 'T00:00:01'; - }); - if (headerFilters[element].length === 1) { - headerFilters[element].push(LocalDateTime.now().toString()); - } - headerFilters[element] = headerFilters[element].join(','); + const submissionDate = headerFilters['initialSubmitDate'] + 'T00:00:01'; + headerFilters[element] = submissionDate + ',' + LocalDateTime.now().toString(); operation = 'btn'; valueType = 'DATE_TIME'; } @@ -132,7 +127,7 @@ function getRequestCommentById(requestType) { name: (element.staffMemberName ? element.staffMemberName : 'Student'), timestamp: readableTime, color: (element.staffMemberIDIRGUID ? 'adminGreen' : 'studentBlue'), - icon: (element.staffMemberIDIRGUID ? '$question' : '$info') + icon: (element.staffMemberIDIRGUID ? 'mdi-help-circle' : 'mdi-alert-circle') }); }); return res.status(200).json(response); diff --git a/backend/tests/unit/components/penRequests.spec.js b/backend/tests/unit/components/penRequests.spec.js index bd9c27e8b..b9264113e 100644 --- a/backend/tests/unit/components/penRequests.spec.js +++ b/backend/tests/unit/components/penRequests.spec.js @@ -128,7 +128,7 @@ describe('getPenRequestCommentById', () => { 'participantId': '11', 'name': 'IDIR', 'color': 'adminGreen', - 'icon': '$question', + 'icon': 'mdi-help-circle', 'timestamp': '2020-03-18 2:22pm' }, { @@ -136,7 +136,7 @@ describe('getPenRequestCommentById', () => { 'participantId': '1', 'name': 'Student', 'color': 'studentBlue', - 'icon': '$info', + 'icon': 'mdi-alert-circle', 'timestamp': '2020-04-18 2:22pm' } ] diff --git a/frontend/src/components/Chat.vue b/frontend/src/components/Chat.vue index ed77a3723..3bc894734 100644 --- a/frontend/src/components/Chat.vue +++ b/frontend/src/components/Chat.vue @@ -162,6 +162,10 @@ export default { background-color: #555; } + .white--text{ + color: white; + } + .v-toolbar /deep/ .v-toolbar__content { padding-left: 20px !important; } diff --git a/frontend/src/components/RequestDetail.vue b/frontend/src/components/RequestDetail.vue index 1e6b0a2fe..971c7e0ac 100644 --- a/frontend/src/components/RequestDetail.vue +++ b/frontend/src/components/RequestDetail.vue @@ -18,12 +18,12 @@ - + {{ title }} - @@ -132,11 +133,14 @@ id="asOfDate" class="mb-2" > - {{ request['statusUpdateDate'] ? moment(request['statusUpdateDate']).fromNow():'' }}, at {{ request['statusUpdateDate'] ? moment(request['statusUpdateDate']).format('YYYY/MM/DD LT'):'' }} + {{ getFromMomentDate(request['statusUpdateDate']) }}, at + {{ getMomentDate(request['statusUpdateDate']) }}

- + - {{ request.initialSubmitDate ? moment(request.initialSubmitDate).fromNow():'' }}, at {{ request.initialSubmitDate ? moment(request.initialSubmitDate).format('YYYY/MM/DD LT'):'' }} + {{ getFromMomentDate(request.initialSubmitDate) }}, + at {{ getMomentDate(request.initialSubmitDate) }}

@@ -179,6 +184,7 @@ @@ -395,7 +431,7 @@ flat color="#036" dark - class="panel-header tester" + class="panel-header white--text tester" >

Actions

@@ -435,7 +471,8 @@ import ImageRenderer from '@/components/common/ImageRenderer.vue'; import {notificationsStore} from '@/store/modules/notifications'; import {appStore} from '@/store/modules/app'; import {authStore} from '@/store/modules/auth'; -import {requestStore} from '@/store/modules/request'; +import {getMomentDate, getFromMomentDate} from '@/utils/dateHelpers'; +import {getRequestStore} from '@/utils/common'; export default { name: 'RequestDetail', @@ -467,14 +504,14 @@ export default { required: true } }, - data () { + data() { return { headers: [ - { text: 'Type', value: 'documentTypeLabel', }, - { text: 'File Name', value: 'fileName' }, - { text: 'Upload Date/time', value: 'createDate' }, - { text: 'Size', value: 'fileSize' }, - { text: '', value: 'action', sortable: false } + {title: 'Type', text: 'Type', value: 'documentTypeLabel', key: 'documentTypeLabel'}, + {title: 'File Name', text: 'File Name', value: 'fileName', key: 'fileName'}, + {title: 'Upload Date/time', text: 'Upload Date/time', value: 'createDate', key: 'createDate'}, + {title: 'Size', text: 'Size', value: 'fileSize', key: 'fileSize'}, + {title: '', text: '', value: 'action', sortable: false, key: 'action'} ], validForm: false, requiredRules: [v => !!v || 'Required'], @@ -482,13 +519,14 @@ export default { name: null, id: null, }, - fileSizeConverter:humanFileSize, + docChangeDialog: false, + fileSizeConverter: humanFileSize, enableActions: true, loadingPen: true, loadingComments: true, loadingActionResults: false, loadingClaimAction: false, - filteredResults:[], + filteredResults: [], activeTab: 0, documentTypes: [], oldDocumentTypeCode: '', @@ -517,13 +555,13 @@ export default { return Statuses[this.requestType]; }, returnMacros() { - return this.$store.getters[`${this.requestType}/returnMacros`]; + return this.getRequestStore(this.requestType).returnMacros; }, rejectMacros() { - return this.$store.getters[`${this.requestType}/rejectMacros`]; + return this.getRequestStore(this.requestType).rejectMacros; }, completeMacros() { - return this.$store.getters[`${this.requestType}/completeMacros`]; + return this.getRequestStore(this.requestType).completeMacros; }, isClaimDisabled() { return !this.enableActions || !this.actionsEnabled || this.isRequestCompleted || this.request[this.requestStatusCodeName] === 'DRAFT' || this.request[this.requestStatusCodeName] === 'ABANDONED'; @@ -538,7 +576,7 @@ export default { return this.enableActions && !this.isRequestCompleted && this.actionsEnabled; }, actionsEnabled() { - if(this.requestType === REQUEST_TYPES.penRequest.name) { + if (this.requestType === REQUEST_TYPES.penRequest.name) { return this.ACTION_GMP_REQUESTS_ROLE; } else { return this.ACTION_UMP_REQUESTS_ROLE; @@ -558,21 +596,19 @@ export default { this.loadingComments = true; this.myself.name = this.userInfo.userName; this.myself.id = this.userInfo.userGuid; - if(!this.returnMacros || ! this.rejectMacros) { - requestStore().getMacros(this.requestType); + if (!this.returnMacros || !this.rejectMacros) { + this.getRequestStore(this.requestType).getMacros(); } - this.documentTypes = requestStore().documentTypes - .sort((a, b) => a.displayOrder - b.displayOrder) - .map(code => ({text: code.label, value: code.documentTypeCode})); + this.getDocumentTypes(); ApiService.apiAxios .get(Routes[this.requestType].ROOT_ENDPOINT + '/' + this.requestId) .then(response => { this.setRequest(response.data); - if(this.request[this.requestStatusCodeName] === this.statusCodes.REJECTED) { + if (this.request[this.requestStatusCodeName] === this.statusCodes.REJECTED) { this.activeTab = 2; } - if(response.data && response.data.sagaInProgress){ + if (response.data && response.data.sagaInProgress) { this.sagaInProgress = true; } }) @@ -580,7 +616,7 @@ export default { console.log(error); }) .finally(() => { - if(!this.sagaInProgress) { + if (!this.sagaInProgress) { this.enableActions = true; } this.loadingPen = false; @@ -596,7 +632,9 @@ export default { }); }, methods: { - ...mapActions(appStore, ['setRequest','setMessages','setParticipants']), + ...mapActions(appStore, ['setRequest', 'setMessages', 'setParticipants']), + getMomentDate, + getFromMomentDate, documentUrl(requestId, document) { return `${Routes[this.requestType].ROOT_ENDPOINT}/${requestId}/documents/${document.documentID}`; }, @@ -605,10 +643,25 @@ export default { * @param requestId * @param document */ - showDocModal(requestId, document){ + showDocModal(requestId, document) { this.imageId = document.documentID; this.imageRendererDialog = true; }, + getDocumentTypes() { + ApiService.apiAxios + .get(Routes[this.requestType].DOCUMENT_TYPES_URL) + .then(response => { + if (response?.data) { + this.getRequestStore(this.requestType).setDocumentTypes(response.data); + this.documentTypes = this.getRequestStore(this.requestType).documentTypes + .sort((a, b) => a.displayOrder - b.displayOrder) + .map(code => ({text: code.label, value: code.documentTypeCode})); + } + }) + .catch(error => { + console.log(error); + }); + }, async closeDialog() { this.documentId = ''; this.imageId = ''; @@ -617,13 +670,12 @@ export default { }, claimRequest() { this.loadingClaimAction = true; - this.claimErrorMessage=''; + this.claimErrorMessage = ''; this.disableActionButtons(); let body = this.prepPut(this.requestId, this.request); - if(this.request.reviewer !== this.myself.name) { + if (this.request.reviewer !== this.myself.name) { body.reviewer = this.myself.name; - } - else { + } else { body.reviewer = null; } ApiService.apiAxios @@ -632,7 +684,7 @@ export default { this.request.reviewer = response.data.reviewer; }) .catch(error => { - this.claimErrorMessage=`There was an error trying to claim the ${this.requestTypeLabel} Request, please navigate to the list and select this ${this.requestTypeLabel} Request again.`; + this.claimErrorMessage = `There was an error trying to claim the ${this.requestTypeLabel} Request, please navigate to the list and select this ${this.requestTypeLabel} Request again.`; this.setFailureAlert(this.claimErrorMessage); console.log(error); }) @@ -648,14 +700,15 @@ export default { this.enableActions = true; }, backToList() { - router.push({ name: REQUEST_TYPES[this.requestType].label, params: { requestType: this.requestType } }); + router.push({name: REQUEST_TYPES[this.requestType].label}); }, setDocumentError(message) { this.documentErrorMessage = message; this.setFailureAlert(this.documentErrorMessage); }, + getRequestStore, setDocumentTypeLabel(document) { - const documentTypeInfo = requestStore().documentTypes.find(typeInfo => + const documentTypeInfo = this.getRequestStore(this.requestType).documentTypes.find(typeInfo => typeInfo.documentTypeCode === document.documentTypeCode ); document.documentTypeLabel = documentTypeInfo ? documentTypeInfo.label : document.documentTypeCode; @@ -685,7 +738,7 @@ export default { this.switchLoading(false); this.enableActionButtons(); }, - refreshRequestDetailsAndComments(){ + refreshRequestDetailsAndComments() { ApiService.apiAxios .get(Routes[this.requestType].ROOT_ENDPOINT + '/' + this.requestId + '/comments') .then(response => { @@ -700,7 +753,7 @@ export default { .get(Routes[this.requestType].ROOT_ENDPOINT + '/' + this.requestId) .then(response => { this.setRequest(response.data); - if(this.request[this.requestStatusCodeName] === this.statusCodes.REJECTED) { + if (this.request[this.requestStatusCodeName] === this.statusCodes.REJECTED) { this.activeTab = 2; } }) @@ -711,7 +764,7 @@ export default { }, watch: { notification(val) { - if(val) { + if (val) { let notificationData = val; if (notificationData[`${this.requestType}ID`] && notificationData[`${this.requestType}ID`] === this.requestId && notificationData.sagaStatus === 'INITIATED') { this.beforeSubmit(); @@ -727,36 +780,57 @@ export default { }; diff --git a/frontend/src/components/RequestReject.vue b/frontend/src/components/RequestReject.vue index 4ef80875f..8ad904a6d 100644 --- a/frontend/src/components/RequestReject.vue +++ b/frontend/src/components/RequestReject.vue @@ -9,7 +9,7 @@ ref="form" v-model="validForm" > - + import ApiService from '../common/apiService'; import {REQUEST_TYPES, Routes, Statuses} from '../utils/constants'; -import { replaceMacro, insertMacro } from '../utils/macro'; +import {replaceMacro, insertMacro} from '../utils/macro'; import {mapActions, mapState} from 'pinia'; import PrimaryButton from './util/PrimaryButton.vue'; import alertMixin from '../mixins/alertMixin'; @@ -66,6 +66,7 @@ import MacroMenu from './common/MacroMenu.vue'; import {notificationsStore} from '@/store/modules/notifications'; import {appStore} from '@/store/modules/app'; import {authStore} from '@/store/modules/auth'; +import {getRequestStore} from '@/utils/common'; export default { name: 'RequestReject', @@ -96,12 +97,12 @@ export default { required: true }, }, - data () { + data() { return { validForm: false, requiredRules: isValidLength(4000), rejectComment: null, - rejectOperationOutcomeMessage : null, + rejectOperationOutcomeMessage: null, }; }, computed: { @@ -115,7 +116,7 @@ export default { return this.selectedRequest; }, rejectMacros() { - return this.$store.getters[`${this.requestType}/rejectMacros`]; + return this.getRequestStore(this.requestType).rejectMacros; }, myself() { return { @@ -130,7 +131,7 @@ export default { return this.enableActions && this.request[this.requestStatusCodeName] !== 'ABANDONED'; }, isRejectEnabledForUser() { - if(this.requestType === REQUEST_TYPES.penRequest.name) { + if (this.requestType === REQUEST_TYPES.penRequest.name) { return this.ACTION_GMP_REQUESTS_ROLE; } else { return this.ACTION_UMP_REQUESTS_ROLE; @@ -142,7 +143,7 @@ export default { if (val) { let notificationData = val; if (notificationData[`${this.requestType}ID`] && notificationData[`${this.requestType}ID`] === this.requestId && notificationData.sagaStatus === 'COMPLETED' - && (notificationData.sagaName === 'PEN_REQUEST_REJECT_SAGA' || notificationData.sagaName === 'STUDENT_PROFILE_REJECT_SAGA') ) { + && (notificationData.sagaName === 'PEN_REQUEST_REJECT_SAGA' || notificationData.sagaName === 'STUDENT_PROFILE_REJECT_SAGA')) { this.rejectOperationOutcomeMessage = 'Your request to reject is now completed.'; this.setSuccessAlert(this.rejectOperationOutcomeMessage); } @@ -157,6 +158,7 @@ export default { replaceRejectMacro() { this.rejectComment = replaceMacro(this.rejectComment, this.rejectMacros); }, + getRequestStore, submitReject() { this.rejectOperationOutcomeMessage = null; if (this.$refs.form.validate()) { diff --git a/frontend/src/components/RequestReturn.vue b/frontend/src/components/RequestReturn.vue index bb1d6cb7c..6990ee0c5 100644 --- a/frontend/src/components/RequestReturn.vue +++ b/frontend/src/components/RequestReturn.vue @@ -6,7 +6,7 @@ :disabled="!isRequestMoreInfoEnabledForUser" > - + - -