Skip to content

Commit

Permalink
Submission listing WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Aug 29, 2024
1 parent 6640d87 commit bd9181e
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 176 deletions.
9 changes: 9 additions & 0 deletions src/composables/useSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export function useSubmission() {
);
}

function getLatestPublication(submission) {
return submission.publications.reduce(
(latestPublication, publication) =>
publication.id > latestPublication.id ? publication : latestPublication,
submission.publications[0],
);
}

function getExtendedStage(submission) {
const activeStage = getActiveStage(submission);

Expand Down Expand Up @@ -137,6 +145,7 @@ export function useSubmission() {
getReviewRoundsForStage,
getCurrentReviewAssignments,
getCurrentPublication,
getLatestPublication,
getFileStageFromWorkflowStage,
hasNotSubmissionStartedStage,
hasSubmissionPassedStage,
Expand Down
2 changes: 1 addition & 1 deletion src/managers/FileManager/fileManagerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useFileManagerStore = defineComponentStore(
const {data, fetch: fetchFiles} = useFetch(filesApiUrl, {
query: {
fileStages: managerConfig.value.fileStage,
reviewRoundId: props.reviewRoundId ? props.reviewRoundId : undefined,
reviewRoundIds: props.reviewRoundId ? props.reviewRoundId : undefined,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ import PublicationVersionControl from './publicationControls/PublicationVersionC
import ActionButton from './actionItems/ActionButton.vue';
import EditorsAssigned from './metaItems/EditorsAssigned.vue';
import BasicMetadata from './metaItems/BasicMetadata.vue';
import SubmissionStatus from './primaryItems/SubmissionStatus.vue';
import PublicationEditDisabled from './primaryItems/PublicationEditDisabled.vue';
import IssueAssigned from './metaItems/IssueAssigned.vue';
import {useSubmissionSummaryStore} from './submissionSummaryStore';
import SideModalLayoutMenu2Columns from '@/components/Modal/SideModalLayoutMenu2Columns.vue';
Expand All @@ -140,6 +141,8 @@ const Components = {
ReviewRoundStatus,
PublicationTitleAbstractForm,
PublicationVersionControl,
SubmissionStatus,
PublicationEditDisabled,
};
const props = defineProps({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {useLocalize} from '@/composables/useLocalize';
import {Actions} from '../../composables/useHandleActions';
import {useSubmission} from '@/composables/useSubmission';
export const PublicationConfig = {
titleAbstract: {
getPrimaryItems: ({submission, selectedPublication, pageInitConfig}) => {
Expand Down Expand Up @@ -62,9 +64,18 @@ export const PublicationConfig = {

export function useEditorPublicationConfig() {
function getPrimaryItems(args) {
return PublicationConfig[args.selectedPublicationMenu].getPrimaryItems(
args,
);
const items = [];
if (args.selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
items.push({
component: 'PublicationEditDisabled',
props: {},
});
}

return [
...items,
...PublicationConfig[args.selectedPublicationMenu].getPrimaryItems(args),
];
}

function getPublicationControlsLeft({
Expand All @@ -91,15 +102,67 @@ export function useEditorPublicationConfig() {
}) {
const items = [];
const {t} = useLocalize();
items.push({
component: 'ActionButton',
props: {
label: t('dashboard.summary.scheduleForPublication'),
isPrimary: true,
//action: 'scheduleForPublication',
action: 'assignToIssueAndScheduleForPublication',
},
});

if (selectedPublication.status === pkp.const.STATUS_QUEUED) {
items.push({
component: 'ActionButton',
props: {
label: t('dashboard.summary.preview'),
isSecondary: true,
action: Actions.PREVIEW_PUBLICATION,
},
});

items.push({
component: 'ActionButton',
props: {
label: t('editor.submission.schedulePublication'),
isSecondary: true,
action: Actions.ASSIGN_TO_ISSUE_AND_SCHEULE_FOR_PUBLICATION,
},
});
} else if (selectedPublication.status === pkp.const.STATUS_SCHEDULED) {
items.push({
component: 'ActionButton',
props: {
label: t('dashboard.summary.preview'),
isSecondary: true,
action: Actions.PREVIEW_PUBLICATION,
},
});

items.push({
component: 'ActionButton',
props: {
label: t('publication.unschedule'),
isWarnable: true,
action: Actions.UNSCHEDULE_PUBLICATION,
},
});
} else if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
items.push({
component: 'ActionButton',
props: {
label: t('publication.unpublish'),
isWarnable: true,
action: Actions.UNPUBLISH_PUBLICATION,
},
});

const {getLatestPublication} = useSubmission();
const latestPublication = getLatestPublication(submission);

if (latestPublication.id === selectedPublication.id) {
items.push({
component: 'ActionButton',
props: {
label: t('publication.createVersion'),
isSecondary: true,
action: Actions.CREATE_NEW_VERSION,
},
});
}
}

return items;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,7 @@ export function useEditorWorkflowConfig() {
const {hasSubmissionPassedStage, hasNotSubmissionStartedStage} =
useSubmission();

function getPrimaryItems({
submission,
currentPublication,
selectedStageId,
selectedReviewRound,
}) {
//const activeStage = getActiveStage(submission);

//const isSelectedStageActive = selectedStageId === activeStage.id;

function getPrimaryItems({submission, selectedStageId, selectedReviewRound}) {
const items = [];

if (selectedStageId === pkp.const.WORKFLOW_STAGE_ID_SUBMISSION) {
Expand All @@ -26,14 +17,7 @@ export function useEditorWorkflowConfig() {
pkp.const.WORKFLOW_STAGE_ID_SUBMISSION,
)
) {
items.push({
component: 'PrimaryBasicMetadata',
props: {
body: t(
'editor.submission.workflowDecision.submission.underReview',
),
},
});
items.push({component: 'SubmissionStatus', props: {submission}});
}

items.push({
Expand Down Expand Up @@ -161,6 +145,14 @@ export function useEditorWorkflowConfig() {
},
});
} else if (selectedStageId === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION) {
if (submission.status === pkp.const.STATUS_PUBLISHED) {
items.push({
component: 'PrimaryBasicMetadata',
props: {
body: t('editor.submission.workflowDecision.submission.published'),
},
});
}
items.push({
component: 'FileManager',
props: {
Expand Down Expand Up @@ -369,20 +361,22 @@ export function useEditorWorkflowConfig() {
items.push({
component: 'ActionButton',
props: {
label: t('dashboard.summary.scheduleForPublication'),
label: t('editor.submission.schedulePublication'),
isPrimary: true,
action: 'scheduleForPublication',
action: 'navigateToMenu',
actionArgs: {key: 'publication_titleAbstract'},
},
});

items.push({
component: 'ActionButton',
props: {
label: t('dashboard.summary.backToCopyediting'),
isWarnable: true,
action: 'decisionBackFromProduction',
},
});
if (submission.status === pkp.const.STATUS_QUEUED)
items.push({
component: 'ActionButton',
props: {
label: t('dashboard.summary.backToCopyediting'),
isWarnable: true,
action: 'decisionBackFromProduction',
},
});
}
return items;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export function useSummarySideNav() {
label: 'Production',
title: getWorkflowTitle(pkp.const.WORKFLOW_STAGE_ID_PRODUCTION),
colorStripe:
activeStage.id === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION
activeStage.id === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION &&
submission.status === pkp.const.STATUS_QUEUED
? 'border-stage-copyediting'
: null,
action: 'selectStage',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div
class="bg -mx-5 -mt-5 bg-attention p-5 text-center text-base-normal text-on-dark"
>
{{ t('publication.editDisabled') }}
</div>
</template>

<script setup>
import {useLocalize} from '@/composables/useLocalize';
const {t} = useLocalize();
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div class="border border-light p-5">
<h2 class="text-lg-bold text-heading">{{ texts.heading }}</h2>
<p v-if="description" class="text-base-normal">{{ texts.description }}</p>
</div>
</template>

<script setup>
import {computed} from 'vue';
import {useLocalize} from '@/composables/useLocalize';
const props = defineProps({
submission: {type: Object, required: true},
});
const {t} = useLocalize();
const texts = computed(() => {
switch (props.submission.stageId) {
case pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
return {
heading: t('editor.submission.workflowDecision.submission.underReview'),
};
case pkp.const.WORKFLOW_STAGE_ID_EDITING:
return {heading: 'a'};
case pkp.const.WORKFLOW_STAGE_ID_PRODUCTION:
switch (props.submission.status) {
case pkp.const.STATUS_QUEUED:
return {heading: 'a'};
case pkp.const.STATUS_SCHEDULED:
return {heading: 'a'};
case pkp.const.STATUS_PUBLISHED:
return {heading: 'a'};
case pkp.const.STATUS_DECLINED:
return {heading: 'a'};
}
}
return '';
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export const useSubmissionSummaryStore = defineComponentStore(
)?.id
}`,
);
} else if (
newSubmission.stageId === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION &&
newSubmission.status !== pkp.const.STATUS_QUEUED
) {
setActiveItemKey(`publication_titleAbstract`);
} else {
setActiveItemKey(`workflow_${newSubmission.stageId}`);
}
Expand Down Expand Up @@ -128,6 +133,11 @@ export const useSubmissionSummaryStore = defineComponentStore(
const {handleSubmissionAction} = useHandleActions(props.pageInitConfig);

function handleAction(actionName, _actionArgs) {
if (actionName === 'navigateToMenu') {
setActiveItemKey(_actionArgs.key);
return;
}

const actionArgs = {
..._actionArgs,
submission: submission.value,
Expand Down Expand Up @@ -212,7 +222,11 @@ export const useSubmissionSummaryStore = defineComponentStore(
});

const publicationControlsRight = computed(() => {
if (!submission.value || !selectedMenuState.value.publicationMenu) {
if (
!submission.value ||
!selectedPublication.value ||
!selectedMenuState.value.publicationMenu
) {
return [];
}

Expand Down
7 changes: 4 additions & 3 deletions src/pages/dashboard/composables/useEditorialLogic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {useSubmission} from '@/composables/useSubmission.js';
import {useLocalize} from '@/composables/useLocalize';
import {useDate} from '@/composables/useDate';
import {Actions} from './useHandleActions';

const {formatShortDate} = useDate();

Expand All @@ -18,7 +19,7 @@ export function useEditorialLogic() {
{
component: 'CellSubmissionActivityActionAlert',
props: {
actionName: 'assignParticipant',
actionName: Actions.ASSIGN_PARTICIPANT,
actionLabel: t('dashboard.assignEditor'),
},
},
Expand All @@ -34,7 +35,7 @@ export function useEditorialLogic() {
{
component: 'CellSubmissionActivityActionAlert',
props: {
actionName: 'assignReviewers',
actionName: Actions.ASSIGN_REVIEWERS,
actionLabel: t('dashboard.assignReviewers'),
},
},
Expand Down Expand Up @@ -137,7 +138,7 @@ export function useEditorialLogic() {
props: {
alert: t('dashboard.revisionRequested'),
actionLabel: t('dashboard.submitRevisions'),
actionName: 'uploadRevisions',
actionName: Actions.UPLOAD_REVISIONS,
},
},
];
Expand Down
Loading

0 comments on commit bd9181e

Please sign in to comment.