forked from verdnatura/salix-front
Merge branch 'dev' into 8440-createVehicleNotes
This commit is contained in:
commit
1805e1e553
|
@ -49,3 +49,9 @@ pnpm run test:e2e:summary
|
|||
```bash
|
||||
quasar build
|
||||
```
|
||||
|
||||
### Serve the app for production
|
||||
|
||||
```bash
|
||||
quasar build quasar serve dist/spa --host 0.0.0.0 --proxy=./proxy-serve.js
|
||||
```
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
@ -18,6 +18,14 @@ const state = useState();
|
|||
const user = state.getUser();
|
||||
const appName = 'Lilium';
|
||||
const pinnedModulesRef = ref();
|
||||
const hostname = window.location.hostname;
|
||||
const env = ref();
|
||||
|
||||
const getEnvironment = computed(() => {
|
||||
env.value = hostname.split('-');
|
||||
if (env.value.length <= 1) return;
|
||||
return env.value[0];
|
||||
});
|
||||
|
||||
onMounted(() => stateStore.setMounted());
|
||||
const refresh = () => window.location.reload();
|
||||
|
@ -49,6 +57,9 @@ const refresh = () => window.location.reload();
|
|||
{{ t('globals.backToDashboard') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBadge v-if="getEnvironment" color="primary" align="top">
|
||||
{{ getEnvironment }}
|
||||
</QBadge>
|
||||
</RouterLink>
|
||||
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
|
||||
<QSpinner
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<script setup>
|
||||
import {useDialogPluginComponent} from 'quasar';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import {computed, ref} from 'vue';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, ref } from 'vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import axios from 'axios';
|
||||
import useNotify from "composables/useNotify";
|
||||
import useNotify from 'composables/useNotify';
|
||||
|
||||
const MESSAGE_MAX_LENGTH = 160;
|
||||
|
||||
const {t} = useI18n();
|
||||
const {notify} = useNotify();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
|
@ -34,7 +34,7 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const emit = defineEmits([...useDialogPluginComponent.emits, 'sent']);
|
||||
const {dialogRef, onDialogHide} = useDialogPluginComponent();
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
|
||||
const smsRules = [
|
||||
(val) => (val && val.length > 0) || t("The message can't be empty"),
|
||||
|
@ -43,10 +43,10 @@ const smsRules = [
|
|||
t("The message it's too long"),
|
||||
];
|
||||
|
||||
const message = ref('');
|
||||
const message = ref(t('routeDelay'));
|
||||
|
||||
const charactersRemaining = computed(
|
||||
() => MESSAGE_MAX_LENGTH - new Blob([message.value]).size
|
||||
() => MESSAGE_MAX_LENGTH - new Blob([message.value]).size,
|
||||
);
|
||||
|
||||
const charactersChipColor = computed(() => {
|
||||
|
@ -114,7 +114,7 @@ const onSubmit = async () => {
|
|||
<QTooltip>
|
||||
{{
|
||||
t(
|
||||
'Special characters like accents counts as a multiple'
|
||||
'Special characters like accents counts as a multiple',
|
||||
)
|
||||
}}
|
||||
</QTooltip>
|
||||
|
@ -144,7 +144,10 @@ const onSubmit = async () => {
|
|||
max-width: 450px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
routeDelay: "Your order has been delayed in transit.\nDelivery will take place throughout the day.\nWe apologize for the inconvenience and appreciate your patience."
|
||||
es:
|
||||
Message: Mensaje
|
||||
Send: Enviar
|
||||
|
@ -153,4 +156,5 @@ es:
|
|||
The destination can't be empty: El destinatario no puede estar vacio
|
||||
The message can't be empty: El mensaje no puede estar vacio
|
||||
The message it's too long: El mensaje es demasiado largo
|
||||
</i18n>
|
||||
routeDelay: "Retraso en ruta.\nInformamos que la ruta que lleva su pedido ha sufrido un retraso y la entrega se hará a lo largo del día.\nDisculpe las molestias."
|
||||
</i18n>
|
||||
|
|
|
@ -35,6 +35,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: null,
|
||||
},
|
||||
hasFile: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const warehouses = ref();
|
||||
|
@ -90,6 +94,7 @@ function defaultData() {
|
|||
if ($props.formInitialData) return (dms.value = $props.formInitialData);
|
||||
return addDefaultData({
|
||||
reference: route.params.id,
|
||||
hasFile: $props.hasFile,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const editDownloadDisabled = ref(false);
|
|||
const $props = defineProps({
|
||||
defaultDmsCode: {
|
||||
type: String,
|
||||
default: 'InvoiceIn',
|
||||
default: 'invoiceIn',
|
||||
},
|
||||
disable: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import VnSelect from './VnSelect.vue';
|
||||
|
||||
const stateBtnDropdownRef = ref();
|
||||
|
||||
const emit = defineEmits(['changeState']);
|
||||
|
||||
const $props = defineProps({
|
||||
disable: {
|
||||
type: Boolean,
|
||||
default: null,
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
optionLabel: {
|
||||
type: String,
|
||||
default: 'name',
|
||||
},
|
||||
optionValue: {
|
||||
type: String,
|
||||
default: 'id',
|
||||
},
|
||||
});
|
||||
|
||||
async function changeState(value) {
|
||||
stateBtnDropdownRef.value?.hide();
|
||||
emit('changeState', value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
text-color="white"
|
||||
:label="$t('globals.changeState')"
|
||||
:disable="$props.disable"
|
||||
>
|
||||
<VnSelect
|
||||
:options="$props.options"
|
||||
:option-label="$props.optionLabel"
|
||||
:option-value="$props.optionValue"
|
||||
hide-selected
|
||||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="changeState"
|
||||
>
|
||||
</VnSelect>
|
||||
</QBtnDropdown>
|
||||
</template>
|
|
@ -561,9 +561,7 @@ watch(
|
|||
}}:
|
||||
</span>
|
||||
<VnLogValue
|
||||
:value="
|
||||
value.val.val
|
||||
"
|
||||
:value="value.val"
|
||||
:name="value.name"
|
||||
/>
|
||||
</QItem>
|
||||
|
@ -616,7 +614,7 @@ watch(
|
|||
{{ prop.nameI18n }}:
|
||||
</span>
|
||||
<VnLogValue
|
||||
:value="prop.val.val"
|
||||
:value="prop.val"
|
||||
:name="prop.name"
|
||||
/>
|
||||
<span
|
||||
|
@ -647,7 +645,7 @@ watch(
|
|||
</span>
|
||||
<span v-if="log.action == 'update'">
|
||||
<VnLogValue
|
||||
:value="prop.old.val"
|
||||
:value="prop.old"
|
||||
:name="prop.name"
|
||||
/>
|
||||
<span
|
||||
|
@ -658,7 +656,7 @@ watch(
|
|||
</span>
|
||||
→
|
||||
<VnLogValue
|
||||
:value="prop.val.val"
|
||||
:value="prop.val"
|
||||
:name="prop.name"
|
||||
/>
|
||||
<span
|
||||
|
@ -670,7 +668,7 @@ watch(
|
|||
</span>
|
||||
<span v-else="prop.old.val">
|
||||
<VnLogValue
|
||||
:value="prop.val.val"
|
||||
:value="prop.val"
|
||||
:name="prop.name"
|
||||
/>
|
||||
<span
|
||||
|
|
|
@ -5,18 +5,24 @@ import { computed } from 'vue';
|
|||
const descriptorStore = useDescriptorStore();
|
||||
|
||||
const $props = defineProps({
|
||||
name: { type: [String], default: undefined },
|
||||
value: { type: Object, default: () => {} },
|
||||
name: { type: String, default: undefined },
|
||||
});
|
||||
|
||||
const descriptor = computed(() => descriptorStore.has($props.name));
|
||||
</script>
|
||||
<template>
|
||||
<VnJsonValue v-bind="$attrs" />
|
||||
<QIcon
|
||||
name="launch"
|
||||
class="link"
|
||||
v-if="$attrs.value && descriptor"
|
||||
:data-cy="'iconLaunch-' + $props.name"
|
||||
/>
|
||||
<component :is="descriptor" :id="$attrs.value" v-if="$attrs.value && descriptor" />
|
||||
<VnJsonValue :value="value.val" />
|
||||
<span
|
||||
v-if="(value.id || typeof value.val == 'number') && descriptor"
|
||||
style="margin-left: 2px"
|
||||
>
|
||||
<QIcon
|
||||
name="launch"
|
||||
class="link"
|
||||
:data-cy="'iconLaunch-' + $props.name"
|
||||
style="padding-bottom: 2px"
|
||||
/>
|
||||
<component :is="descriptor" :id="value.id ?? value.val" />
|
||||
</span>
|
||||
</template>
|
||||
|
|
|
@ -57,4 +57,5 @@ function handleClick() {
|
|||
{{ capitalize(type).replace('-', '') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
{{ phoneNumber }}
|
||||
</template>
|
||||
|
|
|
@ -43,7 +43,7 @@ const val = computed(() => $props.value);
|
|||
<span style="color: var(--vn-label-color)">{{ label }}</span>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="value">
|
||||
<div class="value" v-if="value || $slots.value">
|
||||
<slot name="value">
|
||||
<span :title="value" style="text-overflow: ellipsis">
|
||||
{{ dash ? dashIfEmpty(value) : value }}
|
||||
|
|
|
@ -842,6 +842,7 @@ travel:
|
|||
availabledHour: Availabled hour
|
||||
thermographs: Thermographs
|
||||
hb: HB
|
||||
roundedCc: Rounded CC
|
||||
basicData:
|
||||
daysInForward: Automatic movement (Raid)
|
||||
isRaid: Raid
|
||||
|
@ -884,7 +885,7 @@ components:
|
|||
openCard: View
|
||||
openSummary: Summary
|
||||
viewSummary: Summary
|
||||
cardDescriptor:
|
||||
vnDescriptor:
|
||||
mainList: Main list
|
||||
summary: Summary
|
||||
moreOptions: More options
|
||||
|
|
|
@ -925,6 +925,7 @@ travel:
|
|||
availabled: F. Disponible
|
||||
availabledHour: Hora Disponible
|
||||
hb: HB
|
||||
roundedCc: CC redondeado
|
||||
basicData:
|
||||
daysInForward: Desplazamiento automatico (redada)
|
||||
isRaid: Redada
|
||||
|
@ -968,7 +969,7 @@ components:
|
|||
openCard: Ficha
|
||||
openSummary: Detalles
|
||||
viewSummary: Vista previa
|
||||
cardDescriptor:
|
||||
vnDescriptor:
|
||||
mainList: Listado principal
|
||||
summary: Resumen
|
||||
moreOptions: Más opciones
|
||||
|
|
|
@ -21,6 +21,7 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
|
|||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import ClaimDescriptorMenu from './ClaimDescriptorMenu.vue';
|
||||
import VnDropdown from 'src/components/common/VnDropdown.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
@ -36,7 +37,7 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const ClaimStates = ref([]);
|
||||
const claimStates = ref([]);
|
||||
const claimDmsRef = ref();
|
||||
const claimDms = ref([]);
|
||||
const multimediaDialog = ref();
|
||||
|
@ -173,7 +174,9 @@ function openDialog(dmsId) {
|
|||
}
|
||||
|
||||
async function changeState(value) {
|
||||
await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value });
|
||||
await axios.patch(`Claims/updateClaim/${entityId.value}`, {
|
||||
claimStateFk: value,
|
||||
});
|
||||
router.go(route.fullPath);
|
||||
}
|
||||
|
||||
|
@ -183,13 +186,18 @@ function claimUrl(section) {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="ClaimStates"
|
||||
:filter="{ fields: ['id', 'description'] }"
|
||||
@on-fetch="(data) => (claimStates = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="ClaimDms"
|
||||
:filter="claimDmsFilter"
|
||||
@on-fetch="(data) => setClaimDms(data)"
|
||||
ref="claimDmsRef"
|
||||
/>
|
||||
<FetchData url="ClaimStates" @on-fetch="(data) => (ClaimStates = data)" auto-load />
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Claims/${entityId}/getSummary`"
|
||||
|
@ -201,34 +209,11 @@ function claimUrl(section) {
|
|||
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
|
||||
</template>
|
||||
<template #header-right>
|
||||
<QBtnDropdown
|
||||
side
|
||||
top
|
||||
color="black"
|
||||
text-color="white"
|
||||
:label="t('globals.changeState')"
|
||||
>
|
||||
<QList>
|
||||
<QVirtualScroll
|
||||
class="max-container-height"
|
||||
:items="ClaimStates"
|
||||
separator
|
||||
v-slot="{ item, index }"
|
||||
>
|
||||
<QItem
|
||||
:key="index"
|
||||
dense
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="changeState(item.id)"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ item.description }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QVirtualScroll>
|
||||
</QList>
|
||||
</QBtnDropdown>
|
||||
<VnDropdown
|
||||
:options="claimStates"
|
||||
option-label="description"
|
||||
@change-state="changeState"
|
||||
/>
|
||||
</template>
|
||||
<template #menu="{ entity }">
|
||||
<ClaimDescriptorMenu :claim="entity.claim" />
|
||||
|
|
|
@ -648,7 +648,7 @@ onMounted(() => {
|
|||
:url="`Entries/${entityId}/getBuyList`"
|
||||
search-url="EntryBuys"
|
||||
save-url="Buys/crud"
|
||||
:filter="filter"
|
||||
:filter="editableMode ? filter : {}"
|
||||
:disable-option="{ card: true }"
|
||||
v-model:selected="selectedRows"
|
||||
@on-fetch="() => footerFetchDataRef.fetch()"
|
||||
|
|
|
@ -8,6 +8,6 @@ import filter from './EntryFilter.js';
|
|||
data-key="Entry"
|
||||
url="Entries"
|
||||
:descriptor="EntryDescriptor"
|
||||
:filter="filter"
|
||||
:filter="{ ...filter, where: { id: $route.params.id } }"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -147,7 +147,7 @@ async function deleteEntry() {
|
|||
<template>
|
||||
<EntityDescriptor
|
||||
:url="`Entries/${entityId}`"
|
||||
:user-filter="entryFilter"
|
||||
:filter="entryFilter"
|
||||
title="supplier.nickname"
|
||||
data-key="Entry"
|
||||
width="lg-width"
|
||||
|
|
|
@ -249,7 +249,6 @@ function getBadgeAttrs(row) {
|
|||
let timeDiff = today - timeTicket;
|
||||
|
||||
if (timeDiff > 0) return { color: 'info', 'text-color': 'black' };
|
||||
if (timeDiff < 0) return { color: 'warning', 'text-color': 'black' };
|
||||
switch (row.entryTypeCode) {
|
||||
case 'regularization':
|
||||
case 'life':
|
||||
|
@ -274,6 +273,7 @@ function getBadgeAttrs(row) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (timeDiff < 0) return { color: 'warning', 'text-color': 'black' };
|
||||
return { color: 'transparent' };
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@ const filter = computed(() => ({
|
|||
hour: 0,
|
||||
minute: 0,
|
||||
second: 0,
|
||||
milliseconds: 0,
|
||||
}),
|
||||
m3: { neq: null },
|
||||
},
|
||||
|
|
|
@ -25,7 +25,8 @@ const invoiceInFormRef = ref();
|
|||
const invoiceId = +route.params.id;
|
||||
const filter = { where: { invoiceInFk: invoiceId } };
|
||||
const areRows = ref(false);
|
||||
const totals = ref();
|
||||
const totalTaxableBase = ref();
|
||||
const noMatch = computed(() => totalAmount.value != totalTaxableBase.value);
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'duedate',
|
||||
|
@ -74,9 +75,12 @@ async function insert() {
|
|||
notify(t('globals.dataSaved'), 'positive');
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
totals.value = (await axios.get(`InvoiceIns/${invoiceId}/getTotals`)).data;
|
||||
});
|
||||
async function setTaxableBase() {
|
||||
const { data } = await axios.get(`InvoiceIns/${invoiceId}/getTotals`);
|
||||
totalTaxableBase.value = data.totalTaxableBase;
|
||||
}
|
||||
|
||||
onBeforeMount(async () => await setTaxableBase());
|
||||
</script>
|
||||
<template>
|
||||
<CrudModel
|
||||
|
@ -89,13 +93,14 @@ onBeforeMount(async () => {
|
|||
:data-required="{ invoiceInFk: invoiceId }"
|
||||
v-model:selected="rowsSelected"
|
||||
@on-fetch="(data) => (areRows = !!data.length)"
|
||||
@save-changes="setTaxableBase"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
v-model:selected="rowsSelected"
|
||||
selection="multiple"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:columns
|
||||
:rows
|
||||
row-key="$index"
|
||||
:grid="$q.screen.lt.sm"
|
||||
>
|
||||
|
@ -151,7 +156,18 @@ onBeforeMount(async () => {
|
|||
<QTd />
|
||||
<QTd />
|
||||
<QTd>
|
||||
{{ toCurrency(totalAmount) }}
|
||||
<QChip
|
||||
dense
|
||||
:color="noMatch ? 'negative' : 'transparent'"
|
||||
class="q-pa-xs"
|
||||
:title="
|
||||
noMatch
|
||||
? t('invoiceIn.noMatch', { totalTaxableBase })
|
||||
: ''
|
||||
"
|
||||
>
|
||||
{{ toCurrency(totalAmount) }}
|
||||
</QChip>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<template v-if="isNotEuro(invoiceIn.currency.code)">
|
||||
|
@ -237,7 +253,7 @@ onBeforeMount(async () => {
|
|||
if (!areRows) insert();
|
||||
else
|
||||
invoiceInFormRef.insert({
|
||||
amount: (totals.totalTaxableBase - totalAmount).toFixed(2),
|
||||
amount: (totalTaxableBase - totalAmount).toFixed(2),
|
||||
invoiceInFk: invoiceId,
|
||||
});
|
||||
}
|
||||
|
@ -249,6 +265,10 @@ onBeforeMount(async () => {
|
|||
.bg {
|
||||
background-color: var(--vn-light-gray);
|
||||
}
|
||||
|
||||
.q-chip {
|
||||
color: var(--vn-text-color);
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
|
|
|
@ -304,7 +304,10 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
:color="amountsNotMatch ? 'negative' : 'transparent'"
|
||||
:title="
|
||||
amountsNotMatch
|
||||
? t('invoiceIn.summary.noMatch')
|
||||
? t('invoiceIn.noMatch', {
|
||||
totalTaxableBase:
|
||||
entity.totals.totalTaxableBase,
|
||||
})
|
||||
: t('invoiceIn.summary.dueTotal')
|
||||
"
|
||||
>
|
||||
|
|
|
@ -156,7 +156,7 @@ const cols = computed(() => [
|
|||
:create="{
|
||||
urlCreate: 'InvoiceIns',
|
||||
title: t('globals.createInvoiceIn'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
|
||||
formInitialData: { companyFk: user.companyFk, issued: Date.vnNew() },
|
||||
}"
|
||||
redirect="invoice-in"
|
||||
|
|
|
@ -56,8 +56,9 @@ async function checkToBook(id) {
|
|||
componentProps: {
|
||||
title: t('Are you sure you want to book this invoice?'),
|
||||
message: messages.reduce((acc, msg) => `${acc}<p>${msg}</p>`, ''),
|
||||
promise: () => toBook(id),
|
||||
},
|
||||
}).onOk(() => toBook(id));
|
||||
});
|
||||
}
|
||||
|
||||
async function toBook(id) {
|
||||
|
|
|
@ -58,7 +58,6 @@ invoiceIn:
|
|||
bank: Bank
|
||||
foreignValue: Foreign value
|
||||
dueTotal: Due day
|
||||
noMatch: Do not match
|
||||
code: Code
|
||||
net: Net
|
||||
stems: Stems
|
||||
|
@ -69,3 +68,4 @@ invoiceIn:
|
|||
isBooked: Is booked
|
||||
account: Ledger account
|
||||
correctingFk: Rectificative
|
||||
noMatch: No match with the vat({totalTaxableBase})
|
||||
|
|
|
@ -67,3 +67,4 @@ invoiceIn:
|
|||
isBooked: Contabilizada
|
||||
account: Cuenta contable
|
||||
correctingFk: Rectificativa
|
||||
noMatch: No cuadra con el iva({totalTaxableBase})
|
||||
|
|
|
@ -198,20 +198,7 @@ const getLocale = (label) => {
|
|||
<QItemSection>
|
||||
<VnSelect
|
||||
dense
|
||||
filled
|
||||
:label="t('globals.params.departmentFk')"
|
||||
v-model="params.department"
|
||||
option-label="name"
|
||||
option-value="name"
|
||||
url="Departments"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
dense
|
||||
filled
|
||||
rounded
|
||||
:label="t('globals.params.packing')"
|
||||
v-model="params.packing"
|
||||
url="ItemPackingTypes"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<script setup>
|
||||
import ParkingDescriptor from './ParkingDescriptor.vue';
|
||||
import ParkingSummary from './ParkingSummary.vue';
|
||||
</script>
|
||||
<template>
|
||||
<QPopupProxy style="max-width: 10px">
|
||||
<ParkingDescriptor
|
||||
v-if="$attrs.id"
|
||||
v-bind="$attrs.id"
|
||||
:summary="ParkingSummary"
|
||||
:proxy-render="true"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
|
@ -21,6 +21,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
import VnDropdown from 'src/components/common/VnDropdown.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { notify } = useNotify();
|
||||
|
@ -40,7 +41,7 @@ const ticket = computed(() => summary.value?.entity);
|
|||
const editableStates = ref([]);
|
||||
const ticketUrl = ref();
|
||||
const grafanaUrl = 'https://grafana.verdnatura.es';
|
||||
const stateBtnDropdownRef = ref();
|
||||
|
||||
const descriptorData = useArrayData('Ticket');
|
||||
|
||||
onMounted(async () => {
|
||||
|
@ -67,7 +68,6 @@ function isEditable() {
|
|||
}
|
||||
|
||||
async function changeState(value) {
|
||||
stateBtnDropdownRef.value?.hide();
|
||||
const formData = {
|
||||
ticketFk: entityId.value,
|
||||
code: value,
|
||||
|
@ -113,25 +113,12 @@ onMounted(async () => {
|
|||
</div>
|
||||
</template>
|
||||
<template #header-right>
|
||||
<div>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
text-color="white"
|
||||
:label="t('globals.changeState')"
|
||||
:disable="!isEditable()"
|
||||
>
|
||||
<VnSelect
|
||||
:options="editableStates"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="changeState"
|
||||
/>
|
||||
</QBtnDropdown>
|
||||
</div>
|
||||
<VnDropdown
|
||||
:disable="!isEditable()"
|
||||
:options="editableStates"
|
||||
option-value="code"
|
||||
@change-state="changeState"
|
||||
/>
|
||||
</template>
|
||||
<template #menu="{ entity }">
|
||||
<TicketDescriptorMenu :ticket="entity" />
|
||||
|
@ -229,27 +216,23 @@ onMounted(async () => {
|
|||
:value="toDate(entity.landed)"
|
||||
/>
|
||||
<VnLv :label="t('globals.packages')" :value="entity.packages" />
|
||||
<VnLv :value="entity.address.phone">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.consigneePhone') }}
|
||||
<VnLv :label="t('ticket.summary.consigneePhone')">
|
||||
<template #value>
|
||||
<VnLinkPhone :phone-number="entity.address.phone" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="entity.address.mobile">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.consigneeMobile') }}
|
||||
<VnLv :label="t('ticket.summary.consigneeMobile')">
|
||||
<template #value>
|
||||
<VnLinkPhone :phone-number="entity.address.mobile" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="entity.client.phone">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.clientPhone') }}
|
||||
<VnLv :label="t('ticket.summary.clientPhone')">
|
||||
<template #value>
|
||||
<VnLinkPhone :phone-number="entity.client.phone" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="entity.client.mobile">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.clientMobile') }}
|
||||
<VnLv :label="t('ticket.summary.clientMobile')">
|
||||
<template #value>
|
||||
<VnLinkPhone :phone-number="entity.client.mobile" />
|
||||
</template>
|
||||
</VnLv>
|
||||
|
|
|
@ -89,6 +89,13 @@ const entriesTableColumns = computed(() => {
|
|||
showValue: true,
|
||||
},
|
||||
{ label: 'CC', field: 'cc', name: 'cc', align: 'left', showValue: true },
|
||||
{
|
||||
label: t('travel.summary.roundedCc'),
|
||||
field: 'cc',
|
||||
name: 'roundedCc',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: 'Pallet',
|
||||
field: 'pallet',
|
||||
|
@ -191,13 +198,18 @@ const entriesTotals = computed(() => {
|
|||
freightValue: 0,
|
||||
packageValue: 0,
|
||||
cc: 0,
|
||||
roundedCc: 0,
|
||||
pallet: 0,
|
||||
m3: 0,
|
||||
};
|
||||
|
||||
entriesTableRows.value.forEach((row) => {
|
||||
for (const key in totals) {
|
||||
totals[key] += row[key] || 0;
|
||||
if (key === 'roundedCc') {
|
||||
totals['roundedCc'] += Math.ceil(row['cc'] || 0);
|
||||
} else {
|
||||
totals[key] += row[key] || 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -206,6 +218,7 @@ const entriesTotals = computed(() => {
|
|||
freight: toCurrency(totals.freightValue),
|
||||
packageValue: toCurrency(totals.packageValue),
|
||||
cc: totals.cc.toFixed(2),
|
||||
roundedCc: totals.roundedCc,
|
||||
pallet: totals.pallet.toFixed(2),
|
||||
m3: totals.m3.toFixed(2),
|
||||
};
|
||||
|
@ -370,6 +383,11 @@ onMounted(async () => {
|
|||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-roundedCc="{ col, value }">
|
||||
<QTd>
|
||||
{{ Math.ceil(value) || 0 }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-observation="{ value }">
|
||||
<QTd>
|
||||
<QIcon name="insert_drive_file" color="primary" size="24px">
|
||||
|
@ -386,6 +404,7 @@ onMounted(async () => {
|
|||
<QTd class="text-bold">{{ entriesTotals.freight }}</QTd>
|
||||
<QTd class="text-bold">{{ entriesTotals.packageValue }}</QTd>
|
||||
<QTd class="text-bold">{{ entriesTotals.cc }}</QTd>
|
||||
<QTd class="text-bold">{{ entriesTotals.roundedCc }}</QTd>
|
||||
<QTd class="text-bold">{{ entriesTotals.pallet }}</QTd>
|
||||
<QTd class="text-bold">{{ entriesTotals.m3 }}</QTd>
|
||||
</template>
|
||||
|
|
|
@ -141,7 +141,6 @@ const columns = computed(() => [
|
|||
label: 'id',
|
||||
field: 'id',
|
||||
name: 'id',
|
||||
align: 'center',
|
||||
showValue: true,
|
||||
sortable: true,
|
||||
},
|
||||
|
@ -165,7 +164,7 @@ const columns = computed(() => [
|
|||
label: t('globals.amount'),
|
||||
name: 'invoiceAmount',
|
||||
field: 'entries',
|
||||
align: 'left',
|
||||
align: 'right',
|
||||
showValue: true,
|
||||
sortable: true,
|
||||
format: (value) =>
|
||||
|
@ -190,7 +189,7 @@ const columns = computed(() => [
|
|||
label: t('globals.packages'),
|
||||
field: 'stickers',
|
||||
name: 'stickers',
|
||||
align: 'left',
|
||||
align: 'right',
|
||||
showValue: true,
|
||||
sortable: true,
|
||||
},
|
||||
|
@ -198,7 +197,7 @@ const columns = computed(() => [
|
|||
label: '%',
|
||||
field: '',
|
||||
name: 'percentage',
|
||||
align: 'center',
|
||||
align: 'right',
|
||||
showValue: false,
|
||||
sortable: true,
|
||||
},
|
||||
|
@ -214,7 +213,7 @@ const columns = computed(() => [
|
|||
label: t('extraCommunity.physicKg'),
|
||||
field: 'loadedKg',
|
||||
name: 'loadedKg',
|
||||
align: 'left',
|
||||
align: 'right',
|
||||
showValue: true,
|
||||
sortable: true,
|
||||
},
|
||||
|
@ -222,7 +221,7 @@ const columns = computed(() => [
|
|||
label: 'KG Vol.',
|
||||
field: 'volumeKg',
|
||||
name: 'volumeKg',
|
||||
align: 'left',
|
||||
align: 'right',
|
||||
showValue: true,
|
||||
sortable: true,
|
||||
},
|
||||
|
@ -277,7 +276,6 @@ async function getData() {
|
|||
const onStoreDataChange = () => {
|
||||
const newData = JSON.parse(JSON.stringify(arrayData.store.data)) || [];
|
||||
rows.value = newData;
|
||||
// el objetivo de esto es guardar una copia de los valores iniciales de todas las rows para corroborar si la data cambio antes de guardar los cambios
|
||||
originalRowDataCopy.value = JSON.parse(JSON.stringify(newData));
|
||||
};
|
||||
|
||||
|
@ -300,20 +298,17 @@ const openReportPdf = () => {
|
|||
};
|
||||
|
||||
const saveFieldValue = async (val, field, index) => {
|
||||
// Evitar la solicitud de guardado si el valor no ha cambiado
|
||||
if (originalRowDataCopy.value[index][field] == val) return;
|
||||
|
||||
const id = rows.value[index].id;
|
||||
const params = { [field]: val };
|
||||
await axios.patch(`Travels/${id}`, params);
|
||||
// Actualizar la copia de los datos originales con el nuevo valor
|
||||
originalRowDataCopy.value[index][field] = val;
|
||||
|
||||
await arrayData.fetch({ append: false });
|
||||
};
|
||||
|
||||
const stopEventPropagation = (event, col) => {
|
||||
// Detener la propagación del evento de los siguientes elementos para evitar el click sobre la row que dispararía la función navigateToTravelId
|
||||
if (!['ref', 'id', 'cargoSupplierNickname', 'kg'].includes(col.name)) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -335,14 +330,12 @@ onMounted(async () => {
|
|||
await getData();
|
||||
});
|
||||
|
||||
// Handler del evento @dragstart (inicio del drag) y guarda información inicial
|
||||
const handleDragStart = (event, rowIndex, entryIndex) => {
|
||||
draggedRowIndex.value = rowIndex;
|
||||
entryRowIndex.value = entryIndex;
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
};
|
||||
|
||||
// Handler del evento @dragenter (cuando haces drag sobre une elemento y lo arrastras sobre un posible target de drop) y actualiza el targetIndex
|
||||
const handleDragEnter = (_, targetIndex) => {
|
||||
targetRowIndex.value = targetIndex;
|
||||
};
|
||||
|
@ -356,11 +349,8 @@ const saveRowDrop = async (targetRowIndex) => {
|
|||
const moveRow = async (draggedRowIndex, targetRowIndex, entryIndex) => {
|
||||
try {
|
||||
if (draggedRowIndex === targetRowIndex) return;
|
||||
// Remover entry de la row original
|
||||
draggedEntry.value = rows.value[draggedRowIndex].entries.splice(entryIndex, 1)[0];
|
||||
//Si la row de destino por alguna razón no tiene la propiedad entry la creamos
|
||||
if (!rows.value[targetRowIndex].entries) rows.value[targetRowIndex].entries = [];
|
||||
// Añadir entry a la row de destino
|
||||
rows.value[targetRowIndex].entries.push(draggedEntry.value);
|
||||
|
||||
await saveRowDrop(targetRowIndex);
|
||||
|
@ -370,13 +360,11 @@ const moveRow = async (draggedRowIndex, targetRowIndex, entryIndex) => {
|
|||
}
|
||||
};
|
||||
|
||||
// Handler de cuando haces un drop tanto dentro como fuera de la tabla para limpiar acciones y data
|
||||
const handleDragEnd = () => {
|
||||
stopScroll();
|
||||
cleanDragAndDropData();
|
||||
};
|
||||
|
||||
// Handler del evento @drop (cuando soltas el elemento draggeado sobre un target)
|
||||
const handleDrop = () => {
|
||||
if (
|
||||
!draggedRowIndex.value &&
|
||||
|
@ -399,7 +387,6 @@ const cleanDragAndDropData = () => {
|
|||
const scrollInterval = ref(null);
|
||||
|
||||
const startScroll = (direction) => {
|
||||
// Iniciar el scroll en la dirección especificada
|
||||
if (!scrollInterval.value) {
|
||||
scrollInterval.value = requestAnimationFrame(() => scroll(direction));
|
||||
}
|
||||
|
@ -413,14 +400,12 @@ const stopScroll = () => {
|
|||
};
|
||||
|
||||
const scroll = (direction) => {
|
||||
// Controlar el desplazamiento en la dirección especificada
|
||||
const yOffset = direction === 'up' ? -2 : 2;
|
||||
window.scrollBy(0, yOffset);
|
||||
|
||||
const windowHeight = window.innerHeight;
|
||||
const documentHeight = document.body.offsetHeight;
|
||||
|
||||
// Verificar si se alcanzaron los límites de la ventana para detener el desplazamiento
|
||||
if (
|
||||
(direction === 'up' && window.scrollY > 0) ||
|
||||
(direction === 'down' && windowHeight + window.scrollY < documentHeight)
|
||||
|
@ -431,13 +416,10 @@ const scroll = (direction) => {
|
|||
}
|
||||
};
|
||||
|
||||
// Handler del scroll mientras se hace el drag de una row
|
||||
const handleDragScroll = (event) => {
|
||||
// Obtener la posición y dimensiones del cursor
|
||||
const y = event.clientY;
|
||||
const windowHeight = window.innerHeight;
|
||||
|
||||
// Verificar si el cursor está cerca del borde superior o inferior de la ventana
|
||||
const nearTop = y < 150;
|
||||
const nearBottom = y > windowHeight - 100;
|
||||
|
||||
|
@ -547,7 +529,7 @@ watch(route, () => {
|
|||
? `${props.row.percentageKg}%`
|
||||
: '-'
|
||||
"
|
||||
class="text-left q-py-xs q-px-sm"
|
||||
class="text-right q-py-xs q-px-sm"
|
||||
:color="getColor(props.row.percentageKg)"
|
||||
/>
|
||||
<span
|
||||
|
@ -566,7 +548,6 @@ watch(route, () => {
|
|||
]"
|
||||
v-text="col.value"
|
||||
/>
|
||||
<!-- Main Row Descriptors -->
|
||||
<TravelDescriptorProxy
|
||||
v-if="col.name === 'id'"
|
||||
:id="props.row.id"
|
||||
|
@ -597,7 +578,7 @@ watch(route, () => {
|
|||
index === props.row.entries.length - 1,
|
||||
}"
|
||||
>
|
||||
<QTd>
|
||||
<QTd class="text-right">
|
||||
<QBtn dense flat class="link">{{ entry.id }} </QBtn>
|
||||
<EntryDescriptorProxy :id="entry.id" />
|
||||
</QTd>
|
||||
|
@ -605,7 +586,7 @@ watch(route, () => {
|
|||
<QBtn flat class="link" dense>{{ entry.supplierName }}</QBtn>
|
||||
<SupplierDescriptorProxy :id="entry.supplierFk" />
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QTd class="text-center">
|
||||
<QIcon
|
||||
v-if="entry.isCustomInspectionRequired"
|
||||
name="warning"
|
||||
|
@ -615,21 +596,21 @@ watch(route, () => {
|
|||
>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QTd class="text-right">
|
||||
<span>{{ toCurrency(entry.invoiceAmount) }}</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<span>{{ entry.reference }}</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QTd class="text-right">
|
||||
<span>{{ entry.stickers }}</span>
|
||||
</QTd>
|
||||
<QTd />
|
||||
<QTd></QTd>
|
||||
<QTd>
|
||||
<QTd class="text-right">
|
||||
<span>{{ entry.loadedkg }}</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QTd class="text-right">
|
||||
<span>{{ entry.volumeKg }}</span>
|
||||
</QTd>
|
||||
<QTd />
|
||||
|
@ -664,9 +645,6 @@ watch(route, () => {
|
|||
:deep(.q-table) {
|
||||
border-collapse: collapse;
|
||||
|
||||
th {
|
||||
padding: 0;
|
||||
}
|
||||
tbody tr td {
|
||||
&:nth-child(1) {
|
||||
max-width: 65px;
|
||||
|
@ -675,6 +653,10 @@ watch(route, () => {
|
|||
padding: 0;
|
||||
}
|
||||
}
|
||||
thead > tr > th {
|
||||
padding: 3px;
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
}
|
||||
|
||||
.q-td :deep(input) {
|
||||
|
|
|
@ -80,7 +80,7 @@ defineExpose({ states });
|
|||
/>
|
||||
<VnSelect
|
||||
:label="t('travel.warehouseOut')"
|
||||
v-model="params.warehouseOut"
|
||||
v-model="params.warehouseOutFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="warehouses"
|
||||
:use-like="false"
|
||||
|
@ -128,6 +128,7 @@ en:
|
|||
ref: Reference
|
||||
agency: Agency
|
||||
warehouseInFk: Warehouse In
|
||||
warehouseOutFk: Warehouse Out
|
||||
shipped: Shipped
|
||||
shipmentHour: Shipment Hour
|
||||
warehouseOut: Warehouse Out
|
||||
|
@ -141,6 +142,7 @@ es:
|
|||
ref: Referencia
|
||||
agency: Agencia
|
||||
warehouseInFk: Alm.Entrada
|
||||
warehouseOutFk: Alm.Salida
|
||||
shipped: F.Envío
|
||||
shipmentHour: Hora de envío
|
||||
warehouseOut: Alm.Salida
|
||||
|
|
|
@ -11,7 +11,7 @@ export const useDescriptorStore = defineStore('descriptorStore', () => {
|
|||
const files = import.meta.glob(`/src/**/*DescriptorProxy.vue`);
|
||||
const moduleParser = {
|
||||
account: 'user',
|
||||
client: 'customer',
|
||||
customer: 'client',
|
||||
};
|
||||
for (const file in files) {
|
||||
const name = file.split('/').at(-1).slice(0, -19).toLowerCase();
|
||||
|
|
|
@ -41,12 +41,12 @@ describe('InvoiceInList', () => {
|
|||
cy.fillInForm({ ...mock }, { attr: 'data-cy' });
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.intercept('GET', /\/api\/InvoiceIns\/\d+\/getTotals$/).as('invoice');
|
||||
cy.wait('@invoice').then(() =>
|
||||
cy.wait('@invoice').then(() => {
|
||||
cy.validateDescriptor({
|
||||
title: mockInvoiceRef,
|
||||
listBox: { 0: '11/16/2001', 3: 'The farmer' },
|
||||
}),
|
||||
);
|
||||
cy.get('[data-cy="vnLvCompany"]').should('contain.text', 'ORN');
|
||||
});
|
||||
cy.dataCy('invoiceInBasicDataCompanyFk').should('have.value', 'ORN');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
describe('RouteAutonomous', () => {
|
||||
describe.skip('RouteAutonomous', () => {
|
||||
const getLinkSelector = (colField) =>
|
||||
`tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;
|
||||
|
||||
|
|
Loading…
Reference in New Issue