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