Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-14 17:11:46 +07:00
commit 1e40c4dbc0

View file

@ -14,6 +14,7 @@ import type { ResponseItems } from "@/modules/06_retirement/interface/response/e
import DialogFooter from "@/modules/05_placement/components/PersonalList/DialogFooter.vue";
import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue";
import { identity } from "@fullcalendar/core/internal";
import { tabList } from "@/interface/request/main/main";
const $q = useQuasar(); // noti quasar
const router = useRouter();
@ -138,6 +139,7 @@ const columns = ref<QTableProps["columns"]>([
const visibleColumns = ref<string[]>([]);
const dateBreak = ref<Date | null>(null);
const daterow = ref<string | null>("");
const id = ref<string>("");
const filters = ref<ResponseItems[]>([]);
const rows2 = ref<ResponseItems[]>([]);
@ -177,6 +179,7 @@ const openModalCalendar = (rows: any) => {
openModal();
dateBreak.value = null;
id.value = rows.id;
daterow.value = convertThaiDateToNumeric(rows.datetext);
};
const openModalOrder = () => {
@ -256,6 +259,38 @@ const saveAppoint = async () => {
}
});
};
const validationDate = (thaiDate: string | null) => {
if (thaiDate && daterow.value) {
let a = convertThaiDateToNumeric(thaiDate);
let b = daterow.value;
if (a) {
return a > b;
}
}
};
const convertThaiDateToNumeric = (thaiDate: string) => {
const parts = thaiDate.split(" ");
if (parts.length !== 3) return null;
const [day, month, year] = parts;
const monthMap: any = {
"ม.ค.": "01",
"ก.พ.": "02",
"มี.ค.": "03",
"เม.ย.": "04",
"พ.ค.": "05",
"มิ.ย.": "06",
"ก.ค.": "07",
"ส.ค.": "08",
"ก.ย.": "09",
"ต.ค.": "10",
"พ.ย.": "11",
"ธ.ค.": "12",
};
if (!(month in monthMap)) return null;
const numericDate = `${year}${monthMap[month]}${day}`;
return numericDate;
};
// const saveOrder = async () => {
// const id = selected.value.map((r) => r.id);
// const body = {
@ -617,8 +652,14 @@ const saveAppoint = async () => {
"
hide-bottom-space
:label="`${' วันนัดหมายเพื่อทําการสัมภาษณ์การลาออก'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
:rules="[
(val) => !!val || `${'กรุณาเลือกลงวันที่'}`,
(val) =>
validationDate(val) ||
`${'วันที่นัดหมายต้องมากกว่าวันที่สร้าง'}`,
]"
>
<!-- :rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]" -->
<template v-slot:prepend>
<q-icon
name="event"