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

@ -274,7 +274,7 @@ const subdistrictCOptions = ref<DataOption[]>([]);
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const emit = defineEmits(["update:form"]);
watch(myform, async (count: any, prevCount: any) => {
@ -319,7 +319,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -381,7 +381,7 @@ const fetchDistrict = async (id: string, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -409,7 +409,7 @@ const fetchSubDistrict = async (id: string, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -213,7 +213,15 @@ const props = defineProps({
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { dateThaiRange, modalDelete, modalConfirm, dateToISO, success } = mixin;
const {
dateThaiRange,
modalDelete,
modalConfirm,
dateToISO,
success,
showLoader,
hideLoader,
} = mixin;
const store = useExamDataStore();
const { examData, changeExamColumns } = store;
const id = ref<string>("");
@ -318,7 +326,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateCareer(candidateId.value))
.then((res) => {
@ -336,7 +344,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -415,7 +423,7 @@ const checkDelete = (row: RequestItemsObject) => {
*/
const clickDeleteRow = async () => {
if (rawItem.value != null) {
loaderPage(true);
showLoader();
await http
.delete(config.API.candidateAdminCareer(rawItem.value.id))
.then(() => {
@ -451,7 +459,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.candidateAdminCareer(candidateId.value), {
name: location.value,
@ -476,7 +484,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateAdminCareer(id.value), {
name: location.value,

View file

@ -168,7 +168,7 @@ const name = ref<string>("");
const files = ref<UploadType[]>([]);
const file = ref<File[]>([]);
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
onMounted(async () => {
await getData();
@ -180,7 +180,7 @@ const fileAdd = async (val: any) => {
};
const getData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateUpload(candidateId.value))
.then((res) => {
@ -191,7 +191,7 @@ const getData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -199,7 +199,7 @@ const deleteData = async (id: string) => {
const params = {
documentId: id,
};
loaderPage(true);
showLoader();
await http
.delete(config.API.candidateUpload(candidateId.value), {
params,
@ -211,7 +211,7 @@ const deleteData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
await getData();
});
};
@ -223,7 +223,7 @@ const uploadData = async () => {
});
const formData = new FormData();
formData.append("", newFile);
loaderPage(true);
showLoader();
await http
.put(config.API.candidateUpload(candidateId.value), formData)
.then((res) => {
@ -233,7 +233,7 @@ const uploadData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
name.value = "";
uploader.value.reset();
await getData();

View file

@ -240,7 +240,7 @@ const rows = ref<RequestItemsObject[]>([]);
const route = useRoute();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const candidateId = ref<string>(route.params.candidateId.toString());
const filter = ref<string>(""); //search data table
@ -324,7 +324,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateEducation(candidateId.value))
.then((res) => {
@ -343,12 +343,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetcheducationLevel = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.educationLevel)
.then((res) => {
@ -363,7 +363,7 @@ const fetcheducationLevel = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -444,7 +444,7 @@ const checkDelete = (row: RequestItemsObject) => {
*/
const clickDeleteRow = async () => {
if (rawItem.value != null) {
loaderPage(true);
showLoader();
await http
.delete(config.API.candidateAdminEducation(rawItem.value.id))
.then(() => {
@ -480,7 +480,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.candidateAdminEducation(candidateId.value), {
educationLevelId: educationLevelId.value,
@ -505,7 +505,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateAdminEducation(id.value), {
educationLevelId: educationLevelId.value,

View file

@ -113,7 +113,7 @@ const props = defineProps({
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { messageError, date2Thai } = mixin;
const { messageError, date2Thai, showLoader, hideLoader } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const fullName = ref<string>("");
@ -136,7 +136,7 @@ onMounted(async () => {
});
const fetchCard = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateCard(props.candidateId))
.then((res) => {
@ -178,7 +178,7 @@ const fetchCard = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
</script>

View file

@ -302,7 +302,7 @@ const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(true);
const myform = ref<any>({});
const route = useRoute();
@ -323,7 +323,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateFamily(candidateId.value))
.then((res) => {
@ -350,7 +350,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -430,7 +430,8 @@ const props = defineProps({
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, calAge, modalError, success } = mixin;
const { date2Thai, calAge, modalError, success, showLoader, hideLoader } =
mixin;
const districtOptions = ref<DataOption[]>([]);
const route = useRoute();
const candidateId = ref<string>(route.params.candidateId.toString());
@ -463,7 +464,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateInformation(candidateId.value))
.then((res) => {
@ -494,12 +495,12 @@ const fetchData = async () => {
keycloak.tokenParsed == null ? "" : keycloak.tokenParsed.family_name;
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchImgData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateProfile(candidateId.value))
.then((res) => {
@ -510,7 +511,7 @@ const fetchImgData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -542,7 +543,7 @@ const selectProvince = (val: string) => {
};
const fetchDistrict = async (id: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -557,7 +558,7 @@ const fetchDistrict = async (id: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -283,7 +283,7 @@ const candidateId = ref<string>(route.params.candidateId.toString());
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const emit = defineEmits(["update:form"]);
@ -300,7 +300,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateOccupation(candidateId.value))
.then((res) => {
@ -327,7 +327,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -21,7 +21,11 @@
<q-separator class="q-my-lg bg-gray" size="5px" />
<div class="q-px-sm">
<Family :prefixOptions="prefixOptions" :status="status" v-model:form="formFamily" />
<Family
:prefixOptions="prefixOptions"
:status="status"
v-model:form="formFamily"
/>
</div>
<q-separator class="q-my-lg bg-gray" size="5px" />
@ -94,7 +98,7 @@ const formAddress = ref<any>({});
const formFamily = ref<any>({});
const formOccupation = ref<any>({});
const mixin = useCounterMixin();
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const emit = defineEmits([
"update:formInformation",
@ -120,14 +124,14 @@ watch(formOccupation, async (count: Object, prevCount: Object) => {
});
onMounted(() => {
loaderPage(false);
hideLoader();
fetchPrefix();
fetchRelationship();
fetchProvince();
});
const fetchPrefix = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.prefix)
.then((res) => {
@ -142,12 +146,12 @@ const fetchPrefix = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchRelationship = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.relationship)
.then((res) => {
@ -162,12 +166,12 @@ const fetchRelationship = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchProvince = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.province)
.then((res) => {
@ -182,7 +186,7 @@ const fetchProvince = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
</script>

View file

@ -155,7 +155,7 @@ const table = ref<any>(null);
const files = ref<File[]>([]);
const filterRef = ref<any>(null);
const examId = ref<string>(route.params.examId.toString());
const { messageError } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
const props = defineProps({
inputfilter: String,
inputvisible: Array,
@ -278,7 +278,7 @@ const uploadFile = async () => {
};
const uploadDataSeat = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("", files.value[0]);
await http
@ -290,14 +290,14 @@ const uploadDataSeat = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
files.value = [];
props.fetchData();
});
};
const uploadDataPoint = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("", files.value[0]);
await http
@ -310,14 +310,14 @@ const uploadDataPoint = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
files.value = [];
props.fetchData();
});
};
const downloadFile = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamDownload(examId.value), {
responseType: "blob",
@ -330,12 +330,12 @@ const downloadFile = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const downloadFileDetail = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamDownloadDetail(examId.value), {
responseType: "blob",
@ -348,7 +348,7 @@ const downloadFileDetail = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};