import { defineStore } from "pinia"; import { ref } from "vue"; import { useCounterMixin } from "@/stores/mixin"; import type { QTableProps } from "quasar"; import type { DataOption } from '@/modules/11_discipline/interface/index/Main' import type { MainList, RowList,RowAddList } from '@/modules/11_discipline/interface/response/appealComplain' export const useAppealComplainStore = defineStore( "AppealComplainStore", () => { const rows = ref([]); const rowsAdd = ref([]); const visibleColumns = ref([]); const columns = ref([]); const mixin = useCounterMixin() const { date2Thai } = mixin function fetchAppealComplain(data: MainList[]) { let dataList: RowList[] = data.map((e: MainList) => ({ id: e.id, profileId: e.profileId, type: typeConvert(e.type), title: e.title, description: e.description, year: e.year, fullname: e.fullname, citizenId: e.citizenId, caseType: e.caseType, caseNumber: e.caseNumber, lastUpdatedAt: date2Thai(e.lastUpdatedAt), status: statusTothai(e.status) })); rows.value = dataList; } function getRow(data:RowAddList[]){ if(data){ rowsAdd.value = data } } function statusTothai(val: string){ switch (val) { case "NEW": return "ใหม่"; case "RECEIVE_DOC": return "ได้รับเอกสารแล้ว"; case "RECEIVE_APPEAL": return "รับอุทธรณ์/ร้องทุกข์"; case "NO_RECEIVE_APPEAL": return "ไม่รับอุทธรณ์/ร้องทุกข์"; case "DIAGNOSTIC": return "ตั้งองค์คณะวินิจฉัย"; case "SUMMARY": return "สรุปผลการพิจารณา"; case "DONE": return "ปิดคำร้อง"; default: return "-"; } }; const typeConvert = (val: string) => { switch (val) { case "APPEAL": return "อุทธรณ์"; case "COMPLAIN": return "ร้องทุกข์"; default: return "-"; } }; const typeOptions = ref([ { id: "APPEAL", name: "อุทธรณ์" }, { id: "COMPLAIN", name: "ร้องทุกข์" }, ]); const fiscalyearOP = ref([ { id: "0", name: "ทั้งหมด" }, ]) const statusOptions = ref([ { id: "ALL", name: "ทั้งหมด" }, { id: "NEW", name: "ใหม่" }, { id: "RECEIVE_DOC", name: "ได้รับเอกสารแล้ว" }, { id: "RECEIVE_APPEAL", name: "รับอุทธรณ์/ร้องทุกข์" }, { id: "NO_RECEIVE_APPEAL", name: "ไม่รับอุทธรณ์/ร้องทุกข์" }, { id: "DIAGNOSTIC", name: "ตั้งองค์คณะวินิจฉัย" }, { id: "SUMMARY", name: "สรุปผลการพิจารณา" }, { id: "DONE", name: "ปิดคำร้อง" }, ]); const statusOptionsEdit = ref([ { id: "NEW", name: "ใหม่" }, { id: "RECEIVE_DOC", name: "ได้รับเอกสารแล้ว" }, { id: "RECEIVE_APPEAL", name: "รับอุทธรณ์/ร้องทุกข์" }, { id: "NO_RECEIVE_APPEAL", name: "ไม่รับอุทธรณ์/ร้องทุกข์" }, { id: "DIAGNOSTIC", name: "ตั้งองค์คณะวินิจฉัย" }, { id: "SUMMARY", name: "สรุปผลการพิจารณา" }, { id: "DONE", name: "ปิดคำร้อง" }, ]); return { rows, visibleColumns, columns, fetchAppealComplain, // filterSelector, typeOptions, statusOptions, fiscalyearOP, getRow, rowsAdd, statusOptionsEdit, statusTothai }; } );