diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index 3649ba8f5..920836a93 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -74,6 +74,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
+ mapKey: {
+ type: String,
+ default: '',
+ },
});
const emit = defineEmits(['onFetch', 'onPaginate', 'onChange']);
@@ -96,6 +100,7 @@ const arrayData = useArrayData(props.dataKey, {
exprBuilder: props.exprBuilder,
keepOpts: props.keepOpts,
searchUrl: props.searchUrl,
+ mapKey: props.mapKey,
});
const store = arrayData.store;
diff --git a/src/composables/getExchange.js b/src/composables/getExchange.js
new file mode 100644
index 000000000..e81e9e895
--- /dev/null
+++ b/src/composables/getExchange.js
@@ -0,0 +1,16 @@
+import axios from 'axios';
+export async function getExchange(amount, currencyFk, dated, decimalPlaces = 2) {
+ try {
+ const { data } = await axios.get('ReferenceRates/findOne', {
+ params: {
+ filter: {
+ fields: ['value'],
+ where: { currencyFk, dated },
+ },
+ },
+ });
+ return (amount / data.value).toFixed(decimalPlaces);
+ } catch (e) {
+ return null;
+ }
+}
diff --git a/src/composables/getTotal.js b/src/composables/getTotal.js
index 41c4330c4..24ac3aa27 100644
--- a/src/composables/getTotal.js
+++ b/src/composables/getTotal.js
@@ -1,10 +1,10 @@
import { toCurrency } from 'src/filters';
export function getTotal(rows, key, opts = {}) {
- const { currency, cb } = opts;
+ const { currency, cb, decimalPlaces } = opts;
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
return currency
? toCurrency(total, currency == 'default' ? undefined : currency)
- : total;
+ : parseFloat(total).toFixed(decimalPlaces ?? 2);
}
diff --git a/src/composables/useAccountShortToStandard.js b/src/composables/useAccountShortToStandard.js
new file mode 100644
index 000000000..ca221433e
--- /dev/null
+++ b/src/composables/useAccountShortToStandard.js
@@ -0,0 +1,4 @@
+export function useAccountShortToStandard(val) {
+ if (!val || !/^\d+(\.\d*)$/.test(val)) return;
+ return val?.replace('.', '0'.repeat(11 - val.length));
+}
diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index da62eee3e..6e685ee20 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -49,6 +49,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
'exprBuilder',
'searchUrl',
'navigate',
+ 'mapKey',
];
if (typeof userOptions === 'object') {
for (const option in userOptions) {
@@ -119,17 +120,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const { limit } = filter;
store.hasMoreData = limit && response.data.length >= limit;
- if (append) {
- if (!store.data) store.data = [];
- for (const row of response.data) store.data.push(row);
- } else {
- store.data = response.data;
- if (!isDialogOpened()) updateRouter && updateStateParams();
- }
+ processData(response.data, { map: !!store.mapKey, append });
+ if (!append && !isDialogOpened()) updateRouter && updateStateParams();
store.isLoading = false;
-
canceller = null;
+
return response;
}
@@ -288,6 +284,31 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
router.replace(newUrl);
}
+ function processData(data, { map = true, append = true }) {
+ if (!append) {
+ store.data = [];
+ store.map = new Map();
+ }
+
+ if (!Array.isArray(data)) store.data = data;
+ else if (!map && append) for (const row of data) store.data.push(row);
+ else
+ for (const row of data) {
+ const key = row[store.mapKey];
+ const val = { ...row, key };
+ if (store.map.has(key)) {
+ const { position } = store.map.get(key);
+ val.position = position;
+ store.map.set(key, val);
+ store.data[position] = val;
+ } else {
+ val.position = store.map.size;
+ store.map.set(key, val);
+ store.data.push(val);
+ }
+ }
+ }
+
const totalRows = computed(() => (store.data && store.data.length) || 0);
const isLoading = computed(() => store.isLoading || false);
diff --git a/src/css/app.scss b/src/css/app.scss
index abb388be9..e87b37154 100644
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -11,6 +11,7 @@ body.body--light {
--vn-text-color: var(--font-color);
--vn-label-color: #5f5f5f;
--vn-accent-color: #e7e3e3;
+ --vn-empty-tag: #acacac;
background-color: var(--vn-page-color);
@@ -26,6 +27,7 @@ body.body--dark {
--vn-text-color: white;
--vn-label-color: #a8a8a8;
--vn-accent-color: #424242;
+ --vn-empty-tag: #2d2d2d;
background-color: var(--vn-page-color);
}
@@ -240,7 +242,7 @@ input::-webkit-inner-spin-button {
.q-table {
th,
td {
- padding: 1px 10px 1px 10px;
+ padding: 1px 3px 1px 3px;
max-width: 130px;
div span {
overflow: hidden;
@@ -296,3 +298,20 @@ input::-webkit-inner-spin-button {
.no-visible {
visibility: hidden;
}
+.q-field__inner {
+ .q-field__control {
+ min-height: auto !important;
+ display: flex;
+ align-items: flex-end;
+ padding-bottom: 2px;
+ .q-field__native.row {
+ min-height: auto !important;
+ }
+ }
+}
+
+.q-date__header-today {
+ border-radius: 12px;
+ border: 1px solid;
+ box-shadow: 0 4px 6px #00000000;
+}
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index 1162f0b07..67d7a2bee 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -142,7 +142,7 @@ globals:
workCenters: Work centers
modes: Modes
zones: Zones
- zonesList: Zones
+ zonesList: List
deliveryDays: Delivery days
upcomingDeliveries: Upcoming deliveries
role: Role
@@ -333,11 +333,23 @@ globals:
packing: ITP
myTeam: My team
departmentFk: Department
+ from: From
+ to: To
+ supplierFk: Supplier
+ supplierRef: Supplier ref
+ serial: Serial
+ amount: Importe
+ awbCode: AWB
+ correctedFk: Rectified
+ correctingFk: Rectificative
+ daysOnward: Days onward
countryFk: Country
+ companyFk: Company
changePass: Change password
deleteConfirmTitle: Delete selected elements
changeState: Change state
raid: 'Raid {daysInForward} days'
+ isVies: Vies
errors:
statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred
@@ -731,7 +743,6 @@ supplier:
sageTransactionTypeFk: Sage transaction type
supplierActivityFk: Supplier activity
isTrucker: Trucker
- isVies: Vies
billingData:
payMethodFk: Billing data
payDemFk: Payment deadline
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 5710a324a..4fa8699c9 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -144,7 +144,7 @@ globals:
workCenters: Centros de trabajo
modes: Modos
zones: Zonas
- zonesList: Zonas
+ zonesList: Listado
deliveryDays: Días de entrega
upcomingDeliveries: Próximos repartos
role: Role
@@ -336,12 +336,22 @@ globals:
SSN: NSS
fi: NIF
myTeam: Mi equipo
+ from: Desde
+ to: Hasta
+ supplierFk: Proveedor
+ supplierRef: Ref. proveedor
+ serial: Serie
+ amount: Importe
+ awbCode: AWB
+ daysOnward: Días adelante
packing: ITP
countryFk: País
+ companyFk: Empresa
changePass: Cambiar contraseña
deleteConfirmTitle: Eliminar los elementos seleccionados
changeState: Cambiar estado
raid: 'Redada {daysInForward} días'
+ isVies: Vies
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor
@@ -726,7 +736,6 @@ supplier:
sageTransactionTypeFk: Tipo de transacción sage
supplierActivityFk: Actividad proveedor
isTrucker: Transportista
- isVies: Vies
billingData:
payMethodFk: Forma de pago
payDemFk: Plazo de pago
diff --git a/src/pages/Claim/Card/ClaimLines.vue b/src/pages/Claim/Card/ClaimLines.vue
index 60c470d22..90a68beae 100644
--- a/src/pages/Claim/Card/ClaimLines.vue
+++ b/src/pages/Claim/Card/ClaimLines.vue
@@ -57,6 +57,7 @@ function onFetch(rows, newRows) {
const price = row.quantity * sale.price;
const discount = (sale.discount * price) / 100;
amountClaimed.value = amountClaimed.value + (price - discount);
+
}
}
@@ -207,9 +208,10 @@ async function saveWhenHasChanges() {
selection="multiple"
v-model:selected="selected"
:grid="$q.screen.lt.md"
+
>
-
+
-
+
{{ value }}
-
+
{{ value }}
-
+
-
+
{{ column.value }}
diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index 200ab4bea..8939a0785 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -345,12 +345,9 @@ function claimUrl(section) {
{{
t(col.value)
}}
- {{ col.value }}
+ {{
+ t(col.value)
+ }}
[
title: t('components.smartCard.viewSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ClaimSummary),
+ isPrimary: true,
},
],
},
@@ -135,7 +136,6 @@ const STATE_COLOR = {
:columns="columns"
redirect="claim"
:right-search="false"
- auto-load
>
diff --git a/src/pages/Customer/Card/CustomerFiscalData.vue b/src/pages/Customer/Card/CustomerFiscalData.vue
index 673c7dda9..aff7deda4 100644
--- a/src/pages/Customer/Card/CustomerFiscalData.vue
+++ b/src/pages/Customer/Card/CustomerFiscalData.vue
@@ -110,7 +110,7 @@ function handleLocation(data, location) {
-
+
{{ t('whenActivatingIt') }}
@@ -169,7 +169,6 @@ es:
Active: Activo
Frozen: Congelado
Has to invoice: Factura
- Vies: Vies
Notify by email: Notificar vía e-mail
Invoice by address: Facturar por consignatario
Is equalizated: Recargo de equivalencia
diff --git a/src/pages/Customer/Card/CustomerSummary.vue b/src/pages/Customer/Card/CustomerSummary.vue
index ae4c7f3ab..6650ea395 100644
--- a/src/pages/Customer/Card/CustomerSummary.vue
+++ b/src/pages/Customer/Card/CustomerSummary.vue
@@ -173,7 +173,7 @@ const sumRisk = ({ clientRisks }) => {
:label="t('customer.summary.notifyByEmail')"
:value="entity.isToBeMailed"
/>
-
+
diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue
index e86e35966..fdfd7ff9c 100644
--- a/src/pages/Customer/CustomerList.vue
+++ b/src/pages/Customer/CustomerList.vue
@@ -2,22 +2,21 @@
import { ref, computed, markRaw } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
+import { useSummaryDialog } from 'src/composables/useSummaryDialog';
+import { toDate } from 'src/filters';
+
+import RightMenu from 'src/components/common/RightMenu.vue';
+import CustomerSummary from './Card/CustomerSummary.vue';
+import CustomerFilter from './CustomerFilter.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
-import CustomerSummary from './Card/CustomerSummary.vue';
-import { useSummaryDialog } from 'src/composables/useSummaryDialog';
-import RightMenu from 'src/components/common/RightMenu.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
-import { toDate } from 'src/filters';
-import CustomerFilter from './CustomerFilter.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
const { t } = useI18n();
const router = useRouter();
-
const tableRef = ref();
-
const columns = computed(() => [
{
align: 'left',
@@ -263,7 +262,7 @@ const columns = computed(() => [
},
{
align: 'left',
- label: t('customer.extendedList.tableVisibleColumns.isVies'),
+ label: t('globals.isVies'),
name: 'isVies',
columnFilter: {
inWhere: true,
@@ -405,6 +404,7 @@ function handleLocation(data, location) {
ref="tableRef"
data-key="CustomerList"
url="Clients/filter"
+ order="id DESC"
:create="{
urlCreate: 'Clients/createWithUser',
title: t('globals.pageTitles.customerCreate'),
@@ -414,11 +414,9 @@ function handleLocation(data, location) {
isEqualizated: false,
},
}"
- order="id DESC"
:columns="columns"
- redirect="customer"
:right-search="false"
- auto-load
+ redirect="customer"
>
+ >
+
+
+
+
+
+
+ {{ scope.opt?.name }}
+ {{ scope.opt?.nickname }},
+ {{ scope.opt?.code }}
+
+
+
+
es:
- Web user: Usuario Web
+ Web user: Usuario web
es:
Original invoice: Factura origen
diff --git a/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue b/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue
index 92f3fffca..cb8a45833 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue
@@ -1,5 +1,5 @@
{
@@ -138,8 +130,8 @@ const formatOpt = (row, { model, options }, prop) => {
@@ -154,7 +146,7 @@ const formatOpt = (row, { model, options }, prop) => {
{{ getTotal(rows, 'net') }}
- {{ getTotal(rows, 'stems') }}
+ {{ getTotal(rows, 'stems', { decimalPlaces: 0 }) }}
@@ -174,7 +166,9 @@ const formatOpt = (row, { model, options }, prop) => {
v-model="props.row['intrastatFk']"
:options="intrastats"
option-value="id"
- option-label="description"
+ :option-label="
+ (row) => `${row.id}:${row.description}`
+ "
:filter-options="['id', 'description']"
>
@@ -248,11 +242,6 @@ const formatOpt = (row, { model, options }, prop) => {
}
}
-
en:
amount: Amount
@@ -261,7 +250,7 @@ const formatOpt = (row, { model, options }, prop) => {
country: Country
es:
Code: Código
- amount: Cantidad
+ amount: Valor mercancía
net: Neto
stems: Tallos
country: País
diff --git a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
index 08fc11f69..115a33208 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
@@ -26,14 +26,14 @@ const intrastatTotals = ref({ amount: 0, net: 0, stems: 0 });
const vatColumns = ref([
{
name: 'expense',
- label: 'invoiceIn.summary.expense',
+ label: 'InvoiceIn.summary.expense',
field: (row) => row.expenseFk,
sortable: true,
align: 'left',
},
{
name: 'landed',
- label: 'invoiceIn.summary.taxableBase',
+ label: 'InvoiceIn.summary.taxableBase',
field: (row) => row.taxableBase,
format: (value) => toCurrency(value),
sortable: true,
@@ -41,7 +41,7 @@ const vatColumns = ref([
},
{
name: 'vat',
- label: 'invoiceIn.summary.sageVat',
+ label: 'InvoiceIn.summary.sageVat',
field: (row) => {
if (row.taxTypeSage) return `#${row.taxTypeSage.id} : ${row.taxTypeSage.vat}`;
},
@@ -51,7 +51,7 @@ const vatColumns = ref([
},
{
name: 'transaction',
- label: 'invoiceIn.summary.sageTransaction',
+ label: 'InvoiceIn.summary.sageTransaction',
field: (row) => {
if (row.transactionTypeSage)
return `#${row.transactionTypeSage.id} : ${row.transactionTypeSage?.transaction}`;
@@ -62,7 +62,7 @@ const vatColumns = ref([
},
{
name: 'rate',
- label: 'invoiceIn.summary.rate',
+ label: 'InvoiceIn.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value),
sortable: true,
@@ -70,7 +70,7 @@ const vatColumns = ref([
},
{
name: 'currency',
- label: 'invoiceIn.summary.currency',
+ label: 'InvoiceIn.summary.currency',
field: (row) => row.foreignValue,
format: (val) => val && toCurrency(val, currency.value),
sortable: true,
@@ -81,21 +81,21 @@ const vatColumns = ref([
const dueDayColumns = ref([
{
name: 'date',
- label: 'invoiceIn.summary.dueDay',
+ label: 'InvoiceIn.summary.dueDay',
field: (row) => toDate(row.dueDated),
sortable: true,
align: 'left',
},
{
name: 'bank',
- label: 'invoiceIn.summary.bank',
+ label: 'InvoiceIn.summary.bank',
field: (row) => row.bank.bank,
sortable: true,
align: 'left',
},
{
name: 'amount',
- label: 'invoiceIn.list.amount',
+ label: 'InvoiceIn.list.amount',
field: (row) => row.amount,
format: (value) => toCurrency(value),
sortable: true,
@@ -103,7 +103,7 @@ const dueDayColumns = ref([
},
{
name: 'landed',
- label: 'invoiceIn.summary.foreignValue',
+ label: 'InvoiceIn.summary.foreignValue',
field: (row) => row.foreignValue,
format: (val) => val && toCurrency(val, currency.value),
sortable: true,
@@ -114,7 +114,7 @@ const dueDayColumns = ref([
const intrastatColumns = ref([
{
name: 'code',
- label: 'invoiceIn.summary.code',
+ label: 'InvoiceIn.summary.code',
field: (row) => {
return `${row.intrastat.id}: ${row.intrastat?.description}`;
},
@@ -123,21 +123,21 @@ const intrastatColumns = ref([
},
{
name: 'amount',
- label: 'invoiceIn.list.amount',
+ label: 'InvoiceIn.list.amount',
field: (row) => toCurrency(row.amount),
sortable: true,
align: 'left',
},
{
name: 'net',
- label: 'invoiceIn.summary.net',
+ label: 'InvoiceIn.summary.net',
field: (row) => row.net,
sortable: true,
align: 'left',
},
{
name: 'stems',
- label: 'invoiceIn.summary.stems',
+ label: 'InvoiceIn.summary.stems',
field: (row) => row.stems,
format: (value) => value,
sortable: true,
@@ -145,7 +145,7 @@ const intrastatColumns = ref([
},
{
name: 'landed',
- label: 'invoiceIn.summary.country',
+ label: 'InvoiceIn.summary.country',
field: (row) => row.country?.code,
format: (value) => value,
sortable: true,
@@ -210,7 +210,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/>
@@ -221,14 +221,18 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
-
+
+
@@ -239,21 +243,22 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
+
@@ -263,18 +268,18 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/>
-
+
@@ -285,11 +290,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
-
+
`#/invoice-in/${entityId.value}/${param}`;
:color="amountsNotMatch ? 'negative' : 'transparent'"
:title="
amountsNotMatch
- ? t('invoiceIn.summary.noMatch')
- : t('invoiceIn.summary.dueTotal')
+ ? t('InvoiceIn.summary.noMatch')
+ : t('InvoiceIn.summary.dueTotal')
"
>
{{ toCurrency(entity.totals.totalDueDay) }}
@@ -309,7 +314,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
-
+
`#/invoice-in/${entityId.value}/${param}`;
-
+
@@ -395,7 +400,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
arrayData.store.data);
-const invoiceId = +useRoute().params.id;
const currency = computed(() => invoiceIn.value?.currency?.code);
const expenses = ref([]);
const sageTaxTypes = ref([]);
@@ -39,9 +41,8 @@ const columns = computed(() => [
options: expenses.value,
model: 'expenseFk',
optionValue: 'id',
- optionLabel: 'id',
+ optionLabel: (row) => `${row.id}: ${row.name}`,
sortable: true,
- tabIndex: 1,
align: 'left',
},
{
@@ -50,7 +51,6 @@ const columns = computed(() => [
field: (row) => row.taxableBase,
model: 'taxableBase',
sortable: true,
- tabIndex: 2,
align: 'left',
},
{
@@ -60,9 +60,8 @@ const columns = computed(() => [
options: sageTaxTypes.value,
model: 'taxTypeSageFk',
optionValue: 'id',
- optionLabel: 'id',
+ optionLabel: (row) => `${row.id}: ${row.vat}`,
sortable: true,
- tabindex: 3,
align: 'left',
},
{
@@ -72,16 +71,14 @@ const columns = computed(() => [
options: sageTransactionTypes.value,
model: 'transactionTypeSageFk',
optionValue: 'id',
- optionLabel: 'id',
+ optionLabel: (row) => `${row.id}: ${row.transaction}`,
sortable: true,
- tabIndex: 4,
align: 'left',
},
{
name: 'rate',
label: t('Rate'),
sortable: true,
- tabIndex: 5,
field: (row) => taxRate(row, row.taxTypeSageFk),
align: 'left',
},
@@ -89,7 +86,6 @@ const columns = computed(() => [
name: 'foreignvalue',
label: t('Foreign value'),
sortable: true,
- tabIndex: 6,
field: (row) => row.foreignValue,
align: 'left',
},
@@ -106,7 +102,7 @@ const filter = {
'transactionTypeSageFk',
],
where: {
- invoiceInFk: invoiceId,
+ invoiceInFk: route.params.id,
},
};
@@ -120,14 +116,20 @@ function taxRate(invoiceInTax) {
const taxTypeSage = taxRateSelection?.rate ?? 0;
const taxableBase = invoiceInTax?.taxableBase ?? 0;
- return (taxTypeSage / 100) * taxableBase;
+ return ((taxTypeSage / 100) * taxableBase).toFixed(2);
}
-const formatOpt = (row, { model, options }, prop) => {
- const obj = row[model];
- const option = options.find(({ id }) => id == obj);
- return option ? `${obj}:${option[prop]}` : '';
-};
+function autocompleteExpense(evt, row, col) {
+ const val = evt.target.value;
+ if (!val) return;
+
+ const param = isNaN(val) ? row[col.model] : val;
+ const lookup = expenses.value.find(
+ ({ id }) => id == useAccountShortToStandard(param)
+ );
+
+ if (lookup) row[col.model] = lookup;
+}
{
data-key="InvoiceInTaxes"
url="InvoiceInTaxes"
:filter="filter"
- :data-required="{ invoiceInFk: invoiceId }"
+ :data-required="{ invoiceInFk: $route.params.id }"
auto-load
v-model:selected="rowsSelected"
- :go-to="`/invoice-in/${invoiceId}/due-day`"
+ :go-to="`/invoice-in/${$route.params.id}/due-day`"
>
{
:option-label="col.optionLabel"
:filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
+ @keydown.tab="autocompleteExpense($event, row, col)"
>
@@ -187,13 +190,7 @@ const formatOpt = (row, { model, options }, prop) => {
- {{ currency }}
{
:option-value="col.optionValue"
:option-label="col.optionLabel"
:filter-options="['id', 'vat']"
- :hide-selected="false"
- :fill-input="false"
- :display-value="formatOpt(row, col, 'vat')"
+ data-cy="vat-sageiva"
>
@@ -233,11 +228,6 @@ const formatOpt = (row, { model, options }, prop) => {
:option-value="col.optionValue"
:option-label="col.optionLabel"
:filter-options="['id', 'transaction']"
- :autofocus="col.tabIndex == 1"
- input-debounce="0"
- :hide-selected="false"
- :fill-input="false"
- :display-value="formatOpt(row, col, 'transaction')"
>
@@ -262,6 +252,16 @@ const formatOpt = (row, { model, options }, prop) => {
}"
:disable="!isNotEuro(currency)"
v-model="row.foreignValue"
+ @update:model-value="
+ async (val) => {
+ if (!isNotEuro(currency)) return;
+ row.taxableBase = await getExchange(
+ val,
+ row.currencyFk,
+ invoiceIn.issued
+ );
+ }
+ "
/>
@@ -305,7 +305,7 @@ const formatOpt = (row, { model, options }, prop) => {
v-model="props.row['expenseFk']"
:options="expenses"
option-value="id"
- option-label="name"
+ :option-label="(row) => `${row.id}:${row.name}`"
:filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
>
@@ -339,7 +339,7 @@ const formatOpt = (row, { model, options }, prop) => {
v-model="props.row['taxTypeSageFk']"
:options="sageTaxTypes"
option-value="id"
- option-label="vat"
+ :option-label="(row) => `${row.id}:${row.vat}`"
:filter-options="['id', 'vat']"
>
@@ -362,7 +362,9 @@ const formatOpt = (row, { model, options }, prop) => {
v-model="props.row['transactionTypeSageFk']"
:options="sageTransactionTypes"
option-value="id"
- option-label="transaction"
+ :option-label="
+ (row) => `${row.id}:${row.transaction}`
+ "
:filter-options="['id', 'transaction']"
>
@@ -418,11 +420,6 @@ const formatOpt = (row, { model, options }, prop) => {
.bg {
background-color: var(--vn-light-gray);
}
-
-:deep(.q-table tr td:nth-child(n + 4):nth-child(-n + 5) input) {
- display: none;
-}
-
@media (max-width: $breakpoint-xs) {
.q-dialog {
.q-card {
diff --git a/src/pages/InvoiceIn/InvoiceInCreate.vue b/src/pages/InvoiceIn/InvoiceInCreate.vue
index c809e032b..200997f65 100644
--- a/src/pages/InvoiceIn/InvoiceInCreate.vue
+++ b/src/pages/InvoiceIn/InvoiceInCreate.vue
@@ -83,7 +83,7 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
@@ -97,10 +97,10 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
map-options
hide-selected
:required="true"
- :rules="validate('invoiceIn.companyFk')"
+ :rules="validate('InvoiceIn.companyFk')"
/>
diff --git a/src/pages/InvoiceIn/InvoiceInFilter.vue b/src/pages/InvoiceIn/InvoiceInFilter.vue
index 130a77960..653692026 100644
--- a/src/pages/InvoiceIn/InvoiceInFilter.vue
+++ b/src/pages/InvoiceIn/InvoiceInFilter.vue
@@ -1,41 +1,66 @@
- (activities = data)"
- />
-
-
+
+
- {{ t(`params.${tag.label}`) }}:
+ {{ getLocale(tag.label) }}:
{{ formatFn(tag.value) }}
-
+
-
+
-
+
+
+
+
+
+ handleDaysAgo(params, val)"
+ @remove="(val) => handleDaysAgo(params, val)"
+ />
@@ -44,20 +69,18 @@ const activities = ref([]);
v-model="params.supplierFk"
url="Suppliers"
:fields="['id', 'nickname']"
- :label="t('params.supplierFk')"
- option-value="id"
+ :label="getLocale('supplierFk')"
option-label="nickname"
dense
outlined
rounded
- :filter-options="['id', 'name']"
/>
+
+
+
+
+
-
-
-
-
-en:
- params:
- search: Id or supplier name
- supplierRef: Supplier ref.
- supplierFk: Supplier
- fi: Supplier fiscal id
- clientFk: Customer
- amount: Amount
- created: Created
- awb: AWB
- dued: Dued
- serialNumber: Serial Number
- serial: Serial
- account: Ledger account
- isBooked: is booked
- correctedFk: Rectified
- issued: Issued
- to: To
- from: From
- awbCode: AWB
- correctingFk: Rectificative
- supplierActivityFk: Supplier activity
-es:
- params:
- search: Id o nombre proveedor
- supplierRef: Ref. proveedor
- supplierFk: Proveedor
- clientFk: Cliente
- fi: CIF proveedor
- serialNumber: Num. serie
- serial: Serie
- awb: AWB
- amount: Importe
- issued: Emitida
- isBooked: Contabilizada
- account: Cuenta contable
- created: Creada
- dued: Vencida
- correctedFk: Rectificada
- correctingFk: Rectificativa
- supplierActivityFk: Actividad proveedor
- from: Desde
- to: Hasta
- From: Desde
- To: Hasta
- Amount: Importe
- Issued: Fecha factura
- Id or supplier: Id o proveedor
-
diff --git a/src/pages/InvoiceIn/InvoiceInList.vue b/src/pages/InvoiceIn/InvoiceInList.vue
index 8d658bee3..db6e7d214 100644
--- a/src/pages/InvoiceIn/InvoiceInList.vue
+++ b/src/pages/InvoiceIn/InvoiceInList.vue
@@ -1,7 +1,7 @@
+ (companies = data)" auto-load />
@@ -116,7 +160,7 @@ const cols = computed(() => [
urlCreate: 'InvoiceIns',
title: t('globals.createInvoiceIn'),
onDataSaved: ({ id }) => tableRef.redirect(id),
- formInitialData: {},
+ formInitialData: { companyFk: user.companyFk, issued: Date.vnNew() },
}"
redirect="invoice-in"
:columns="cols"
@@ -151,7 +195,7 @@ const cols = computed(() => [
[
option-label="code"
:required="true"
/>
-
+
diff --git a/src/pages/InvoiceIn/Serial/InvoiceInSerial.vue b/src/pages/InvoiceIn/Serial/InvoiceInSerial.vue
index 4eb9fa69d..a8fb3b0c8 100644
--- a/src/pages/InvoiceIn/Serial/InvoiceInSerial.vue
+++ b/src/pages/InvoiceIn/Serial/InvoiceInSerial.vue
@@ -58,6 +58,14 @@ onBeforeMount(async () => {
:right-search="false"
:user-params="{ daysAgo }"
:disable-option="{ card: true }"
+ :row-click="
+ (row) => {
+ $router.push({
+ name: 'InvoiceInList',
+ query: { table: JSON.stringify({ serial: row.serial }) },
+ });
+ }
+ "
auto-load
/>
diff --git a/src/pages/InvoiceIn/Serial/InvoiceInSerialFilter.vue b/src/pages/InvoiceIn/Serial/InvoiceInSerialFilter.vue
index 4f8c9d70b..19ed73e50 100644
--- a/src/pages/InvoiceIn/Serial/InvoiceInSerialFilter.vue
+++ b/src/pages/InvoiceIn/Serial/InvoiceInSerialFilter.vue
@@ -8,7 +8,11 @@ defineProps({ dataKey: { type: String, required: true } });
const { t } = useI18n();
-
+
{{ t(`params.${tag.label}`) }}:
diff --git a/src/pages/InvoiceIn/locale/en.yml b/src/pages/InvoiceIn/locale/en.yml
index b39511f29..ef7e31ac3 100644
--- a/src/pages/InvoiceIn/locale/en.yml
+++ b/src/pages/InvoiceIn/locale/en.yml
@@ -1,4 +1,4 @@
-invoiceIn:
+InvoiceIn:
serial: Serial
isBooked: Is booked
list:
@@ -7,8 +7,11 @@ invoiceIn:
supplierRef: Supplier ref.
file: File
issued: Issued
+ dueDated: Due dated
awb: AWB
amount: Amount
+ descriptor:
+ ticketList: Ticket list
card:
client: Client
company: Company
@@ -39,3 +42,9 @@ invoiceIn:
net: Net
stems: Stems
country: Country
+ params:
+ search: Id or supplier name
+ account: Ledger account
+ correctingFk: Rectificative
+ correctedFk: Corrected
+ isBooked: Is booked
diff --git a/src/pages/InvoiceIn/locale/es.yml b/src/pages/InvoiceIn/locale/es.yml
index 5f483dd08..ed5943489 100644
--- a/src/pages/InvoiceIn/locale/es.yml
+++ b/src/pages/InvoiceIn/locale/es.yml
@@ -1,15 +1,17 @@
-invoiceIn:
+InvoiceIn:
serial: Serie
isBooked: Contabilizada
list:
ref: Referencia
supplier: Proveedor
supplierRef: Ref. proveedor
- shortIssued: F. emisión
+ issued: F. emisión
+ dueDated: F. vencimiento
file: Fichero
- issued: Fecha emisión
awb: AWB
amount: Importe
+ descriptor:
+ ticketList: Listado de tickets
card:
client: Cliente
company: Empresa
@@ -38,3 +40,8 @@ invoiceIn:
net: Neto
stems: Tallos
country: País
+ params:
+ search: Id o nombre proveedor
+ account: Cuenta contable
+ correctingFk: Rectificativa
+ correctedFk: Rectificada
diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
index 3fd3104bf..e6c689523 100644
--- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
+++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
@@ -115,6 +115,9 @@ onMounted(async () => {
-import { onMounted, onUnmounted, ref, computed, watchEffect } from 'vue';
+import { ref, computed, watchEffect } from 'vue';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
@@ -10,7 +10,6 @@ import { usePrintService } from 'src/composables/usePrintService';
import VnTable from 'src/components/VnTable/VnTable.vue';
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
import { toCurrency, toDate } from 'src/filters/index';
-import { useStateStore } from 'stores/useStateStore';
import { QBtn } from 'quasar';
import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue';
@@ -21,7 +20,6 @@ import VnInput from 'src/components/common/VnInput.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
const { t } = useI18n();
-const stateStore = useStateStore();
const { viewSummary } = useSummaryDialog();
const tableRef = ref();
const invoiceOutSerialsOptions = ref([]);
@@ -147,8 +145,6 @@ const columns = computed(() => [
],
},
]);
-onMounted(() => (stateStore.rightDrawer = true));
-onUnmounted(() => (stateStore.rightDrawer = false));
function openPdf(id) {
openReport(`${MODEL}/${id}/download`);
@@ -214,7 +210,6 @@ watchEffect(selectedRows);
order="id DESC"
:columns="columns"
redirect="invoice-out"
- auto-load
:table="{
'row-key': 'id',
selection: 'multiple',
diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue
index 09fccfd6d..74403d471 100644
--- a/src/pages/Item/ItemFixedPrice.vue
+++ b/src/pages/Item/ItemFixedPrice.vue
@@ -361,7 +361,7 @@ function handleOnDataSave({ CrudModelRef }) {
@on-fetch="(data) => (warehousesOptions = data)"
auto-load
url="Warehouses"
- :filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
+ :filter="{ fields: ['id', 'name'], order: 'name ASC' }"
/>
@@ -394,191 +394,186 @@ function handleOnDataSave({ CrudModelRef }) {
/>
-
-
- data.forEach((item) => {
- item.hasMinPrice = `${item.hasMinPrice !== 0}`;
- })
- "
- :default-remove="false"
- :default-reset="false"
- :default-save="false"
- data-key="ItemFixedPrices"
- url="FixedPrices/filter"
- :order="['itemFk DESC', 'name DESC']"
- save-url="FixedPrices/crud"
- ref="tableRef"
- dense
- :filter="{
- where: {
- warehouseFk: user.warehouseFk,
- },
- }"
- :columns="columns"
- default-mode="table"
- auto-load
- :is-editable="true"
- :right-search="false"
- :table="{
- 'row-key': 'id',
- selection: 'multiple',
- }"
- :crud-model="{
- disableInfiniteScroll: true,
- }"
- v-model:selected="rowsSelected"
- :create-as-dialog="false"
- :create="{
- onDataSaved: handleOnDataSave,
- }"
- :use-model="true"
- :disable-option="{ card: true }"
- >
-
-
-
-
- {{ scope }}
-
-
+
+ data.forEach((item) => {
+ item.hasMinPrice = `${item.hasMinPrice !== 0}`;
+ })
+ "
+ :default-remove="false"
+ :default-reset="false"
+ :default-save="false"
+ data-key="ItemFixedPrices"
+ url="FixedPrices/filter"
+ :order="['itemFk DESC', 'name DESC']"
+ save-url="FixedPrices/crud"
+ ref="tableRef"
+ dense
+ :filter="{
+ where: {
+ warehouseFk: user.warehouseFk,
+ },
+ }"
+ :columns="columns"
+ default-mode="table"
+ auto-load
+ :is-editable="true"
+ :right-search="false"
+ :table="{
+ 'row-key': 'id',
+ selection: 'multiple',
+ }"
+ :use-model="true"
+ v-model:selected="rowsSelected"
+ :create-as-dialog="false"
+ :create="{
+ onDataSaved: handleOnDataSave,
+ }"
+ :disable-option="{ card: true }"
+ >
+
+
+
+
+ {{ scope }}
+
+
-
-
+
+
+
+
+ #{{ scope.opt?.id }}
+ {{ scope.opt?.name }}
+
+
+
+
+
+
+
+ {{ row.name }}
+
+ {{ row.subName }}
+
+
+
+
+
+
-
-
-
- #{{ scope.opt?.id }}
- {{ scope.opt?.name }}
-
-
-
-
-
-
-
- {{ row.name }}
-
- {{ row.subName }}
-
-
-
-
-
-
- €
-
-
-
-
-
-
- €
-
-
-
-
-
-
-
-
- €
-
-
-
-
-
-
-
-
-
-
-
-
- €
+
+
+
+
+
+
+ €
+
+
+
+
+
+
+
-
-
-
- removePrice(row.id, rowIndex)
- )
- "
- >
-
- {{ t('globals.delete') }}
-
-
-
-
-
-
-
+ €
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+ removePrice(row.id, rowIndex)
+ )
+ "
+ >
+
+ {{ t('globals.delete') }}
+
+
+
+
+
+
+
+
diff --git a/src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue b/src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue
index cd12fc238..936e95d2f 100644
--- a/src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue
+++ b/src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue
@@ -6,13 +6,11 @@ import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
-
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({
id: {
type: Number,
- required: false,
default: null,
},
summary: {
@@ -24,6 +22,10 @@ const $props = defineProps({
const route = useRoute();
const { t } = useI18n();
+const entityId = computed(() => {
+ return $props.id || route.params.id;
+});
+
const itemTypeFilter = {
include: [
{ relation: 'worker' },
@@ -33,10 +35,6 @@ const itemTypeFilter = {
],
};
-const entityId = computed(() => {
- return $props.id || route.params.id;
-});
-
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
@@ -48,8 +46,8 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
:filter="itemTypeFilter"
:title="data.title"
:subtitle="data.subtitle"
+ data-key="itemTypeDescriptor"
@on-fetch="setData"
- data-key="entry"
>
diff --git a/src/pages/Item/ItemType/Card/ItemTypeDescriptorProxy.vue b/src/pages/Item/ItemType/Card/ItemTypeDescriptorProxy.vue
new file mode 100644
index 000000000..7cde9aef8
--- /dev/null
+++ b/src/pages/Item/ItemType/Card/ItemTypeDescriptorProxy.vue
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
diff --git a/src/pages/Item/locale/en.yml b/src/pages/Item/locale/en.yml
index bd91ef745..74feb512b 100644
--- a/src/pages/Item/locale/en.yml
+++ b/src/pages/Item/locale/en.yml
@@ -135,7 +135,7 @@ item:
origin: Orig.
userName: Buyer
weight: Weight
- weightByPiece: Weight/Piece
+ weightByPiece: Weight/stem
stemMultiplier: Multiplier
producer: Producer
landed: Landed
diff --git a/src/pages/Item/locale/es.yml b/src/pages/Item/locale/es.yml
index b821d276a..3f2a06f1f 100644
--- a/src/pages/Item/locale/es.yml
+++ b/src/pages/Item/locale/es.yml
@@ -136,7 +136,7 @@ item:
size: Medida
origin: Orig.
weight: Peso
- weightByPiece: Peso (gramos)/tallo
+ weightByPiece: Peso/tallo
userName: Comprador
stemMultiplier: Multiplicador
producer: Productor
diff --git a/src/pages/Order/OrderList.vue b/src/pages/Order/OrderList.vue
index dfeb0f6e2..baa203541 100644
--- a/src/pages/Order/OrderList.vue
+++ b/src/pages/Order/OrderList.vue
@@ -1,20 +1,22 @@
@@ -201,8 +203,8 @@ const getDateColor = (date) => {
},
}"
:user-params="{ showEmpty: false }"
- :right-search="false"
:columns="columns"
+ :right-search="false"
redirect="order"
>
diff --git a/src/pages/Route/Card/RouteAutonomousFilter.vue b/src/pages/Route/Card/RouteAutonomousFilter.vue
index eb3fa6f2c..3d08e1355 100644
--- a/src/pages/Route/Card/RouteAutonomousFilter.vue
+++ b/src/pages/Route/Card/RouteAutonomousFilter.vue
@@ -29,7 +29,7 @@ const exprBuilder = (param, value) => {
return { 'a.supplierName': value };
case 'routeFk':
return { 'a.routeFk': value };
- case 'created':
+ case 'dated':
case 'agencyFk':
case 'packages':
case 'm3':
@@ -145,7 +145,7 @@ const exprBuilder = (param, value) => {
diff --git a/src/pages/Route/Card/RouteDescriptor.vue b/src/pages/Route/Card/RouteDescriptor.vue
index cbabaf648..fa621843e 100644
--- a/src/pages/Route/Card/RouteDescriptor.vue
+++ b/src/pages/Route/Card/RouteDescriptor.vue
@@ -28,7 +28,7 @@ const filter = {
'id',
'workerFk',
'agencyModeFk',
- 'created',
+ 'dated',
'm3',
'warehouseFk',
'description',
@@ -78,7 +78,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
@on-fetch="setData"
>
-
+
{
option-label="name"
:input-debounce="0"
/>
-
+
@@ -170,7 +170,7 @@ es:
Hour finished: Hora fin
Description: Descripción
Is served: Se ha servido
- Created: Creado
+ Dated: Fecha
The km can not exceed: La distancia debe ser inferior a {maxDistance}
en:
The km can not exceed: Distance must be lesser than {maxDistance}
diff --git a/src/pages/Route/Card/RouteSummary.vue b/src/pages/Route/Card/RouteSummary.vue
index 3f9b1a2a9..a0b971195 100644
--- a/src/pages/Route/Card/RouteSummary.vue
+++ b/src/pages/Route/Card/RouteSummary.vue
@@ -139,7 +139,7 @@ const ticketColumns = ref([
[
},
{
align: 'left',
- name: 'created',
+ name: 'dated',
label: t('Date'),
columnFilter: false,
- format: ({ created }) => toDate(created),
+ format: ({ dated }) => toDate(dated),
},
{
align: 'left',
diff --git a/src/pages/Route/RouteExtendedList.vue b/src/pages/Route/RouteExtendedList.vue
index 38e907ce0..221fc4754 100644
--- a/src/pages/Route/RouteExtendedList.vue
+++ b/src/pages/Route/RouteExtendedList.vue
@@ -111,7 +111,7 @@ const columns = computed(() => [
},
{
align: 'left',
- name: 'created',
+ name: 'dated',
label: t('route.Date'),
columnFilter: false,
cardVisible: true,
diff --git a/src/pages/Route/RouteList.vue b/src/pages/Route/RouteList.vue
index d0feb9a65..b82d1468e 100644
--- a/src/pages/Route/RouteList.vue
+++ b/src/pages/Route/RouteList.vue
@@ -26,7 +26,7 @@ const routeFilter = {
};
const columns = computed(() => [
{
- align: 'left',
+ align: 'right',
isId: true,
name: 'id',
label: 'Id',
diff --git a/src/pages/Route/RouteRoadmap.vue b/src/pages/Route/RouteRoadmap.vue
index 3687442f5..168e52b23 100644
--- a/src/pages/Route/RouteRoadmap.vue
+++ b/src/pages/Route/RouteRoadmap.vue
@@ -45,7 +45,7 @@ const columns = computed(() => [
columnFilter: {
inWhere: true,
},
- format: ({ created }) => toDate(created),
+ format: ({ dated }) => toDate(dated),
cardVisible: true,
},
{
diff --git a/src/pages/Route/RouteTickets.vue b/src/pages/Route/RouteTickets.vue
index 3bdad4fec..56e3143b4 100644
--- a/src/pages/Route/RouteTickets.vue
+++ b/src/pages/Route/RouteTickets.vue
@@ -109,7 +109,7 @@ const ticketList = ref([]);
const cloneRoutes = () => {
axios.post('Routes/clone', {
- created: startingDate.value,
+ dated: startingDate.value,
ids: selectedRows.value.map((row) => row?.id),
});
refreshKey.value++;
diff --git a/src/pages/Route/locale/en.yml b/src/pages/Route/locale/en.yml
index d113fda67..420d18dfe 100644
--- a/src/pages/Route/locale/en.yml
+++ b/src/pages/Route/locale/en.yml
@@ -5,7 +5,7 @@ route:
Description: Description
hourStarted: H.Start
hourFinished: H.End
- createRoute: Create route
+ dated: Dated
From: From
To: To
Date: Date
diff --git a/src/pages/Shelving/Card/ShelvingSummary.vue b/src/pages/Shelving/Card/ShelvingSummary.vue
index db7ac34f5..0c1eb2a1d 100644
--- a/src/pages/Shelving/Card/ShelvingSummary.vue
+++ b/src/pages/Shelving/Card/ShelvingSummary.vue
@@ -43,7 +43,7 @@ const filter = {
data-key="ShelvingSummary"
>
- {{ entity.code }}
+ {{ entity.id }} - {{ entity.code }}
diff --git a/src/pages/Shelving/ShelvingList.vue b/src/pages/Shelving/ShelvingList.vue
index a6ea50cf4..cd7c4bcf9 100644
--- a/src/pages/Shelving/ShelvingList.vue
+++ b/src/pages/Shelving/ShelvingList.vue
@@ -1,8 +1,6 @@
- {{ travel.ref }} - {{ travel.id }}
+ {{ travel.id }} - {{ travel.ref }}
@@ -256,16 +256,20 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
:label="t('globals.warehouseOut')"
:value="travel.warehouseOut?.name"
/>
-
-
+
+
+
+
+
+
@@ -320,7 +324,6 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
- {{ t(`params.${tag.label}`) }}:
+ {{ t(`travel.${tag.label}`) }}:
{{ formatFn(tag.value) }}
@@ -77,7 +77,6 @@ defineExpose({ states });
:label="t('travel.shipped')"
v-model="params.shipped"
@update:model-value="searchFn()"
- dense
outlined
rounded
/>
@@ -125,7 +124,7 @@ defineExpose({ states });
is-outlined
/>
diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue
index 0e69250a8..4d2912bf7 100644
--- a/src/pages/Travel/TravelList.vue
+++ b/src/pages/Travel/TravelList.vue
@@ -1,8 +1,7 @@
@@ -156,7 +152,6 @@ onMounted(() => (stateStore.rightDrawer = true));
:columns="columns"
redirect="zone"
:right-search="false"
- auto-load
>
import('src/pages/Shelving/ShelvingList.vue'),
diff --git a/src/router/modules/wagon.js b/src/router/modules/wagon.js
index e25e585eb..3556f215f 100644
--- a/src/router/modules/wagon.js
+++ b/src/router/modules/wagon.js
@@ -25,7 +25,7 @@ export default {
path: 'list',
name: 'WagonList',
meta: {
- title: 'wagonsList',
+ title: 'list',
icon: 'vn:trolley',
},
component: () => import('src/pages/Wagon/WagonList.vue'),
diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js
index c5ebe762e..fc8161fb3 100644
--- a/src/router/modules/zone.js
+++ b/src/router/modules/zone.js
@@ -38,7 +38,7 @@ export default {
name: 'ZoneList',
meta: {
title: 'zonesList',
- icon: 'vn:zone',
+ icon: 'view_list',
},
component: () => import('src/pages/Zone/ZoneList.vue'),
},
diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js
index 332494aa8..cc8d86ea8 100644
--- a/src/stores/invoiceOutGlobal.js
+++ b/src/stores/invoiceOutGlobal.js
@@ -19,7 +19,7 @@ export const useInvoiceOutGlobalStore = defineStore({
maxShipped: null,
clientId: null,
printer: null,
- serialType: null,
+ serialType: 'global',
},
addresses: [],
minInvoicingDate: null,
@@ -41,7 +41,6 @@ export const useInvoiceOutGlobalStore = defineStore({
async fetchAllData() {
try {
- const userInfo = await useUserConfig().fetch();
const date = Date.vnNew();
this.formInitialData.maxShipped = new Date(
date.getFullYear(),
@@ -53,7 +52,7 @@ export const useInvoiceOutGlobalStore = defineStore({
await Promise.all([
this.fetchParallelism(),
- this.fetchInvoiceOutConfig(userInfo.companyFk),
+ this.fetchInvoiceOutConfig(),
]);
this.initialDataLoading = false;
@@ -62,21 +61,23 @@ export const useInvoiceOutGlobalStore = defineStore({
}
},
- async fetchInvoiceOutConfig(companyFk) {
+ async fetchInvoiceOutConfig(formData = this.formInitialData) {
try {
- this.formInitialData.companyFk = companyFk;
- const params = { companyFk: companyFk };
+ const userInfo = await useUserConfig().fetch();
+ const params = {
+ companyFk: userInfo.companyFk,
+ serialType: formData.serialType,
+ };
const { data } = await axios.get('InvoiceOuts/getInvoiceDate', {
params,
});
- const stringDate = data.issued.substring(0, 10);
- this.minInvoicingDate = stringDate;
- this.formInitialData.invoiceDate = stringDate;
-
- this.minInvoicingDate = new Date(data.issued);
+ this.minInvoicingDate = data?.issued
+ ? new Date(data.issued)
+ : Date.vnNew();
this.formInitialData.invoiceDate = this.minInvoicingDate;
+ formData.invoiceDate = this.minInvoicingDate;
} catch (err) {
console.error('Error fetching invoice out global initial data');
throw new Error();
diff --git a/src/stores/useArrayDataStore.js b/src/stores/useArrayDataStore.js
index 6a0e7dfa8..d0a1c3a8f 100644
--- a/src/stores/useArrayDataStore.js
+++ b/src/stores/useArrayDataStore.js
@@ -17,6 +17,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
searchUrl: 'params',
navigate: null,
page: 1,
+ mapKey: 'id',
};
function get(key) {
@@ -46,6 +47,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
function getDefaultState() {
return Object.assign(JSON.parse(JSON.stringify(defaultOpts)), {
data: ref(),
+ map: ref(new Map()),
});
}
diff --git a/src/stores/useStateStore.js b/src/stores/useStateStore.js
index 328df9978..686e76c77 100644
--- a/src/stores/useStateStore.js
+++ b/src/stores/useStateStore.js
@@ -15,6 +15,10 @@ export const useStateStore = defineStore('stateStore', () => {
rightDrawer.value = !rightDrawer.value;
}
+ function rightDrawerChangeValue(value) {
+ rightDrawer.value = value;
+ }
+
function toggleSubToolbar() {
subToolbar.value = !subToolbar.value;
}
@@ -50,5 +54,6 @@ export const useStateStore = defineStore('stateStore', () => {
isRightDrawerShown,
isSubToolbarShown,
toggleSubToolbar,
+ rightDrawerChangeValue,
};
});
diff --git a/test/cypress/integration/claim/claimDevelopment.spec.js b/test/cypress/integration/claim/claimDevelopment.spec.js
index eb39f340a..df9d09a49 100755
--- a/test/cypress/integration/claim/claimDevelopment.spec.js
+++ b/test/cypress/integration/claim/claimDevelopment.spec.js
@@ -3,6 +3,8 @@ describe('ClaimDevelopment', () => {
const claimId = 1;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const thirdRow = 'tbody > :nth-child(3)';
+ const lastReason = 'Incompetencia';
+ const newReason = 'Calor';
beforeEach(() => {
cy.viewport(1920, 1080);
@@ -14,22 +16,22 @@ describe('ClaimDevelopment', () => {
});
it('should reset line', () => {
- cy.selectOption(firstLineReason, 'Novato');
+ cy.selectOption(firstLineReason, newReason);
cy.resetCard();
- cy.getValue(firstLineReason).should('equal', 'Prisas');
+ cy.getValue(firstLineReason).should('equal', lastReason);
});
it('should edit line', () => {
- cy.selectOption(firstLineReason, 'Novato');
+ cy.selectOption(firstLineReason, newReason);
cy.saveCard();
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
- cy.getValue(firstLineReason).should('equal', 'Novato');
+ cy.getValue(firstLineReason).should('equal', newReason);
//Restart data
- cy.selectOption(firstLineReason, 'Prisas');
+ cy.selectOption(firstLineReason, lastReason);
cy.saveCard();
});
@@ -42,7 +44,7 @@ describe('ClaimDevelopment', () => {
const rowData = [
false,
- 'Novato',
+ newReason,
'Roces',
'Compradores',
'administrativeNick',
diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js
index ce07deb16..dcded63b0 100644
--- a/test/cypress/integration/client/clientList.spec.js
+++ b/test/cypress/integration/client/clientList.spec.js
@@ -16,7 +16,7 @@ describe('Client list', () => {
});
it('Client list create new client', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
const randomInt = Math.floor(Math.random() * 90) + 10;
const data = {
@@ -26,8 +26,8 @@ describe('Client list', () => {
'Web user': { val: `user_test_${randomInt}` },
Street: { val: `C/ STREET ${randomInt}` },
Email: { val: `user.test${randomInt}@cypress.com` },
- 'Sales person': { val: 'employee', type: 'select' },
- Location: { val: '46000, Valencia(Province one), España', type: 'select' },
+ 'Sales person': { val: 'salesPerson', type: 'select' },
+ Location: { val: '46000', type: 'select' },
'Business type': { val: 'Otros', type: 'select' },
};
cy.fillInForm(data);
diff --git a/test/cypress/integration/entry/stockBought.spec.js b/test/cypress/integration/entry/stockBought.spec.js
index 66e06b79e..078ad19cc 100644
--- a/test/cypress/integration/entry/stockBought.spec.js
+++ b/test/cypress/integration/entry/stockBought.spec.js
@@ -11,7 +11,7 @@ describe('EntryStockBought', () => {
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
it('Should add a new reserved space for buyerBoss', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.get('input[aria-label="Reserve"]').type('1');
cy.get('input[aria-label="Date"]').eq(1).clear();
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
diff --git a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
index f6dac4c73..4c2550548 100644
--- a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js
@@ -2,7 +2,7 @@
describe('InvoiceInIntrastat', () => {
const firstRow = 'tbody > :nth-child(1)';
const thirdRow = 'tbody > :nth-child(3)';
- const firstRowCode = `${firstRow} > :nth-child(2)`;
+ const codes = `[data-cy="intrastat-code"]`;
const firstRowAmount = `${firstRow} > :nth-child(3)`;
beforeEach(() => {
@@ -11,13 +11,12 @@ describe('InvoiceInIntrastat', () => {
});
it('should edit the first line', () => {
- cy.selectOption(firstRowCode, 'Plantas vivas: Esqueje/injerto, Vid');
+ cy.selectOption(`${firstRow} ${codes}`, 'Plantas vivas: Esqueje/injerto, Vid');
cy.get(firstRowAmount).clear();
cy.saveCard();
- cy.get(`${firstRowCode} span`).should(
- 'have.text',
- '6021010:Plantas vivas: Esqueje/injerto, Vid'
- );
+ cy.get(codes)
+ .eq(0)
+ .should('have.value', '6021010: Plantas vivas: Esqueje/injerto, Vid');
});
it('should add a new row', () => {
diff --git a/test/cypress/integration/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
index fa0d1c5e4..d9ab3f7e7 100644
--- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js
@@ -1,7 +1,7 @@
///
describe('InvoiceInList', () => {
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
- const firstId = `${firstRow} > td:nth-child(1) span`;
+ const firstId = `${firstRow} > td:nth-child(2) span`;
const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
const summaryHeaders = '.summaryBody .header-link';
diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
index b84d743d1..f8b403a45 100644
--- a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
@@ -2,6 +2,7 @@
describe('InvoiceInVat', () => {
const thirdRow = 'tbody > :nth-child(3)';
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
+ const vats = '[data-cy="vat-sageiva"]';
const dialogInputs = '.q-dialog label input';
const addBtn = 'tbody tr:nth-child(1) td:nth-child(2) .--add-icon';
const randomInt = Math.floor(Math.random() * 100);
@@ -14,9 +15,9 @@ describe('InvoiceInVat', () => {
});
it('should edit the sage iva', () => {
- cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
+ cy.selectOption(`${firstLineVat} ${vats}`, 'H.P. IVA 21% CEE');
cy.saveCard();
- cy.get(`${firstLineVat} span`).should('have.text', '8:H.P. IVA 21% CEE');
+ cy.get(vats).eq(0).should('have.value', '8: H.P. IVA 21% CEE');
});
it('should add a new row', () => {
diff --git a/test/cypress/integration/item/ItemFixedPrice.spec.js b/test/cypress/integration/item/ItemFixedPrice.spec.js
index 824ecf7a0..92dc27fda 100644
--- a/test/cypress/integration/item/ItemFixedPrice.spec.js
+++ b/test/cypress/integration/item/ItemFixedPrice.spec.js
@@ -19,7 +19,7 @@ describe('Handle Items FixedPrice', () => {
cy.selectOption('.list > :nth-child(2)', 'Alstroemeria');
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.selectOption(`${firstRow} > :nth-child(2)`, '#13');
cy.get(`${firstRow} > :nth-child(4)`).find('input').type(1);
cy.get(`${firstRow} > :nth-child(5)`).find('input').type('2');
@@ -29,7 +29,7 @@ describe('Handle Items FixedPrice', () => {
});
it('Create and delete ', function () {
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
cy.get(`${firstRow} > :nth-child(4)`).type('1');
cy.get(`${firstRow} > :nth-child(5)`).type('2');
diff --git a/test/cypress/integration/route/roadMap/roadmapList.spec.js b/test/cypress/integration/route/roadMap/roadmapList.spec.js
index ba602fdf6..2f5e5672f 100644
--- a/test/cypress/integration/route/roadMap/roadmapList.spec.js
+++ b/test/cypress/integration/route/roadMap/roadmapList.spec.js
@@ -5,7 +5,7 @@ describe('RoadMap', () => {
cy.visit(`/#/route/roadmap`);
});
it('Route list create roadmap and redirect', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.get('input[name="name"]').eq(1).type('roadMapTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary');
diff --git a/test/cypress/integration/route/routeList.spec.js b/test/cypress/integration/route/routeList.spec.js
index 8020d3ea9..4da43ce8e 100644
--- a/test/cypress/integration/route/routeList.spec.js
+++ b/test/cypress/integration/route/routeList.spec.js
@@ -9,7 +9,7 @@ describe('Route', () => {
const getRowColumn = (row, column) => `:nth-child(${row}) > :nth-child(${column})`;
it('Route list create route', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.get('input[name="description"]').type('routeTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary');
diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index c1d1a0655..b30b4cdad 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -37,7 +37,7 @@ describe('TicketList', () => {
cy.dataCy('ticketSummary').should('exist');
});
- it.only('Client list create new client', () => {
+ it('Client list create new client', () => {
cy.dataCy('vnTableCreateBtn').should('exist');
cy.dataCy('vnTableCreateBtn').click();
const data = {
diff --git a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
index e996a65d5..8e37d8c9c 100644
--- a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
+++ b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
@@ -1,6 +1,5 @@
///
describe('VnBreadcrumbs', () => {
- const firstCard = '.q-infinite-scroll > :nth-child(1)';
const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
beforeEach(() => {
cy.viewport(1920, 1080);
@@ -13,10 +12,7 @@ describe('VnBreadcrumbs', () => {
});
it('should get the correct breadcrumbs', () => {
- cy.visit('#/customer/list');
- cy.get('.q-breadcrumbs__el').should('have.length', 2);
-
- cy.get(firstCard).click();
+ cy.visit('#/customer/1/summary');
cy.get(`${lastBreadcrumb} > .q-icon`).should('have.text', 'launch');
});
});
diff --git a/test/cypress/integration/vnComponent/VnLog.spec.js b/test/cypress/integration/vnComponent/VnLog.spec.js
index 4db724e99..80b9d07df 100644
--- a/test/cypress/integration/vnComponent/VnLog.spec.js
+++ b/test/cypress/integration/vnComponent/VnLog.spec.js
@@ -9,15 +9,15 @@ describe('VnLog', () => {
cy.visit(`/#/claim/${1}/log`);
cy.openRightMenu();
});
- // Se tiene que cambiar el Accept-Language a 'en', ya hay una tarea para eso #7189.
- xit('should filter by insert actions', () => {
+
+ it('should filter by insert actions', () => {
cy.checkOption(':nth-child(7) > .q-checkbox');
cy.get('.q-page').click();
cy.validateContent(chips[0], 'Document');
cy.validateContent(chips[1], 'Beginning');
});
- xit('should filter by entity', () => {
+ it('should filter by entity', () => {
cy.selectOption('.q-drawer--right .q-item > .q-select', 'Claim');
cy.get('.q-page').click();
cy.validateContent(chips[0], 'Claim');
diff --git a/test/cypress/integration/wagonType/wagonTypeCreate.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
similarity index 100%
rename from test/cypress/integration/wagonType/wagonTypeCreate.spec.js
rename to test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
diff --git a/test/cypress/integration/wagonType/wagonTypeEdit.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
similarity index 100%
rename from test/cypress/integration/wagonType/wagonTypeEdit.spec.js
rename to test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
diff --git a/test/cypress/integration/worker/workerPda.spec.js b/test/cypress/integration/worker/workerPda.spec.js
index dc1ca6224..31ec19eda 100644
--- a/test/cypress/integration/worker/workerPda.spec.js
+++ b/test/cypress/integration/worker/workerPda.spec.js
@@ -7,7 +7,7 @@ describe('WorkerPda', () => {
});
it('assign pda', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.addBtnClick();
cy.get(select).click();
cy.get(select).type('{downArrow}{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
diff --git a/test/cypress/integration/zone/zoneCreate.spec.js b/test/cypress/integration/zone/zoneCreate.spec.js
index 9618ea846..cc5de8c6c 100644
--- a/test/cypress/integration/zone/zoneCreate.spec.js
+++ b/test/cypress/integration/zone/zoneCreate.spec.js
@@ -22,6 +22,7 @@ describe('ZoneCreate', () => {
...data,
});
cy.get('input[aria-label="Close"]').type('10:00');
+ cy.get('body').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Agency cannot be blank');
});
@@ -32,6 +33,7 @@ describe('ZoneCreate', () => {
Agency: { val: 'inhouse pickup', type: 'select' },
});
cy.get('input[aria-label="Close"]').type('10:00');
+ cy.get('body').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created');
});
diff --git a/test/cypress/integration/zone/zoneList.spec.js b/test/cypress/integration/zone/zoneList.spec.js
index 92c77a2c6..8d01d4e4e 100644
--- a/test/cypress/integration/zone/zoneList.spec.js
+++ b/test/cypress/integration/zone/zoneList.spec.js
@@ -6,9 +6,7 @@ describe('ZoneList', () => {
});
it('should filter by agency', () => {
- cy.get(
- ':nth-child(1) > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
- ).type('{downArrow}{enter}');
+ cy.get('input[aria-label="Agency"]').type('{downArrow}{enter}');
});
it('should open the zone summary', () => {
diff --git a/test/cypress/integration/zone/zoneWarehouse.spec.js b/test/cypress/integration/zone/zoneWarehouse.spec.js
index 3ffa3f69d..817e26312 100644
--- a/test/cypress/integration/zone/zoneWarehouse.spec.js
+++ b/test/cypress/integration/zone/zoneWarehouse.spec.js
@@ -1,10 +1,10 @@
describe('ZoneWarehouse', () => {
const data = {
- Warehouse: { val: 'Algemesi', type: 'select' },
+ Warehouse: { val: 'Warehouse One', type: 'select' },
};
- const deviceProductionField =
- '.vn-row > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
- const dataError = "ER_DUP_ENTRY: Duplicate entry '2-2' for key 'zoneFk'";
+
+ const dataError = 'ER_DUP_ENTRY: Duplicate entry';
+ const saveBtn = '.q-btn--standard > .q-btn__content > .block';
beforeEach(() => {
cy.viewport(1280, 720);
@@ -13,22 +13,21 @@ describe('ZoneWarehouse', () => {
});
it('should throw an error if the warehouse chosen is already put in the zone', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(deviceProductionField).click();
- cy.get(deviceProductionField).type('{upArrow}{enter}');
- cy.get('.q-notification__message').should('have.text', dataError);
+ cy.addBtnClick();
+ cy.selectOption('[data-cy="Warehouse_select"]', 'Warehouse Two');
+ cy.get(saveBtn).click();
+ cy.checkNotification(dataError);
});
- it('should create a warehouse', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(deviceProductionField).click();
+ it('should create & remove a warehouse', () => {
+ cy.addBtnClick();
cy.fillInForm(data);
+ cy.get(saveBtn).click();
cy.get('.q-mt-lg > .q-btn--standard').click();
- });
- it('should delete a warehouse', () => {
cy.get('tbody > :nth-child(2) > :nth-child(2) > .q-icon').click();
- cy.get('.q-card__actions > .q-btn--flat > .q-btn__content').click();
+ cy.get('[title="Confirm"]').click();
+
cy.reload();
});
});
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 2b13a7144..df2c00e03 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -58,8 +58,9 @@ Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
});
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
- cy.waitUntil(() => cy.get(element).then(($el) => $el.is(':visible')));
+ cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
});
+
Cypress.Commands.add('getValue', (selector) => {
cy.get(selector).then(($el) => {
if ($el.find('.q-checkbox__inner').length > 0) {
@@ -86,15 +87,40 @@ Cypress.Commands.add('getValue', (selector) => {
});
// Fill Inputs
-Cypress.Commands.add('selectOption', (selector, option, timeout) => {
- cy.waitForElement(selector);
+Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
+ cy.waitForElement(selector, timeout);
cy.get(selector).click();
- cy.wait(timeout || 1000);
- cy.get('.q-menu .q-item').contains(option).click();
+ cy.get(selector).invoke('data', 'url').as('dataUrl');
+ cy.get(selector)
+ .clear()
+ .type(option)
+ .then(() => {
+ cy.get('.q-menu', { timeout })
+ .should('be.visible') // Asegurarse de que el menú está visible
+ .and('exist') // Verificar que el menú existe
+ .then(() => {
+ cy.get('@dataUrl').then((url) => {
+ if (url) {
+ cy.log('url: ', url);
+ // Esperar a que el menú no esté visible (desaparezca)
+ cy.get('.q-menu').should('not.be.visible');
+ // Ahora esperar a que el menú vuelva a aparecer
+ cy.get('.q-menu').should('be.visible').and('exist');
+ }
+ });
+ });
+ });
+
+ // Finalmente, seleccionar la opción deseada
+ cy.get('.q-menu:visible') // Asegurarse de que estamos dentro del menú visible
+ .find('.q-item') // Encontrar los elementos de las opciones
+ .contains(option) // Verificar que existe una opción que contenga el texto deseado
+ .click(); // Hacer clic en la opción
});
+
Cypress.Commands.add('countSelectOptions', (selector, option) => {
cy.waitForElement(selector);
- cy.get(selector).click();
+ cy.get(selector).click({ force: true });
cy.get('.q-menu .q-item').should('have.length', option);
});
@@ -110,8 +136,7 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
const { type, val } = field;
switch (type) {
case 'select':
- cy.get(el).click();
- cy.get('.q-menu .q-item').contains(val).click();
+ cy.selectOption(el, val);
break;
case 'date':
cy.get(el).type(val.split('-').join(''));
@@ -347,3 +372,10 @@ Cypress.Commands.add('searchByLabel', (label, value) => {
Cypress.Commands.add('dataCy', (tag, attr = 'data-cy') => {
return cy.get(`[${attr}="${tag}"]`);
});
+
+Cypress.Commands.add('addBtnClick', () => {
+ cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon')
+ .should('exist')
+ .and('be.visible')
+ .click();
+});
diff --git a/test/vitest/__tests__/boot/axios.spec.js b/test/vitest/__tests__/boot/axios.spec.js
index 19d396ec5..b3b6f98c6 100644
--- a/test/vitest/__tests__/boot/axios.spec.js
+++ b/test/vitest/__tests__/boot/axios.spec.js
@@ -1,4 +1,3 @@
-import { Notify } from 'quasar';
import { onRequest, onResponseError } from 'src/boot/axios';
import { describe, expect, it, vi } from 'vitest';
@@ -27,6 +26,7 @@ describe('Axios boot', () => {
expect(resultConfig).toEqual(
expect.objectContaining({
headers: {
+ 'Accept-Language': 'en-US',
Authorization: 'DEFAULT_TOKEN',
},
})
diff --git a/test/vitest/__tests__/components/Paginate.spec.js b/test/vitest/__tests__/components/Paginate.spec.js
index 345903c1a..a67dfcdc6 100644
--- a/test/vitest/__tests__/components/Paginate.spec.js
+++ b/test/vitest/__tests__/components/Paginate.spec.js
@@ -4,7 +4,11 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue';
describe('VnPaginate', () => {
const expectedUrl = '/api/customers';
-
+ const defaultData = [
+ { id: 1, name: 'Tony Stark' },
+ { id: 2, name: 'Jessica Jones' },
+ { id: 3, name: 'Bruce Wayne' },
+ ];
let vm;
beforeAll(() => {
const options = {
@@ -28,11 +32,7 @@ describe('VnPaginate', () => {
describe('paginate()', () => {
it('should call to the paginate() method and set the data on the rows property', async () => {
vi.spyOn(vm.arrayData, 'loadMore');
- vm.store.data = [
- { id: 1, name: 'Tony Stark' },
- { id: 2, name: 'Jessica Jones' },
- { id: 3, name: 'Bruce Wayne' },
- ];
+ vm.store.data = defaultData;
await vm.paginate();
@@ -42,26 +42,25 @@ describe('VnPaginate', () => {
it('should call to the paginate() method and then call it again to paginate', async () => {
vi.spyOn(axios, 'get').mockResolvedValue({
- data: [
- { id: 1, name: 'Tony Stark' },
- { id: 2, name: 'Jessica Jones' },
- { id: 3, name: 'Bruce Wayne' },
- ],
+ data: defaultData,
});
vm.store.hasMoreData = true;
await vm.$nextTick();
- vm.store.data = [
- { id: 1, name: 'Tony Stark' },
- { id: 2, name: 'Jessica Jones' },
- { id: 3, name: 'Bruce Wayne' },
- ];
+ vm.store.data = defaultData;
await vm.paginate();
expect(vm.store.skip).toEqual(3);
expect(vm.store.data.length).toEqual(6);
+ vi.spyOn(axios, 'get').mockResolvedValue({
+ data: [
+ { id: 4, name: 'Peter Parker' },
+ { id: 5, name: 'Clark Kent' },
+ { id: 6, name: 'Barry Allen' },
+ ],
+ });
await vm.paginate();
expect(vm.store.skip).toEqual(6);
@@ -85,11 +84,7 @@ describe('VnPaginate', () => {
const index = 1;
const done = vi.fn();
- vm.store.data = [
- { id: 1, name: 'Tony Stark' },
- { id: 2, name: 'Jessica Jones' },
- { id: 3, name: 'Bruce Wayne' },
- ];
+ vm.store.data = defaultData;
await vm.onLoad(index, done);
@@ -105,11 +100,7 @@ describe('VnPaginate', () => {
],
});
- vm.store.data = [
- { id: 1, name: 'Tony Stark' },
- { id: 2, name: 'Jessica Jones' },
- { id: 3, name: 'Bruce Wayne' },
- ];
+ vm.store.data = defaultData;
expect(vm.pagination.page).toEqual(1);
diff --git a/test/vitest/__tests__/composables/getExchange.spec.js b/test/vitest/__tests__/composables/getExchange.spec.js
new file mode 100644
index 000000000..dba31458e
--- /dev/null
+++ b/test/vitest/__tests__/composables/getExchange.spec.js
@@ -0,0 +1,45 @@
+import { describe, expect, it, vi } from 'vitest';
+import axios from 'axios';
+import { getExchange } from 'src/composables/getExchange';
+
+vi.mock('axios');
+
+describe('getExchange()', () => {
+ it('should return the correct exchange rate', async () => {
+ axios.get.mockResolvedValue({
+ data: { value: 1.2 },
+ });
+
+ const amount = 100;
+ const currencyFk = 1;
+ const dated = '2023-01-01';
+ const result = await getExchange(amount, currencyFk, dated);
+
+ expect(result).toBe('83.33');
+ });
+
+ it('should return the correct exchange rate with custom decimal places', async () => {
+ axios.get.mockResolvedValue({
+ data: { value: 1.2 },
+ });
+
+ const amount = 100;
+ const currencyFk = 1;
+ const dated = '2023-01-01';
+ const decimalPlaces = 3;
+ const result = await getExchange(amount, currencyFk, dated, decimalPlaces);
+
+ expect(result).toBe('83.333');
+ });
+
+ it('should return null if the API call fails', async () => {
+ axios.get.mockRejectedValue(new Error('Network error'));
+
+ const amount = 100;
+ const currencyFk = 1;
+ const dated = '2023-01-01';
+ const result = await getExchange(amount, currencyFk, dated);
+
+ expect(result).toBeNull();
+ });
+});
diff --git a/test/vitest/__tests__/composables/getTotal.spec.js b/test/vitest/__tests__/composables/getTotal.spec.js
new file mode 100644
index 000000000..789e3fbcf
--- /dev/null
+++ b/test/vitest/__tests__/composables/getTotal.spec.js
@@ -0,0 +1,55 @@
+import { vi, describe, expect, it } from 'vitest';
+import { getTotal } from 'src/composables/getTotal';
+
+vi.mock('src/filters', () => ({
+ toCurrency: vi.fn((value, currency) => `${currency} ${value.toFixed(2)}`),
+}));
+
+describe('getTotal()', () => {
+ const rows = [
+ { amount: 10.5, tax: 2.1 },
+ { amount: 20.75, tax: 3.25 },
+ { amount: 30.25, tax: 4.75 },
+ ];
+
+ it('should calculate the total for a given key', () => {
+ const total = getTotal(rows, 'amount');
+ expect(total).toBe('61.50');
+ });
+
+ it('should calculate the total with a callback function', () => {
+ const total = getTotal(rows, null, { cb: (row) => row.amount + row.tax });
+ expect(total).toBe('71.60');
+ });
+
+ it('should format the total as currency', () => {
+ const total = getTotal(rows, 'amount', { currency: 'USD' });
+ expect(total).toBe('USD 61.50');
+ });
+
+ it('should format the total as currency with default currency', () => {
+ const total = getTotal(rows, 'amount', { currency: 'default' });
+ expect(total).toBe('undefined 61.50');
+ });
+
+ it('should calculate the total with integer formatting', () => {
+ const total = getTotal(rows, 'amount', { decimalPlaces: 0 });
+ expect(total).toBe('62');
+ });
+
+ it('should calculate the total with custom decimal places', () => {
+ const total = getTotal(rows, 'amount', { decimalPlaces: 1 });
+ expect(total).toBe('61.5');
+ });
+
+ it('should handle rows with missing keys', () => {
+ const rowsWithMissingKeys = [{ amount: 10.5 }, { amount: 20.75 }, {}];
+ const total = getTotal(rowsWithMissingKeys, 'amount');
+ expect(total).toBe('31.25');
+ });
+
+ it('should handle empty rows', () => {
+ const total = getTotal([], 'amount');
+ expect(total).toBe('0.00');
+ });
+});
diff --git a/test/vitest/__tests__/composables/useAccountShortToStandard.spec.js b/test/vitest/__tests__/composables/useAccountShortToStandard.spec.js
new file mode 100644
index 000000000..d24585812
--- /dev/null
+++ b/test/vitest/__tests__/composables/useAccountShortToStandard.spec.js
@@ -0,0 +1,9 @@
+import { describe, expect, it } from 'vitest';
+import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
+
+describe('useAccountShortToStandard()', () => {
+ it('should pad the decimal part with zeros for short numbers', () => {
+ expect(useAccountShortToStandard('123.45')).toBe('1230000045');
+ expect(useAccountShortToStandard('123.')).toBe('1230000000');
+ });
+});
diff --git a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js b/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js
deleted file mode 100644
index adfb054c6..000000000
--- a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInIntrastat.spec.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import { vi, describe, expect, it, beforeAll } from 'vitest';
-import { createWrapper, axios } from 'app/test/vitest/helper';
-import InvoiceInIntrastat from 'src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue';
-
-describe('InvoiceInIntrastat', () => {
- let vm;
-
- beforeAll(() => {
- vm = createWrapper(InvoiceInIntrastat, {
- global: {
- stubs: ['vnPaginate'],
- mocks: {
- fetch: vi.fn(),
- },
- },
- }).vm;
- vi.spyOn(axios, 'get').mockResolvedValue({ data: [{}] });
- });
-
- describe('getTotal()', () => {
- it('should correctly handle the sum', () => {
- const invoceInIntrastat = [
- { amount: 10, stems: 162 },
- { amount: 20, stems: 21 },
- ];
-
- const totalAmount = vm.getTotal(invoceInIntrastat, 'amount');
- const totalStems = vm.getTotal(invoceInIntrastat, 'stems');
-
- expect(totalAmount).toBe(10 + 20);
- expect(totalStems).toBe(162 + 21);
- });
- });
-});
diff --git a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInVat.spec.js b/test/vitest/__tests__/pages/InvoiceIn/InvoiceInVat.spec.js
deleted file mode 100644
index 76453f65a..000000000
--- a/test/vitest/__tests__/pages/InvoiceIn/InvoiceInVat.spec.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import { vi, describe, expect, it, beforeAll } from 'vitest';
-import { createWrapper } from 'app/test/vitest/helper';
-import InvoiceInVat from 'src/pages/InvoiceIn/Card/InvoiceInVat.vue';
-
-describe('InvoiceInVat', () => {
- let vm;
-
- beforeAll(() => {
- vm = createWrapper(InvoiceInVat, {
- global: {
- stubs: [],
- mocks: {
- fetch: vi.fn(),
- },
- },
- }).vm;
- });
-
- describe('taxRate()', () => {
- it('should correctly compute the tax rate', () => {
- const invoiceInTax = { taxableBase: 100, taxTypeSageFk: 1 };
- vm.sageTaxTypes = [
- { id: 1, rate: 10 },
- { id: 2, rate: 20 },
- ];
- const result = vm.taxRate(invoiceInTax);
- expect(result).toBe((10 / 100) * 100);
- });
-
- it('should return 0 if there is not tax rate', () => {
- const invoiceInTax = { taxableBase: 100, taxTypeSageFk: 1 };
- vm.sageTaxTypes = [];
-
- const result = vm.taxRate(invoiceInTax);
- expect(result).toBe(0);
- });
- });
-});