#7566 fixed summary cards and table #444
|
@ -87,7 +87,7 @@ const $props = defineProps({
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`
|
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`
|
||||||
);
|
).value;
|
||||||
const componentIsRendered = ref(false);
|
const componentIsRendered = ref(false);
|
||||||
const arrayData = useArrayData(modelValue);
|
const arrayData = useArrayData(modelValue);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
@ -119,9 +119,10 @@ onMounted(async () => {
|
||||||
// Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
|
// Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
|
||||||
state.set(modelValue, $props.formInitialData);
|
state.set(modelValue, $props.formInitialData);
|
||||||
|
|
||||||
if ($props.autoLoad && !$props.formInitialData && $props.url) await fetch();
|
if (!$props.formInitialData) {
|
||||||
else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data);
|
if ($props.autoLoad && $props.url) await fetch();
|
||||||
|
else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data);
|
||||||
|
}
|
||||||
if ($props.observeFormChanges) {
|
if ($props.observeFormChanges) {
|
||||||
watch(
|
watch(
|
||||||
() => formData.value,
|
() => formData.value,
|
||||||
|
|
|
@ -115,13 +115,13 @@ const emit = defineEmits(['onFetch']);
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
v-if="$slots.menu"
|
||||||
color="white"
|
color="white"
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
icon="more_vert"
|
icon="more_vert"
|
||||||
round
|
round
|
||||||
size="md"
|
size="md"
|
||||||
:class="{ invisible: !$slots.menu }"
|
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('components.cardDescriptor.moreOptions') }}
|
{{ t('components.cardDescriptor.moreOptions') }}
|
||||||
|
|
|
@ -421,6 +421,7 @@ entry:
|
||||||
buyingValue: Buying value
|
buyingValue: Buying value
|
||||||
freightValue: Freight value
|
freightValue: Freight value
|
||||||
comissionValue: Commission value
|
comissionValue: Commission value
|
||||||
|
description: Description
|
||||||
packageValue: Package value
|
packageValue: Package value
|
||||||
isIgnored: Is ignored
|
isIgnored: Is ignored
|
||||||
price2: Grouping
|
price2: Grouping
|
||||||
|
|
|
@ -419,6 +419,7 @@ entry:
|
||||||
buyingValue: Coste
|
buyingValue: Coste
|
||||||
freightValue: Porte
|
freightValue: Porte
|
||||||
comissionValue: Comisión
|
comissionValue: Comisión
|
||||||
|
description: Descripción
|
||||||
packageValue: Embalaje
|
packageValue: Embalaje
|
||||||
isIgnored: Ignorado
|
isIgnored: Ignorado
|
||||||
price2: Grouping
|
price2: Grouping
|
||||||
|
|
|
@ -135,14 +135,19 @@ watch;
|
||||||
<template #icons>
|
<template #icons>
|
||||||
<QCardActions class="q-gutter-x-md">
|
<QCardActions class="q-gutter-x-md">
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="currentEntry.isExcludedFromAvailable"
|
v-if="currentEntry?.isExcludedFromAvailable"
|
||||||
name="vn:inventory"
|
name="vn:inventory"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="xs"
|
size="xs"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Inventory entry') }}</QTooltip>
|
<QTooltip>{{ t('Inventory entry') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="currentEntry.isRaid" name="vn:net" color="primary" size="xs">
|
<QIcon
|
||||||
|
v-if="currentEntry?.isRaid"
|
||||||
|
name="vn:net"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
<QTooltip>{{ t('Virtual entry') }}</QTooltip>
|
<QTooltip>{{ t('Virtual entry') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
|
|
|
@ -167,7 +167,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('globals.description'),
|
label: t('entry.latestBuys.description'),
|
||||||
field: 'description',
|
field: 'description',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -653,6 +653,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
<EntryLatestBuysFilter data-key="EntryLatestBuys" />
|
<EntryLatestBuysFilter data-key="EntryLatestBuys" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
|
<Teleport to="#actions-append">
|
||||||
|
<div class="row q-gutter-x-sm">
|
||||||
|
<QBtn flat @click="stateStore.toggleRightDrawer()" round dense icon="menu">
|
||||||
|
<QTooltip bottom anchor="bottom right">
|
||||||
|
{{ t('globals.collapseMenu') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</div>
|
||||||
|
</Teleport>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
|
|
|
@ -184,13 +184,6 @@ const suppliersOptions = ref([]);
|
||||||
@click="removeTag(index, params, searchFn)"
|
@click="removeTag(index, params, searchFn)"
|
||||||
/>
|
/>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mt-lg">
|
|
||||||
<QIcon
|
|
||||||
name="add_circle"
|
|
||||||
class="filter-icon"
|
|
||||||
@click="tagValues.push({})"
|
|
||||||
/>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
</template>
|
||||||
</ItemsFilterPanel>
|
</ItemsFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { onBeforeMount, computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Notify } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
|
import axios from 'axios';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { toDate } from 'filters/index';
|
import { toDate } from 'filters/index';
|
||||||
|
@ -29,7 +30,6 @@ const columns = computed(() => [
|
||||||
field: (row) => row.hasCmrDms,
|
field: (row) => row.hasCmrDms,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
headerStyle: 'padding-left: 35px',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ticketFk',
|
name: 'ticketFk',
|
||||||
|
@ -62,7 +62,6 @@ const columns = computed(() => [
|
||||||
field: (row) => toDate(row.shipped),
|
field: (row) => toDate(row.shipped),
|
||||||
align: 'center',
|
align: 'center',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
headerStyle: 'padding-left: 33px',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'warehouseFk',
|
name: 'warehouseFk',
|
||||||
|
@ -77,6 +76,11 @@ const columns = computed(() => [
|
||||||
field: (row) => row.cmrFk,
|
field: (row) => row.cmrFk,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const { data } = await axios.get('Warehouses');
|
||||||
|
warehouses.value = data;
|
||||||
|
});
|
||||||
function getApiUrl() {
|
function getApiUrl() {
|
||||||
return new URL(window.location).origin;
|
return new URL(window.location).origin;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +191,6 @@ function downloadPdfs() {
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.list {
|
.list {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
|
@ -204,4 +207,10 @@ function downloadPdfs() {
|
||||||
#false {
|
#false {
|
||||||
background-color: $negative;
|
background-color: $negative;
|
||||||
}
|
}
|
||||||
|
:deep(.q-table th) {
|
||||||
|
max-width: 80px;
|
||||||
|
}
|
||||||
|
:deep(.q-table th:nth-child(3)) {
|
||||||
|
max-width: 100px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -17,6 +17,10 @@ const $props = defineProps({
|
||||||
required: false,
|
required: false,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
summary: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -106,6 +110,7 @@ const getEntryQueryParams = (supplier) => {
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
data-key="supplier"
|
data-key="supplier"
|
||||||
|
:summary="$props.summary"
|
||||||
>
|
>
|
||||||
<template #header-extra-action>
|
<template #header-extra-action>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import SupplierDescriptor from './SupplierDescriptor.vue';
|
import SupplierDescriptor from './SupplierDescriptor.vue';
|
||||||
|
import SupplierSummary from './SupplierSummary.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -11,6 +12,6 @@ const $props = defineProps({
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<SupplierDescriptor v-if="$props.id" :id="$props.id" />
|
<SupplierDescriptor v-if="$props.id" :id="$props.id" :summary="SupplierSummary" />
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -24,7 +24,7 @@ const agenciesOptions = ref([]);
|
||||||
<FormModel
|
<FormModel
|
||||||
:url="`Travels/${route.params.id}`"
|
:url="`Travels/${route.params.id}`"
|
||||||
:url-update="`Travels/${route.params.id}`"
|
:url-update="`Travels/${route.params.id}`"
|
||||||
model="travel"
|
model="Travel"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
|
|
|
@ -1,7 +1,40 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import TravelDescriptor from './TravelDescriptor.vue';
|
import TravelDescriptor from './TravelDescriptor.vue';
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
'ref',
|
||||||
|
'shipped',
|
||||||
|
'landed',
|
||||||
|
'totalEntries',
|
||||||
|
'warehouseInFk',
|
||||||
|
'warehouseOutFk',
|
||||||
|
'cargoSupplierFk',
|
||||||
|
'agencyModeFk',
|
||||||
|
],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'warehouseIn',
|
||||||
|
scope: {
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'warehouseOut',
|
||||||
|
scope: {
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard data-key="Travel" base-url="Travels" :descriptor="TravelDescriptor" />
|
<VnCard
|
||||||
|
data-key="Travel"
|
||||||
|
:filter="filter"
|
||||||
|
base-url="Travels"
|
||||||
|
:descriptor="TravelDescriptor"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import TravelDescriptorMenuItems from './TravelDescriptorMenuItems.vue';
|
import TravelDescriptorMenuItems from './TravelDescriptorMenuItems.vue';
|
||||||
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -52,23 +51,15 @@ const filter = {
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
|
||||||
|
|
||||||
const setData = (entity) => {
|
|
||||||
data.value = useCardDescription(entity.ref, entity.id);
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
module="Travel"
|
module="Travel"
|
||||||
:url="`Travels/${entityId}`"
|
:url="`Travels/${entityId}`"
|
||||||
:title="data.title"
|
title="ref"
|
||||||
:subtitle="data.subtitle"
|
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="setData"
|
data-key="Travel"
|
||||||
data-key="travelData"
|
|
||||||
>
|
>
|
||||||
<template #header-extra-action>
|
<template #header-extra-action>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
|
@ -32,10 +32,11 @@ const cloneTravel = () => {
|
||||||
redirectToCreateView(stringifiedTravelData);
|
redirectToCreateView(stringifiedTravelData);
|
||||||
};
|
};
|
||||||
|
|
||||||
const cloneTravelWithEntries = () => {
|
const cloneTravelWithEntries = async () => {
|
||||||
try {
|
try {
|
||||||
axios.post(`Travels/${$props.travel.id}/cloneWithEntries`);
|
const { data } = await axios.post(`Travels/${$props.travel.id}/cloneWithEntries`);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
|
router.push({ name: 'TravelBasicData', params: { id: data.id } });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.err('Error cloning travel with entries');
|
console.err('Error cloning travel with entries');
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import TravelDescriptorMenuItems from './TravelDescriptorMenuItems.vue';
|
|
||||||
|
|
||||||
import { toDate, toCurrency } from 'src/filters';
|
import { toDate, toCurrency } from 'src/filters';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -222,6 +221,8 @@ async function setTravelData(travelData) {
|
||||||
console.error(`Error setting travel data`, err);
|
console.error(`Error setting travel data`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -240,21 +241,15 @@ async function setTravelData(travelData) {
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>{{ travel.ref }} - {{ travel.id }}</span>
|
<span>{{ travel.ref }} - {{ travel.id }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
|
||||||
<QBtn color="white" dense flat icon="more_vert" round size="md">
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('components.cardDescriptor.moreOptions') }}
|
|
||||||
</QTooltip>
|
|
||||||
<QMenu>
|
|
||||||
<QList>
|
|
||||||
<TravelDescriptorMenuItems :travel="travel" />
|
|
||||||
</QList>
|
|
||||||
</QMenu>
|
|
||||||
</QBtn>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #body>
|
<template #body>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
|
<QCardSection class="q-pa-none">
|
||||||
|
<VnTitle
|
||||||
|
:url="getLink('basic-data')"
|
||||||
|
:text="t('travel.pageTitles.basicData')"
|
||||||
|
/>
|
||||||
|
</QCardSection>
|
||||||
<VnLv :label="t('globals.shipped')" :value="toDate(travel.shipped)" />
|
<VnLv :label="t('globals.shipped')" :value="toDate(travel.shipped)" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('globals.wareHouseOut')"
|
:label="t('globals.wareHouseOut')"
|
||||||
|
@ -267,6 +262,12 @@ async function setTravelData(travelData) {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
|
<QCardSection class="q-pa-none">
|
||||||
|
<VnTitle
|
||||||
|
:url="getLink('basic-data')"
|
||||||
|
:text="t('travel.pageTitles.basicData')"
|
||||||
|
/>
|
||||||
|
</QCardSection>
|
||||||
<VnLv :label="t('globals.landed')" :value="toDate(travel.landed)" />
|
<VnLv :label="t('globals.landed')" :value="toDate(travel.landed)" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('globals.wareHouseIn')"
|
:label="t('globals.wareHouseIn')"
|
||||||
|
@ -279,12 +280,18 @@ async function setTravelData(travelData) {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
|
<QCardSection class="q-pa-none">
|
||||||
|
<VnTitle
|
||||||
|
:url="getLink('basic-data')"
|
||||||
|
:text="t('travel.pageTitles.basicData')"
|
||||||
|
/>
|
||||||
|
</QCardSection>
|
||||||
<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.totalEntries" />
|
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="full-width" v-if="entriesTableRows.length > 0">
|
<QCard class="full-width">
|
||||||
<VnTitle :text="t('travel.summary.entries')" />
|
<VnTitle :text="t('travel.summary.entries')" />
|
||||||
<QTable
|
<QTable
|
||||||
:rows="entriesTableRows"
|
:rows="entriesTableRows"
|
||||||
|
@ -299,13 +306,15 @@ async function setTravelData(travelData) {
|
||||||
</QTh>
|
</QTh>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-isConfirmed="{ col, value }">
|
<template #body-cell-isConfirmed="{ col, row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QIcon
|
<QCheckbox
|
||||||
v-if="col.name === 'isConfirmed'"
|
v-if="col.name === 'isConfirmed'"
|
||||||
:name="value ? 'check' : 'close'"
|
:label="t('travel.summary.received')"
|
||||||
:color="value ? 'positive' : 'negative'"
|
:true-value="1"
|
||||||
size="sm"
|
:false-value="0"
|
||||||
|
v-model="row[col.name]"
|
||||||
|
:disable="true"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -53,6 +53,7 @@ const draggedRowIndex = ref(null);
|
||||||
const targetRowIndex = ref(null);
|
const targetRowIndex = ref(null);
|
||||||
const entryRowIndex = ref(null);
|
const entryRowIndex = ref(null);
|
||||||
const draggedEntry = ref(null);
|
const draggedEntry = ref(null);
|
||||||
|
const travelKgPercentages = ref([]);
|
||||||
|
|
||||||
const tableColumnComponents = {
|
const tableColumnComponents = {
|
||||||
id: {
|
id: {
|
||||||
|
@ -88,6 +89,10 @@ const tableColumnComponents = {
|
||||||
component: 'span',
|
component: 'span',
|
||||||
attrs: {},
|
attrs: {},
|
||||||
},
|
},
|
||||||
|
percentage: {
|
||||||
|
component: 'span',
|
||||||
|
attrs: {},
|
||||||
|
},
|
||||||
kg: {
|
kg: {
|
||||||
component: VnInput,
|
component: VnInput,
|
||||||
attrs: { dense: true, type: 'number', min: 0, class: 'input-number' },
|
attrs: { dense: true, type: 'number', min: 0, class: 'input-number' },
|
||||||
|
@ -179,6 +184,14 @@ const columns = computed(() => [
|
||||||
showValue: true,
|
showValue: true,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '%',
|
||||||
|
field: '',
|
||||||
|
name: 'percentage',
|
||||||
|
align: 'center',
|
||||||
|
showValue: false,
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('kg'),
|
label: t('kg'),
|
||||||
field: 'kg',
|
field: 'kg',
|
||||||
|
@ -278,6 +291,8 @@ const saveFieldValue = async (val, field, index) => {
|
||||||
await axios.patch(`Travels/${id}`, params);
|
await axios.patch(`Travels/${id}`, params);
|
||||||
// Actualizar la copia de los datos originales con el nuevo valor
|
// Actualizar la copia de los datos originales con el nuevo valor
|
||||||
originalRowDataCopy.value[index][field] = val;
|
originalRowDataCopy.value[index][field] = val;
|
||||||
|
|
||||||
|
await arrayData.fetch({ append: false });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error updating travel');
|
console.error('Error updating travel');
|
||||||
}
|
}
|
||||||
|
@ -302,6 +317,11 @@ onMounted(async () => {
|
||||||
|
|
||||||
landedTo.value.setDate(landedTo.value.getDate() + 7);
|
landedTo.value.setDate(landedTo.value.getDate() + 7);
|
||||||
landedTo.value.setHours(23, 59, 59, 59);
|
landedTo.value.setHours(23, 59, 59, 59);
|
||||||
|
const { data } = await axios.get('TravelKgPercentages', {
|
||||||
|
params: { filter: JSON.stringify({ order: 'value DESC' }) },
|
||||||
|
});
|
||||||
|
|
||||||
|
travelKgPercentages.value = data;
|
||||||
await getData();
|
await getData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -419,6 +439,11 @@ const handleDragScroll = (event) => {
|
||||||
stopScroll();
|
stopScroll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getColor = (percentage) => {
|
||||||
|
for (const { value, className } of travelKgPercentages.value)
|
||||||
|
if (percentage > value) return className;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -460,7 +485,7 @@ const handleDragScroll = (event) => {
|
||||||
<template #body="props">
|
<template #body="props">
|
||||||
<QTr
|
<QTr
|
||||||
:props="props"
|
:props="props"
|
||||||
class="cursor-pointer bg-vn-primary-row"
|
class="cursor-pointer bg-travel"
|
||||||
@click="navigateToTravelId(props.row.id)"
|
@click="navigateToTravelId(props.row.id)"
|
||||||
@dragenter="handleDragEnter($event, props.rowIndex)"
|
@dragenter="handleDragEnter($event, props.rowIndex)"
|
||||||
@dragover.prevent
|
@dragover.prevent
|
||||||
|
@ -494,18 +519,32 @@ const handleDragScroll = (event) => {
|
||||||
: {}
|
: {}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<template v-if="col.showValue">
|
<QChip
|
||||||
<span
|
v-if="col.name === 'percentage'"
|
||||||
:class="[
|
:label="
|
||||||
'text-left',
|
props.row.percentageKg
|
||||||
{
|
? `${props.row.percentageKg}%`
|
||||||
'supplier-name':
|
: '-'
|
||||||
col.name === 'cargoSupplierNickname',
|
"
|
||||||
},
|
class="text-left q-py-xs q-px-sm"
|
||||||
]"
|
:color="getColor(props.row.percentageKg)"
|
||||||
>{{ col.value }}</span
|
/>
|
||||||
>
|
<span
|
||||||
</template>
|
v-else-if="col.showValue"
|
||||||
|
:class="[
|
||||||
|
'text-left',
|
||||||
|
{
|
||||||
|
'supplier-name':
|
||||||
|
col.name === 'cargoSupplierNickname',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: ['id', 'cargoSupplierNickname'].includes(
|
||||||
|
col.name
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
v-text="col.value"
|
||||||
|
/>
|
||||||
<!-- Main Row Descriptors -->
|
<!-- Main Row Descriptors -->
|
||||||
<TravelDescriptorProxy
|
<TravelDescriptorProxy
|
||||||
v-if="col.name === 'id'"
|
v-if="col.name === 'id'"
|
||||||
|
@ -539,11 +578,11 @@ const handleDragScroll = (event) => {
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat color="primary">{{ entry.id }} </QBtn>
|
<QBtn flat class="link">{{ entry.id }} </QBtn>
|
||||||
<EntryDescriptorProxy :id="entry.id" />
|
<EntryDescriptorProxy :id="entry.id" />
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat color="primary" dense>{{ entry.supplierName }}</QBtn>
|
<QBtn flat class="link" dense>{{ entry.supplierName }}</QBtn>
|
||||||
<SupplierDescriptorProxy :id="entry.supplierFk" />
|
<SupplierDescriptorProxy :id="entry.supplierFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd />
|
<QTd />
|
||||||
|
@ -556,6 +595,7 @@ const handleDragScroll = (event) => {
|
||||||
<QTd>
|
<QTd>
|
||||||
<span>{{ entry.stickers }}</span>
|
<span>{{ entry.stickers }}</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
|
<QTd />
|
||||||
<QTd></QTd>
|
<QTd></QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
<span>{{ entry.loadedkg }}</span>
|
<span>{{ entry.loadedkg }}</span>
|
||||||
|
@ -574,10 +614,23 @@ const handleDragScroll = (event) => {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.q-chip {
|
||||||
|
color: var(--vn-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.q-table) {
|
:deep(.q-table) {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-td :deep(input) {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-travel {
|
||||||
|
background-color: var(--vn-page-color);
|
||||||
|
border-bottom: 2px solid $primary;
|
||||||
|
}
|
||||||
|
|
||||||
.dashed-border {
|
.dashed-border {
|
||||||
&.--left {
|
&.--left {
|
||||||
border-left: 1px dashed #ccc;
|
border-left: 1px dashed #ccc;
|
||||||
|
|
|
@ -15,29 +15,19 @@ const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const newTravelForm = reactive({
|
|
||||||
ref: null,
|
|
||||||
agencyModeFk: null,
|
|
||||||
shipped: null,
|
|
||||||
landed: null,
|
|
||||||
warehouseOutFk: null,
|
|
||||||
warehouseInFk: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const viewAction = ref();
|
const viewAction = ref();
|
||||||
|
|
||||||
|
const newTravelForm = ref({});
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
// Esto nos permite decirle a FormModel si queremos observar los cambios o no
|
|
||||||
// Ya que si queremos clonar queremos que nos permita guardar inmediatamente sin realizar cambios en el form
|
|
||||||
viewAction.value = route.query.travelData ? 'clone' : 'create';
|
viewAction.value = route.query.travelData ? 'clone' : 'create';
|
||||||
|
|
||||||
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) {
|
|
||||||
newTravelForm[key] = travelData[key];
|
newTravelForm.value = { ...newTravelForm.value, ...travelData };
|
||||||
}
|
delete newTravelForm.value.id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,8 +50,8 @@ const redirectToTravelBasicData = (_, { id }) => {
|
||||||
<QPage>
|
<QPage>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<FormModel
|
<FormModel
|
||||||
url-update="Travels"
|
url-create="Travels"
|
||||||
model="travel"
|
model="travelCreate"
|
||||||
:form-initial-data="newTravelForm"
|
:form-initial-data="newTravelForm"
|
||||||
:observe-form-changes="viewAction === 'create'"
|
:observe-form-changes="viewAction === 'create'"
|
||||||
@on-data-saved="redirectToTravelBasicData"
|
@on-data-saved="redirectToTravelBasicData"
|
||||||
|
|
|
@ -2,8 +2,7 @@ const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-i
|
||||||
describe('VnLocation', () => {
|
describe('VnLocation', () => {
|
||||||
const dialogInputs = '.q-dialog label input';
|
const dialogInputs = '.q-dialog label input';
|
||||||
describe('Worker Create', () => {
|
describe('Worker Create', () => {
|
||||||
const inputLocation =
|
const inputLocation = '.q-form input[aria-label="Location"]';
|
||||||
'.q-form .q-card > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
@ -25,9 +24,6 @@ describe('VnLocation', () => {
|
||||||
cy.get(inputLocation).clear();
|
cy.get(inputLocation).clear();
|
||||||
cy.get(inputLocation).type('ecuador');
|
cy.get(inputLocation).type('ecuador');
|
||||||
cy.get(locationOptions).should('have.length.at.least', 1);
|
cy.get(locationOptions).should('have.length.at.least', 1);
|
||||||
cy.get(
|
|
||||||
'.q-form .q-card > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon'
|
|
||||||
).click();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Fiscal-data', () => {
|
describe('Fiscal-data', () => {
|
||||||
|
@ -38,9 +34,7 @@ describe('VnLocation', () => {
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
});
|
});
|
||||||
it('Create postCode', function () {
|
it('Create postCode', function () {
|
||||||
cy.get(
|
cy.get('.q-form > .q-card > .vn-row:nth-child(6) .--add-icon').click();
|
||||||
':nth-child(6) > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon'
|
|
||||||
).click();
|
|
||||||
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
||||||
cy.get(dialogInputs).eq(0).clear('12');
|
cy.get(dialogInputs).eq(0).clear('12');
|
||||||
cy.get(dialogInputs).eq(0).type('1234453');
|
cy.get(dialogInputs).eq(0).type('1234453');
|
||||||
|
|
Loading…
Reference in New Issue