diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/04_Family.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/04_Family.vue index 5996edee9..797cdfcfe 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/04_Family.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/04_Family.vue @@ -7,7 +7,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { useRoute } from "vue-router"; import DialogHistory from "@/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyHistory.vue"; - +import { useProfileDataStore } from "@/modules/04_registryNew/stores/profile"; const mixin = useCounterMixin(); const $q = useQuasar(); const { @@ -20,6 +20,7 @@ const { date2Thai, } = mixin; +const store = useProfileDataStore(); const route = useRoute(); const id = ref(route.params.id.toString()); const dialog = ref(false); @@ -64,7 +65,7 @@ const spouseData = reactive({ const rows = ref([]); const historyRows = ref([]); - +const prefixFilter = ref([]); const childrenData: any = reactive({ childrens: [], }); @@ -233,8 +234,32 @@ function deleteChildren(items: any) { } onMounted(async () => { + if ( + store.Ops.prefixOps.length === 0 || + store.Ops.genderOps.length === 0 || + store.Ops.bloodOps.length === 0 || + store.Ops.statusOps.length === 0 || + store.Ops.religionOps.length === 0 + ) { + await fetchPerson(); + } + prefixFilter.value = store.Ops.prefixOps; await fetchData(id.value); }); + +function filterSelector(val: string, update: Function, refData: string) { + switch (refData) { + case "prefixOps": + update(() => { + store.Ops.prefixOps = prefixFilter.value.filter( + (v: any) => v.name.indexOf(val) > -1 + ); + }); + break; + default: + break; + } +}