2023-06-27 16:23:18 +00:00
|
|
|
<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 { Inertia } from '@inertiajs/inertia';
|
|
|
|
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, 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: '',
|
2024-07-08 11:52:20 +00:00
|
|
|
preferation: 'no_preferation',
|
2023-06-27 16:23:18 +00:00
|
|
|
|
|
|
|
// preferation: '',
|
|
|
|
// isPreferationRequired: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
// const preferation = ref('yes_preferation');
|
|
|
|
// const isPreferationRequired = ref(false);
|
|
|
|
const isPreferationRequired = computed(() => form.preferation === 'yes_preferation');
|
|
|
|
|
2024-03-14 19:25:27 +00:00
|
|
|
const handleSubmit = async (e: Event) => {
|
2023-06-27 16:23:18 +00:00
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
await form.put(stardust.route('dataset.releaseUpdate', [props.dataset.id]));
|
2023-10-17 13:45:41 +00:00
|
|
|
// await form.put(stardust.route('editor.dataset.update', [props.dataset.id]));
|
2023-06-27 16:23:18 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<LayoutAuthenticated>
|
|
|
|
<Head title="Release saved datasets" />
|
|
|
|
<SectionMain>
|
|
|
|
<SectionTitleLineWithButton :icon="mdiLockOpen" title="Release your dataset for Editor" main>
|
|
|
|
<BaseButton
|
|
|
|
:route-name="stardust.route('dataset.list')"
|
|
|
|
:icon="mdiArrowLeftBoldOutline"
|
|
|
|
label="Back"
|
|
|
|
color="white"
|
|
|
|
rounded-full
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
</SectionTitleLineWithButton>
|
|
|
|
<CardBox form @submit.prevent="handleSubmit">
|
|
|
|
<FormValidationErrors v-bind:errors="errors" />
|
2024-07-26 12:51:57 +00:00
|
|
|
<div class="lex flex-col md:flex-row mb-3">
|
2023-06-27 16:23:18 +00:00
|
|
|
<label for="elevation-option-two" class="pure-radio">
|
|
|
|
<input id="elevation-option-two" type="radio" v-model="form.preferation" value="no_preferation" />
|
|
|
|
no preferred reviewer
|
|
|
|
</label>
|
2024-07-26 12:51:57 +00:00
|
|
|
<label for="elevation-option-one" class="pure-radio">
|
|
|
|
<input id="elevation-option-one" type="radio" v-model="form.preferation" value="yes_preferation" />
|
|
|
|
preferred reviewer
|
|
|
|
</label>
|
2023-06-27 16:23:18 +00:00
|
|
|
</div>
|
|
|
|
<div v-if="isPreferationRequired == true">
|
|
|
|
<FormField label="preferred reviewer" :class="{ 'text-red-400': form.errors.preferred_reviewer }">
|
|
|
|
<FormControl
|
|
|
|
v-model="form.preferred_reviewer"
|
|
|
|
type="text"
|
|
|
|
placeholder="-- enter name of preferred reviewer --"
|
|
|
|
required
|
|
|
|
:error="form.errors.preferred_reviewer"
|
|
|
|
>
|
|
|
|
<div class="text-red-400 text-sm" v-if="form.errors.preferred_reviewer">
|
|
|
|
{{ form.errors.preferred_reviewer }}
|
|
|
|
</div>
|
|
|
|
</FormControl>
|
|
|
|
</FormField>
|
|
|
|
<FormField label="reviewer email" :class="{ 'text-red-400': form.errors.preferred_reviewer_email }">
|
|
|
|
<FormControl
|
|
|
|
v-model="form.preferred_reviewer_email"
|
|
|
|
type="text"
|
|
|
|
placeholder="-- enter email of reviewer --"
|
|
|
|
required
|
|
|
|
:error="form.errors.preferred_reviewer_email"
|
|
|
|
>
|
|
|
|
<div class="text-red-400 text-sm" v-if="form.errors.preferred_reviewer_email">
|
|
|
|
{{ form.errors.preferred_reviewer_email }}
|
|
|
|
</div>
|
|
|
|
</FormControl>
|
|
|
|
</FormField>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- <NotificationBar v-if="flash && flash.message" color="warning" :icon="mdiAlertBoxOutline">
|
|
|
|
{{ flash.message }}
|
|
|
|
class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4"
|
|
|
|
</NotificationBar> -->
|
2023-07-17 17:13:30 +00:00
|
|
|
<div v-if="flash && flash.warning" class="flex flex-col mt-6 animate-fade-in">
|
2023-06-27 16:23:18 +00:00
|
|
|
<div class="bg-yellow-500 border-l-4 border-orange-400 text-white p-4" role="alert">
|
|
|
|
<p class="font-bold">Be Warned</p>
|
2023-07-17 17:13:30 +00:00
|
|
|
<p>{{ flash.warning }}</p>
|
2023-06-27 16:23:18 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
<BaseButtons>
|
|
|
|
<BaseButton
|
|
|
|
type="submit"
|
|
|
|
color="info"
|
|
|
|
label="Release"
|
|
|
|
:class="{ 'opacity-25': form.processing }"
|
|
|
|
:disabled="form.processing"
|
|
|
|
/>
|
|
|
|
</BaseButtons>
|
|
|
|
</template>
|
|
|
|
</CardBox>
|
|
|
|
</SectionMain>
|
|
|
|
</LayoutAuthenticated>
|
|
|
|
</template>
|