- Added "rejected_to_reviewer" state to the `ServerStates` enum. - Implemented routes and controller actions (`rejectToReviewer`, `rejectToReviewerUpdate`) for editors to reject datasets back to reviewers with a rejection note. - Added UI elements (button) in the editor dataset index and publish views to trigger the "reject to reviewer" action. - Updated the reviewer dataset index view to display datasets in the "rejected_to_reviewer" state and show the editor's rejection note. - Modified the reviewer dataset review page to allow reviewers to view and accept datasets that have been rejected back to them by editors. - Updated the database migration to include the "rejected_to_reviewer" state in the `documents_server_state_check` constraint. - Updated dependencies (pinia, redis).
110 lines
4.7 KiB
Vue
110 lines
4.7 KiB
Vue
<script setup lang="ts">
|
|
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
|
|
import SectionMain from '@/Components/SectionMain.vue';
|
|
import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue';
|
|
import { useForm, Head, usePage } from '@inertiajs/vue3';
|
|
import { computed, Ref } from 'vue';
|
|
import CardBox from '@/Components/CardBox.vue';
|
|
import FormField from '@/Components/FormField.vue';
|
|
import FormControl from '@/Components/FormControl.vue';
|
|
import BaseButton from '@/Components/BaseButton.vue';
|
|
import BaseButtons from '@/Components/BaseButtons.vue';
|
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
|
import { mdiArrowLeftBoldOutline, mdiReiterate, mdiBookEdit, mdiUndo } from '@mdi/js';
|
|
import FormValidationErrors from '@/Components/FormValidationErrors.vue';
|
|
|
|
const props = defineProps({
|
|
dataset: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
can: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
});
|
|
|
|
const flash: Ref<any> = computed(() => {
|
|
return usePage().props.flash;
|
|
});
|
|
const errors: Ref<any> = computed(() => {
|
|
return usePage().props.errors;
|
|
});
|
|
|
|
const form = useForm({
|
|
server_state: 'published',
|
|
publisher_name: 'GeoSphere Austria',
|
|
});
|
|
|
|
const handleSubmit = async (e) => {
|
|
e.preventDefault();
|
|
await form.put(stardust.route('editor.dataset.publishUpdate', [props.dataset.id]));
|
|
// await form.put(stardust.route('editor.dataset.update', [props.dataset.id]));
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<LayoutAuthenticated>
|
|
|
|
<Head title="Publish reviewed dataset" />
|
|
<SectionMain>
|
|
<SectionTitleLineWithButton :icon="mdiReiterate" title="Publish reviewed dataset" main>
|
|
<BaseButton :route-name="stardust.route('editor.dataset.list')" :icon="mdiArrowLeftBoldOutline" label="Back"
|
|
color="white" rounded-full small />
|
|
</SectionTitleLineWithButton>
|
|
|
|
<CardBox form @submit.prevent="handleSubmit">
|
|
<FormValidationErrors v-bind:errors="errors" />
|
|
|
|
|
|
<div class="title font-bold">
|
|
Title: {{ dataset.main_title }}
|
|
</div>
|
|
<!-- <div class="authors">
|
|
<span v-for="person in dataset.authors" :key="person.id">
|
|
{{ person.name }}
|
|
</span>
|
|
</div> -->
|
|
|
|
|
|
<FormField label="server state" :class="{ 'text-red-400': form.errors.server_state }">
|
|
<FormControl v-model="form.server_state" type="text" placeholder="-- server state --"
|
|
:is-read-only="true" :error="form.errors.server_state">
|
|
<div class="text-red-400 text-sm" v-if="form.errors.server_state">
|
|
{{ form.errors.server_state }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
<FormField label="Publisher Name" :class="{ 'text-red-400': form.errors.publisher_name }">
|
|
<FormControl v-model="form.publisher_name" placeholder="--publisher name --"
|
|
:error="form.errors.publisher_name" is-read-only>
|
|
<div class="text-red-400 text-sm" v-if="form.errors.publisher_name">
|
|
{{ form.errors.publisher_name }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
<div v-if="flash && flash.warning" class="flex flex-col mt-6 animate-fade-in">
|
|
<div class="bg-yellow-500 border-l-4 border-orange-400 text-white p-4" role="alert">
|
|
<p class="font-bold">Be Warned</p>
|
|
<p>{{ flash.warning }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<template #footer>
|
|
<p class="text-lg font-medium mb-2">
|
|
Are you sure you want to publish the selected dataset?
|
|
</p>
|
|
<BaseButtons>
|
|
<BaseButton type="submit" color="info" label="Set published"
|
|
:class="{ 'opacity-25': form.processing }" :disabled="form.processing" :icon="mdiBookEdit" small />
|
|
<BaseButton v-if="can.reject && (dataset.server_state == 'reviewed')"
|
|
:route-name="stardust.route('editor.dataset.rejectToReviewer', [dataset.id])"
|
|
color="info" :icon="mdiUndo" :label="'Reject To Reviewer'" small
|
|
class="col-span-1" />
|
|
</BaseButtons>
|
|
</template>
|
|
</CardBox>
|
|
</SectionMain>
|
|
</LayoutAuthenticated>
|
|
</template>
|