diff --git a/src/components/ListPanel/users/SelectReviewerListPanel.vue b/src/components/ListPanel/users/SelectReviewerListPanel.vue index 4d7fab2ee..84542560b 100644 --- a/src/components/ListPanel/users/SelectReviewerListPanel.vue +++ b/src/components/ListPanel/users/SelectReviewerListPanel.vue @@ -27,12 +27,14 @@ @@ -361,6 +363,11 @@ export default { return []; }, }, + /** The API Url to obtain reviewer suggestion for this submission */ + reviewerSuggestionsApiUrl: { + type: String, + required: false, + }, }, emits: [ /** Emitted when a prop should be changed. Payload: `(id, newProps)` */ @@ -456,6 +463,37 @@ export default { itemsMax, }); }, + + /** + * Update the list of reviewer suggestions list + * + * @param {Number} reviewerSuggestionId + */ + updateReviewerSuggestionList(reviewerSuggestionId) { + this.isLoading = true; + $.ajax({ + url: this.reviewerSuggestionsApiUrl + '/' + reviewerSuggestionId, + type: 'GET', + context: this, + headers: { + 'X-Csrf-Token': pkp.currentUser.csrfToken, + }, + error: this.ajaxErrorCallback, + success(r) { + // TODO : may be some better appraoch than this ? + if (r.approvedAt) { + this.suggestions.forEach((reviewerSuggestion) => { + if (reviewerSuggestion.id == reviewerSuggestionId) { + reviewerSuggestion.approvedAt = r.approvedAt; + } + }); + } + }, + complete(r) { + this.isLoading = false; + }, + }); + }, }, }; diff --git a/src/components/ListPanel/users/SelectReviewerSuggestionListItem.vue b/src/components/ListPanel/users/SelectReviewerSuggestionListItem.vue index 114bb9cf8..8dd96e838 100644 --- a/src/components/ListPanel/users/SelectReviewerSuggestionListItem.vue +++ b/src/components/ListPanel/users/SelectReviewerSuggestionListItem.vue @@ -127,9 +127,8 @@ export default { }, }); - openLegacyModal( - {title: t('editor.submission.addReviewer')}, - function () {}, + openLegacyModal({title: t('editor.submission.addReviewer')}, () => + this.$emit('update:suggestions', this.item.id), ); }, },