API แก้ไขสถานะการเข้า-ออกงาน
This commit is contained in:
parent
8c4cacd3e5
commit
53cbf74f52
4 changed files with 35 additions and 8 deletions
|
|
@ -12,7 +12,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, success } = mixin;
|
||||
const { dialogConfirm, success, showLoader, hideLoader, messageError } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
modal: {
|
||||
|
|
@ -27,6 +27,10 @@ const props = defineProps({
|
|||
type: Function,
|
||||
require: true,
|
||||
},
|
||||
fetchData: {
|
||||
type: Function,
|
||||
require: true,
|
||||
},
|
||||
});
|
||||
|
||||
const morningStatus = ref<string>("");
|
||||
|
|
@ -48,15 +52,26 @@ async function onClickSave() {
|
|||
afternoonStatusRef.value?.validate();
|
||||
if (!morningStatusRef.value.hasError && !afternoonStatusRef.value.hasError) {
|
||||
const body = {
|
||||
morningStatus: morningStatus.value,
|
||||
afternoonStatus: afternoonStatus.value,
|
||||
checkInStatus: morningStatus.value,
|
||||
checkOutStatus: afternoonStatus.value,
|
||||
reason: reason.value,
|
||||
};
|
||||
dialogConfirm($q, async () => {
|
||||
console.log(body);
|
||||
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
props.close?.();
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.leaveEditCheckin(props.detail?.id), body)
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
props.fetchData?.();
|
||||
props.close?.();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ onMounted(async () => {
|
|||
:maxPage="maxPage"
|
||||
@update:pagination="updatePaging"
|
||||
:tab="'time-record'"
|
||||
:fetchData="fetchListTimeRecord"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ const props = defineProps({
|
|||
type: String,
|
||||
require: true,
|
||||
},
|
||||
fetchData: {
|
||||
type: Function,
|
||||
require: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:pagination"]);
|
||||
|
|
@ -203,6 +207,11 @@ onMounted(() => {
|
|||
:close="closeDetail"
|
||||
/>
|
||||
|
||||
<DialogEdit :modal="modalEdit" :detail="dataDetail" :close="onClickEdit" />
|
||||
<DialogEdit
|
||||
:modal="modalEdit"
|
||||
:detail="dataDetail"
|
||||
:close="onClickEdit"
|
||||
:fetchData="props.fetchData"
|
||||
/>
|
||||
</template>
|
||||
<style scoped></style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue