|
|
@@ -35,7 +35,6 @@
|
|
|
outlined
|
|
|
label="Função"
|
|
|
:rules="[inputRules.required]"
|
|
|
- :type="editUserTypeValue"
|
|
|
:disable="!canChangeUserType"
|
|
|
:exclude-types="['ADMIN']"
|
|
|
/>
|
|
|
@@ -118,7 +117,6 @@ const { user } = storeToRefs(userStore());
|
|
|
const formRef = ref(null);
|
|
|
const avatarRef = ref(null);
|
|
|
const avatarFile = ref(null);
|
|
|
-const editUserTypeValue = ref(null);
|
|
|
const originalUserType = ref(null);
|
|
|
|
|
|
const isEdit = computed(() => !!route.params.id);
|
|
|
@@ -147,8 +145,8 @@ onMounted(async () => {
|
|
|
form.value.email = data.email;
|
|
|
form.value.cpf = data.cpf;
|
|
|
form.value.phone = data.phone;
|
|
|
- editUserTypeValue.value = data.user_type?.value ?? data.user_type;
|
|
|
- originalUserType.value = editUserTypeValue.value;
|
|
|
+ form.value.user_type = data.user_type;
|
|
|
+ originalUserType.value = data.user_type;
|
|
|
if (data.avatar_url) avatarRef.value?.setImageUrl(data.avatar_url);
|
|
|
} catch (error) {
|
|
|
console.error("Failed to load user:", error);
|
|
|
@@ -161,7 +159,7 @@ function buildPayload() {
|
|
|
if (avatarFile.value) fd.append("avatar", avatarFile.value);
|
|
|
|
|
|
if (user.value?.unit_id) fd.append("unit_id", user.value.unit_id);
|
|
|
- if (form.value.user_type?.value) fd.append("user_type", form.value.user_type.value);
|
|
|
+ if (form.value.user_type) fd.append("user_type", form.value.user_type);
|
|
|
if (form.value.cpf) fd.append("cpf", form.value.cpf);
|
|
|
if (form.value.phone) fd.append("phone", form.value.phone);
|
|
|
if (form.value.name) fd.append("name", form.value.name);
|
|
|
@@ -172,7 +170,7 @@ function buildPayload() {
|
|
|
}
|
|
|
|
|
|
async function onSave() {
|
|
|
- if (isEditingSelf.value && form.value.user_type?.value !== originalUserType.value) {
|
|
|
+ if (isEditingSelf.value && form.value.user_type !== originalUserType.value) {
|
|
|
$q.notify({
|
|
|
type: "warning",
|
|
|
message: "Não é possível alterar o seu próprio tipo de usuário. Entre em contato com o suporte.",
|