0
0
Fork 0

Merge branch 'dev' into 7411-addInfoOnVnCheckboxAndVnInput

This commit is contained in:
Alex Moreno 2025-02-11 08:38:51 +00:00
commit c975943eb1
38 changed files with 380 additions and 159 deletions

View File

@ -0,0 +1,2 @@
export const langs = ['en', 'es'];
export const decimalPlaces = 2;

View File

@ -328,7 +328,6 @@ en:
active: Is active
visible: Is visible
floramondo: Is floramondo
salesPersonFk: Buyer
categoryFk: Category
es:
@ -339,7 +338,6 @@ es:
active: Activo
visible: Visible
floramondo: Floramondo
salesPersonFk: Comprador
categoryFk: Categoría
Plant: Planta natural
Flower: Flor fresca

View File

@ -171,7 +171,8 @@ onMounted(() => {
});
const arrayDataKey =
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
$props.dataKey ??
($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
const arrayData = useArrayData(arrayDataKey, {
url: $props.url,
@ -220,7 +221,7 @@ async function fetchFilter(val) {
optionFilterValue.value ??
(new RegExp(/\d/g).test(val)
? optionValue.value
: optionFilter.value ?? optionLabel.value);
: (optionFilter.value ?? optionLabel.value));
let defaultWhere = {};
if ($props.filterOptions.length) {
@ -239,7 +240,7 @@ async function fetchFilter(val) {
const { data } = await arrayData.applyFilter(
{ filter: filterOptions },
{ updateRouter: false }
{ updateRouter: false },
);
setOptions(data);
return data;
@ -272,7 +273,7 @@ async function filterHandler(val, update) {
ref.setOptionIndex(-1);
ref.moveOptionSelection(1, true);
}
}
},
);
}
@ -308,7 +309,7 @@ function handleKeyDown(event) {
if (inputValue) {
const matchingOption = myOptions.value.find(
(option) =>
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase(),
);
if (matchingOption) {
@ -320,11 +321,11 @@ function handleKeyDown(event) {
}
const focusableElements = document.querySelectorAll(
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])'
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])',
);
const currentIndex = Array.prototype.indexOf.call(
focusableElements,
event.target
event.target,
);
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
focusableElements[currentIndex + 1].focus();

View File

@ -1,9 +1,7 @@
<script setup>
import { computed } from 'vue';
import VnSelect from 'components/common/VnSelect.vue';
const model = defineModel({ type: [String, Number, Object] });
const url = 'Suppliers';
</script>
<template>
@ -11,11 +9,13 @@ const url = 'Suppliers';
:label="$t('globals.supplier')"
v-bind="$attrs"
v-model="model"
:url="url"
url="Suppliers"
option-value="id"
option-label="nickname"
:fields="['id', 'name', 'nickname', 'nif']"
:filter-options="['id', 'name', 'nickname', 'nif']"
sort-by="name ASC"
data-cy="vnSupplierSelect"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">

View File

