fix Bug registry-temp

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-04-29 10:44:44 +07:00
parent dae8c1b70e
commit 862cad07be
2 changed files with 25 additions and 18 deletions

View file

@ -45,6 +45,7 @@ const emit = defineEmits(["update:modal"]);
/** ตัวแปร*/
const modal = ref<boolean>(false);
const employeeClass = ref<string>("");
const avatar = reactive<Avatar>({
avatar: "",
fullname: "",
@ -124,6 +125,7 @@ async function fetchInformation(id: string) {
imformation.birthDate = data.birthDate ? date2Thai(data.birthDate) : "-";
imformation.age = data.birthDate ? calculateAge(data.birthDate) : "-";
imformation.gender = data.gender ?? "-";
employeeClass.value = data.employeeClass ?? "officer";
avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`;
@ -191,7 +193,11 @@ async function fetchProfileGov(id: string) {
function redirecToRegistry() {
router.push(
`/registry-${
props.type.toLocaleLowerCase() == "employee" ? "employee" : "officer"
employeeClass.value.toLocaleLowerCase() === "perm"
? "employee"
: employeeClass.value.toLocaleLowerCase() === "temp"
? "temp"
: "officer"
}/${props.id}`
);
modal.value = false;