<template>
  <a
    class="has-text-link"
    @click="open"
    >{{ row["collaborator__code"] }}</a
  >
</template>
<script setup>
import { useStore } from "@/stores/index";
const store = useStore();
const { $getdata } = useNuxtApp();

const emit = defineEmits(["clickevent"]);
const props = defineProps({
  row: Object,
});
async function open() {
  const record = await $getdata("collaborator", {
    first: true,
    filter: { code: props.row.collaborator__code },
  });
  emit("clickevent", {
    name: "dataevent",
    data: {
      modal: {
        title: store.lang === "en" ? "Collaborator" : "Cộng tác viên",
        height: "400px",
        width: "60%",
        component: "collaborator/CollaboratorView",
        vbind: { row: record },
      },
    },
  });
}
</script>
