Merge pull request 'refactor: refs #8697 simplify date handling in ItemDiary component' (!1532) from 8697-fixScrollToView into test
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1532
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Pablo Natek 2025-03-03 11:49:45 +00:00
commit f189a9912c
1 changed files with 5 additions and 10 deletions

View File

@ -158,15 +158,10 @@ const getBadgeAttrs = (_date) => {
const scrollToToday = async () => { const scrollToToday = async () => {
await nextTick(); await nextTick();
const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`); const todayCell = document.querySelector(
if (todayCell) { `td[data-date="${date.formatDate(today, 'YYYY-MM-DD')}"]`,
todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' }); );
} if (todayCell) todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
};
const formatDateForAttribute = (dateValue) => {
if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD');
return dateValue;
}; };
async function updateWarehouse(warehouseFk) { async function updateWarehouse(warehouseFk) {
@ -242,7 +237,7 @@ async function updateWarehouse(warehouseFk) {
</QTd> </QTd>
</template> </template>
<template #body-cell-date="{ row }"> <template #body-cell-date="{ row }">
<QTd @click.stop :data-date="formatDateForAttribute(row.shipped)"> <QTd @click.stop :data-date="row?.shipped.substring(0, 10)">
<QBadge <QBadge
v-bind="getBadgeAttrs(row.shipped)" v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none" class="q-ma-none"