Added printing + Resume name input
This commit is contained in:
@@ -2,20 +2,24 @@
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { type BreadcrumbItem } from '@/types';
|
||||
import { Head } from '@inertiajs/vue3';
|
||||
import { Resume, ResumeComponent, ResumeComponentPlacement } from '@/types/resume';
|
||||
import { Resume, ResumeComponentPlacement } from '@/types/resume';
|
||||
import ResumeEditPanel from '@/components/resume/ResumeEditPanel.vue';
|
||||
import ResumePreviewPanel from '@/components/resume/ResumePreviewPanel.vue';
|
||||
import { ref } from '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: props.resume?.name ?? 'Sans titre',
|
||||
title: resumeTitle.value,
|
||||
href: '/resumes/edit',
|
||||
},
|
||||
];
|
||||
@@ -23,22 +27,39 @@ const breadcrumbs: BreadcrumbItem[] = [
|
||||
function changeSelectedComponent(newComponent: ResumeComponentPlacement) {
|
||||
selectedComponent.value = newComponent;
|
||||
// Update the resume
|
||||
props.resume.components_placements! = props.resume.components_placements!.map(component =>
|
||||
localResume.value.components_placements! = localResume.value.components_placements!.map(component =>
|
||||
component.id === newComponent.id ? newComponent : component
|
||||
);
|
||||
}
|
||||
|
||||
console.log('Resume : ', props.resume);
|
||||
function changeResumeTitle(newTitle: string) {
|
||||
console.log('Changing resume title to ', newTitle);
|
||||
localResume.value.name = newTitle;
|
||||
}
|
||||
|
||||
console.debug('Resume : ', localResume.value);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Dashboard" />
|
||||
<Head :title="resumeTitle" />
|
||||
|
||||
<AppLayout :breadcrumbs="breadcrumbs">
|
||||
<div class="flex h-full flex-1 gap-4 rounded-xl p-4 overflow-x-auto">
|
||||
<ResumeEditPanel :resume="props.resume" :selected-component="selectedComponent" @selected-component-change="changeSelectedComponent" />
|
||||
<ResumePreviewPanel :resume="props.resume" :selected-component="selectedComponent" @selected-component-change="changeSelectedComponent" />
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user