<template>
  <div>
    <b-tooltip
      label="Bút toán hạch toán"
      position="is-left"
      type="is-primary"
    >
      <a
        class="mr-2"
        @click="list()"
      >
        <SvgIcon v-bind="{ name: 'menu.png', type: 'gray', size: 16 }"></SvgIcon>
      </a>
    </b-tooltip>
    <b-tooltip
      v-if="$getEditRights()"
      label="Hạch toán"
      position="is-left"
      type="is-primary"
    >
      <a
        class="mr-2"
        @click="entry()"
      >
        <SvgIcon v-bind="{ name: 'usd.png', type: 'gray', size: 16 }"></SvgIcon>
      </a>
    </b-tooltip>
  </div>
</template>
<script>
export default {
  props: ["row", "api", "pagename"],
  methods: {
    list() {
      let obj = {
        component: "common/ViewList",
        title: this.$lang("entry"),
        width: "80%",
        height: "400px",
        vbind: {
          vbind: {
            api: "internalentry",
            setting: "internal-entry-fields",
            filter: { account__code: this.row.code },
          },
        },
      };
      this.$emit("open", { name: "dataevent", data: { modal: obj } });
    },
    entry() {
      let obj = {
        component: "accounting/InternalDeposit",
        title: this.$lang("accounting-entry"),
        width: "1000px",
        height: "450px",
        vbind: { row: this.row, api: this.api, pagename: this.pagename },
      };
      this.$emit("open", { name: "dataevent", data: { modal: obj } });
    },
  },
};
</script>
