<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnNotes from 'src/components/ui/VnNotes.vue';

const route = useRoute();

const $props = defineProps({
    id: { type: [Number, String], default: null },
    addNote: { type: Boolean, default: true },
});
const claimId = computed(() => $props.id || route.params.id);

const claimFilter = {
    fields: ['id', 'created', 'userFk', 'text'],
    include: {
        relation: 'user',
        scope: {
            fields: ['id', 'nickname', 'name'],
        },
    },
};
</script>
    
<template>
    <VnNotes
        url="claimObservations"
        :go-to="`/claim/${route.params.id}/lines`"
        :add-note="$props.addNote"
        :user-filter="claimFilter"
        :filter="{ where: { claimFk: claimId } }"
        :body="{
            claimFk: claimId,
        }"
        v-bind="$attrs"
        style="overflow-y: auto"
    />
</template>
