diff --git a/src/components/date-range-picker.vue b/src/components/date-range-picker.vue index c80eccf74..d873f6062 100644 --- a/src/components/date-range-picker.vue +++ b/src/components/date-range-picker.vue @@ -16,10 +16,12 @@ except according to the terms contained in the LICENSE file. https://github.com/ankurk91/vue-flatpickr-component/issues/47 --> @@ -48,6 +51,14 @@ export default { reviewState: { type: Array, required: true + }, + disabled: { + type: Boolean, + required: true + }, + disabledMessage: { + type: String, + required: false } }, emits: ['update:submitterId', 'update:submissionDate', 'update:reviewState'] diff --git a/src/components/submission/list.vue b/src/components/submission/list.vue index 08d9c1342..d16548d72 100644 --- a/src/components/submission/list.vue +++ b/src/components/submission/list.vue @@ -17,7 +17,8 @@ except according to the terms contained in the LICENSE file.
+ v-model:reviewState="reviewStates" + :disabled="deleted" :disabled-message="deleted ? $t('filterDisabledMessage') : null"/> @@ -29,15 +30,24 @@ except according to the terms contained in the LICENSE file. + :aria-disabled="deleted" v-tooltip.aria-describedby="deleted ? $t('downloadDisabled') : null" + :filtered="odataFilter != null && !deleted" @download="downloadModal.show()"/> - -

+

- {{ odataFilter == null ? $t('submission.emptyTable') : $t('noMatching') }} + +

+ + + + +{ + "en": { + // This is the title at the top of Submission undelete pop-up. + "title": "Undelete Submission", + "introduction": [ + "Are you sure you want to undelete this Submission?", + "The Submission will be restored to its previous state, including associated data like comments.", + "If the Submission is deleted again, it will be another 30 days before it is removed." + ], + "field": { + "noConfirm": "Undelete immediately without confirmation until I leave the page" + } + } +} + diff --git a/src/components/submission/show.vue b/src/components/submission/show.vue index 3cfff7d44..eef7d3ad0 100644 --- a/src/components/submission/show.vue +++ b/src/components/submission/show.vue @@ -27,13 +27,16 @@ except according to the terms contained in the LICENSE file.
+ @comment="fetchActivityData" @delete="deleteModal.show()"/>
+ @@ -47,13 +50,16 @@ import PageHead from '../page/head.vue'; import SubmissionActivity from './activity.vue'; import SubmissionBasicDetails from './basic-details.vue'; import SubmissionUpdateReviewState from './update-review-state.vue'; +import SubmissionDelete from './delete.vue'; import useFields from '../../request-data/fields'; import useRoutes from '../../composables/routes'; +import useRequest from '../../composables/request'; import useSubmission from '../../request-data/submission'; import { apiPaths } from '../../util/request'; import { modalData, setDocumentTitle } from '../../util/reactivity'; import { useRequestData } from '../../request-data'; +import { noop } from '../../util/util'; export default { name: 'SubmissionShow', @@ -64,6 +70,7 @@ export default { PageHead, SubmissionActivity, SubmissionBasicDetails, + SubmissionDelete, SubmissionUpdateReviewState }, inject: ['alert'], @@ -83,6 +90,8 @@ export default { }, setup() { const { project, resourceStates } = useRequestData(); + const { request, awaitingResponse } = useRequest(); + const { submission, submissionVersion, audits, comments, diffs } = useSubmission(); const fields = useFields(); @@ -94,8 +103,8 @@ export default { const { formPath } = useRoutes(); return { project, submission, submissionVersion, audits, comments, diffs, fields, - ...resourceStates([project, submission]), - reviewModal: modalData(), + request, awaitingResponse, ...resourceStates([project, submission]), + reviewModal: modalData(), deleteModal: modalData(), formPath }; }, @@ -166,6 +175,18 @@ export default { this.reviewModal.hide(); this.alert.success(this.$t('alert.updateReviewState')); this.submission.__system.reviewState = reviewState; + }, + requestDelete([{ __id: instanceId }]) { + this.request({ + method: 'DELETE', + url: apiPaths.submission(this.projectId, this.xmlFormId, instanceId) + }) + .then(() => { + const message = this.$t('alert.submissionDeleted'); + this.$router.push(this.formPath('submissions')) + .then(() => { this.alert.success(message); }); + }) + .catch(noop); } } }; diff --git a/src/components/submission/table.vue b/src/components/submission/table.vue index 9335701a7..566f61ee5 100644 --- a/src/components/submission/table.vue +++ b/src/components/submission/table.vue @@ -12,12 +12,13 @@ except according to the terms contained in the LICENSE file.