kanban - fix steps statuses

This commit is contained in:
isUnknown 2024-11-18 15:52:15 +01:00
parent e66ed56324
commit 23bfd67b21
4 changed files with 51 additions and 5 deletions

View file

@ -1,3 +1,11 @@
Comments:
----
Label: Offre initiale
----
Uuid: 7cCbXLUJWENOMUwh
----

View file

@ -6,3 +6,6 @@ focus: false
fields:
comments:
type: hidden
label:
label: Nom
type: text

View file

@ -2,9 +2,11 @@
function getFileData($file) {
$data = [
'modified' => $file->modified('YYYY-MM-dd'),
'url' => $file->url(),
'uuid' => (string) $file->uuid(),
'name' => $file->filename(),
'label' => (string) $file->label(),
'type' => (string) $file->type(),
];

View file

@ -6,7 +6,7 @@
<span data-icon="votre-brief">{{ step.label }}</span>
</h2>
<div class="cards | flow">
<article class="card">
<article v-if="step.id !== 'proposal'" class="card">
<hgroup class="order-last">
<h3 class="card__title | font-serif | text-lg">{{ step.label }}</h3>
</hgroup>
@ -58,6 +58,32 @@
}}
</footer>
</article>
<template v-if="step.id == 'proposal' && step.files.length">
<article class="card" v-for="file in step.files">
<hgroup class="order-last">
<h3 class="card__title | font-serif | text-lg">
{{
file.label.length ? file.label : file.name.replace(".pdf", "")
}}
</h3>
</hgroup>
<div class="card__meta | flex">
<time
class="card__date | text-grey-700"
:datetime="dayjs(file.modified).format('YYYY-M-DD')"
>{{ dayjs(file.modified).format("DD MMMM YYYY") }}</time
>
</div>
<div class="card__images" data-icon="document"></div>
<footer v-if="file.comments?.length > 0">
{{ file.comments.length }} commentaire{{
file.comments.length > 1 ? "s" : ""
}}
</footer>
</article>
</template>
</div>
</router-link>
</section>
@ -85,13 +111,20 @@ const steps = page.steps.map((item) => {
const status = setStatus();
function setStatus() {
if (page.content.currentstep === step.id) {
const currentStepId = page.content.currentstep;
const currentStepIndex = page.steps.findIndex(
(item) => item.id === currentStepId
);
const stepIndex = page.steps.findIndex((item) => item.id === step.id);
if (currentStepIndex === stepIndex) {
return "in-progress";
}
if (steps.indexOf(step.id) < steps.indexOf(page.content.currentstep)) {
return "completed";
if (currentStepIndex > stepIndex) {
return "done";
}
if (steps.indexOf(step.id) > steps.indexOf(page.content.currentstep)) {
if (currentStepIndex < stepIndex) {
return "uncompleted";
}
}