0
0
Fork 0

travels corrections and improvements

This commit is contained in:
William Buezas 2024-02-07 15:01:51 -03:00
parent 018f251f3d
commit f59c2409f1
7 changed files with 61 additions and 91 deletions

View File

@ -23,11 +23,11 @@ const stateStore = useStateStore();
const user = state.getUser(); const user = state.getUser();
const newEntryForm = reactive({ const newEntryForm = reactive({
supplierFk: null, supplierFk: null,
travelFk: route.query?.travelFk || null, travelFk: Number(route.query?.travelFk) || null,
companyFk: user.value.companyFk || null, companyFk: user.value.companyFk || null,
}); });
const suppliersOptions = ref([]); const suppliersOptions = ref([]);
const travelsOptionsOptions = ref([]); const travelsOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const redirectToEntryBasicData = (_, { id }) => { const redirectToEntryBasicData = (_, { id }) => {
@ -47,7 +47,7 @@ const redirectToEntryBasicData = (_, { id }) => {
url="Travels/filter" url="Travels/filter"
:filter="{ fields: ['id', 'warehouseInName'] }" :filter="{ fields: ['id', 'warehouseInName'] }"
order="id" order="id"
@on-fetch="(data) => (travelsOptionsOptions = data)" @on-fetch="(data) => (travelsOptions = data)"
auto-load auto-load
/> />
<FetchData <FetchData
@ -110,7 +110,7 @@ const redirectToEntryBasicData = (_, { id }) => {
:label="t('Travel')" :label="t('Travel')"
class="full-width" class="full-width"
v-model="data.travelFk" v-model="data.travelFk"
:options="travelsOptionsOptions" :options="travelsOptions"
option-value="id" option-value="id"
option-label="warehouseInName" option-label="warehouseInName"
map-options map-options

View File

@ -301,7 +301,7 @@ async function setTravelData(travelData) {
<VnLv :label="t('globals.agency')" :value="travel.agency?.name" /> <VnLv :label="t('globals.agency')" :value="travel.agency?.name" />
<VnLv :label="t('globals.reference')" :value="travel.ref" /> <VnLv :label="t('globals.reference')" :value="travel.ref" />
<VnLv label="m³" :value="travel.m3" /> <VnLv label="m³" :value="travel.m3" />
<VnLv :label="t('globals.totalEntries')" :value="travel.m3" /> <VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
</QCard> </QCard>
<QCard class="full-width" v-if="entriesTableRows.length > 0"> <QCard class="full-width" v-if="entriesTableRows.length > 0">
<span class="header"> <span class="header">

View File

@ -101,7 +101,7 @@ const openRemoveDialog = async (id) => {
}); });
}; };
const redirectToThermographForm = (action, { id = null }) => { const redirectToThermographForm = (action, id) => {
const routeDetails = { const routeDetails = {
name: action === 'create' ? 'TravelThermographsCreate' : 'TravelThermographsEdit', name: action === 'create' ? 'TravelThermographsCreate' : 'TravelThermographsEdit',
}; };

View File

@ -36,11 +36,7 @@ onBeforeMount(() => {
if (route.query.travelData) { if (route.query.travelData) {
const travelData = JSON.parse(route.query.travelData); const travelData = JSON.parse(route.query.travelData);
for (let key in newTravelForm) { for (let key in newTravelForm) {
if (key === 'landed' || key === 'shipped') { newTravelForm[key] = travelData[key];
newTravelForm[key] = travelData[key].substring(0, 10);
} else {
newTravelForm[key] = travelData[key];
}
} }
} }
}); });

View File

