client brief pdf - upload : add file to field without uploading it if it already exist

This commit is contained in:
isUnknown 2024-10-14 15:23:06 +02:00
parent e74ff559bf
commit a14f1d210f
9 changed files with 132 additions and 86 deletions

View file

@ -16,6 +16,7 @@ import ModeSelection from "../components/project/client-brief/ModeSelection.vue"
import Images from "../components/project/client-brief/Images.vue";
import PdfViewer from "../components/project/client-brief/PdfViewer.vue";
import { usePageStore } from "../stores/page";
import { storeToRefs } from "pinia";
const stepsComponents = {
Intro,
@ -24,7 +25,7 @@ const stepsComponents = {
PdfViewer,
};
const { page } = usePageStore();
const { page } = storeToRefs(usePageStore());
const currentStep = ref(setInitialStep());
@ -33,11 +34,13 @@ function changeStep(stepName) {
}
function setInitialStep() {
const hasPDF = page.content.clientbriefpdf.length !== 0;
const hasImages = page.content.clientbriefimages.length !== 0;
const hasPDF = page.value.content.clientbriefpdf.length !== 0;
const hasImages =
page.value.content.clientbriefimages.length !== 0 ||
page.value.content.description.length !== 0;
const isEmpty = !hasPDF && !hasImages;
if (isEmpty) return "Intro";
if (hasPDF) return "PDF";
if (hasPDF) return "PdfViewer";
if (hasImages) return "Images";
}
</script>