<!--
Program: Excel Upload
Author: SDL
Description: Excel Upload Common Component
-->
<template>
  <!-- SUB Contents -->
  <div class="ui--content-wrapper">
    <sdl-breadcrumb></sdl-breadcrumb>
    <h4 class="mb-3">Excel Upload Sample Information</h4>
    <!-- SEARCH Area -->
    <div class="ui--search-container clearfix">
      <div class="row">
        <label class="col-2 col-form-label text-end">Excel File</label>
        <div class="col-5">
          <sdl-exceluploadbtn :excelInfo="excelUpInfo" @after-upload="afterUpload" :before-click="beforeClick" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { SDLUtil } from '@/utils';

export default {
  data() {
    return {
      excelUpInfo: {
        columnInfoFile: 'excelUploadSample', // Column Info XML file
        queryId: 'insertExcelUploadSample', // execute query Id
        returnPath: '', // Page path to move after saving Excel (replaced with 'uplo-upload' event)
        startRow: 2, // First row of data to store
        useObjectName: 'com.samsung.sample.excel.entity.ExcelUploadSample', // Java object for processing data
      },
    };
  },
  methods: {
    /**
     * param:
     * return:
     * exception:
     * Description : pre-upload check
     */
    beforeClick() {
      return true;
    },
    /**
     * param:
     * return:
     * exception:
     * Description : Upload and execute
     */
    afterUpload(rtn) {
      console.log(rtn);
      SDLUtil.alert('sdl.excel.label.uploadCompleted');
    },
  },
};
</script>

<style scoped></style>