@ -57,7 +57,7 @@ defineExpose({ getData });
onBeforeMount(async () => {
arrayData = useArrayData($props.dataKey, {
url: $props.url,
filter: $props.filter,
userFilter: $props.filter,
skip: 0,
oneRecord: true,
});

View File

@ -18,7 +18,12 @@ import VnInput from 'components/common/VnInput.vue';
const emit = defineEmits(['onFetch']);
const $attrs = useAttrs();
const originalAttrs = useAttrs();
const $attrs = computed(() => {
const { style, ...rest } = originalAttrs;
return rest;
});
const isRequired = computed(() => {
return Object.keys($attrs).includes('required')

View File

@ -352,7 +352,7 @@ globals:
from: Desde
to: Hasta
supplierFk: Proveedor
supplierRef: Ref. proveedor
supplierRef: Nº factura
serial: Serie
amount: Importe
awbCode: AWB
@ -653,7 +653,6 @@ supplier:
tableVisibleColumns:
nif: NIF/CIF
account: Cuenta
summary:
responsible: Responsable
verified: Verificado

View File

@ -1,12 +1,12 @@
<script setup>
import { Dark, Quasar } from 'quasar';
import { computed } from 'vue';
import { computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { localeEquivalence } from 'src/i18n/index';
import quasarLang from 'src/utils/quasarLang';
import { langs } from 'src/boot/defaults/constants.js';
const { t, locale } = useI18n();
const userLocale = computed({
get() {
return locale.value;
@ -28,7 +28,6 @@ const darkMode = computed({
Dark.set(value);
},
});
const langs = ['en', 'es'];
</script>
<template>

View File

@ -23,7 +23,7 @@ onMounted(async () => {
<CardDescriptor
ref="descriptor"
:url="`VnUsers/preview`"
:filter="filter"
:filter="{ ...filter, where: { id: entityId } }"
module="Account"
data-key="Account"
title="nickname"

View File

@ -86,7 +86,7 @@ onMounted(async () => {
/>
</template>
</VnLv>
<VnLv :label="t('claim.zone')">
<VnLv v-if="entity.ticket?.zone?.id" :label="t('claim.zone')">
<template #value>
<span class="link">
{{ entity.ticket?.zone?.name }}
@ -98,11 +98,10 @@ onMounted(async () => {
:label="t('claim.province')"
:value="entity.ticket?.address?.province?.name"
/>
<VnLv :label="t('claim.ticketId')">
<VnLv v-if="entity.ticketFk" :label="t('claim.ticketId')">
<template #value>
<span class="link">
{{ entity.ticketFk }}
<TicketDescriptorProxy :id="entity.ticketFk" />
</span>
</template>

View File

@ -1,5 +1,5 @@
<script setup>
import { computed } from 'vue';
import { computed, useAttrs } from 'vue';
import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import VnNotes from 'src/components/ui/VnNotes.vue';
@ -7,6 +7,7 @@ import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const state = useState();
const user = state.getUser();
const $attrs = useAttrs();
const $props = defineProps({
id: { type: [Number, String], default: null },

View File

@ -131,7 +131,7 @@ const STATE_COLOR = {
prefix="claim"
:array-data-props="{
url: 'Claims/filter',
order: ['cs.priority ASC', 'created ASC'],
order: 'cs.priority ASC, created ASC',
}"
>
<template #advanced-menu>

View File

@ -117,7 +117,7 @@ const toCustomerAddressEdit = (addressId) => {
data-key="CustomerAddresses"
order="id DESC"
ref="vnPaginateRef"
:user-filter="addressFilter"
:filter="addressFilter"
:url="`Clients/${route.params.id}/addresses`"
/>
<div class="full-width flex justify-center">
@ -189,11 +189,11 @@ const toCustomerAddressEdit = (addressId) => {
<QSeparator
class="q-mx-lg"
v-if="item.observations.length"
v-if="item?.observations?.length"
vertical
/>
<div v-if="item.observations.length">
<div v-if="item?.observations?.length">
<div
:key="obIndex"
class="flex q-mb-sm"

View File

@ -61,6 +61,23 @@ const columns = computed(() => [
columnFilter: false,
cardVisible: true,
},
{
align: 'left',
name: 'buyerId',
label: t('customer.params.buyerId'),
component: 'select',
attrs: {
url: 'TicketRequests/getItemTypeWorker',
optionLabel: 'nickname',
optionValue: 'id',
fields: ['id', 'nickname'],
sortBy: ['nickname ASC'],
optionFilter: 'firstName',
},
cardVisible: false,
visible: false,
},
{
name: 'description',
align: 'left',
@ -74,6 +91,7 @@ const columns = computed(() => [
name: 'quantity',
label: t('globals.quantity'),
cardVisible: true,
visible: true,
columnFilter: {
inWhere: true,
},
@ -138,11 +156,11 @@ const updateDateParams = (value, params) => {
const campaign = campaignList.value.find((c) => c.id === value);
if (!campaign) return;
const { dated, previousDays, scopeDays } = campaign;
const _date = new Date(dated);
const [from, to] = dateRange(_date);
params.from = new Date(from.setDate(from.getDate() - previousDays)).toISOString();
params.to = new Date(to.setDate(to.getDate() + scopeDays)).toISOString();
const { dated, scopeDays } = campaign;
const from = new Date(dated);
from.setDate(from.getDate() - scopeDays);
params.from = from;
params.to = dated;
return params;
};
</script>
@ -205,24 +223,57 @@ const updateDateParams = (value, params) => {
<template #moreFilterPanel="{ params }">
<div class="column no-wrap flex-center q-gutter-y-md q-mt-xs q-pr-xl">
<VnSelect
v-model="params.campaign"
:options="campaignList"
:label="t('globals.campaign')"
:filled="true"
class="q-px-sm q-pt-none fit"
url="ItemTypes"
v-model="params.typeId"
:label="t('item.list.typeName')"
:fields="['id', 'name', 'categoryFk']"
:include="'category'"
:sortBy="'name ASC'"
dense
option-label="code"
@update:model-value="(data) => updateDateParams(data, params)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.code }}
{{
new Date(scope.opt?.dated).getFullYear()
}}</QItemLabel
>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>{{
scope.opt?.category?.name
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect
:filled="true"
class="q-px-sm q-pt-none fit"
url="ItemCategories"
v-model="params.categoryId"
:label="t('item.list.category')"
:fields="['id', 'name']"
:sortBy="'name ASC'"
dense
@update:model-value="(data) => updateDateParams(data, params)"
/>
<VnSelect
v-model="params.campaign"
:options="campaignList"
:label="t('globals.campaign')"
:filled="true"
class="q-px-sm q-pt-none fit"
:option-label="(opt) => t(opt.code)"
:fields="['id', 'code', 'dated', 'scopeDays']"
@update:model-value="(data) => updateDateParams(data, params)"
dense
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel> {{ t(scope.opt?.code) }} </QItemLabel>
<QItemLabel caption>
{{ new Date(scope.opt?.dated).getFullYear() }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
@ -247,7 +298,19 @@ const updateDateParams = (value, params) => {
</template>
<i18n>
en:
valentinesDay: Valentine's Day
mothersDay: Mother's Day
allSaints: All Saints' Day
es:
Enter a new search: Introduce una nueva búsqueda
Group by items: Agrupar por artículos
valentinesDay: Día de San Valentín
mothersDay: Día de la Madre
allSaints: Día de Todos los Santos
Campaign consumption: Consumo campaña
Campaign: Campaña
From: Desde
To: Hasta
</i18n>

View File

@ -107,6 +107,9 @@ customer:
defaulterSinced: Defaulted Since
hasRecovery: Has Recovery
socialName: Social name
typeId: Type
buyerId: Buyer
categoryId: Category
city: City
phone: Phone
postcode: Postcode

View File

@ -108,6 +108,9 @@ customer:
hasRecovery: Tiene recobro
socialName: Razón social
campaign: Campaña
typeId: Familia
buyerId: Comprador
categoryId: Reino
city: Ciudad
phone: Teléfono
postcode: Código postal

View File

@ -54,8 +54,8 @@ const transferEntry = async () => {
<i18n>
en:
transferEntryDialog: The entries will be transferred to the next day
transferEntry: Transfer Entry
transferEntry: Partial delay
es:
transferEntryDialog: Se van a transferir las compras al dia siguiente
transferEntry: Transferir Entrada
transferEntry: Retraso parcial
</i18n>

View File

@ -125,7 +125,7 @@ function deleteFile(dmsFk) {
<VnInput
clearable
clear-icon="close"
:label="t('Supplier ref')"
:label="t('invoiceIn.supplierRef')"
v-model="data.supplierRef"
/>
</VnRow>
@ -149,6 +149,7 @@ function deleteFile(dmsFk) {
option-value="id"
option-label="id"
:filter-options="['id', 'name']"
data-cy="UnDeductibleVatSelect"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -310,7 +311,6 @@ function deleteFile(dmsFk) {
supplierFk: Supplier
es:
supplierFk: Proveedor
Supplier ref: Ref. proveedor
Expedition date: Fecha expedición
Operation date: Fecha operación
Undeductible VAT: Iva no deducible

View File

@ -186,7 +186,7 @@ const createInvoiceInCorrection = async () => {
clickable
@click="book(entityId)"
>
<QItemSection>{{ t('invoiceIn.descriptorMenu.toBook') }}</QItemSection>
<QItemSection>{{ t('invoiceIn.descriptorMenu.book') }}</QItemSection>
</QItem>
</template>
</InvoiceInToBook>
@ -197,7 +197,7 @@ const createInvoiceInCorrection = async () => {
@click="triggerMenu('unbook')"
>
<QItemSection>
{{ t('invoiceIn.descriptorMenu.toUnbook') }}
{{ t('invoiceIn.descriptorMenu.unbook') }}
</QItemSection>
</QItem>
<QItem

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, onBeforeMount } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
@ -12,6 +12,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import useNotify from 'src/composables/useNotify.js';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import { toCurrency } from 'filters/index';
const route = useRoute();
const { notify } = useNotify();
@ -26,7 +27,7 @@ const invoiceInFormRef = ref();
const invoiceId = +route.params.id;
const filter = { where: { invoiceInFk: invoiceId } };
const areRows = ref(false);
const totals = ref();
const columns = computed(() => [
{
name: 'duedate',
@ -66,6 +67,8 @@ const columns = computed(() => [
},
]);
const totalAmount = computed(() => getTotal(invoiceInFormRef.value.formData, 'amount'));
const isNotEuro = (code) => code != 'EUR';
async function insert() {
@ -73,6 +76,10 @@ async function insert() {
await invoiceInFormRef.value.reload();
notify(t('globals.dataSaved'), 'positive');
}
onBeforeMount(async () => {
totals.value = (await axios.get(`InvoiceIns/${invoiceId}/getTotals`)).data;
});
</script>
<template>
<FetchData
@ -153,7 +160,7 @@ async function insert() {
<QTd />
<QTd />
<QTd>
{{ getTotal(rows, 'amount', { currency: 'default' }) }}
{{ toCurrency(totalAmount) }}
</QTd>
<QTd>
<template v-if="isNotEuro(invoiceIn.currency.code)">
@ -235,7 +242,16 @@ async function insert() {
v-shortcut="'+'"
size="lg"
round
@click="!areRows ? insert() : invoiceInFormRef.insert()"
@click="
() => {
if (!areRows) insert();
else
invoiceInFormRef.insert({
amount: (totals.totalTaxableBase - totalAmount).toFixed(2),
invoiceInFk: invoiceId,
});
}
"
/>
</QPageSticky>
</template>

View File

@ -193,7 +193,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<InvoiceIntoBook>
<template #content="{ book }">
<QBtn
:label="t('To book')"
:label="t('Book')"
color="orange-11"
text-color="black"
@click="book(entityId)"
@ -224,10 +224,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</span>
</template>
</VnLv>
<VnLv
:label="t('invoiceIn.list.supplierRef')"
:value="entity.supplierRef"
/>
<VnLv :label="t('invoiceIn.supplierRef')" :value="entity.supplierRef" />
<VnLv
:label="t('invoiceIn.summary.currency')"
:value="entity.currency?.code"
@ -357,7 +354,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
entity.totals.totalTaxableBaseForeignValue &&
toCurrency(
entity.totals.totalTaxableBaseForeignValue,
currency
currency,
)
}}</QTd>
</QTr>
@ -392,7 +389,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
entity.totals.totalDueDayForeignValue &&
toCurrency(
entity.totals.totalDueDayForeignValue,
currency
currency,
)
}}
</QTd>
@ -472,5 +469,5 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
Search invoice: Buscar factura recibida
You can search by invoice reference: Puedes buscar por referencia de la factura
Totals: Totales
To book: Contabilizar
Book: Contabilizar
</i18n>

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'src/composables/useArrayData';
@ -25,7 +25,6 @@ const sageTaxTypes = ref([]);
const sageTransactionTypes = ref([]);
const rowsSelected = ref([]);
const invoiceInFormRef = ref();
const expenseRef = ref();
defineProps({
actionIcon: {
@ -97,6 +96,20 @@ const columns = computed(() => [
},
]);
const taxableBaseTotal = computed(() => {
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
});
const taxRateTotal = computed(() => {
return getTotal(invoiceInFormRef.value.formData, null, {
cb: taxRate,
});
});
const combinedTotal = computed(() => {
return +taxableBaseTotal.value + +taxRateTotal.value;
});
const filter = {
fields: [
'id',
@ -125,7 +138,7 @@ function taxRate(invoiceInTax) {
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
}
function autocompleteExpense(evt, row, col) {
function autocompleteExpense(evt, row, col, ref) {
const val = evt.target.value;
if (!val) return;
@ -134,22 +147,17 @@ function autocompleteExpense(evt, row, col) {
({ id }) => id == useAccountShortToStandard(param),
);
expenseRef.value.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
ref.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
}
const taxableBaseTotal = computed(() => {
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
});
const taxRateTotal = computed(() => {
return getTotal(invoiceInFormRef.value.formData, null, {
cb: taxRate,
function setCursor(ref) {
nextTick(() => {
const select = ref.vnSelectDialogRef
? ref.vnSelectDialogRef.vnSelectRef
: ref.vnSelectRef;
select.$el.querySelector('input').setSelectionRange(0, 0);
});
});
const combinedTotal = computed(() => {
return +taxableBaseTotal.value + +taxRateTotal.value;
});
}
</script>
<template>
<FetchData
@ -187,14 +195,24 @@ const combinedTotal = computed(() => {
<template #body-cell-expense="{ row, col }">
<QTd>
<VnSelectDialog
ref="expenseRef"
:ref="`expenseRef-${row.$index}`"
v-model="row[col.model]"
:options="col.options"
:option-value="col.optionValue"
:option-label="col.optionLabel"
:filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
@keydown.tab="autocompleteExpense($event, row, col)"
@keydown.tab="
autocompleteExpense(
$event,
row,
col,
$refs[`expenseRef-${row.$index}`],
)
"
@update:model-value="
setCursor($refs[`expenseRef-${row.$index}`])
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -210,7 +228,7 @@ const combinedTotal = computed(() => {
</QTd>
</template>
<template #body-cell-taxablebase="{ row }">
<QTd>
<QTd shrink>
<VnInputNumber
clear-icon="close"
v-model="row.taxableBase"
@ -221,12 +239,16 @@ const combinedTotal = computed(() => {
<template #body-cell-sageiva="{ row, col }">
<QTd>
<VnSelect
:ref="`sageivaRef-${row.$index}`"
v-model="row[col.model]"
:options="col.options"
:option-value="col.optionValue"
:option-label="col.optionLabel"
:filter-options="['id', 'vat']"
data-cy="vat-sageiva"
@update:model-value="
setCursor($refs[`sageivaRef-${row.$index}`])
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -244,11 +266,15 @@ const combinedTotal = computed(() => {
<template #body-cell-sagetransaction="{ row, col }">
<QTd>
<VnSelect
:ref="`sagetransactionRef-${row.$index}`"
v-model="row[col.model]"
:options="col.options"
:option-value="col.optionValue"
:option-label="col.optionLabel"
:filter-options="['id', 'transaction']"
@update:model-value="
setCursor($refs[`sagetransactionRef-${row.$index}`])
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -266,7 +292,7 @@ const combinedTotal = computed(() => {
</QTd>
</template>
<template #body-cell-foreignvalue="{ row }">
<QTd>
<QTd shrink>
<VnInputNumber
:class="{
'no-pointer-events': !isNotEuro(currency),

View File

@ -56,7 +56,7 @@ const cols = computed(() => [
{
align: 'left',
name: 'supplierRef',
label: t('invoiceIn.list.supplierRef'),
label: t('invoiceIn.supplierRef'),
},
{
align: 'left',
@ -177,7 +177,7 @@ const cols = computed(() => [
:required="true"
/>
<VnInput
:label="t('invoiceIn.list.supplierRef')"
:label="t('invoiceIn.supplierRef')"
v-model="data.supplierRef"
/>
<VnSelect

View File

@ -4,6 +4,7 @@ import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import { useArrayData } from 'src/composables/useArrayData';
import qs from 'qs';
const { notify, dialog } = useQuasar();
const { t } = useI18n();
@ -12,29 +13,51 @@ defineExpose({ checkToBook });
const { store } = useArrayData();
async function checkToBook(id) {
let directBooking = true;
let messages = [];
const hasProblemWithTax = (
await axios.get('InvoiceInTaxes/count', {
params: {
where: JSON.stringify({
invoiceInFk: id,
or: [{ taxTypeSageFk: null }, { transactionTypeSageFk: null }],
}),
},
})
).data?.count;
if (hasProblemWithTax)
messages.push(t('The VAT and Transaction fields have not been informed'));
const { data: totals } = await axios.get(`InvoiceIns/${id}/getTotals`);
const taxableBaseNotEqualDueDay = totals.totalDueDay != totals.totalTaxableBase;
const vatNotEqualDueDay = totals.totalDueDay != totals.totalVat;
if (taxableBaseNotEqualDueDay && vatNotEqualDueDay) directBooking = false;
if (taxableBaseNotEqualDueDay && vatNotEqualDueDay)
messages.push(t('The sum of the taxable bases does not match the due dates'));
const { data: dueDaysCount } = await axios.get('InvoiceInDueDays/count', {
where: {
invoiceInFk: id,
dueDated: { gte: Date.vnNew() },
},
});
const dueDaysCount = (
await axios.get('InvoiceInDueDays/count', {
params: {
where: JSON.stringify({
invoiceInFk: id,
dueDated: { gte: Date.vnNew() },
}),
},
})
).data?.count;
if (dueDaysCount) directBooking = false;
if (dueDaysCount) messages.push(t('Some due dates are less than or equal to today'));
if (directBooking) return toBook(id);
dialog({
component: VnConfirm,
componentProps: { title: t('Are you sure you want to book this invoice?') },
}).onOk(async () => await toBook(id));
if (!messages.length) toBook(id);
else
dialog({
component: VnConfirm,
componentProps: {
title: t('Are you sure you want to book this invoice?'),
message: messages.reduce((acc, msg) => `${acc}<p>${msg}</p>`, ''),
},
}).onOk(() => toBook(id));
}
async function toBook(id) {
@ -59,4 +82,7 @@ async function toBook(id) {
es:
Are you sure you want to book this invoice?: ¿Estás seguro de querer asentar esta factura?
It was not able to book the invoice: No se pudo contabilizar la factura
Some due dates are less than or equal to today: Algún vencimiento tiene una fecha menor o igual que hoy
The sum of the taxable bases does not match the due dates: La suma de las bases imponibles no coincide con la de los vencimientos
The VAT and Transaction fields have not been informed: No se han informado los campos de iva y/o transacción
</i18n>

View File

@ -3,10 +3,10 @@ invoiceIn:
searchInfo: Search incoming invoices by ID or supplier fiscal name
serial: Serial
isBooked: Is booked
supplierRef: Invoice nº
list:
ref: Reference
supplier: Supplier
supplierRef: Supplier ref.
file: File
issued: Issued
dueDated: Due dated
@ -19,8 +19,6 @@ invoiceIn:
unbook: Unbook
delete: Delete
clone: Clone
toBook: To book
toUnbook: To unbook
deleteInvoice: Delete invoice
invoiceDeleted: invoice deleted
cloneInvoice: Clone invoice
@ -70,4 +68,3 @@ invoiceIn:
isBooked: Is booked
account: Ledger account
correctingFk: Rectificative

View File

@ -3,10 +3,10 @@ invoiceIn:
searchInfo: Buscar facturas recibidas por ID o nombre fiscal del proveedor
serial: Serie
isBooked: Contabilizada
supplierRef: Nº factura
list:
ref: Referencia
supplier: Proveedor
supplierRef: Ref. proveedor
issued: F. emisión
dueDated: F. vencimiento
file: Fichero
@ -15,12 +15,10 @@ invoiceIn:
descriptor:
ticketList: Listado de tickets
descriptorMenu:
book: Asentar
unbook: Desasentar
book: Contabilizar
unbook: Descontabilizar
delete: Eliminar
clone: Clonar
toBook: Contabilizar
toUnbook: Descontabilizar
deleteInvoice: Eliminar factura
invoiceDeleted: Factura eliminada
cloneInvoice: Clonar factura
@ -68,4 +66,3 @@ invoiceIn:
isBooked: Contabilizada
account: Cuenta contable
correctingFk: Rectificativa

View File

@ -97,12 +97,19 @@ const columns = computed(() => [
},
{
align: 'left',
name: 'companyCode',
name: 'companyFk',
label: t('globals.company'),
cardVisible: true,
component: 'select',
attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' },
columnField: { component: null },
attrs: {
url: 'Companies',
optionLabel: 'code',
optionValue: 'id',
},
columnField: {
component: null,
},
format: (row, dashIfEmpty) => dashIfEmpty(row.companyCode),
},
{
align: 'left',

View File

@ -65,10 +65,19 @@ const columns = computed(() => [
name: 'name',
...defaultColumnAttrs,
create: true,
columnFilter: {
component: 'select',
attrs: {
url: 'Items',
fields: ['id', 'name', 'subName'],
optionLabel: 'name',
optionValue: 'name',
uppercase: false,
},
},
},
{
label: t('item.fixedPrice.groupingPrice'),
field: 'rate2',
name: 'rate2',
...defaultColumnAttrs,
component: 'input',
@ -76,7 +85,6 @@ const columns = computed(() => [
},
{
label: t('item.fixedPrice.packingPrice'),
field: 'rate3',
name: 'rate3',
...defaultColumnAttrs,
component: 'input',
@ -85,7 +93,6 @@ const columns = computed(() => [
{
label: t('item.fixedPrice.minPrice'),
field: 'minPrice',
name: 'minPrice',
...defaultColumnAttrs,
component: 'input',
@ -108,7 +115,6 @@ const columns = computed(() => [
},
{
label: t('item.fixedPrice.ended'),
field: 'ended',
name: 'ended',
...defaultColumnAttrs,
columnField: {
@ -124,7 +130,6 @@ const columns = computed(() => [
{
label: t('globals.warehouse'),
field: 'warehouseFk',
name: 'warehouseFk',
...defaultColumnAttrs,
columnClass: 'shrink',
@ -415,7 +420,6 @@ function handleOnDataSave({ CrudModelRef }) {
'row-key': 'id',
selection: 'multiple',
}"
:use-model="true"
v-model:selected="rowsSelected"
:create-as-dialog="false"
:create="{

View File

@ -43,10 +43,9 @@ const addToOrder = async () => {
);
state.set('orderTotal', orderTotal);
const rows = orderData.value.rows.push(...items) || [];
state.set('Order', {
...orderData.value,
rows,
items,
});
notify(t('globals.dataSaved'), 'positive');
emit('added', -totalQuantity(items));

View File

@ -6,7 +6,7 @@ import VehicleFilter from '../VehicleFilter.js';
<template>
<VnCardBeta
data-key="Vehicle"
base-url="Vehicles"
url="Vehicles"
:filter="VehicleFilter"
:descriptor="VehicleDescriptor"
/>

View File

@ -136,7 +136,7 @@ const columns = computed(() => [
/>
<FetchData
url="Countries"
:filter="{ fields: ['code'] }"
:filter="{ fields: ['name', 'code'] }"
@on-fetch="(data) => (countries = data)"
auto-load
/>
@ -209,7 +209,7 @@ const columns = computed(() => [
v-model="data.countryCodeFk"
:label="$t('globals.country')"
option-value="code"
option-label="code"
option-label="name"
:options="countries"
/>
<VnInput

View File

@ -376,6 +376,30 @@ onMounted(async () => {
</template>
<template #body-cell-problems="{ row }">
<QTd class="q-gutter-x-xs">
<QIcon
v-if="row.futureAgencyFk !== row.agencyFk && row.agencyFk"
color="primary"
name="vn:agency-term"
size="xs"
class="q-mr-xs"
>
<QTooltip class="column">
<span>
{{
t('advanceTickets.originAgency', {
agency: row.futureAgency,
})
}}
</span>
<span>
{{
t('advanceTickets.destinationAgency', {
agency: row.agency,
})
}}
</span>
</QTooltip>
</QIcon>
<QIcon
v-if="row.isTaxDataChecked === 0"
color="primary"

View File

@ -53,6 +53,7 @@ const handlePhotoUpdated = (evt = false) => {
module="Worker"
:data-key="dataKey"
url="Workers/summary"
:filter="{ where: { id: entityId } }"
title="user.nickname"
@on-fetch="getIsExcluded"
>

View File

@ -1,5 +1,7 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
@ -7,10 +9,33 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const agencyFilter = {
fields: ['id', 'name'],
order: 'name ASC',
limit: 30,
};
const agencyOptions = ref([]);
const validAddresses = ref([]);
const filterWhere = computed(() => ({
id: { inq: validAddresses.value.map((item) => item.addressFk) },
}));
</script>
<template>
<FormModel :url="`Zones/${$route.params.id}`" auto-load model="zone">
<FetchData
:filter="agencyFilter"
@on-fetch="(data) => (agencyOptions = data)"
auto-load
url="AgencyModes/isActive"
/>
<FetchData
url="RoadmapAddresses"
auto-load
@on-fetch="(data) => (validAddresses = data)"
/>
<FormModel :url="`Zones/${route.params.id}`" auto-load model="zone">
<template #form="{ data, validate }">
<VnRow>
<VnInput
@ -109,6 +134,8 @@ const { t } = useI18n();
hide-selected
map-options
:rules="validate('data.addressFk')"
:filter-options="['id']"
:where="filterWhere"
/>
</VnRow>
<VnRow>

View File

@ -22,15 +22,50 @@ const exprBuilder = (param, value) => {
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
}
};
const tableFilter = {
include: [
{
relation: 'agencyMode',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'address',
scope: {
fields: ['id', 'nickname', 'provinceFk', 'postalCode'],
include: [
{
relation: 'province',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'postcode',
scope: {
fields: ['code', 'townFk'],
include: {
relation: 'town',
scope: {
fields: ['id', 'name'],
},
},
},
},
],
},
},
],
};
</script>
<template>
<VnSearchbar
data-key="ZonesList"
url="Zones"
:filter="{
include: { relation: 'agencyMode', scope: { fields: ['name'] } },
}"
:filter="tableFilter"
:expr-builder="exprBuilder"
:label="t('list.searchZone')"
:info="t('list.searchInfo')"

View File

@ -4,7 +4,7 @@ import { useRouter } from 'vue-router';
import { computed, ref } from 'vue';
import axios from 'axios';
import { toCurrency } from 'src/filters';
import { dashIfEmpty, toCurrency } from 'src/filters';
import { toTimeFormat } from 'src/filters/date';
import { useVnConfirm } from 'composables/useVnConfirm';
import useNotify from 'src/composables/useNotify.js';
@ -17,7 +17,6 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
import FetchData from 'src/components/FetchData.vue';
const { t } = useI18n();
const router = useRouter();
@ -26,7 +25,6 @@ const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm();
const tableRef = ref();
const warehouseOptions = ref([]);
const validAddresses = ref([]);
const tableFilter = {
include: [
@ -161,30 +159,18 @@ const handleClone = (id) => {
openConfirmationModal(
t('list.confirmCloneTitle'),
t('list.confirmCloneSubtitle'),
() => clone(id)
() => clone(id),
);
};
function showValidAddresses(row) {
if (row.addressFk) {
const isValid = validAddresses.value.some(
(address) => address.addressFk === row.addressFk
);
if (isValid)
return `${row.address?.nickname},
${row.address?.postcode?.town?.name} (${row.address?.province?.name})`;
else return '-';
}
return '-';
function formatRow(row) {
if (!row?.address) return '-';
return dashIfEmpty(`${row?.address?.nickname},
${row?.address?.postcode?.town?.name} (${row?.address?.province?.name})`);
}
</script>
<template>
<FetchData
url="RoadmapAddresses"
auto-load
@on-fetch="(data) => (validAddresses = data)"
/>
<ZoneSearchbar />
<RightMenu>
<template #right-panel>
@ -207,7 +193,7 @@ function showValidAddresses(row) {
:right-search="false"
>
<template #column-addressFk="{ row }">
{{ showValidAddresses(row) }}
{{ dashIfEmpty(formatRow(row)) }}
</template>
<template #more-create-dialog="{ data }">
<VnSelect

View File

@ -107,7 +107,10 @@ export default defineRouter(function (/* { store, ssrContext } */) {
'Failed to fetch dynamically imported module',
'Importing a module script failed',
];
state.set('error', errorMessages.some(message.includes));
state.set(
'error',
errorMessages.some((error) => message.startsWith(error)),
);
});
return Router;
});

View File

@ -1,9 +1,9 @@
/// <reference types="cypress" />
describe('InvoiceInBasicData', () => {
const formInputs = '.q-form > .q-card input';
const firstFormSelect = '.q-card > .vn-row:nth-child(1) > .q-select';
const documentBtns = '[data-cy="dms-buttons"] button';
const dialogInputs = '.q-dialog input';
const resetBtn = '.q-btn-group--push > .q-btn--flat';
const getDocumentBtns = (opt) => `[data-cy="dms-buttons"] > :nth-child(${opt})`;
beforeEach(() => {
cy.login('developer');
@ -11,13 +11,16 @@ describe('InvoiceInBasicData', () => {
});
it('should edit the provideer and supplier ref', () => {
cy.selectOption(firstFormSelect, 'Bros');
cy.get('[title="Reset"]').click();
cy.get(formInputs).eq(1).type('{selectall}4739');
cy.saveCard();
cy.dataCy('UnDeductibleVatSelect').type('4751000000');
cy.get('.q-menu .q-item').contains('4751000000').click();
cy.get(resetBtn).click();
cy.get(`${firstFormSelect} input`).invoke('val').should('eq', 'Plants nick');
cy.get(formInputs).eq(1).invoke('val').should('eq', '4739');
cy.waitForElement('#formModel').within(() => {
cy.dataCy('vnSupplierSelect').type('Bros nick');
})
cy.get('.q-menu .q-item').contains('Bros nick').click();
cy.saveCard();
cy.get(`${firstFormSelect} input`).invoke('val').should('eq', 'Bros nick');
});
it('should edit, remove and create the dms data', () => {
@ -25,18 +28,18 @@ describe('InvoiceInBasicData', () => {
const secondInput = "I don't know what posting here!";
//edit
cy.get(documentBtns).eq(1).click();
cy.get(getDocumentBtns(2)).click();
cy.get(dialogInputs).eq(0).type(`{selectall}${firtsInput}`);
cy.get('textarea').type(`{selectall}${secondInput}`);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get(documentBtns).eq(1).click();
cy.get(getDocumentBtns(2)).click();
cy.get(dialogInputs).eq(0).invoke('val').should('eq', firtsInput);
cy.get('textarea').invoke('val').should('eq', secondInput);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data saved');
//remove
cy.get(documentBtns).eq(2).click();
cy.get(getDocumentBtns(3)).click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.checkNotification('Data saved');