<script setup lang="ts">
const props = defineProps({
  title: String,
  titleType: String,
  close: {
    type: Function,
    default: () => console.log("not function"),
  },
});

const close = async () => {
  props.close();
};

function onTemplate() {
  window.open(`/File/${props.titleType}.xlsx`, "_blank");
}
</script>
<template>
  <q-toolbar>
    <q-toolbar-title class="text-subtitle2 text-bold"
      >{{ title }}
      <q-btn
        icon="mdi-download"
        unelevated
        round
        color="blue"
        flat
        dense
        @click="onTemplate()"
      >
        <q-tooltip>ดาวน์โหลดไฟล์ต้นแบบ</q-tooltip>
      </q-btn></q-toolbar-title
    >
    <q-btn
      icon="close"
      unelevated
      round
      dense
      @click="close"
      style="color: #ff8080; background-color: #ffdede"
    />
  </q-toolbar>
</template>
