update phone /email
This commit is contained in:
parent
f12f64313a
commit
f61d1e9060
2 changed files with 56 additions and 24 deletions
|
|
@ -84,6 +84,8 @@ export default {
|
||||||
requestEdit: `${profileOrg}/edit/`,
|
requestEdit: `${profileOrg}/edit/`,
|
||||||
developmentUser: `${profileOrg}/development/user`,
|
developmentUser: `${profileOrg}/development/user`,
|
||||||
|
|
||||||
|
upDateNumber:`${profileOrg}/updatePhoneNumber/user`,
|
||||||
|
updateEmail:`${profileOrg}/updateEmail/user`,
|
||||||
/**
|
/**
|
||||||
* workflow
|
* workflow
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,14 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = useRegistryInFormationStore();
|
const store = useRegistryInFormationStore();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { showLoader, hideLoader, messageError, date2Thai, dialogConfirm } =
|
const {
|
||||||
mixin;
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
messageError,
|
||||||
|
date2Thai,
|
||||||
|
dialogConfirm,
|
||||||
|
success,
|
||||||
|
} = mixin;
|
||||||
|
|
||||||
const editPhone = ref<boolean>(false);
|
const editPhone = ref<boolean>(false);
|
||||||
const editEmail = ref<boolean>(false);
|
const editEmail = ref<boolean>(false);
|
||||||
|
|
@ -37,7 +43,7 @@ const formDataInformation = reactive<any>({
|
||||||
email: "",
|
email: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const emailVerify = ref<boolean | null>(null);
|
const emailVerify = ref<string>("");
|
||||||
const visibleColumnsHistory = ref<string[]>([
|
const visibleColumnsHistory = ref<string[]>([
|
||||||
"citizenId",
|
"citizenId",
|
||||||
"prefix",
|
"prefix",
|
||||||
|
|
@ -231,12 +237,12 @@ function onHistory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** get data */
|
/** get data */
|
||||||
function getData() {
|
async function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(config.API.dataUserInformation)
|
.get(config.API.dataUserInformation)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
formDataInformation.citizenId = data.citizenId;
|
formDataInformation.citizenId = data.citizenId;
|
||||||
formDataInformation.prefix = data.prefix;
|
formDataInformation.prefix = data.prefix;
|
||||||
formDataInformation.firstName = data.firstName;
|
formDataInformation.firstName = data.firstName;
|
||||||
|
|
@ -251,15 +257,16 @@ function getData() {
|
||||||
formDataInformation.bloodGroup = data.bloodGroup;
|
formDataInformation.bloodGroup = data.bloodGroup;
|
||||||
formDataInformation.phone = data.phone;
|
formDataInformation.phone = data.phone;
|
||||||
formDataInformation.email = data.email.split("@")[0];
|
formDataInformation.email = data.email.split("@")[0];
|
||||||
|
|
||||||
|
emailVerify.value = data.statusEmail;
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
|
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {});
|
||||||
setTimeout(() => {
|
|
||||||
hideLoader();
|
|
||||||
}, 2000);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** get history */
|
/** get history */
|
||||||
|
|
@ -306,18 +313,41 @@ function onSubmitEdit(type: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** บันทึกเบอร์โทร */
|
/** บันทึกเบอร์โทร */
|
||||||
function onSavePhone() {
|
async function onSavePhone() {
|
||||||
editPhone.value = false;
|
await http
|
||||||
|
.put(config.API.upDateNumber, {
|
||||||
|
phone: formDataInformation.phone,
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
await getData();
|
||||||
|
editPhone.value = false;
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** บันทึก email */
|
/** บันทึก email */
|
||||||
function onSaveEmail() {
|
async function onSaveEmail() {
|
||||||
emailVerify.value = false;
|
await http
|
||||||
editEmail.value = false;
|
.put(config.API.updateEmail, {
|
||||||
|
email: formDataInformation.email + `@bangkok.go.th`,
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
await getData();
|
||||||
|
editEmail.value = false;
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
getData();
|
await getData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -510,10 +540,7 @@ onMounted(() => {
|
||||||
>
|
>
|
||||||
</q-input>
|
</q-input>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-if="emailVerify == ''" class="self-center col-3">
|
||||||
v-if="emailVerify == null || emailVerify == true"
|
|
||||||
class="self-center col-3"
|
|
||||||
>
|
|
||||||
<div v-if="editEmail == false">
|
<div v-if="editEmail == false">
|
||||||
<q-btn
|
<q-btn
|
||||||
dense
|
dense
|
||||||
|
|
@ -549,7 +576,10 @@ onMounted(() => {
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="self-center col-3">
|
<div
|
||||||
|
v-else-if="emailVerify == 'NOT_VERIFIED'"
|
||||||
|
class="self-center col-3"
|
||||||
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
name="mdi-alert-box"
|
name="mdi-alert-box"
|
||||||
color="warning"
|
color="warning"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue