<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";

import CardDirector from "@/modules/12_evaluatePersonal/components/Detail/viewTab2/CardDirector.vue";
import CardMeet from "@/modules/12_evaluatePersonal/components/Detail/viewTab2/CardMeet.vue";

import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRouter, useRoute } from "vue-router";

const router = useRouter();
const route = useRoute();
const id = ref<string>(route.params.id as string);
const store = useEvaluateDetailStore();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, messageError } = mixin;

const director = ref<any[]>();
const meeting = ref<any[]>();
const $q = useQuasar();

// onMounted(() => {
//   store.step = 1;
// });

function getList() {
  showLoader();
  http
    .get(config.API.evaluationListData(id.value))
    .then((res) => {
      const data = res.data.result;
      director.value = data.directors;
      meeting.value = data.meetings;
    })
    .catch((e) => {
      messageError($q, e);
    })
    .finally(() => {
      hideLoader();
    });
}
onMounted(() => {
  getList();
});
</script>

<template>
  <div class="row col-12">
    <div class="toptitle">กรรมการและการประชุม</div>

    <div class="row col-12 q-gutter-md">
      <CardDirector :data="director"/>
      <CardMeet :data="meeting"/>
    </div>
  </div>
</template>

<style>
.q-stepper--vertical .q-stepper__step-inner {
  padding: 0;
}
</style>
