-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor/admin single user view (#314)
* feat(dashboard/admin/single-user-view): Added new user details form card * feat: I don't know what I added, but I need to work on other things * refactor(dashboard/admin-single-user-view): remove old user edit card and dependencies * bug-introduce(dashboard/admin-single-user-view): bug where v-if in inputspan breaks the page * fix(dashboard/admin-single-user-view): fixed a v-if breaking the entire page * feat(dashboard/admin-single-user-view): form now auto fills user info * feat(dashboard/admin-single-user-view): fixed up styling of single user view * refactor(dashboard/components): removed change info component * feat(dashboard/admin-single-user-view): redid a little styling of the User info card and the balance card * fix(dashboard/admin-single-user-view): type check errors * feat(dashboard/admin-single-user-view): added proper placeholders to forms * refactor(dashboard/user-edit-form): small code improvements * fix(dashboard/user-edit-form): nickname cannot be null error, even though it is allowed * fix(dashboard/admin-single-user-view): fixed some type-check issues
- Loading branch information
1 parent
7102efd
commit cc2d7b5
Showing
19 changed files
with
249 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
apps/dashboard/src/modules/admin/components/users/AdminUserInfoCard.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<template> | ||
<FormCard :header="t('userDetails.userInformation')" | ||
@update:modelValue="edit = $event" | ||
@save="formSubmit" | ||
:enableEdit="true" | ||
> | ||
<div class="flex flex-column justify-content-between gap-2"> | ||
<UserEditForm :user="props.user" :form="form" :edit="edit" @update:edit="edit = $event"/> | ||
</div> | ||
</FormCard> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import FormCard from "@/components/FormCard.vue"; | ||
import { onMounted, type PropType, ref, watch } from "vue"; | ||
import type { UserResponse } from "@sudosos/sudosos-client"; | ||
import { schemaToForm } from "@/utils/formUtils"; | ||
import { updateUserDetailsObject, userTypes } from "@/utils/validation-schema"; | ||
import UserEditForm from "@/modules/admin/components/users/forms/UserEditForm.vue"; | ||
import { useI18n } from "vue-i18n"; | ||
const { t } = useI18n(); | ||
const props = defineProps({ | ||
user: { | ||
type: Object as PropType<UserResponse>, | ||
required: true | ||
} | ||
}); | ||
const edit = ref(false); | ||
const form = schemaToForm(updateUserDetailsObject); | ||
const formSubmit = () => { | ||
form.submit(); | ||
}; | ||
const updateFieldValues = (p: UserResponse) => { | ||
if (!p) return; | ||
const values = { | ||
...p, | ||
userType: userTypes.value.find(ut => ut.name === p.type)?.value || undefined, | ||
isActive: p.active, | ||
}; | ||
form.context.resetForm({ values }); | ||
}; | ||
watch(() => props.user, (newValue: UserResponse) => { | ||
updateFieldValues(newValue); | ||
}); | ||
onMounted(() => { | ||
if (props.user) { | ||
updateFieldValues(props.user); | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
Oops, something went wrong.