2024-11-05 14:26:23 +01:00
|
|
|
import { defineStore } from "pinia";
|
2024-11-21 11:27:14 +01:00
|
|
|
import { usePageStore } from "./page";
|
2024-11-05 14:26:23 +01:00
|
|
|
|
|
|
|
|
export const useProjectStore = defineStore("project", () => {
|
2024-11-21 11:27:14 +01:00
|
|
|
const { page } = usePageStore();
|
|
|
|
|
|
2024-11-05 14:26:23 +01:00
|
|
|
const stepsLabels = {
|
2024-11-19 14:10:35 +01:00
|
|
|
Brief: "Votre brief",
|
2024-11-05 14:26:23 +01:00
|
|
|
proposal: "Proposition commerciale",
|
|
|
|
|
extendedBrief: "Brief enrichi",
|
|
|
|
|
industrialIdeation: "Idéation industrielle",
|
|
|
|
|
virtualSample: "Échantillon virtuel",
|
|
|
|
|
physicalSample: "Échantillon physique",
|
|
|
|
|
};
|
|
|
|
|
|
2024-11-21 11:27:14 +01:00
|
|
|
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 };
|
2024-11-05 14:26:23 +01:00
|
|
|
});
|