2025-01-23 15:31:15 +01:00
|
|
|
|
<template>
|
2025-01-27 16:28:12 +01:00
|
|
|
|
<Dialog
|
|
|
|
|
|
id="project-request-dialog"
|
|
|
|
|
|
v-model:visible="isOpen"
|
|
|
|
|
|
modal
|
|
|
|
|
|
:draggable="false"
|
2025-09-09 09:37:34 +02:00
|
|
|
|
:dismissableMask="true"
|
2025-01-27 16:28:12 +01:00
|
|
|
|
header="Demander la création d’un projet"
|
|
|
|
|
|
class="dialog"
|
|
|
|
|
|
:closeOnEscape="true"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<h2 class="font-serif text-lg">Demander la création d’un projet</h2>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2025-01-27 18:22:03 +01:00
|
|
|
|
<form
|
|
|
|
|
|
@submit.prevent="handleSubmit"
|
|
|
|
|
|
class="w-full h-full p-16 flex flex-col"
|
|
|
|
|
|
style="--row-gap: 1rem"
|
|
|
|
|
|
>
|
2025-01-27 16:28:12 +01:00
|
|
|
|
<label for="project-title" class="sr-only">Nom du projet</label>
|
2025-01-27 18:22:03 +01:00
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
v-model="title"
|
|
|
|
|
|
id="project-title"
|
|
|
|
|
|
placeholder="Nom du projet"
|
|
|
|
|
|
class="w-full rounded-md border border-grey-200 px-16 py-12"
|
2025-01-27 16:28:12 +01:00
|
|
|
|
required
|
2025-01-27 18:22:03 +01:00
|
|
|
|
/>
|
2025-01-27 16:28:12 +01:00
|
|
|
|
|
|
|
|
|
|
<label for="project-details" class="sr-only">Détails du projet</label>
|
|
|
|
|
|
<textarea
|
|
|
|
|
|
id="project-details"
|
|
|
|
|
|
name="details"
|
|
|
|
|
|
v-model="details"
|
|
|
|
|
|
cols="30"
|
|
|
|
|
|
rows="10"
|
2025-01-27 19:34:18 +01:00
|
|
|
|
placeholder="Détails du projet…"
|
|
|
|
|
|
class="w-full flex-1 rounded-md border border-grey-200 px-16 py-12"
|
2025-01-27 16:28:12 +01:00
|
|
|
|
required
|
|
|
|
|
|
></textarea>
|
|
|
|
|
|
|
2025-01-27 18:22:03 +01:00
|
|
|
|
<div
|
|
|
|
|
|
id="project-dtl"
|
|
|
|
|
|
class="w-full text-left rounded-md border border-grey-200 text-grey-800 p-12"
|
|
|
|
|
|
style="align-self: flex-start"
|
2025-09-09 09:37:34 +02:00
|
|
|
|
:class="{ selected: isDTLEnabled }"
|
2025-01-27 18:22:03 +01:00
|
|
|
|
>
|
|
|
|
|
|
<input id="dtl" type="checkbox" v-model="isDTLEnabled" />
|
|
|
|
|
|
<label
|
|
|
|
|
|
for="dtl"
|
|
|
|
|
|
class="flex font-medium mt-4"
|
|
|
|
|
|
style="--column-gap: var(--space-4)"
|
|
|
|
|
|
>
|
|
|
|
|
|
Créer avec
|
|
|
|
|
|
<span class="flex justify-center text-sm" data-icon="leaf"
|
|
|
|
|
|
>Design to Light</span
|
|
|
|
|
|
>
|
2025-01-27 16:28:12 +01:00
|
|
|
|
</label>
|
|
|
|
|
|
<p class="text-sm mt-8 mb-4">
|
2025-01-27 18:22:03 +01:00
|
|
|
|
Découvrez la note environnementale de votre projet et allégez l’impact
|
|
|
|
|
|
de votre projet grâce à nos expertises d’optimisation du poids de
|
|
|
|
|
|
flacon.
|
2025-01-27 16:28:12 +01:00
|
|
|
|
</p>
|
2025-01-27 18:22:03 +01:00
|
|
|
|
<router-link to="/design-to-light" class="text-sm font-medium"
|
|
|
|
|
|
>En savoir plus</router-link
|
|
|
|
|
|
>
|
2025-01-27 16:28:12 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-01-27 19:34:18 +01:00
|
|
|
|
<footer class="flex-columns w-full mt-16" style="column-gap: 0.5rem">
|
2025-01-27 18:22:03 +01:00
|
|
|
|
<button class="btn btn--black-10" @click="emits('close')">
|
|
|
|
|
|
Annuler
|
|
|
|
|
|
</button>
|
2025-01-27 16:28:12 +01:00
|
|
|
|
<button class="btn" type="submit">Soumettre</button>
|
|
|
|
|
|
</footer>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</Dialog>
|
2025-01-23 15:31:15 +01:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-09-09 09:37:34 +02:00
|
|
|
|
import Dialog from 'primevue/dialog';
|
|
|
|
|
|
import { ref, watch } from 'vue';
|
|
|
|
|
|
import { useApiStore } from '../stores/api';
|
2025-01-23 15:31:15 +01:00
|
|
|
|
|
2025-09-09 09:37:34 +02:00
|
|
|
|
const title = ref('');
|
|
|
|
|
|
const details = ref('');
|
2025-01-23 15:31:15 +01:00
|
|
|
|
const isDTLEnabled = ref(false);
|
|
|
|
|
|
const api = useApiStore();
|
2025-01-27 16:28:12 +01:00
|
|
|
|
const isOpen = ref(true);
|
2025-09-09 09:37:34 +02:00
|
|
|
|
const emits = defineEmits('close');
|
2025-01-23 15:31:15 +01:00
|
|
|
|
|
2025-01-27 18:22:03 +01:00
|
|
|
|
watch(isOpen, (newValue) => {
|
|
|
|
|
|
if (!newValue) {
|
2025-09-09 09:37:34 +02:00
|
|
|
|
emits('close');
|
2025-01-27 18:22:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-01-23 15:31:15 +01:00
|
|
|
|
async function handleSubmit() {
|
|
|
|
|
|
const formData = {
|
|
|
|
|
|
title: title.value,
|
|
|
|
|
|
details: details.value,
|
|
|
|
|
|
isDTLEnabled: isDTLEnabled.value,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-09-09 09:37:34 +02:00
|
|
|
|
const response = await api.post(formData, 'request-project-creation.json');
|
2025-01-27 19:47:29 +01:00
|
|
|
|
isOpen.value = false;
|
2025-01-23 15:31:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|