<script setup>
import {getDataColumns, getDataRows, getParsedDataFormatFunction, setDataRows, clearProgress} from "@/components/forms/other/MassDataInserter.vue";
import { ref, computed, defineEmits, defineProps } from 'vue';
import { initiateFileSelection, getFileContent } from "@/components/forms/other/functions/selectParseFile.vue";
import { SessionUser } from "@/components/session/token/SessionUser.vue";

// Emits
const emit = defineEmits(["onClickAdd", "onClickClear"]);
const onClickAdd = () => {
  initiateFileSelection(getParsedDataFormatFunction());
  emit("onClickAdd");
}
const onClickClear = () => {
  // Clear the dataRows
  setDataRows([]);
  // Clear the progress
  clearProgress();
  emit("onClickClear");
}
</script>

<template>
  <div class="buttons is-pulled-right">
    <!-- Add rows -->
    <button
        class="button is-light"
        @click="onClickAdd"
    >
      <span class="icon is-small">
        <i class="fas fa-plus"></i>
      </span>
      <span>{{ SessionUser.objects.global.language.add }}</span>
    </button>
    <!-- Clear rows -->
    <button
        class="button is-danger is-light"
        @click="onClickClear"
    >
      <span class="icon is-small">
        <i class="fas fa-trash"></i>
      </span>
      <span>{{ SessionUser.objects.global.language.clear }}</span>
    </button>
  </div>
</template>

<style scoped>

</style>