tethys.backend/resources/js/Pages/Editor/Dataset/Receive.vue

108 lines
4.2 KiB
Vue
Raw Permalink Normal View History

<script setup lang="ts">
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
import SectionMain from '@/Components/SectionMain.vue';
import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue';
import { router, Head, usePage } from '@inertiajs/vue3';
import { computed, Ref } from 'vue';
import CardBox from '@/Components/CardBox.vue';
import BaseButton from '@/Components/BaseButton.vue';
import BaseButtons from '@/Components/BaseButtons.vue';
import { stardust } from '@eidellev/adonis-stardust/client';
import { mdiArrowLeftBoldOutline, mdiLockOpen } from '@mdi/js';
import FormValidationErrors from '@/Components/FormValidationErrors.vue';
const props = defineProps({
dataset: {
type: Object,
default: () => ({}),
},
});
const flash: Ref<any> = computed(() => {
return usePage().props.flash;
});
const errors: Ref<any> = computed(() => {
return usePage().props.errors;
});
// const form = useForm({
// preferred_reviewer: '',
// preferred_reviewer_email: '',
// preferation: 'yes_preferation',
// // preferation: '',
// // isPreferationRequired: false,
// });
// const isPreferationRequired = computed(() => form.preferation === 'yes_preferation');
const handleSubmit = async (e) => {
e.preventDefault();
await router.put(stardust.route('editor.dataset.receiveUpdate', [props.dataset.id]));
// await form.put(stardust.route('dataset.releaseUpdate', [props.dataset.id]));
// // await form.put(stardust.route('editor.dataset.update', [props.dataset.id]));
};
</script>
<template>
<LayoutAuthenticated>
<Head title="Receive dataset" />
<SectionMain>
<SectionTitleLineWithButton :icon="mdiLockOpen" title="Receive released 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="flex flex-col md:flex-row items-center"> -->
<div class="w-full">
<label class="block font-bold mb-2" for="owner">Submitter:</label>
<div class="w-full p-2 rounded-md">{{ dataset.user.login }}</div>
</div>
<div class="w-full">
<label class="block font-bold mb-2" for="title">Dataset title:</label>
<div class="w-full p-2 rounded-md" v-if="dataset.main_title">
{{ dataset.main_title }}
</div>
<div class="w-full p-2 rounded-md" v-else>
No title available
</div>
</div>
<div class="w-full">
<label class="block font-bold mb-2" for="title">Dataset abstract:</label>
<div class="w-full p-2 rounded-md" v-if="dataset.main_abstract">
{{ dataset.main_abstract }}
</div>
<div class="w-full p-2 rounded-md" v-else>
No abstract available
</div>
</div>
<!-- </div> -->
<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>
<BaseButtons>
<!-- <BaseButton type="submit" color="info" label="Receive"
:class="{ 'opacity-25': router.processing }" :disabled="form.processing" /> -->
<BaseButton type="submit" color="info" label="Receive"/>
</BaseButtons>
</template>
</CardBox>
</SectionMain>
</LayoutAuthenticated>
</template>