Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development update user image #396

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions client/src/components/UpdateUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
<v-col cols="12">
<v-file-input v-model="image" label="Image" variant="filled" accept="image/*" :show-size="1024"
prepend-icon="mdi-camera" @input="chooseImage" density="comfortable"></v-file-input>
<v-img v-if="image && image.length > 0 && imageUrl" :src="imageUrl" width="200" height="200"
<v-img v-if="image && image.length > 0 && imageUrl" :src="imageUrl" width="200" height="200"
class="justify-center mb-5"></v-img>
<v-img v-else :src="imageSrc+ selectedUser?.image" width="200" height="200"
class="justify-center mb-5"></v-img>
<v-row>
<v-col cols="3">
Expand Down Expand Up @@ -116,7 +118,6 @@ import {
listUsers
} from '@/utils'
import { useAsyncState } from '@vueuse/core'
import { ApiClientBase } from '@/clients/api/base'

export default {
name: 'UpdateUser',
Expand All @@ -139,6 +140,7 @@ export default {
const supervisors = ref<any[]>([])
const image = ref()
const imageUrl = ref()
const imageSrc = window.env.SERVER_DOMAIN_NAME_API.replace('api', '')
const selectedUser = ref()
const reporting_to = ref()
const userIsActive = ref<boolean>(selectedUser.value?.is_active)
Expand Down Expand Up @@ -251,7 +253,7 @@ export default {
selectedUser.value.user_type = selectedUser.value.user_type === "Team Lead" ? "Supervisor" : selectedUser.value.user_type
await $api.myprofile.update(selectedUser.value.id, {
...selectedUser.value,
image: imageUrl.value ? imageUrl.value : null,
image: imageUrl.value ? imageUrl.value : selectedUser.value.image,
location: selectedUser.value.location.id,
filename: image.value ? image.value[0].name : null,
reporting_to: reporting_to.value ? [reporting_to.value.id] : []
Expand All @@ -273,6 +275,7 @@ export default {
joiningDate,
image,
imageUrl,
imageSrc,
supervisors,
officeUsers,
selectedUser,
Expand Down