fix:send_Date
This commit is contained in:
parent
e61f97faaf
commit
82eac261f4
2 changed files with 109 additions and 45 deletions
|
|
@ -24,6 +24,7 @@ const {
|
|||
dateToISO,
|
||||
pathRegistryEmp,
|
||||
success,
|
||||
dialogConfirm,
|
||||
} = useCounterMixin();
|
||||
|
||||
//props
|
||||
|
|
@ -64,32 +65,34 @@ const reasonOp = ref<DataOption[]>([
|
|||
},
|
||||
]);
|
||||
|
||||
async function onSubmit() {
|
||||
try {
|
||||
showLoader();
|
||||
const formData = new FormData();
|
||||
formData.append("ProfileId", profileId.value);
|
||||
formData.append("Location", form.location);
|
||||
formData.append(
|
||||
"ActiveDate",
|
||||
form.activeDate !== null ? dateToISO(form.activeDate) : ""
|
||||
);
|
||||
formData.append("Reason", form.reason);
|
||||
if (form.files) {
|
||||
formData.append("file", form.files);
|
||||
}
|
||||
if (form.reason === "OTHER") {
|
||||
formData.append("remark", form.remark);
|
||||
}
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
try {
|
||||
showLoader();
|
||||
const formData = new FormData();
|
||||
formData.append("ProfileId", profileId.value);
|
||||
formData.append("Location", form.location);
|
||||
formData.append(
|
||||
"ActiveDate",
|
||||
form.activeDate !== null ? dateToISO(form.activeDate) : ""
|
||||
);
|
||||
formData.append("Reason", form.reason);
|
||||
if (form.files) {
|
||||
formData.append("file", form.files);
|
||||
}
|
||||
if (form.reason === "OTHER") {
|
||||
formData.append("remark", form.remark);
|
||||
}
|
||||
|
||||
await http.post(config.API.resignAdmin(empType.value), formData);
|
||||
router.push({ name: isEmployee.value ? "resignEmployee" : "resign" });
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
await http.post(config.API.resignAdmin(empType.value), formData);
|
||||
router.push({ name: isEmployee.value ? "resignEmployee" : "resign" });
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** function ปิด popup*/
|
||||
|
|
|
|||
|
|
@ -15,7 +15,15 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
|||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { showLoader, hideLoader, messageError, success } = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
date2Thai,
|
||||
convertDateToAPI,
|
||||
dialogConfirm,
|
||||
} = useCounterMixin();
|
||||
|
||||
//props
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
|
|
@ -26,27 +34,34 @@ const form = reactive({
|
|||
tranferOrg: "",
|
||||
noteReason: "",
|
||||
files: null as File | null,
|
||||
date: null as Date | null,
|
||||
});
|
||||
|
||||
async function onSubmit() {
|
||||
try {
|
||||
showLoader();
|
||||
const formData = new FormData();
|
||||
formData.append("ProfileId", profileId.value);
|
||||
formData.append("Organization", form.tranferOrg);
|
||||
formData.append("Reason", form.noteReason);
|
||||
if (form.files) {
|
||||
formData.append("file", form.files);
|
||||
}
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
try {
|
||||
showLoader();
|
||||
const formData = new FormData();
|
||||
formData.append("ProfileId", profileId.value);
|
||||
formData.append("Organization", form.tranferOrg);
|
||||
formData.append("Reason", form.noteReason);
|
||||
formData.append(
|
||||
"Date",
|
||||
form.date !== null ? (convertDateToAPI(form.date) as string) : ""
|
||||
);
|
||||
if (form.files) {
|
||||
formData.append("file", form.files);
|
||||
}
|
||||
|
||||
await http.post(config.API.transferAdmin, formData);
|
||||
router.push({ name: "transfer" });
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
await http.post(config.API.transferAdmin, formData);
|
||||
router.push({ name: "transfer" });
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** function ปิด popup*/
|
||||
|
|
@ -55,6 +70,7 @@ function closeDialog() {
|
|||
form.tranferOrg = "";
|
||||
form.noteReason = "";
|
||||
form.files = null;
|
||||
form.date = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -67,7 +83,7 @@ function closeDialog() {
|
|||
|
||||
<q-card-section class="q-pa-md">
|
||||
<div class="col-12 row q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<div class="col-md-9 col-sm-12">
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
dense
|
||||
|
|
@ -79,6 +95,51 @@ function closeDialog() {
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-sm-12">
|
||||
<datepicker
|
||||
class="inputgreen"
|
||||
menu-class-name="modalfix"
|
||||
v-model="form.date"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
hide-bottom-space
|
||||
class="full-width"
|
||||
:model-value="
|
||||
form.date != null ? date2Thai(form.date) : null
|
||||
"
|
||||
:label="`${'ขอโอนตั้งแต่วันที่'}`"
|
||||
:rules="[
|
||||
(val: string) =>
|
||||
!!val || `${'กรุณาเลือกวันที่ขอโอน'}`,
|
||||
]"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue