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

const route = useRoute();
const state = useState();
const user = state.getUser();

const userFilter = {
    order: 'created DESC',
    include: {
        relation: 'user',
        scope: {
            fields: ['id', 'nickname', 'name'],
        },
    },
};

const body = {
    workerFk: route.params.id,
    userFk: user.value.id,
};
</script>

<template>
    <VnNotes
        :add-note="true"
        url="WorkerObservations"
        :user-filter="userFilter"
        :filter="{ where: { workerFk: $route.params.id } }"
        :body="body"
    />
</template>
