<script setup lang="ts">
import { useQuasar } from "quasar";
import { ref, defineAsyncComponent } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useProbationStore } from "@/modules/11_probation/store/probation";

const Evaluascore = defineAsyncComponent(
  () => import("@/modules/11_probation/component/editPage/04_evaluascore.vue")
);

const router = useRouter();
const route = useRoute();

const id = ref<string>(route.params.id as string);
const profileId = ref<string>(route.params.profileId as string);

const store = useProbationStore();
const $q = useQuasar();
const mode = ref<any>($q.screen.gt.xs);

function addData() {
  router.push(
    `/probation/detail/addevaluascore/${profileId.value}/${id.value}`
  );
}
</script>
<template>
  <div v-if="!$q.screen.gt.xs" class="col-xs-12 col-sm-12 col-md-11">
    <div class="toptitle text-white col-12 row items-center">
      <q-btn
        icon="mdi-arrow-left"
        unelevated
        round
        dense
        flat
        color="primary"
        class="q-mr-sm"
        @click="router.go(-1)"
      />
      <div>แบบประเมินผล (คณะกรรมการ)</div>
    </div>
  </div>
  <div :class="`row q-my-sm ${$q.screen.gt.xs ? '' : 'mobileClass'}`">
    <div class="col-12 q-gutter-md" v-if="store.tabs.length == 0">
      <div class="flex justify-center items-center q-my-md q-gutter-md">
        <q-btn
          outline
          color="primary"
          label="สร้างแบบประเมิน"
          @click="addData"
        />
      </div>
    </div>
    <div v-else>
      <Evaluascore />
    </div>
  </div>
</template>
<style scoped>
.mobileClass {
  background-color: #fff;
  border-radius: 10px;
}
</style>
