home (projects) : dynamize steps
This commit is contained in:
parent
8bcba4ca9c
commit
837b741c47
4 changed files with 49 additions and 37 deletions
|
|
@ -1,6 +1,9 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { usePageStore } from "./page";
|
||||
|
||||
export const useProjectStore = defineStore("project", () => {
|
||||
const { page } = usePageStore();
|
||||
|
||||
const stepsLabels = {
|
||||
Brief: "Votre brief",
|
||||
proposal: "Proposition commerciale",
|
||||
|
|
@ -10,5 +13,24 @@ export const useProjectStore = defineStore("project", () => {
|
|||
physicalSample: "Échantillon physique",
|
||||
};
|
||||
|
||||
return { stepsLabels };
|
||||
function setStatus(steps, step) {
|
||||
const currentStepId = page.content.currentstep;
|
||||
|
||||
const currentStepIndex = steps.findIndex(
|
||||
(item) => item.id === currentStepId
|
||||
);
|
||||
const stepIndex = steps.findIndex((item) => item.id === step.id);
|
||||
|
||||
if (currentStepIndex === stepIndex) {
|
||||
return "in-progress";
|
||||
}
|
||||
if (currentStepIndex > stepIndex) {
|
||||
return "done";
|
||||
}
|
||||
if (currentStepIndex < stepIndex) {
|
||||
return "uncompleted";
|
||||
}
|
||||
}
|
||||
|
||||
return { stepsLabels, setStatus };
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue