0
0
Fork 0

Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6238-addPercentageColumn

This commit is contained in:
Jorge Penadés 2024-06-18 09:54:33 +02:00
commit 34069f4841
13 changed files with 110 additions and 66 deletions

View File

@ -119,9 +119,10 @@ onMounted(async () => {
// Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
state.set(modelValue, $props.formInitialData);
if ($props.autoLoad && !$props.formInitialData && $props.url) await fetch();
else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data);
if (!$props.formInitialData) {
if ($props.autoLoad && $props.url) await fetch();
else if (arrayData.store.data) updateAndEmit(arrayData.store.data, 'onFetch');
}
if ($props.observeFormChanges) {
watch(
() => formData.value,

View File

@ -421,6 +421,7 @@ entry:
buyingValue: Buying value
freightValue: Freight value
comissionValue: Commission value
description: Description
packageValue: Package value
isIgnored: Is ignored
price2: Grouping

View File

@ -419,6 +419,7 @@ entry:
buyingValue: Coste
freightValue: Porte
comissionValue: Comisión
description: Descripción
packageValue: Embalaje
isIgnored: Ignorado
price2: Grouping

View File

@ -135,14 +135,19 @@ watch;
<template #icons>
<QCardActions class="q-gutter-x-md">
<QIcon
v-if="currentEntry.isExcludedFromAvailable"
v-if="currentEntry?.isExcludedFromAvailable"
name="vn:inventory"
color="primary"
size="xs"
>
<QTooltip>{{ t('Inventory entry') }}</QTooltip>
</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>
</QIcon>
</QCardActions>

View File

@ -167,7 +167,7 @@ const columns = computed(() => [
},
},
{
label: t('globals.description'),
label: t('entry.latestBuys.description'),
field: 'description',
name: 'description',
align: 'left',
@ -653,6 +653,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<EntryLatestBuysFilter data-key="EntryLatestBuys" />
</template>
</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">
<QTable
:rows="rows"

View File

@ -184,13 +184,6 @@ const suppliersOptions = ref([]);
@click="removeTag(index, params, searchFn)"
/>
</QItem>
<QItem class="q-mt-lg">
<QIcon
name="add_circle"
class="filter-icon"
@click="tagValues.push({})"
/>
</QItem>
</template>
</ItemsFilterPanel>
</template>

View File

@ -1,7 +1,8 @@
<script setup>
import { computed, ref } from 'vue';
import { onBeforeMount, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar';
import axios from 'axios';
import VnPaginate from 'components/ui/VnPaginate.vue';
import { useSession } from 'src/composables/useSession';
import { toDate } from 'filters/index';
@ -29,7 +30,6 @@ const columns = computed(() => [
field: (row) => row.hasCmrDms,
align: 'center',
sortable: true,
headerStyle: 'padding-left: 35px',
},
{
name: 'ticketFk',
@ -62,7 +62,6 @@ const columns = computed(() => [
field: (row) => toDate(row.shipped),
align: 'center',
sortable: true,
headerStyle: 'padding-left: 33px',
},
{
name: 'warehouseFk',
@ -77,6 +76,11 @@ const columns = computed(() => [
field: (row) => row.cmrFk,
},
]);
onBeforeMount(async () => {
const { data } = await axios.get('Warehouses');
warehouses.value = data;
});
function getApiUrl() {
return new URL(window.location).origin;
}
@ -187,7 +191,6 @@ function downloadPdfs() {
</QPageSticky>
</div>
</template>
<style lang="scss" scoped>
.list {
padding-top: 15px;
@ -204,4 +207,10 @@ function downloadPdfs() {
#false {
background-color: $negative;
}
:deep(.q-table th) {
max-width: 80px;
}
:deep(.q-table th:nth-child(3)) {
max-width: 100px;
}
</style>

View File

@ -24,7 +24,7 @@ const agenciesOptions = ref([]);
<FormModel
:url="`Travels/${route.params.id}`"
:url-update="`Travels/${route.params.id}`"
model="travel"
model="Travel"
auto-load
>
<template #form="{ data }">

View File

@ -1,7 +1,40 @@
<script setup>
import VnCard from 'components/common/VnCard.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>
<template>
<VnCard data-key="Travel" base-url="Travels" :descriptor="TravelDescriptor" />
<VnCard
data-key="Travel"
:filter="filter"
base-url="Travels"
:descriptor="TravelDescriptor"
/>
</template>

View File

@ -52,23 +52,15 @@ const filter = {
const entityId = computed(() => {
return $props.id || route.params.id;
});
const data = ref(useCardDescription());
const setData = (entity) => {
data.value = useCardDescription(entity.ref, entity.id);
};
</script>
<template>
<CardDescriptor
module="Travel"
:url="`Travels/${entityId}`"
:title="data.title"
:subtitle="data.subtitle"
title="ref"
:filter="filter"
@on-fetch="setData"
data-key="travelData"
data-key="Travel"
>
<template #header-extra-action>
<QBtn

View File

@ -32,10 +32,11 @@ const cloneTravel = () => {
redirectToCreateView(stringifiedTravelData);
};
const cloneTravelWithEntries = () => {
const cloneTravelWithEntries = async () => {
try {
axios.post(`Travels/${$props.travel.id}/cloneWithEntries`);
const { data } = await axios.post(`Travels/${$props.travel.id}/cloneWithEntries`);
notify('globals.dataSaved', 'positive');
router.push({ name: 'TravelBasicData', params: { id: data.id } });
} catch (err) {
console.err('Error cloning travel with entries');
}

View File

@ -8,7 +8,6 @@ import VnLv from 'src/components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import FetchData from 'src/components/FetchData.vue';
import TravelDescriptorMenuItems from './TravelDescriptorMenuItems.vue';
import { toDate, toCurrency } from 'src/filters';
import axios from 'axios';
@ -222,6 +221,8 @@ async function setTravelData(travelData) {
console.error(`Error setting travel data`, err);
}
}
const getLink = (param) => `#/travel/${entityId.value}/${param}`;
</script>
<template>
@ -240,21 +241,15 @@ async function setTravelData(travelData) {
<template #header>
<span>{{ travel.ref }} - {{ travel.id }}</span>
</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>
<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.wareHouseOut')"
@ -267,6 +262,12 @@ async function setTravelData(travelData) {
/>
</QCard>
<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.wareHouseIn')"
@ -279,12 +280,18 @@ async function setTravelData(travelData) {
/>
</QCard>
<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.reference')" :value="travel.ref" />
<VnLv label="m³" :value="travel.m3" />
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
</QCard>
<QCard class="full-width" v-if="entriesTableRows.length > 0">
<QCard class="full-width">
<VnTitle :text="t('travel.summary.entries')" />
<QTable
:rows="entriesTableRows"
@ -299,13 +306,15 @@ async function setTravelData(travelData) {
</QTh>
</QTr>
</template>
<template #body-cell-isConfirmed="{ col, value }">
<template #body-cell-isConfirmed="{ col, row }">
<QTd>
<QIcon
<QCheckbox
v-if="col.name === 'isConfirmed'"
:name="value ? 'check' : 'close'"
:color="value ? 'positive' : 'negative'"
size="sm"
:label="t('travel.summary.received')"
:true-value="1"
:false-value="0"
v-model="row[col.name]"
:disable="true"
/>
</QTd>
</template>

View File

@ -15,29 +15,19 @@ const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const newTravelForm = reactive({
ref: null,
agencyModeFk: null,
shipped: null,
landed: null,
warehouseOutFk: null,
warehouseInFk: null,
});
const agenciesOptions = ref([]);
const warehousesOptions = ref([]);
const viewAction = ref();
const newTravelForm = ref({});
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';
if (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>
<VnSubToolbar />
<FormModel
url-update="Travels"
model="travel"
url-create="Travels"
model="travelCreate"
:form-initial-data="newTravelForm"
:observe-form-changes="viewAction === 'create'"
@on-data-saved="redirectToTravelBasicData"