@ -6,8 +6,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import { toDate } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -60,7 +59,7 @@ const decrement = (paramsObj, key) => {
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
<template #body="{ params }"> <template #body="{ params, searchFn }">
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -75,6 +74,7 @@ const decrement = (paramsObj, key) => {
<VnSelectFilter <VnSelectFilter
:label="t('params.agencyModeFk')" :label="t('params.agencyModeFk')"
v-model="params.agencyModeFk" v-model="params.agencyModeFk"
@update:model-value="searchFn()"
:options="agenciesOptions" :options="agenciesOptions"
option-value="agencyFk" option-value="agencyFk"
option-label="name" option-label="name"
@ -90,6 +90,7 @@ const decrement = (paramsObj, key) => {
<VnSelectFilter <VnSelectFilter
:label="t('params.warehouseOutFk')" :label="t('params.warehouseOutFk')"
v-model="params.warehouseOutFk" v-model="params.warehouseOutFk"
@update:model-value="searchFn()"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
@ -105,6 +106,7 @@ const decrement = (paramsObj, key) => {
<VnSelectFilter <VnSelectFilter
:label="t('params.warehouseInFk')" :label="t('params.warehouseInFk')"
v-model="params.warehouseInFk" v-model="params.warehouseInFk"
@update:model-value="searchFn()"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
@ -147,68 +149,20 @@ const decrement = (paramsObj, key) => {
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<QInput <VnInputDate
dense v-model="params.landedFrom"
outlined
rounded
placeholder="dd-mm-aaa"
:label="t('params.landedFrom')" :label="t('params.landedFrom')"
:model-value="toDate(params.landedFrom)" is-outlined
> />
<template #append>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
cover
transition-show="scale"
transition-hide="scale"
>
<QDate v-model="params.landedFrom">
<div class="row items-center justify-end">
<QBtn
v-close-popup
:label="t('globals.close')"
color="primary"
flat
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<QInput <VnInputDate
dense
outlined
rounded
placeholder="dd-mm-aaa"
:model-value="toDate(params.landedTo)"
:label="t('params.landedTo')" :label="t('params.landedTo')"
> v-model="params.landedTo"
<template #append> is-outlined
<QIcon name="event" class="cursor-pointer"> />
<QPopupProxy
cover
transition-show="scale"
transition-hide="scale"
>
<QDate v-model="params.landedTo">
<div class="row items-center justify-end">
<QBtn
v-close-popup
:label="t('globals.close')"
color="primary"
flat
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -216,6 +170,7 @@ const decrement = (paramsObj, key) => {
<VnSelectFilter <VnSelectFilter
:label="t('params.continent')" :label="t('params.continent')"
v-model="params.continent" v-model="params.continent"
@update:model-value="searchFn()"
:options="continentsOptions" :options="continentsOptions"
option-value="code" option-value="code"
option-label="name" option-label="name"
@ -261,18 +216,6 @@ const decrement = (paramsObj, key) => {
</VnFilterPanel> </VnFilterPanel>
</template> </template>
<style scoped>
.input-number >>> input[type='number'] {
-moz-appearance: textfield;
}
.input-number >>> input::-webkit-outer-spin-button,
.input-number >>> input::-webkit-inner-spin-button {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
}
</style>
<i18n> <i18n>
en: en:
params: params:

View File

@ -51,6 +51,18 @@ const viewSummary = (id) => {
}); });
}; };
const getDateQBadgeColor = (date) => {
let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
date = new Date(date);
date.setHours(0, 0, 0, 0);
const timeDifference = today - date;
if (timeDifference == 0) return 'warning';
if (timeDifference < 0) return 'success';
};
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}); });
@ -95,14 +107,34 @@ onMounted(async () => {
:label="t('globals.wareHouseOut')" :label="t('globals.wareHouseOut')"
:value="getWarehouseName(row.warehouseOutFk)" :value="getWarehouseName(row.warehouseOutFk)"
/> />
<VnLv <VnLv :label="t('globals.shipped')">
:label="t('globals.shipped')" <template #value>
:value="toDate(row.shipped)" <QBadge
/> v-if="getDateQBadgeColor(row.shipped)"
<VnLv :color="getDateQBadgeColor(row.shipped)"
:label="t('globals.landed')" class="q-ma-none"
:value="toDate(row.landed)" dense
/> style="font-size: 14px"
>
{{ toDate(row.shipped) }}
</QBadge>
<span v-else>{{ toDate(row.shipped) }}</span>
</template>
</VnLv>
<VnLv :label="t('globals.landed')">
<template #value>
<QBadge
v-if="getDateQBadgeColor(row.landed)"
:color="getDateQBadgeColor(row.landed)"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ toDate(row.landed) }}
</QBadge>
<span v-else>{{ toDate(row.landed) }}</span>
</template>
</VnLv>
<VnLv <VnLv
v-if="warehouses.length > 0" v-if="warehouses.length > 0"
:label="t('globals.wareHouseIn')" :label="t('globals.wareHouseIn')"

View File

@ -43,7 +43,6 @@ export default {
name: 'TravelCreate', name: 'TravelCreate',
meta: { meta: {
title: 'travelCreate', title: 'travelCreate',
icon: '',
}, },
component: () => import('src/pages/Travel/TravelCreate.vue'), component: () => import('src/pages/Travel/TravelCreate.vue'),
}, },