0
0
Fork 0

fix: refs #6769 Fixes item diary

This commit is contained in:
Guillermo Bonet 2024-07-26 12:37:53 +02:00
parent 21b642a7c5
commit 86ab161302
3 changed files with 31 additions and 33 deletions

View File

@ -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) => {
<QInput
:label="t('Type the visible quantity')"
v-model.number="data.quantity"
type="number"
autofocus
/>
</VnRow>
@ -60,7 +61,7 @@ const onDataSaved = (data) => {
<div class="col">
<VnSelect
:label="t('Warehouse')"
v-model="data.warehouseFk"
v-model.number="data.warehouseFk"
:options="warehousesOptions"
option-value="id"
option-label="name"

View File

@ -209,29 +209,6 @@ input::-webkit-inner-spin-button {
max-width: 100%;
}
/* ===== Scrollbar CSS ===== /
/ Firefox */
* {
scrollbar-width: auto;
scrollbar-color: var(--vn-label-color) transparent;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
*::-webkit-scrollbar-thumb {
background-color: var(--vn-label-color);
border-radius: 10px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
.q-table {
thead,
tbody {

View File

@ -1,5 +1,5 @@
<script setup>
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));
</QTd>
</template>
<template #body-cell-date="{ row }">
<QTd @click.stop>
<QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
<QBadge
v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none"
@ -237,12 +256,13 @@ onUnmounted(() => (stateStore.rightDrawer = false));
>
{{ row.originId }}
</component>
<span class="link">
<QIcon
:name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm"
size="xs"
size="sm"
:color="originTypeMap[row.originType]?.color"
/>
<span class="link">
{{ row.originId }}
</span>
</QTd>