designtopack/src/components/project/cards/Brief.vue

58 lines
1.4 KiB
Vue
Raw Normal View History

2024-12-20 07:19:46 +01:00
<template>
<Images
v-if="images.length > 0"
:step="step"
:images="images"
:uri="addLocalePrefix(step.uri)"
/>
2024-12-20 07:19:46 +01:00
<Document v-if="pdf" :step="step" :pdf="pdf" />
<button
v-if="images.length === 0 && step.id === 'clientBrief'"
2024-12-20 07:19:46 +01:00
class="btn | w-full"
@click="goToImagesBrief()"
>
{{ t('brief.addPlatform') }}
2024-12-20 07:19:46 +01:00
</button>
<div class="btn | w-full" v-if="!pdf && step.id === 'clientBrief'">
2024-12-20 07:19:46 +01:00
<label for="upload-pdf">
{{ t('brief.addPdf') }}
2024-12-20 07:19:46 +01:00
<input
id="upload-pdf"
type="file"
@change="addPdf($event, step.uri)"
accept="application/pdf"
ref="pdfInput"
hidden
/>
</label>
</div>
</template>
<script setup>
import { computed } from "vue";
import Images from "./Images.vue";
import Document from "./Document.vue";
import { useBriefStore } from "../../../stores/brief";
import { useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
import { addLocalePrefix } from "../../../utils/router";
2024-12-20 07:19:46 +01:00
const { step } = defineProps({ step: Object });
const { addPdf } = useBriefStore();
const router = useRouter();
const { t } = useI18n();
2024-12-20 07:19:46 +01:00
const images = computed(() => {
return step.files.filter((file) => file.type === "image");
});
const pdf = computed(() => {
return step.files.find((file) => file.type === "document");
});
function goToImagesBrief() {
router.push(location.pathname + "/" + step.slug);
2024-12-20 07:19:46 +01:00
}
</script>