designtopack/src/views/Brief.vue

70 lines
1.8 KiB
Vue
Raw Normal View History

2024-09-26 19:14:20 +02:00
<template>
<main class="flex flex-col items-stretch | w-full" style="--row-gap: 2rem">
<header class="flex | bg-white | rounded-2xl | p-8">
2024-10-16 17:32:15 +02:00
<router-link
:to="'/' + page.parent"
class="btn btn--white"
data-icon="arrow-left"
2024-12-11 12:25:45 +01:00
aria-labelledby="back-to-project"
2024-10-16 17:32:15 +02:00
>
2024-12-11 12:25:45 +01:00
<span id="back-to-project">Retour au projet</span>
2024-10-02 15:33:57 +02:00
</router-link>
<button class="btn | ml-auto" @click="validate">
2024-12-16 17:25:52 +01:00
Valider et envoyer le brief
</button>
2024-10-02 15:33:57 +02:00
</header>
2024-09-26 19:14:20 +02:00
<component :is="stepsComponents[currentStep]" @update:step="changeStep" />
</main>
</template>
<script setup>
import { ref } from "vue";
2024-11-19 14:10:35 +01:00
import Intro from "../components/project/brief/Intro.vue";
import ModeSelection from "../components/project/brief/ModeSelection.vue";
import Images from "../components/project/brief/Images.vue";
2024-11-27 17:51:49 +01:00
import TitledPdfWrapper from "../components/project/TitledPdfWrapper.vue";
import { usePageStore } from "../stores/page";
import { storeToRefs } from "pinia";
2024-12-16 17:25:52 +01:00
import { useApiStore } from "../stores/api";
2024-09-26 19:14:20 +02:00
const stepsComponents = {
Intro,
ModeSelection,
Images,
2024-11-27 17:51:49 +01:00
TitledPdfWrapper,
2024-09-26 19:14:20 +02:00
};
const { page } = storeToRefs(usePageStore());
2024-12-16 17:25:52 +01:00
const api = useApiStore();
const currentStep = ref(setInitialStep());
2024-09-26 19:14:20 +02:00
function changeStep(stepName) {
currentStep.value = stepName;
}
function setInitialStep() {
2024-10-16 15:04:15 +02:00
const hasPDF = page.value.content.pdf.length !== 0;
const hasImages =
2024-10-16 15:03:20 +02:00
page.value.content.moodboard.length !== 0 ||
page.value.content.description.length !== 0;
const isEmpty = !hasPDF && !hasImages;
if (isEmpty) return "Intro";
if (hasImages) return "Images";
}
2024-12-16 17:25:52 +01:00
function validate() {
api.validateBrief(page.value.uri).then((res) => {
console.log(res);
// location.href = "/" + page.value.parent;
2024-12-16 17:25:52 +01:00
});
}
2024-09-26 19:14:20 +02:00
</script>
2024-12-11 12:25:45 +01:00
<style scoped>
@media (max-width: 540px) {
#back-to-project {
display: none;
}
}
2024-12-16 17:25:52 +01:00
</style>