new loader

This commit is contained in:
Thanit Konmek 2023-06-09 14:25:41 +07:00
parent fd7aae2f5d
commit fe6c712a18
95 changed files with 1189 additions and 950 deletions

View file

@ -323,7 +323,7 @@ const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, messageError } = mixin;
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(false);
const addressData = ref<Address>(defaultAddress);
const myform = ref<any>();
@ -561,7 +561,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
*/
const clickHistory = async () => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileAdrsHisId(route.params.id.toString()))
.then((res) => {
@ -589,7 +589,7 @@ const clickHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -610,7 +610,7 @@ const getNewData = async () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
@ -629,7 +629,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -661,7 +661,7 @@ const editData = async () => {
createdAt: new Date(),
createdFullName: "-",
};
loaderPage(true);
showLoader();
await http
.put(config.API.profileAdrsId(route.params.id.toString()), body)
.then((res) => {
@ -731,7 +731,7 @@ const selectSubDistrict = (e: string | null, name: string) => {
};
const fetchProvince = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.province)
.then((res) => {
@ -747,13 +747,13 @@ const fetchProvince = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchDistrict = async (id: string | null, position: string) => {
if (id != null) {
loaderPage(true);
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -774,14 +774,14 @@ const fetchDistrict = async (id: string | null, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchSubDistrict = async (id: string | null, position: string) => {
if (id != null) {
loaderPage(true);
showLoader();
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
@ -806,7 +806,7 @@ const fetchSubDistrict = async (id: string | null, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};

View file

@ -293,7 +293,8 @@ const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const route = useRoute();
const id = ref<string>("");
const certificateNo = ref<string>();
@ -484,7 +485,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
@ -507,7 +508,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -595,7 +596,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.profileCertId(profileId.value), {
id: id.value,
@ -621,7 +622,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.profileCertId(id.value), {
id: id.value,
@ -655,7 +656,7 @@ const clickDelete = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileCertId(id.value))
.then((res) => {
@ -769,7 +770,7 @@ const clickHistory = async (row: RequestItemsObject) => {
? "ประวัติแก้ไขใบอนุญาตของลูกจ้าง"
: "ประวัติแก้ไขใบอนุญาตประกอบอาชีพ";
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileCertHisId(row.id))
.then((res) => {
@ -792,7 +793,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -792,7 +792,7 @@ const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, messageError } = mixin;
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(false);
const fix = ref<boolean>(true);
const myform = ref<QForm | null>(null);
@ -857,7 +857,7 @@ const refreshData = async () => {
};
const fetchPrefix = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.prefix)
.then((res) => {
@ -873,7 +873,7 @@ const fetchPrefix = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -901,7 +901,7 @@ const deleteChildren = (items: childrenFamily) => {
const fetchHistory = async () => {
familyDataHistory.value = [];
loaderPage(true);
showLoader();
await http
.get(config.API.profileFamiHisId(route.params.id.toString()))
.then((res) => {
@ -933,7 +933,7 @@ const fetchHistory = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
if (familyDataHistory.value.length == 0) {
// modalError(
// $q,
@ -955,7 +955,7 @@ const fetchHistory = async () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileFamiId(route.params.id.toString()))
.then((res) => {
@ -1000,12 +1000,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const editData = async () => {
loaderPage(true);
showLoader();
const body: ResponseObject = {
couple: familyData.value.same == "1",
couplePrefixId: familyData.value.prefixIdC,

View file

@ -319,7 +319,8 @@ const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const profileStore = useProfileDataStore();
const { birthDate, retireText } = storeToRefs(profileStore);
const edit = ref<boolean>(false);
@ -540,7 +541,7 @@ watch(retireText, async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileGovId(route.params.id.toString()))
.then((res) => {
@ -564,7 +565,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -574,7 +575,7 @@ const refreshData = async () => {
};
const editData = async () => {
loaderPage(true);
showLoader();
const body: ResponseObject = {
oc: govermentData.value.ocId,
business: govermentData.value.businessId,
@ -623,7 +624,7 @@ const handleDate = async (modelData: Date) => {
};
const fetchCalAgeGov = async (date: Date) => {
loaderPage(true);
showLoader();
const body = {
dateAppoint: date,
};
@ -637,7 +638,7 @@ const fetchCalAgeGov = async (date: Date) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -646,7 +647,7 @@ const fetchCalAgeGov = async (date: Date) => {
*/
const clickHistory = async () => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileGovHisId(route.params.id.toString()))
.then((res) => {
@ -677,7 +678,7 @@ const clickHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -417,7 +417,15 @@ const emit = defineEmits(["update:statusEdit"]);
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, modalError } = mixin;
const {
date2Thai,
success,
dateToISO,
messageError,
modalError,
showLoader,
hideLoader,
} = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const profileStore = useProfileDataStore();
@ -674,7 +682,7 @@ const onCancel = async () => {
* get รายการ อมลเกยวกบบคคล
*/
const fetchPerson = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.person)
.then((res) => {
@ -731,7 +739,7 @@ const fetchPerson = async () => {
})
.catch((e: any) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -740,7 +748,7 @@ const fetchPerson = async () => {
*/
const clickHistory = async () => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileInforHisId(route.params.id.toString()))
.then((res) => {
@ -781,7 +789,7 @@ const clickHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -851,7 +859,7 @@ const calRetire = async (birth: Date) => {
const body = {
birthDate: dateToISO(birth),
};
loaderPage(true);
showLoader();
await http
.post(config.API.profileCalRetire, body)
.then((res: any) => {
@ -867,12 +875,12 @@ const calRetire = async (birth: Date) => {
changeRetireText(date2Thai(retire));
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
@ -904,7 +912,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -933,7 +941,7 @@ const editData = async () => {
profileType: informaData.value.profileType,
createdFullName: "-",
};
loaderPage(true);
showLoader();
await http
.put(config.API.profileInforId(route.params.id.toString()), body)
.then((res) => {

View file

@ -19,7 +19,8 @@ import Address from "@/modules/04_registry/components/Information/Address.vue";
import Family from "@/modules/04_registry/components/Information/Family.vue";
import Certicate from "@/modules/04_registry/components/Information/Certicate.vue";
// import NotifyError from "@/components/NotifyError.vue";
import { useDataStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin";
const props = defineProps({
statusEdit: {
@ -33,8 +34,8 @@ const props = defineProps({
});
const emit = defineEmits(["update:statusEdit"]);
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { showLoader, hideLoader } = mixin;
const statusEdit = ref<boolean>(false);
const modalNoEdit = ref<boolean>(false);
const modalNoEditTittle = ref<string>("ไม่สามารถไม่สามารถแก้ไขข้อมูลได้?");
@ -49,7 +50,7 @@ watch(props, (count: any, prevCount: any) => {
});
onMounted(() => {
loaderPage(false);
hideLoader();
});
const notiNoEdit = () => {