<template>
  <list-table-content
  v-if="loaded"
    :tableHeader="tableHeader"
    formTitle="Piyango Onay Logları"
    listText="Kayıt"
    :apiList="'OnayDurumLog/Cekilis/' + piyangoStore.selectedLottery"
    apiText="Piyango Onay Log Listesi"
    page="form"
    :refresh="piyangoOnayStore.refreshList" />
</template>
<script setup lang="ts">
  import { ref,onBeforeMount,computed } from 'vue'
  import axios from 'axios'
  import { useDateStore } from '@/stores/dateStore'
  const dateStore = useDateStore()
  import { useGlobalStore } from '@/stores/globalStore'
  const globalStore = useGlobalStore()
  import { usePiyangoOnayStore } from '../../stores/piyangoOnayStore'
  const piyangoOnayStore = usePiyangoOnayStore()
  import { usePiyangoStore } from '../../stores/piyangoStore'
  const piyangoStore = usePiyangoStore()
  import { usePiyangoDataStore } from '../../stores/piyangoDataStore'
  const piyangoDataStore = usePiyangoDataStore()
  import { usePiyangoServices } from '../../service/piyangoServices'
  const piyangoServices = usePiyangoServices()

  const loaded = ref<boolean>(false)

  const piyangoOnayDurumlari = computed<Record<string, any>[]>(() => {
    return piyangoDataStore.piyangoOnayDurumlari
  })

  const tableHeader = ref<Record<string, any>[]>([
    {
      name: 'tarih',
      title: 'Tarih',
      compute: (v: Record<string, any>): string => {
        return v.tarih === null
          ? ''
          : dateStore.dateFormat({ pattern: 'dd-mm-yy', date: v.tarih })
      },
      sort: true,
        filter: {
          type: 'date',
          range: true
        }
    },
    {
      name: 'islemYapanKullanici.email',
      title: 'Kişi',
      sort: true,
      style: { width: '20%' }
    },
    {
      name: 'eskiDurum',
      title: 'Eski Durum',
    },
    {
      name: 'yeniDurum',
      title: 'Yeni Durum',
    },
    {
      name: 'aciklama',
      title: 'Açıklama',
      sort: true,
      style: { width: '30%' }
    }
  ])

  onBeforeMount(async () => {
    loaded.value = true
  })
</script>
