<script setup lang="ts">
import http from "@/plugins/http";
import config from "@/app.config";
import DialogHeader from "@/components/DialogHeader.vue";

const openDialog = defineModel<boolean>("openDialog", {
  required: true,
  default: false,
});

defineProps<{
  title: string;
  close?: (...args: unknown[]) => void;
  downloadTxt: Function;
}>();
</script>

<template>
  <q-dialog v-model="openDialog">
    <q-card style="width: 100%">
      <!-- header -->

      <DialogHeader :tittle="title" :close="close" />

      <q-separator />

      <!-- body -->
      <q-card-section class="scroll" style="height: 80vh">
        <slot />
      </q-card-section>
      <q-separator />
      <q-card-actions align="right">
        <q-btn
          label="ดาวน์โหลด (.TXT)"
          color="blue"
          type="submit"
          icon="download"
          @click="() => downloadTxt()"
          ><q-tooltip>ดาวน์โหลด (.TXT)</q-tooltip></q-btn
        >
      </q-card-actions>
    </q-card>
  </q-dialog>
</template>

<style scoped lang="scss">
@media (min-width: 600px) {
  .q-dialog__inner--minimized > div {
    max-width: 80%;
  }
}
</style>
