<script setup lang="ts">
import { useRouter } from "vue-router";
import { useQuasar } from "quasar";

import DialogHeader from "@/components/DialogHeader.vue";

import { useCounterMixin } from "@/stores/mixin";

const router = useRouter();
const $q = useQuasar();
const mixin = useCounterMixin();

const { dialogConfirm } = mixin;

const props = defineProps({
  modal: {
    type: Boolean,
  },
  menu: {
    type: Object,
    require: true,
  },
  close: {
    type: Function,
  },
});

function onCklicNext() {
  dialogConfirm(
    $q,
    () => {
      router.push("/evaluate/add");
    },
    "ยืนยันการดำเนินการ",
    "ต้องการยืนยันการดำเนินการต่อใช่หรือไม่?"
  );
}
</script>
<template>
  <q-dialog v-model="props.modal">
    <q-card style="width: 700px; max-width: 80vw">
      <DialogHeader
        :tittle="props.menu ? props.menu.label : ''"
        :close="props.close"
      />
      <q-separator />

      <q-card-section class="q-pt-none"> </q-card-section>
      <q-separator />
      <q-card-actions align="right">
        <q-btn
          unelevated
          dense
          color="public"
          label="ดำเนินการต่อ"
          @click="onCklicNext"
        />
      </q-card-actions>
    </q-card>
  </q-dialog>
</template>

<style scoped></style>
