From 86ab1613022d828df6c410c057da50c0bc9d4de5 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 26 Jul 2024 12:37:53 +0200 Subject: [PATCH 1/3] fix: refs #6769 Fixes item diary --- src/components/RegularizeStockForm.vue | 7 +++--- src/css/app.scss | 23 ----------------- src/pages/Item/Card/ItemDiary.vue | 34 ++++++++++++++++++++------ 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/components/RegularizeStockForm.vue b/src/components/RegularizeStockForm.vue index 4f97033b3..4c23bd660 100644 --- a/src/components/RegularizeStockForm.vue +++ b/src/components/RegularizeStockForm.vue @@ -15,7 +15,7 @@ const props = defineProps({ default: null, }, warehouseFk: { - type: Boolean, + type: Number, default: null, }, }); @@ -23,7 +23,7 @@ const props = defineProps({ const { t } = useI18n(); const regularizeFormData = reactive({ - itemFk: props.itemFk, + itemFk: Number(props.itemFk), warehouseFk: props.warehouseFk, quantity: null, }); @@ -53,6 +53,7 @@ const onDataSaved = (data) => { @@ -60,7 +61,7 @@ const onDataSaved = (data) => {
-import { onMounted, computed, onUnmounted, reactive, ref } from 'vue'; +import { onMounted, computed, onUnmounted, reactive, ref, nextTick } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; @@ -113,18 +113,36 @@ const getBadgeAttrs = (_date) => { return attrs; }; +const scrollToToday = async () => { + await nextTick(); + const today = new Date(); + today.setHours(0, 0, 0, 0); + const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`); + if (todayCell) { + todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' }); + } +}; + +const formatDateForAttribute = (dateValue) => { + if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD'); + return dateValue; +}; + const originTypeMap = { entry: { descriptor: EntryDescriptorProxy, icon: 'vn:entry', + color: 'green', }, ticket: { descriptor: TicketDescriptorProxy, icon: 'vn:ticket', + color: 'red', }, order: { descriptor: OrderDescriptorProxy, icon: 'vn:basket', + color: 'yellow', }, }; @@ -143,6 +161,7 @@ onMounted(async () => { else if (user.value) warehouseFk.value = user.value.warehouseFk; itemsBalanceFilter.where.warehouseFk = warehouseFk.value; await fetchItemBalances(); + await scrollToToday(); }); onUnmounted(() => (stateStore.rightDrawer = false)); @@ -215,7 +234,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));