diff --git a/public/globals.js b/public/globals.js index 3d90f042c..53dacb4f3 100644 --- a/public/globals.js +++ b/public/globals.js @@ -67,12 +67,12 @@ window.pkp = { SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS: 2, SUBMISSION_REVIEW_METHOD_OPEN: 3, - SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT: 1, - SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS: 2, - SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE: 3, - SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE: 4, - SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE: 5, - SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS: 6, + // SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT: 1, + // SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS: 2, + // SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE: 3, + // SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE: 4, + // SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE: 5, + // SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS: 6, ROLE_ID_MANAGER: 16, ROLE_ID_SITE_ADMIN: 1, diff --git a/src/composables/useSubmission.js b/src/composables/useSubmission.js index 8a356a39a..777fcafd3 100644 --- a/src/composables/useSubmission.js +++ b/src/composables/useSubmission.js @@ -25,26 +25,26 @@ export const ExtendedStagesLabels = { declined: tk('submissions.declined'), }; -export const RecommendationTranslations = { - [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT]: tk( - 'reviewer.article.decision.accept', - ), - [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS]: tk( - 'reviewer.article.decision.pendingRevisions', - ), - [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE]: tk( - 'reviewer.article.decision.resubmitHere', - ), - [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE]: tk( - 'reviewer.article.decision.resubmitElsewhere', - ), - [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE]: tk( - 'reviewer.article.decision.decline', - ), - [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS]: tk( - 'reviewer.article.decision.seeComments', - ), -}; +// export const RecommendationTranslations = { +// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT]: tk( +// 'reviewer.article.decision.accept', +// ), +// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS]: tk( +// 'reviewer.article.decision.pendingRevisions', +// ), +// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE]: tk( +// 'reviewer.article.decision.resubmitHere', +// ), +// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE]: tk( +// 'reviewer.article.decision.resubmitElsewhere', +// ), +// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE]: tk( +// 'reviewer.article.decision.decline', +// ), +// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS]: tk( +// 'reviewer.article.decision.seeComments', +// ), +// }; const InProgressReviewAssignmentStatuses = [ pkp.const.REVIEW_ASSIGNMENT_STATUS_ACCEPTED, diff --git a/src/managers/ReviewerManager/ReviewerManager.vue b/src/managers/ReviewerManager/ReviewerManager.vue index 143d447e4..c19d95f60 100644 --- a/src/managers/ReviewerManager/ReviewerManager.vue +++ b/src/managers/ReviewerManager/ReviewerManager.vue @@ -100,6 +100,7 @@ const props = defineProps({ submission: {type: Object, required: true}, reviewRoundId: {type: Number, required: true}, redactedForAuthors: {type: Boolean, required: false, default: false}, + recommendations: {type: Array, required: true}, }); const reviewerStore = useReviewerManagerStore(props); diff --git a/src/managers/ReviewerManager/reviewerManagerStore.js b/src/managers/ReviewerManager/reviewerManagerStore.js index 1e1e90339..9ca87388c 100644 --- a/src/managers/ReviewerManager/reviewerManagerStore.js +++ b/src/managers/ReviewerManager/reviewerManagerStore.js @@ -35,7 +35,9 @@ export const useReviewerManagerStore = defineComponentStore( /** * Config */ - const {getCellStatusItems} = useReviewerManagerConfig(); + const {getCellStatusItems} = useReviewerManagerConfig( + props.recommendations, + ); /** * Actions diff --git a/src/managers/ReviewerManager/useReviewerManagerConfig.js b/src/managers/ReviewerManager/useReviewerManagerConfig.js index 82d965561..87962e32d 100644 --- a/src/managers/ReviewerManager/useReviewerManagerConfig.js +++ b/src/managers/ReviewerManager/useReviewerManagerConfig.js @@ -1,25 +1,31 @@ import {useLocalize} from '@/composables/useLocalize'; import {useDate} from '@/composables/useDate'; -import {RecommendationTranslations} from '@/composables/useSubmission'; -export function useReviewerManagerConfig() { - const {t} = useLocalize(); +// import {RecommendationTranslations} from '@/composables/useSubmission'; +export function useReviewerManagerConfig(recommendations) { + const {t, localize} = useLocalize(); const {formatShortDate} = useDate(); function getCellStatusItems({reviewAssignment}) { const items = []; function getRecommendationString(reviewAssignment) { - const recommendationString = reviewAssignment.recommendation - ? t(RecommendationTranslations[reviewAssignment.recommendation]) - : null; + // const recommendationString = reviewAssignment.recommendation + // ? t(RecommendationTranslations[reviewAssignment.recommendation]) + // : null; - if (recommendationString) { - return t('submission.recommendation', { - recommendation: recommendationString, - }); - } + // if (recommendationString) { + // return t('submission.recommendation', { + // recommendation: recommendationString, + // }); + // } + + // return null; + + const recommendation = recommendations.filter( + (r) => r.value === reviewAssignment.recommendation, + )[0]; - return null; + return recommendation ? localize(recommendation.title) : null; } function getCompetingInterests(reviewAssignment) { diff --git a/src/pages/dashboard/DashboardPage.vue b/src/pages/dashboard/DashboardPage.vue index 16e531244..01feefd94 100644 --- a/src/pages/dashboard/DashboardPage.vue +++ b/src/pages/dashboard/DashboardPage.vue @@ -109,6 +109,11 @@ const props = defineProps({ type: Object, required: true, }, + /** context available reviewer recommendations */ + recommendations: { + type: Array, + required: true, + }, }); const store = useDashboardPageStore(props); diff --git a/src/pages/dashboard/composables/useReviewActivityLogic.js b/src/pages/dashboard/composables/useReviewActivityLogic.js index f07dd47df..dd7cf7141 100644 --- a/src/pages/dashboard/composables/useReviewActivityLogic.js +++ b/src/pages/dashboard/composables/useReviewActivityLogic.js @@ -1,11 +1,8 @@ import {useLocalize} from '@/composables/useLocalize'; import {useDate} from '@/composables/useDate'; -import { - useSubmission, - RecommendationTranslations, -} from '@/composables/useSubmission'; +import {useSubmission} from '@/composables/useSubmission'; import {Actions as ReviewerManagerActions} from '@/managers/ReviewerManager/useReviewerManagerActions'; -const {tk, t} = useLocalize(); +const {tk, t, localize} = useLocalize(); const {calculateDaysBetweenDates} = useDate(); const ReviewActivityActions = { @@ -282,7 +279,7 @@ function getDays(config, reviewAssignment) { return null; } -export function useReviewActivityLogic() { +export function useReviewActivityLogic(recommendations) { function getReviewActivityIndicatorProps(reviewAssignment) { const config = ConfigPerStatus[reviewAssignment.statusId]; @@ -323,9 +320,11 @@ export function useReviewActivityLogic() { const date = getDate(config, reviewAssignment); function getRecommendation() { - return RecommendationTranslations[reviewAssignment.recommendation] - ? t(RecommendationTranslations[reviewAssignment.recommendation]) - : null; + const recommendation = recommendations.filter( + (r) => r.value === reviewAssignment.recommendation, + )[0]; + + return recommendation ? localize(recommendation.title) : null; } const days = getDays(config, reviewAssignment); diff --git a/src/pages/dashboard/dashboardPageStore.js b/src/pages/dashboard/dashboardPageStore.js index 852266574..34982d6cd 100644 --- a/src/pages/dashboard/dashboardPageStore.js +++ b/src/pages/dashboard/dashboardPageStore.js @@ -407,7 +407,7 @@ export const useDashboardPageStore = defineComponentStore( const { getReviewActivityIndicatorProps, getReviewActivityIndicatorPopoverProps, - } = useReviewActivityLogic(); + } = useReviewActivityLogic(pageInitConfig.recommendations); return { // Dashboard diff --git a/src/pages/workflow/composables/useWorkflowConfig/useWorkflowConfigOJS.js b/src/pages/workflow/composables/useWorkflowConfig/useWorkflowConfigOJS.js index 6e21e56fc..9118a3269 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/useWorkflowConfigOJS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/useWorkflowConfigOJS.js @@ -28,6 +28,7 @@ export function useWorkflowConfigOJS({dashboardPage}) { if (selectedMenuState.stageId) { const itemsArgs = { submission, + pageInitConfig, selectedPublication, selectedPublicationId, selectedStageId: selectedMenuState.stageId, diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js index 23f3b63ad..309d7e179 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js @@ -252,7 +252,12 @@ export const WorkflowConfig = { }, [pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]: { - getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => { + getPrimaryItems: ({ + submission, + selectedStageId, + selectedReviewRound, + pageInitConfig, + }) => { const items = []; items.push({ @@ -280,6 +285,7 @@ export const WorkflowConfig = { props: { submission: submission, reviewRoundId: selectedReviewRound?.id, + recommendations: pageInitConfig.recommendations, }, });