designtopack/src/stores/project.js
2024-11-21 11:47:36 +01:00

34 lines
938 B
JavaScript

import { defineStore } from "pinia";
import { usePageStore } from "./page";
export const useProjectStore = defineStore("project", () => {
const { page } = usePageStore();
const stepsLabels = {
Brief: "Votre brief",
proposal: "Proposition commerciale",
extendedBrief: "Brief enrichi",
industrialIdeation: "Idéation industrielle",
virtualSample: "Échantillon virtuel",
physicalSample: "Échantillon physique",
};
function setStatus(steps, currentStepId, targetStep) {
const currentStepIndex = steps.findIndex(
(item) => item.id === currentStepId
);
const stepIndex = steps.findIndex((item) => item.id === targetStep.id);
if (currentStepIndex === stepIndex) {
return "in-progress";
}
if (currentStepIndex > stepIndex) {
return "done";
}
if (currentStepIndex < stepIndex) {
return "uncompleted";
}
}
return { stepsLabels, setStatus };
});