Files
CVAtron/resources/js/pages/resumes/Edit.vue
Matthias Guillitte f3ff6fd6ac
Some checks failed
linter / quality (push) Failing after 6m25s
tests / ci (push) Failing after 12m38s
Added printing + Resume name input
2025-08-27 14:54:51 +02:00

66 lines
2.1 KiB
Vue

<script setup lang="ts">
import AppLayout from '@/layouts/AppLayout.vue';
import { type BreadcrumbItem } from '@/types';
import { Head } from '@inertiajs/vue3';
import { Resume, ResumeComponentPlacement } from '@/types/resume';
import ResumeEditPanel from '@/components/resume/ResumeEditPanel.vue';
import ResumePreviewPanel from '@/components/resume/ResumePreviewPanel.vue';
import { computed, ref, watch } from 'vue';
const props = defineProps<{
resume: Resume
}>();
const localResume = ref({ ...props.resume });
const resumeTitle = computed<string>(() => (localResume.value.name == '' ? 'Sans titre' : localResume.value.name) ?? 'Sans titre');
const selectedComponent = ref<ResumeComponentPlacement | null>(null);
const breadcrumbs: BreadcrumbItem[] = [
{
title: resumeTitle.value,
href: '/resumes/edit',
},
];
function changeSelectedComponent(newComponent: ResumeComponentPlacement) {
selectedComponent.value = newComponent;
// Update the resume
localResume.value.components_placements! = localResume.value.components_placements!.map(component =>
component.id === newComponent.id ? newComponent : component
);
}
function changeResumeTitle(newTitle: string) {
console.log('Changing resume title to ', newTitle);
localResume.value.name = newTitle;
}
console.debug('Resume : ', localResume.value);
</script>
<template>
<Head :title="resumeTitle" />
<AppLayout :breadcrumbs="breadcrumbs">
<div class="flex h-full flex-1 gap-4 rounded-xl p-4 overflow-x-auto">
<ResumeEditPanel :resume="localResume" :selected-component="selectedComponent" @selected-component-change="changeSelectedComponent" />
<ResumePreviewPanel :resume="localResume" :selected-component="selectedComponent" @selected-component-change="changeSelectedComponent" @update:resume-title="changeResumeTitle" />
</div>
</AppLayout>
</template>
<style lang="css" scoped>
.v-enter-active,
.v-leave-active {
transition: opacity 0.3s ease;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
</style>