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

@ -382,7 +382,7 @@ const name = ref<string>("");
const year = ref<number>(new Date().getFullYear() + 543);
const round = ref<number>(1);
const mixin = useCounterMixin();
const { success, dateText, messageError } = mixin;
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
const files = ref<any>(null);
const files_score = ref<any>(null);
const files_candidate = ref<any>(null);
@ -549,7 +549,7 @@ const visibleColumnsHistory = ref<String[]>([
]);
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchData();
});
@ -570,7 +570,7 @@ const textDate = (value: Date) => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.getDisableCandidates)
.then((res) => {
@ -592,7 +592,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -618,7 +618,7 @@ const clickEditPeriod = (id: string) => {
const clickHistory = async (id: string) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.getDisableImportHistory(id))
.then((res) => {
@ -644,7 +644,7 @@ const clickHistory = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -659,7 +659,7 @@ const clickDelete = (id: string) => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.deleteDisableCandidates(id))
.then((res) => {
@ -670,7 +670,7 @@ const clickDelete = (id: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
})
.onCancel(() => {})
@ -699,7 +699,7 @@ const clickCloseCandidate = async () => {
const checkSaveCandidate = async () => {
const fd = new FormData();
fd.append("attachment", files_candidate.value[0]);
loaderPage(true);
showLoader();
await http
.post(config.API.uploadDisableCandidates(selected_row_id.value), fd)
.then((res) => {
@ -712,14 +712,14 @@ const checkSaveCandidate = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const checkSaveScore = async () => {
const fd = new FormData();
fd.append("attachment", files_score.value[0]);
loaderPage(true);
showLoader();
await http
.post(config.API.saveDisableScores(selected_row_id.value), fd)
.then((res) => {
@ -732,7 +732,7 @@ const checkSaveScore = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -742,7 +742,7 @@ const checkSave = async () => {
fd.append("year", year.value.toString());
fd.append("round", round.value.toString());
fd.append("name", name.value);
loaderPage(true);
showLoader();
await http
.post(config.API.saveDisableCandidates, fd)
.then((res) => {
@ -754,7 +754,7 @@ const checkSave = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
</script>