<template>
      <Filters @run-search="() => filterData(filters)" class="mb-4">
        <Type15 @update:filters="(value) => {
            filters = value
        }
            " />
    </Filters>
    <div id="data">
        <DxDataGrid class="max-h-[calc(100vh-140px)]" :show-column-lines="true" :show-row-lines="false" :show-borders="true"
            :row-alternation-enabled="true" :hover-state-enabled="true" @selection-changed="" :column-width="100"
            @exporting="" :allow-column-resizing="true" column-resizing-mode="widget">
            <DxSelection mode="single" />
            <DxPaging :page-size="5" :enabled="true" />
            <DxPager :visible="true" :allowed-page-sizes="[5, 10, 20]" display-mode="full"
                :show-page-size-selector="true" :show-info="true" :show-navigation-buttons="true" />
               <DxLoadPanel :position="position" :show-indicator="showIndicator" :show-pane="showPane" :shading="shading"
        v-if="loading" v-model:visible="loading" :enabled="true" />
            <DxSearchPanel :visible="true" :highlight-case-sensitive="true" />
            <DxExport :enabled="true" :formats="['pdf', 'xlsx', 'document']" :allow-export-selected-data="false" />

            <DxColumn css-class="custom-table-column" :width="50" alignment="center" data-field="" data-type="number"
                caption="No" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field="" caption="No. Laporan" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field="" caption="Tgl Lapor" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field=""
                caption="IDPEL/NO METER" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field=""
                caption="Nama Pelapor" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field=""
                caption="Alamat Pelapor" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field=""
                caption="No Tlp Pelapor" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field="" caption="Status" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field="" caption="UI Dist." />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field="" caption="UP 3" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field="" caption="Posko/ULP" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field="" caption="Petugas" />
            <DxColumn css-class="custom-table-column" :width="170" alignment="center" data-field=""
                caption="Keterangan DLPD" />

        </DxDataGrid>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { DxDataGrid } from 'devextreme-vue'
import { DxColumn, DxExport, DxLoadPanel, DxPager, DxPaging, DxScrolling, DxSearchPanel, DxSelection } from 'devextreme-vue/data-grid'
import { Type15 } from '@/components/Form/FiltersType';
import Filters from '@/components/Form/Filters.vue';
const position = { of: '#data' }
const showIndicator = ref(true)
const shading = ref(true)
const showPane = ref(true)
const data = ref<any[]>([])
const dataDetail = ref<any>()
const showDetail = ref(false)
const loading = ref(false)
const filters = ref();
const filterData = async (filters: any) => {
    loading.value = true
    await new Promise((resolve) => setTimeout(resolve, 1000))
    loading.value = false
}
</script>