import { defineStore } from "pinia"; import { ref, } from "vue"; export const useResultDataStore = defineStore("insigniaResult", () => { const insignia = ref('') const insigniaOp = ref([{ name: "ทั้งหมด", id: "" }]) const insigniaOp2 = ref([]) const insigniaType = ref() const fetchDatainsignia = async (data: any) => { data.forEach((e: any) => { insigniaOp.value.push({ name: e.name, id: e.id }) }); data.forEach((e: any) => { insigniaOp2.value.push({ name: e.name, id: e.id }) }); } const fetchDatainsigniaType = async (data: any) => { insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name })) } const status = (val: string) => { switch (val) { case "PENDING": return "รอบันทึกข้อมูล"; case "REJECT": return "ยกเลิก"; case "DELETE": return "ลบ"; case "DONE": return "บันทึกลง ก.พ. 7 แล้ว"; } } const profileType = (val: string) => { switch (val) { case "officer": return "ข้าราชการ กทม.สามัญ"; case "employee": return "ลูกจ้างประจำ"; } } return { insignia, insigniaOp, insigniaOp2, insigniaType, fetchDatainsignia, fetchDatainsigniaType, status, profileType, }; });