solve merge
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-06-18 14:12:24 +02:00
parent 746c8bd975
commit fbc2c892f3
1 changed files with 3 additions and 19 deletions

View File

@ -3,8 +3,7 @@ import { ref, onMounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import EditPictureForm from 'components/EditPictureForm.vue'; import EditPictureForm from 'components/EditPictureForm.vue';
import VnImg from 'src/components/ui/VnImg.vue';
import { useSession } from 'src/composables/useSession';
import axios from 'axios'; import axios from 'axios';
const $props = defineProps({ const $props = defineProps({
@ -27,19 +26,12 @@ const $props = defineProps({
}); });
const { t } = useI18n(); const { t } = useI18n();
const { getTokenMultimedia } = useSession();
const image = ref(null); const image = ref(null);
const editPhotoFormDialog = ref(null); const editPhotoFormDialog = ref(null);
const showEditPhotoForm = ref(false); const showEditPhotoForm = ref(false);
const warehouseName = ref(null); const warehouseName = ref(null);
const getItemAvatar = async () => {
const token = getTokenMultimedia();
const timeStamp = `timestamp=${Date.now()}`;
image.value = `/api/Images/catalog/200x200/${$props.entityId}/download?access_token=${token}&${timeStamp}`;
};
const toggleEditPictureForm = () => { const toggleEditPictureForm = () => {
showEditPhotoForm.value = !showEditPhotoForm.value; showEditPhotoForm.value = !showEditPhotoForm.value;
}; };
@ -62,28 +54,20 @@ const getWarehouseName = async (warehouseFk) => {
}; };
onMounted(async () => { onMounted(async () => {
getItemAvatar();
getItemConfigs(); getItemConfigs();
image.value.store.$subscribe((x, v) => { image.value.store.$subscribe((x, v) => {
handlePhotoUpdated(x.events.effect.newValue); handlePhotoUpdated(x.events.effect.newValue);
}); });
}); });
<<<<<<< Updated upstream
=======
const handlePhotoUpdated = (url = null) => { const handlePhotoUpdated = (url = null) => {
image.value.reload(url); image.value.reload(url);
}; };
>>>>>>> Stashed changes
</script> </script>
<template> <template>
<div class="relative-position"> <div class="relative-position">
<<<<<<< Updated upstream
<QImg :src="image" spinner-color="primary" style="min-height: 256px">
=======
<VnImg ref="image" :id="$props.entityId"> <VnImg ref="image" :id="$props.entityId">
>>>>>>> Stashed changes
<template #error> <template #error>
<div class="absolute-full picture text-center q-pa-md flex flex-center"> <div class="absolute-full picture text-center q-pa-md flex flex-center">
<div> <div>
@ -96,7 +80,7 @@ const handlePhotoUpdated = (url = null) => {
</div> </div>
</div> </div>
</template> </template>
</QImg> </VnImg>
<QBtn <QBtn
v-if="showEditButton" v-if="showEditButton"
color="primary" color="primary"
@ -111,7 +95,7 @@ const handlePhotoUpdated = (url = null) => {
collection="catalog" collection="catalog"
:id="entityId" :id="entityId"
@close-form="toggleEditPictureForm()" @close-form="toggleEditPictureForm()"
@on-photo-uploaded="getItemAvatar()" @on-photo-uploaded="handlePhotoUpdated"
/> />
</QDialog> </QDialog>
</QBtn> </QBtn>