<template>
  <AdminLayout>
    <Breadcrumb currentPageText="Muhasebe / Piyango Detay" go="/muhasebe/piyango-listesi"/>
    <tabs :tabList="tabList" v-if="loaded" isUseRoute>
      <template #piyango-bilgileri>
        <tab-muhasebe-piyango-bilgileri-display />
      </template>
    </tabs>
  </AdminLayout>
</template>
<script setup lang="ts">
  import { onBeforeMount, ref } from 'vue'

  import { useRoute } from 'vue-router'
  const route = useRoute()
  import { useUsersStore } from '@/stores/usersStore'
  const usersStore = useUsersStore()
  import { useDataStore } from '@/stores/dataStore'
  const dataStore = useDataStore()
  import { usePiyangoStore } from '@/module/cekilisler/stores/piyangoStore'
  const piyangoStore = usePiyangoStore()

  import AdminLayout from '@/layouts/AdminLayout.vue'
  import TabMuhasebePiyangoBilgileriDisplay from '../components/TabMuhasebePiyangoBilgileriDisplay.vue'

  const loaded = ref<boolean>(false)
  const tabList = ref<Record<string, any>[]>([
    { text: 'Piyango Bilgileri', id: 'piyango-bilgileri' }
  ])

  onBeforeMount(async () => {
    piyangoStore.selectedLottery = Number(route.params.piyangoId)

    const lotteryData: Record<string, any> = await dataStore.dataGet(
      'Cekilis/durum-sorgu/' + piyangoStore.selectedLottery
    )
    piyangoStore.SetLotteryControlData(lotteryData)

    loaded.value = true
  })
</script>
