0
0
Fork 0

Merge branch 'dev' into feature/TicketFutureFilter

This commit is contained in:
Javier Segarra 2024-08-23 07:13:43 +00:00
commit 91e52432ea
3 changed files with 57 additions and 28 deletions

View File

@ -268,3 +268,10 @@ input::-webkit-inner-spin-button {
max-width: 400px; max-width: 400px;
} }
} }
.edit-photo-btn {
position: absolute;
right: 12px;
bottom: 12px;
z-index: 1;
cursor: pointer;
}

View File

@ -138,14 +138,6 @@ en:
</i18n> </i18n>
<style lang="scss" scoped> <style lang="scss" scoped>
.edit-photo-btn {
position: absolute;
right: 12px;
bottom: 12px;
z-index: 1;
cursor: pointer;
}
.separation-borders { .separation-borders {
border-left: 1px solid $white; border-left: 1px solid $white;
border-right: 1px solid $white; border-right: 1px solid $white;

View File

@ -10,6 +10,7 @@ import useCardDescription from 'src/composables/useCardDescription';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios'; import axios from 'axios';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import EditPictureForm from 'components/EditPictureForm.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -18,6 +19,7 @@ const $props = defineProps({
default: null, default: null,
}, },
}); });
const image = ref(null);
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -25,6 +27,10 @@ const state = useState();
const user = state.getUser(); const user = state.getUser();
const changePasswordFormDialog = ref(null); const changePasswordFormDialog = ref(null);
const cardDescriptorRef = ref(null); const cardDescriptorRef = ref(null);
const showEditPhotoForm = ref(false);
const toggleEditPictureForm = () => {
showEditPhotoForm.value = !showEditPhotoForm.value;
};
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
@ -99,7 +105,9 @@ const handleExcluded = async () => {
workerExcluded.value = !workerExcluded.value; workerExcluded.value = !workerExcluded.value;
}; };
const handlePhotoUpdated = (evt = false) => {
image.value.reload(evt);
};
const refetch = async () => await cardDescriptorRef.value.getData(); const refetch = async () => await cardDescriptorRef.value.getData();
</script> </script>
<template> <template>
@ -144,27 +152,49 @@ const refetch = async () => await cardDescriptorRef.value.getData();
</QItem> </QItem>
</template> </template>
<template #before> <template #before>
<VnImg <div class="relative-position">
:id="parseInt(entityId)" <VnImg
collection="user" ref="image"
resolution="520x520" :id="parseInt(entityId)"
class="photo" collection="user"
> resolution="520x520"
<template #error> class="photo"
<div >
class="absolute-full picture text-center q-pa-md flex flex-center" <template #error>
> <div
<div> class="absolute-full picture text-center q-pa-md flex flex-center"
<div class="text-grey-5" style="opacity: 0.4; font-size: 5vh"> >
<QIcon name="vn:claims" /> <div>
</div> <div
<div class="text-grey-5" style="opacity: 0.4"> class="text-grey-5"
{{ t('worker.imageNotFound') }} style="opacity: 0.4; font-size: 5vh"
>
<QIcon name="vn:claims" />
</div>
<div class="text-grey-5" style="opacity: 0.4">
{{ t('worker.imageNotFound') }}
</div>
</div> </div>
</div> </div>
</div> </template> </VnImg
</template> ><QBtn
</VnImg> color="primary"
size="lg"
round
class="edit-photo-btn"
@click="toggleEditPictureForm()"
>
<QIcon name="edit" size="sm" />
<QDialog ref="editPhotoFormDialog" v-model="showEditPhotoForm">
<EditPictureForm
collection="user"
:id="entityId"
@close-form="toggleEditPictureForm()"
@on-photo-uploaded="handlePhotoUpdated"
/>
</QDialog>
</QBtn>
</div>
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" /> <VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />