0
0
Fork 0

Merge pull request 'fix: refs #6769 Fixes item diary' (!573) from 6769-itemDiaryFix into master

Reviewed-on: verdnatura/salix-front#573
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Guillermo Bonet 2024-07-26 11:18:47 +00:00
commit 36dd6fbe1e
4 changed files with 51 additions and 28 deletions

View File

@ -15,7 +15,7 @@ const props = defineProps({
default: null, default: null,
}, },
warehouseFk: { warehouseFk: {
type: Boolean, type: Number,
default: null, default: null,
}, },
}); });
@ -23,7 +23,7 @@ const props = defineProps({
const { t } = useI18n(); const { t } = useI18n();
const regularizeFormData = reactive({ const regularizeFormData = reactive({
itemFk: props.itemFk, itemFk: Number(props.itemFk),
warehouseFk: props.warehouseFk, warehouseFk: props.warehouseFk,
quantity: null, quantity: null,
}); });
@ -53,6 +53,7 @@ const onDataSaved = (data) => {
<QInput <QInput
:label="t('Type the visible quantity')" :label="t('Type the visible quantity')"
v-model.number="data.quantity" v-model.number="data.quantity"
type="number"
autofocus autofocus
/> />
</VnRow> </VnRow>
@ -60,7 +61,7 @@ const onDataSaved = (data) => {
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('Warehouse')" :label="t('Warehouse')"
v-model="data.warehouseFk" v-model.number="data.warehouseFk"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"

View File

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

View File

@ -1,5 +1,5 @@
<script setup> <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 { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -113,18 +113,36 @@ const getBadgeAttrs = (_date) => {
return attrs; return attrs;
}; };
const scrollToToday = async () => {
await nextTick();
const today = Date.vnNew();
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 = { const originTypeMap = {
entry: { entry: {
descriptor: EntryDescriptorProxy, descriptor: EntryDescriptorProxy,
icon: 'vn:entry', icon: 'vn:entry',
color: 'green',
}, },
ticket: { ticket: {
descriptor: TicketDescriptorProxy, descriptor: TicketDescriptorProxy,
icon: 'vn:ticket', icon: 'vn:ticket',
color: 'red',
}, },
order: { order: {
descriptor: OrderDescriptorProxy, descriptor: OrderDescriptorProxy,
icon: 'vn:basket', icon: 'vn:basket',
color: 'yellow',
}, },
}; };
@ -143,6 +161,7 @@ onMounted(async () => {
else if (user.value) warehouseFk.value = user.value.warehouseFk; else if (user.value) warehouseFk.value = user.value.warehouseFk;
itemsBalanceFilter.where.warehouseFk = warehouseFk.value; itemsBalanceFilter.where.warehouseFk = warehouseFk.value;
await fetchItemBalances(); await fetchItemBalances();
await scrollToToday();
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
@ -215,7 +234,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTd> </QTd>
</template> </template>
<template #body-cell-date="{ row }"> <template #body-cell-date="{ row }">
<QTd @click.stop> <QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
<QBadge <QBadge
v-bind="getBadgeAttrs(row.shipped)" v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none" class="q-ma-none"
@ -237,12 +256,13 @@ onUnmounted(() => (stateStore.rightDrawer = false));
> >
{{ row.originId }} {{ row.originId }}
</component> </component>
<span class="link">
<QIcon <QIcon
:name="originTypeMap[row.originType]?.icon" :name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm" class="fill-icon q-mr-sm"
size="xs" size="sm"
:color="originTypeMap[row.originType]?.color"
/> />
<span class="link">
{{ row.originId }} {{ row.originId }}
</span> </span>
</QTd> </QTd>

View File

@ -145,7 +145,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
</QItem> </QItem>
</template> </template>
<template #before> <template #before>
<VnImg :id="entityId" collection="user" size="160x160" class="photo"> <VnImg :id="entityId" collection="user" size="520x520" class="photo">
<template #error> <template #error>
<div <div
class="absolute-full picture text-center q-pa-md flex flex-center" class="absolute-full picture text-center q-pa-md flex flex-center"