diff --git a/src/api/recruiting/api.period-exam.ts b/src/api/recruiting/api.period-exam.ts index d3676b4aa..91d8dcb72 100644 --- a/src/api/recruiting/api.period-exam.ts +++ b/src/api/recruiting/api.period-exam.ts @@ -57,6 +57,7 @@ export default { candidateUpload: (candidateId: string) => `${candidate}upload/${candidateId}`, candidateCheckRegister: (candidateId: string) => `${candidate}check-register/${candidateId}`, + candidateCheckRegisters: `${candidate}check-registers`, candidateRejectRegister: (candidateId: string) => `${candidate}reject-register/${candidateId}`, candidateCheckPayment: (candidateId: string) => diff --git a/src/modules/03_recruiting/components/Career.vue b/src/modules/03_recruiting/components/Career.vue index acf368048..5b0cc515f 100644 --- a/src/modules/03_recruiting/components/Career.vue +++ b/src/modules/03_recruiting/components/Career.vue @@ -221,7 +221,6 @@ :borderless="!false" v-model="rangeDate" :label="`${'ระยะเวลา'}`" - @update:modelValue="clickEditRow" hide-bottom-space /> @@ -396,10 +395,54 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => { await changeExamColumns("career", count); }); +watch(startDate, async (count: Date, prevCount: Date) => { + await calDate(); +}); + +watch(endDate, async (count: Date, prevCount: Date) => { + await calDate(); +}); + onMounted(async () => { await fetchData(); }); +const calDate = async () => { + let _startDate = new Date(startDate.value.toISOString().substr(0, 10)); + let _endDate = new Date(endDate.value.toISOString().substr(0, 10)); + if (_startDate > _endDate) { + const swap = _startDate; + _startDate = _endDate; + _endDate = swap; + } + const startYear = _startDate.getFullYear(); + const february = + (startYear % 4 === 0 && startYear % 100 !== 0) || startYear % 400 === 0 + ? 29 + : 28; + const daysInMonth = [31, february, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + + let yearDiff = _endDate.getFullYear() - startYear; + let monthDiff = _endDate.getMonth() - _startDate.getMonth(); + if (monthDiff < 0) { + yearDiff--; + monthDiff += 12; + } + let dayDiff = _endDate.getDate() - _startDate.getDate(); + if (dayDiff < 0) { + if (monthDiff > 0) { + monthDiff--; + } else { + yearDiff--; + monthDiff = 11; + } + dayDiff += daysInMonth[_startDate.getMonth()]; + } + rangeDate.value = `${yearDiff > 0 ? yearDiff + " ปี " : ""}${ + monthDiff > 0 ? monthDiff + " เดือน " : "" + }${dayDiff > 0 ? dayDiff + " วัน " : ""}`; +}; + const fetchData = async () => { showLoader(); await http @@ -410,8 +453,8 @@ const fetchData = async () => { data.map((r: any) => { rows.value.push({ ...r, - startDate: r.durationStart, - endDate: r.durationEnd, + startDate: new Date(r.durationStart), + endDate: new Date(r.durationEnd), }); }); }) diff --git a/src/modules/03_recruiting/components/Occupation.vue b/src/modules/03_recruiting/components/Occupation.vue index a80a6788a..2e99c977d 100644 --- a/src/modules/03_recruiting/components/Occupation.vue +++ b/src/modules/03_recruiting/components/Occupation.vue @@ -9,8 +9,8 @@ :editData="false" /> -
-
+
+
-
-
+
+
-
+
-
-
-
+ +
-
+
-
+
-
+
บรรจุผู้ผ่านการคัดเลือก + + ตรวจสอบข้อมูล +
@@ -166,6 +179,7 @@ const table = ref(null); const files = ref([]); const filterRef = ref(null); const examId = ref(route.params.examId.toString()); +const candidateId = ref([]); const { messageError, showLoader, hideLoader } = mixin; const props = defineProps({ inputfilter: String, @@ -391,6 +405,24 @@ const downloadFileDetail = async () => { }); }; +const checkCandidates = async () => { + showLoader(); + await http + .post(config.API.candidateCheckRegisters, { + candidateId: candidateId.value, + }) + .then((res) => { + success($q, "ตรวจสอบข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + props.fetchData(); + }); +}; + const downloadFilePDF = async (res: string, fileName: string) => { const link = document.createElement("a"); link.href = window.URL.createObjectURL( @@ -426,6 +458,27 @@ const publishModal = () => { } }; +const candidateCheckProfileDialog = async () => { + dialogMessage( + $q, + "ยืนยันการตรวจสอบข้อมูลนี้หรือไม่?", + "ยืนยันการตรวจสอบข้อมูล", + "mdi-email-check-outline", + "ยืนยัน", + "public", + candidateCheckProfile, + undefined + ); +}; + +const candidateCheckProfile = async () => { + const filter = attrs.value.rows.filter((r: any) => r.check == true); + filter.map((r: any) => { + candidateId.value.push(r.id.toString()); + }); + await checkCandidates(); +}; + const resetFilter = () => { // reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา emit("update:inputfilter", ""); diff --git a/src/modules/03_recruiting/views/02_qualify/manageDetail.vue b/src/modules/03_recruiting/views/02_qualify/manageDetail.vue index 69ca7f4a6..aee96c268 100644 --- a/src/modules/03_recruiting/views/02_qualify/manageDetail.vue +++ b/src/modules/03_recruiting/views/02_qualify/manageDetail.vue @@ -167,6 +167,9 @@ >