designtopack/src/components/project/client-brief/ModeSelection.vue

132 lines
4.8 KiB
Vue
Raw Normal View History

2024-09-25 17:33:28 +02:00
<template>
<section
class="h-full | flex flex-col justify-center items-center | mx-auto | max-w"
style="--max-w: 42rem; --row-gap: var(--space-32)"
>
<div class="flex items-baseline">
2024-09-25 17:33:28 +02:00
<div
2024-10-08 17:29:59 +02:00
@click="emit('update:step', 'Images')"
2024-09-25 17:33:28 +02:00
class="card card--cta | flex-1 | h-full"
style="--padding: var(--space-32); --row-gap: var(--space-32)"
>
<svg
aria-hidden="true"
width="100"
height="100"
viewBox="0 0 100 100"
fill="none"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
stroke-width="5"
stroke-linecap="round"
stroke-linejoin="round"
2024-09-25 17:33:28 +02:00
>
<path d="M92.8571 46.4292H64.2857C62.3133 46.4292 60.7143 48.0282 60.7143 50.0006V92.8577C60.7143 94.8302 62.3133 96.4292 64.2857 96.4292H92.8571C94.8296 96.4292 96.4286 94.8302 96.4286 92.8577V50.0006C96.4286 48.0282 94.8296 46.4292 92.8571 46.4292Z"/>
<path d="M92.8571 3.57202H64.2857C62.3133 3.57202 60.7143 5.171 60.7143 7.14345V21.5006C60.7143 23.473 62.3133 25.072 64.2857 25.072H92.8571C94.8296 25.072 96.4286 23.473 96.4286 21.5006V7.14345C96.4286 5.171 94.8296 3.57202 92.8571 3.57202Z"/>
<path d="M35.7143 3.57202H7.14284C5.17039 3.57202 3.57141 5.171 3.57141 7.14345V50.0006C3.57141 51.973 5.17039 53.572 7.14284 53.572H35.7143C37.6867 53.572 39.2857 51.973 39.2857 50.0006V7.14345C39.2857 5.171 37.6867 3.57202 35.7143 3.57202Z"/>
<path d="M35.7143 74.9291H7.14284C5.17039 74.9291 3.57141 76.5281 3.57141 78.5005V92.8577C3.57141 94.8301 5.17039 96.4291 7.14284 96.4291H35.7143C37.6867 96.4291 39.2857 94.8301 39.2857 92.8577V78.5005C39.2857 76.5281 37.6867 74.9291 35.7143 74.9291Z"/>
2024-09-25 17:33:28 +02:00
</svg>
<h2 class="font-serif text-lg">Créer via la plateforme</h2>
<p class="text-sm text-grey-700">Ajouter différents éléments tels que des images et du texte sur la plateforme afin de créer votre brief.</p>
2024-09-25 17:33:28 +02:00
</div>
<div
class="card card--cta | flex-1 | h-full"
style="--padding: var(--space-32); --row-gap: var(--space-32)"
>
<svg
aria-hidden="true"
width="100"
height="100"
viewBox="0 0 100 100"
fill="none"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
stroke-width="5"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M3.57153 75.0001V82.143C3.57153 85.9318 5.07663 89.5654 7.75572 92.2445C10.4348 94.9236 14.0684 96.4287 17.8572 96.4287H82.143C85.9318 96.4287 89.5654 94.9236 92.2445 92.2445C94.9236 89.5654 96.4287 85.9318 96.4287 82.143V75.0001M28.5715 28.5715L50.0001 3.57153M50.0001 3.57153L71.4287 28.5715M50.0001 3.57153V67.8573"/>
</svg>
<label class="font-serif text-lg" for="upload-pdf">
Ajouter un PDF
<input
id="upload-pdf"
type="file"
@change="addPdf($event)"
accept="application/pdf"
ref="pdfInput"
hidden
/>
</label>
<p class="text-sm text-grey-700">Vous avez déjà constitué votre brief en amont et souhaitez directement limporter.</p>
</div>
2024-09-25 17:33:28 +02:00
</div>
2024-09-25 17:33:28 +02:00
<div
class="card | bg-grey-200 | items-center | text-center | w-full"
style="--padding: var(--space-32); --row-gap: var(--space-16)"
>
<h2 class="font-serif text-lg">Quest ce que le brief ?</h2>
<p class="text-sm text-grey-700">
Le brief est un outil créatif qui permet de définir les perspectives
esthétiques de votre projet.
2024-09-25 17:33:28 +02:00
</p>
</div>
</section>
</template>
<script setup>
import { ref } from "vue";
import { usePageStore } from "../../../stores/page";
import { storeToRefs } from "pinia";
2024-09-25 17:33:28 +02:00
const emit = defineEmits("update:step");
const { page } = storeToRefs(usePageStore());
const pdfInput = ref(null);
async function addPdf(event) {
const file = event.target.files[0];
if (file) {
const formData = new FormData();
formData.append("file", file);
try {
const response = await fetch(
"/upload-pdf.json?pageUri=" + page.value.uri,
{
method: "POST",
body: formData,
}
);
const result = await response.json();
if (response.ok) {
console.log("File uploaded successfully.");
page.value = result;
2024-10-16 15:32:24 +02:00
location.href = location.origin + "/" + page.value.parent;
} else {
console.error("Error uploading file:", result.error);
}
} catch (error) {
console.error("Request failed:", error);
}
} else {
console.error("No file selected.");
}
}
2024-09-25 17:33:28 +02:00
</script>
<style scoped>
label[for="upload-pdf"]::after {
content: '';
display: block;
position: absolute;
inset: 0;
cursor: pointer;
}
</style>