forked from verdnatura/salix-front
travels corrections and improvements
This commit is contained in:
parent
018f251f3d
commit
f59c2409f1
|
@ -23,11 +23,11 @@ const stateStore = useStateStore();
|
|||
const user = state.getUser();
|
||||
const newEntryForm = reactive({
|
||||
supplierFk: null,
|
||||
travelFk: route.query?.travelFk || null,
|
||||
travelFk: Number(route.query?.travelFk) || null,
|
||||
companyFk: user.value.companyFk || null,
|
||||
});
|
||||
const suppliersOptions = ref([]);
|
||||
const travelsOptionsOptions = ref([]);
|
||||
const travelsOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
|
||||
const redirectToEntryBasicData = (_, { id }) => {
|
||||
|
@ -47,7 +47,7 @@ const redirectToEntryBasicData = (_, { id }) => {
|
|||
url="Travels/filter"
|
||||
:filter="{ fields: ['id', 'warehouseInName'] }"
|
||||
order="id"
|
||||
@on-fetch="(data) => (travelsOptionsOptions = data)"
|
||||
@on-fetch="(data) => (travelsOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
@ -110,7 +110,7 @@ const redirectToEntryBasicData = (_, { id }) => {
|
|||
:label="t('Travel')"
|
||||
class="full-width"
|
||||
v-model="data.travelFk"
|
||||
:options="travelsOptionsOptions"
|
||||
:options="travelsOptions"
|
||||
option-value="id"
|
||||
option-label="warehouseInName"
|
||||
map-options
|
||||
|
|
|
@ -301,7 +301,7 @@ async function setTravelData(travelData) {
|
|||
<VnLv :label="t('globals.agency')" :value="travel.agency?.name" />
|
||||
<VnLv :label="t('globals.reference')" :value="travel.ref" />
|
||||
<VnLv label="m³" :value="travel.m3" />
|
||||
<VnLv :label="t('globals.totalEntries')" :value="travel.m3" />
|
||||
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
|
||||
</QCard>
|
||||
<QCard class="full-width" v-if="entriesTableRows.length > 0">
|
||||
<span class="header">
|
||||
|
|
|
@ -101,7 +101,7 @@ const openRemoveDialog = async (id) => {
|
|||
});
|
||||
};
|
||||
|
||||
const redirectToThermographForm = (action, { id = null }) => {
|
||||
const redirectToThermographForm = (action, id) => {
|
||||
const routeDetails = {
|
||||
name: action === 'create' ? 'TravelThermographsCreate' : 'TravelThermographsEdit',
|
||||
};
|
||||
|
|
|
@ -36,13 +36,9 @@ onBeforeMount(() => {
|
|||
if (route.query.travelData) {
|
||||
const travelData = JSON.parse(route.query.travelData);
|
||||
for (let key in newTravelForm) {
|
||||
if (key === 'landed' || key === 'shipped') {
|
||||
newTravelForm[key] = travelData[key].substring(0, 10);
|
||||
} else {
|
||||
newTravelForm[key] = travelData[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const redirectToTravelBasicData = (_, { id }) => {
|
||||
|
|
|
@ -6,8 +6,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
|||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import { toDate } from 'src/filters';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -60,7 +59,7 @@ const decrement = (paramsObj, key) => {
|
|||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -75,6 +74,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.agencyModeFk')"
|
||||
v-model="params.agencyModeFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="agenciesOptions"
|
||||
option-value="agencyFk"
|
||||
option-label="name"
|
||||
|
@ -90,6 +90,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
@ -105,6 +106,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
@ -147,68 +149,20 @@ const decrement = (paramsObj, key) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
placeholder="dd-mm-aaa"
|
||||
<VnInputDate
|
||||
v-model="params.landedFrom"
|
||||
:label="t('params.landedFrom')"
|
||||
:model-value="toDate(params.landedFrom)"
|
||||
>
|
||||
<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
|
||||
is-outlined
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
placeholder="dd-mm-aaa"
|
||||
:model-value="toDate(params.landedTo)"
|
||||
<VnInputDate
|
||||
:label="t('params.landedTo')"
|
||||
>
|
||||
<template #append>
|
||||
<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
|
||||
v-model="params.landedTo"
|
||||
is-outlined
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -216,6 +170,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.continent')"
|
||||
v-model="params.continent"
|
||||
@update:model-value="searchFn()"
|
||||
:options="continentsOptions"
|
||||
option-value="code"
|
||||
option-label="name"
|
||||
|
@ -261,18 +216,6 @@ const decrement = (paramsObj, key) => {
|
|||
</VnFilterPanel>
|
||||
</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>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -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 () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
@ -95,14 +107,34 @@ onMounted(async () => {
|
|||
:label="t('globals.wareHouseOut')"
|
||||
:value="getWarehouseName(row.warehouseOutFk)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.shipped')"
|
||||
:value="toDate(row.shipped)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.landed')"
|
||||
:value="toDate(row.landed)"
|
||||
/>
|
||||
<VnLv :label="t('globals.shipped')">
|
||||
<template #value>
|
||||
<QBadge
|
||||
v-if="getDateQBadgeColor(row.shipped)"
|
||||
:color="getDateQBadgeColor(row.shipped)"
|
||||
class="q-ma-none"
|
||||
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
|
||||
v-if="warehouses.length > 0"
|
||||
:label="t('globals.wareHouseIn')"
|
||||
|
|
|
@ -43,7 +43,6 @@ export default {
|
|||
name: 'TravelCreate',
|
||||
meta: {
|
||||
title: 'travelCreate',
|
||||
icon: '',
|
||||
},
|
||||
component: () => import('src/pages/Travel/TravelCreate.vue'),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue