api ถึงแก่กรรม

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-08 16:50:50 +07:00
parent 04f79de4c1
commit c51f66c808
6 changed files with 416 additions and 92 deletions

View file

@ -472,12 +472,28 @@
<q-space />
</q-card-section>
<q-separator />
<DialogFooter
<div class="flex justify-end q-pa-sm q-gutter-sm">
<q-btn
unelevated
label="บันทึก"
color="public"
@click="clickSaveDeceased"
:disable="
filePassaway === null ||
deathCertificateNo === '' ||
placeDeathCertificate === '' ||
reasonDeath === ''
"
>
<q-tooltip>นท</q-tooltip>
</q-btn>
</div>
<!-- <DialogFooter
:save="clickSave"
:validate="validateData"
v-model:editvisible="edit"
v-model:modalEdit="modalEdit"
/>
/> -->
</q-form>
</q-card>
</div>
@ -704,7 +720,7 @@ const dialogPassaway = ref<boolean>(false);
const loader = ref<boolean>(false); //
const statusEdit = ref<boolean>(false);
const activeImage = ref<any | null>(null);
const filePassaway = ref(null);
const filePassaway = ref<any>(null);
const images = ref<any>([]);
const checkValidate = ref<boolean>(false); //validate data
const myForm = ref<QForm | null>(null); //form data input
@ -1188,6 +1204,50 @@ const Retire = async () => {
});
}
};
const clickSaveDeceased = async () => {
// console.log(
// filePassaway.value,
// deathCertificateNo.value,
// placeDeathCertificate.value,
// reasonDeath.value
// );
const formData = new FormData();
formData.append("File", filePassaway.value);
formData.append("Number", deathCertificateNo.value);
formData.append("Date", dateToISO(dateDeath.value));
formData.append("Location", placeDeathCertificate.value);
formData.append("Reason", reasonDeath.value);
formData.append("ProfileId", profileId.value);
$q.dialog({
title: "ยืนยันการบันทึกข้อมูล",
message: "ต้องการบันทึกข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
showLoader();
await http
.post(config.API.listDeceased(), formData)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
router.push("/deceased");
})
.catch((e) => {
console.log(e);
messageError($q, e);
})
.finally(()=>{
hideLoader();
})
})
.onCancel(() => {})
.onDismiss(() => {});
};
</script>
<style>
.image-size-default {