2023-08-24 16:27:27 +07:00
|
|
|
import { defineStore } from "pinia";
|
|
|
|
|
import { ref, } from "vue";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-24 17:11:43 +07:00
|
|
|
export const useResultDataStore = defineStore("insigniaResult", () => {
|
2023-08-24 16:27:27 +07:00
|
|
|
const insignia = ref<string>('')
|
|
|
|
|
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "" }])
|
|
|
|
|
const insigniaOp2 = ref<any[]>([])
|
|
|
|
|
const insigniaType = ref<any>()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
});
|