This commit is contained in:
isUnknown 2024-12-16 17:25:52 +01:00
parent 64af50816b
commit 24dbf5bf8d
5 changed files with 30 additions and 11 deletions

View file

@ -6,6 +6,10 @@ Stepname: clientBrief
---- ----
Isvalidated: true
----
Pdf: Pdf:
---- ----
@ -26,8 +30,4 @@ Stepindex: 1
---- ----
Uuid: glE28vWGearnAmxw Uuid: glE28vWGearnAmxw
----
Isvalidated: true

View file

@ -22,7 +22,7 @@ tabs:
fields: fields:
stepName: stepName:
type: hidden type: hidden
isSent: isValidated:
type: hidden type: hidden
pdf: pdf:
label: PDF label: PDF

View file

@ -1,7 +1,7 @@
<?php <?php
return [ return [
'pattern' => 'validate-brief.json', 'pattern' => '(:all)validate-brief.json',
'method' => 'POST', 'method' => 'POST',
'action' => function () { 'action' => function () {
$json = file_get_contents('php://input'); $json = file_get_contents('php://input');
@ -28,6 +28,7 @@ return [
] ]
], ],
'date' => $dateTime->format('Y-m-d\TH:i:sP'), 'date' => $dateTime->format('Y-m-d\TH:i:sP'),
'text' => "Brief (" . $project->title()->value() . ")",
'author' => [ 'author' => [
'name' => (string) kirby()->user()->name(), 'name' => (string) kirby()->user()->name(),
'email' => (string) kirby()->user()->email(), 'email' => (string) kirby()->user()->email(),

View file

@ -9,7 +9,13 @@
> >
<span id="back-to-project">Retour au projet</span> <span id="back-to-project">Retour au projet</span>
</router-link> </router-link>
<button class="btn | ml-auto">Valider et envoyer le brief</button> <button
class="btn | ml-auto"
@click="validate"
v-if="page.content.isvalidated != 'true'"
>
Valider et envoyer le brief
</button>
</header> </header>
<component :is="stepsComponents[currentStep]" @update:step="changeStep" /> <component :is="stepsComponents[currentStep]" @update:step="changeStep" />
</main> </main>
@ -22,6 +28,7 @@ import Images from "../components/project/brief/Images.vue";
import TitledPdfWrapper from "../components/project/TitledPdfWrapper.vue"; import TitledPdfWrapper from "../components/project/TitledPdfWrapper.vue";
import { usePageStore } from "../stores/page"; import { usePageStore } from "../stores/page";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useApiStore } from "../stores/api";
const stepsComponents = { const stepsComponents = {
Intro, Intro,
@ -31,6 +38,7 @@ const stepsComponents = {
}; };
const { page } = storeToRefs(usePageStore()); const { page } = storeToRefs(usePageStore());
const api = useApiStore();
const currentStep = ref(setInitialStep()); const currentStep = ref(setInitialStep());
@ -47,6 +55,12 @@ function setInitialStep() {
if (isEmpty) return "Intro"; if (isEmpty) return "Intro";
if (hasImages) return "Images"; if (hasImages) return "Images";
} }
function validate() {
api.validateBrief(page.value.uri).then((res) => {
location.href = "/" + page.value.parent;
});
}
</script> </script>
<style scoped> <style scoped>
@ -55,4 +69,4 @@ function setInitialStep() {
display: none; display: none;
} }
} }
</style> </style>

View file

@ -45,7 +45,7 @@
> >
<router-link <router-link
v-if="currentTab === 'all' || !notification.isRead" v-if="currentTab === 'all' || !notification.isRead"
:to="notification.location.href" :to="toPath(notification.location.href)"
> >
<header> <header>
<p class="flex"> <p class="flex">
@ -68,7 +68,7 @@
</p> </p>
</header> </header>
<p <p
v-if="notification.type === 'comment'" v-if="notification.type"
class="notification__body | text-md font-medium | line-clamp" class="notification__body | text-md font-medium | line-clamp"
> >
{{ notification.text }} {{ notification.text }}
@ -172,6 +172,10 @@ function readAll() {
console.log("Could not read all notifications : ", error); console.log("Could not read all notifications : ", error);
} }
} }
function toPath(string) {
return string.replace(window.location.origin, "");
}
</script> </script>
<style scoped> <style scoped>