ผูก API ลงเวลากรณีพิเศษ
This commit is contained in:
parent
22688d40d0
commit
8cecc1e596
7 changed files with 296 additions and 98 deletions
|
|
@ -306,6 +306,7 @@ watch(
|
|||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="dataStore.visibleColumnsHistory"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
|
|
|
|||
|
|
@ -8,11 +8,20 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const SpecialTimeStore = useSpecialTimeStore();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, date2Thai } = mixin;
|
||||
const {
|
||||
dialogConfirm,
|
||||
date2Thai,
|
||||
showLoader,
|
||||
success,
|
||||
messageError,
|
||||
hideLoader,
|
||||
} = mixin;
|
||||
const currentDate = ref<Date | null>(new Date());
|
||||
const checkInRef = ref<Object | null>(null);
|
||||
const checkOutRef = ref<Object | null>(null);
|
||||
|
|
@ -51,25 +60,54 @@ function validateForm() {
|
|||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
props.closeDialog?.();
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
modal: { type: Boolean, default: "" },
|
||||
editCheck: { type: String, default: "" },
|
||||
date: { type: String, default: "" },
|
||||
dateFix: { type: String, default: "" },
|
||||
id: { type: String, default: "" },
|
||||
closeDialog: { type: Function, default: () => {} },
|
||||
detailData: Object,
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
props.closeDialog?.();
|
||||
await approveData();
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
console.log(props.dateFix);
|
||||
console.log(props.id);
|
||||
}
|
||||
|
||||
const approveData = async () => {
|
||||
showLoader();
|
||||
const body = {
|
||||
checkInTime: formData.checkIn,
|
||||
checkOutTime: formData.checkOut,
|
||||
checkInStatus: SpecialTimeStore.checkInStatus,
|
||||
checkOutStatus: SpecialTimeStore.checkOutStatus,
|
||||
reason: formData.note,
|
||||
};
|
||||
await http
|
||||
.put(config.API.specialTimeApprove(props.id), body)
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
function close() {
|
||||
if (props.closeDialog) {
|
||||
props.closeDialog();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue