Merge branch 'dev' into 8258-uppercaseInputs
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-14 12:45:18 +00:00
commit 5ce78ba473
10 changed files with 272 additions and 43 deletions

View File

@ -1,3 +1,82 @@
# Version 25.00 - 2025-01-14
### Added 🆕
- chore: refs #7056 move test by:jorgep
- feat: refs #7050 7050 add object check by:Jtubau
- feat: refs #7050 7050 add test to isEmpty() by:Jtubau
- feat: refs #7056 add tests in FormModel by:jorgep
- feat: refs #7056 update route meta information and add FormModel tests by:jorgep
- feat: refs #7074 tests for fns setData(), parseDms() and showFormDialog() (7074-makeFrontTestToVnDmsList) by:Jtubau
- feat: refs #7079 created VnLocation front test by:provira
- feat: refs #7189 add Accept-Language header to axios requests by:jorgep
- feat: refs #7924 add custom inspection checkbox and localization support by:jgallego
- feat: refs #7924 update custom inspection label for clarity in English and Spanish locales by:jgallego
- feat: refs #8004 enhance FetchedTags component with column support and styling updates by:pablone
- feat: refs #8004 hide rightFilter by:pablone
- feat: refs #8246 added new field in list by:Jon
- feat: refs #8266 added descriptor to item name by:jtubau
- feat: refs #8293 add zone filter by:Jtubau
- feat: refs #8293 include zone data in each record by:Jtubau
- fix: refs #8004 more list style issues by:pablone
- fix: refs #8004 some style issues on all list by:pablone
- style: refs #8004 update layout and styling in FetchedTags and ItemList components by:pablone
- style: update CustomerBalance.vue to set label color by:jgallego
### Changed 📦
- perf: order by:alexm
- perf: redirect transition list to card by:alexm
- perf: refs #8201 onDataSaved fetch by:Jon
- perf: revert processData by:alexm
- perf: simplify if by:alexm
- perf: simplify if (perf_redirectTransition) by:alexm
- refactor: item fixedPrice by:Jon
- refactor: refs #7050 refactorize by:jtubau
- refactor: refs #7050 removed blank spaces by:jtubau
- refactor: refs #7052 move EditTableCellValueForm tests to a new location and enhance test coverage by:jgallego
- refactor: refs #7052 remove unnecessary console logs from EditTableCellValueForm tests by:jgallego
- refactor: refs #7074 move dms constant to global scope by:Jtubau
- refactor: refs #7079 removed useless code by:provira
- refactor: refs #7924 simplify custom inspection icon rendering in ExtraCommunity.vue by:jgallego
- refactor: refs #8004 remove console log from CardSummary component on mount by:pablone
- refactor: refs #8004 remove consoleLogs by:pablone
- refactor: refs #8004 remove unused stateStore import in InvoiceInList.vue by:pablone
- refactor: refs #8004 remove unused travelFilterRef and chip definition in TravelList.vue by:pablone
- refactor: refs #8004 replace VnSelect with VnSelectWorker in CustomerList component by:pablone
- refactor: refs #8201 added onMounted to stablish the value to show icons by:Jon
- refactor: refs #8201 deleted condition by:Jon
- refactor: refs #8201 deleted log by:Jon
- refactor: refs #8201 deleted logs by:Jon
- refactor: refs #8266 8266 change expedition item name by:Jtubau
- refactor: refs #8266 change expedition label by:Jtubau
- refactor: refs #8293 remove redundant attributes by:Jtubau
- refactor: refs #8320 changed folder names from "specs" to "**tests**" by:provira
- refactor: refs #8320 moved front tests to their respective sections by:provira
- refactor: refs #8813 removed unused class property by:provira
### Fixed 🛠️
- fix: discount class by:PAU ROVIRA ROSALENY
- fix: duplicate transalation after test to dev by:alexm
- fix: fix translations by:carlossa
- fix: redirect to sales when confirming lines by:Jon
- fix: refs #7050 delete import added by mistake by:Jtubau
- fix: refs #7133 handleSalesModelValue function to handle empty input by:jorgep
- fix: refs #7189 update user language on sessionStorage by:jorgep
- fix: refs #7935 remove unused 'companyFk' column from InvoiceInList component by:jorgep
- fix: refs #8004 more list style issues by:pablone
- fix: refs #8004 some style issues on all list by:pablone
- fix: refs #8004 update label for daysOnward in TravelFilter component and add translations by:pablone
- fix: refs #8004 vnTable card with and add permanent labels by:pablone
- fix: refs #8201 added onDataSaved emi to refetch when cahnges are made by:Jon
- fix: refs #8201 use arrayData to fix the error by:Jon
- fix: refs #8314 space between label and value by:jtubau
- fix: refs #8813 fixed ClaimLines format by:provira
- fix: update button sizes in ExtraCommunity.vue for better visibility by:jgallego
- perf: revert processData by:alexm
- refactor: item fixedPrice by:Jon
# Version 24.52 - 2024-01-07 # Version 24.52 - 2024-01-07
### Added 🆕 ### Added 🆕

View File

@ -31,7 +31,7 @@ export default {
console.error(error); console.error(error);
} }
form.addEventListener('keyup', function (evt) { form.addEventListener('keyup', function (evt) {
if (evt.key === 'Enter') { if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) {
const input = evt.target; const input = evt.target;
if (input.type == 'textarea' && evt.shiftKey) { if (input.type == 'textarea' && evt.shiftKey) {
evt.preventDefault(); evt.preventDefault();

View File

@ -0,0 +1,82 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import FilterItemForm from 'src/components/FilterItemForm.vue';
import { vi, beforeAll, describe, expect, it } from 'vitest';
describe('FilterItemForm', () => {
let vm;
let wrapper;
beforeAll(() => {
wrapper = createWrapper(FilterItemForm, {
props: {
url: 'Items/withName',
},
});
vm = wrapper.vm;
wrapper = wrapper.wrapper;
vi.spyOn(axios, 'get').mockResolvedValue({
data: [
{
id: 999996,
name: 'bolas de madera',
size: 2,
inkFk: null,
producerFk: null,
},
],
});
});
it('should filter data and populate tableRows for table display', async () => {
vm.itemFilterParams.name = 'bolas de madera';
await vm.onSubmit();
const expectedFilter = {
include: [
{ relation: 'producer', scope: { fields: ['name'] } },
{ relation: 'ink', scope: { fields: ['name'] } },
],
where: {"name":{"like":"%bolas de madera%"}},
};
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
params: { filter: JSON.stringify(expectedFilter) },
});
expect(vm.tableRows).toEqual([
{
id: 999996,
name: 'bolas de madera',
size: 2,
inkFk: null,
producerFk: null,
},
]);
});
it('should handle an empty itemFilterParams correctly', async () => {
vm.itemFilterParams.name = null;
vm.itemFilterParams = {};
await vm.onSubmit();
const expectedFilter = {
include: [
{ relation: 'producer', scope: { fields: ['name'] } },
{ relation: 'ink', scope: { fields: ['name'] } },
],
where: {},
};
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
params: { filter: JSON.stringify(expectedFilter) },
});
});
it('should emit "itemSelected" with the correct id and close the form', () => {
vm.selectItem({ id: 12345 });
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
});
});

View File

@ -0,0 +1,72 @@
import { createWrapper } from 'app/test/vitest/helper.js';
import { describe, it, expect } from 'vitest';
import VnInputDate from 'components/common/VnInputDate.vue';
let vm;
let wrapper;
function generateWrapper(date, outlined, required) {
wrapper = createWrapper(VnInputDate, {
props: {
modelValue: date,
},
attrs: {
isOutlined: outlined,
required: required
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
};
describe('VnInputDate', () => {
describe('formattedDate', () => {
it('formats a valid date correctly', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(vm.formattedDate).toBe('25/12/2023');
});
it('updates the model value when a new date is set', async () => {
const input = wrapper.find('input');
await input.setValue('31/12/2023');
expect(wrapper.emitted()['update:modelValue']).toBeTruthy();
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('2023-12-31T00:00:00.000Z');
});
it('should not update the model value when an invalid date is set', async () => {
const input = wrapper.find('input');
await input.setValue('invalid-date');
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('2023-12-31T00:00:00.000Z');
});
});
describe('styleAttrs', () => {
it('should return empty styleAttrs when isOutlined is false', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(vm.styleAttrs).toEqual({});
});
it('should set styleAttrs when isOutlined is true', async () => {
generateWrapper('2023-12-25', true, false);
await vm.$nextTick();
expect(vm.styleAttrs.outlined).toBe(true);
});
});
describe('required', () => {
it('should not applies required class when isRequired is false', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(wrapper.find('.vn-input-date').classes()).not.toContain('required');
});
it('should applies required class when isRequired is true', async () => {
generateWrapper('2023-12-25', false, true);
await vm.$nextTick();
expect(wrapper.find('.vn-input-date').classes()).toContain('required');
});
});
});

View File

@ -82,7 +82,7 @@ async function fetch() {
<span v-else></span> <span v-else></span>
</slot> </slot>
<slot name="header" :entity="entity" dense> <slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" /> {{ entity.id + ' - ' + entity.name }}
</slot> </slot>
<span class="row no-wrap"> <span class="row no-wrap">
<slot name="header-right" :entity="entity" /> <slot name="header-right" :entity="entity" />

View File

@ -30,7 +30,7 @@ onBeforeMount(async () => {
.data; .data;
if (!channel) channel = defaultChannel; if (!channel) channel = defaultChannel;
phone.value = await parsePhone(props.phoneNumber, props.country.toLowerCase()); phone.value = await parsePhone(props.phoneNumber, props.country?.toLowerCase());
config[ config[
type type
].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`; ].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`;

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -11,16 +11,9 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue'; import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
import { useState } from 'src/composables/useState';
const state = useState();
const customer = ref();
onMounted(async () => {
customer.value = state.get('customer');
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
});
const customerDebt = ref();
const customerCredit = ref();
const $props = defineProps({ const $props = defineProps({
id: { id: {
type: Number, type: Number,
@ -42,10 +35,12 @@ const entityId = computed(() => {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
customerDebt.value = entity?.debt;
customerCredit.value = entity?.credit;
data.value = useCardDescription(entity?.name, entity?.id); data.value = useCardDescription(entity?.name, entity?.id);
}; };
const debtWarning = computed(() => { const debtWarning = computed(() => {
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary'; return customerDebt.value > customerCredit.value ? 'negative' : 'primary';
}); });
</script> </script>
@ -97,26 +92,21 @@ const debtWarning = computed(() => {
:value="entity.businessType.description" :value="entity.businessType.description"
/> />
</template> </template>
<template #icons> <template #icons="{ entity }">
<QCardActions v-if="customer" class="q-gutter-x-md"> <QCardActions class="q-gutter-x-md">
<QIcon <QIcon
v-if="!customer.isActive" v-if="!entity.isActive"
name="vn:disabled" name="vn:disabled"
size="xs" size="xs"
color="primary" color="primary"
> >
<QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip> <QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon v-if="entity.isFreezed" name="vn:frozen" size="xs" color="primary">
v-if="customer.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip> <QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="!customer.account?.active" v-if="!entity.account?.active"
color="primary" color="primary"
name="vn:noweb" name="vn:noweb"
size="xs" size="xs"
@ -124,7 +114,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip> <QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="customer.debt > customer.credit" v-if="entity.debt > entity.credit"
name="vn:risk" name="vn:risk"
size="xs" size="xs"
:color="debtWarning" :color="debtWarning"
@ -132,7 +122,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip> <QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="!customer.isTaxDataChecked" v-if="!entity.isTaxDataChecked"
name="vn:no036" name="vn:no036"
size="xs" size="xs"
color="primary" color="primary"
@ -140,7 +130,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip> <QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
</QIcon> </QIcon>
<QBtn <QBtn
v-if="customer.unpaid" v-if="entity.unpaid"
flat flat
size="sm" size="sm"
icon="vn:Client_unpaid" icon="vn:Client_unpaid"

View File

@ -248,12 +248,14 @@ function handleLocation(data, location) {
clearable clearable
v-model="data.longitude" v-model="data.longitude"
:decimal-places="7" :decimal-places="7"
:positive="false"
/> />
<VnInputNumber <VnInputNumber
:label="t('Latitude')" :label="t('Latitude')"
clearable clearable
v-model="data.latitude" v-model="data.latitude"
:decimal-places="7" :decimal-places="7"
:positive="false"
/> />
</VnRow> </VnRow>
<h4 class="q-mb-xs">{{ t('Notes') }}</h4> <h4 class="q-mb-xs">{{ t('Notes') }}</h4>

View File

@ -213,9 +213,9 @@ async function handleConfirm() {
type: 'positive', type: 'positive',
}); });
router.push({ router.push({
name: 'TicketList', name: 'TicketSale',
query: { query: {
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }), table: JSON.stringify({ id: route.params.id }),
}, },
}); });
} }

View File

@ -7,7 +7,14 @@ import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
const { notify } = useNotify(); const { notify } = useNotify();
const initInvoicing = {
invoicing: false,
nRequests: 0,
nPdfs: 0,
totalPdfs: 0,
addressIndex: 0,
errors: [],
};
export const useInvoiceOutGlobalStore = defineStore({ export const useInvoiceOutGlobalStore = defineStore({
id: 'invoiceOutGlobal', id: 'invoiceOutGlobal',
state: () => ({ state: () => ({
@ -23,16 +30,11 @@ export const useInvoiceOutGlobalStore = defineStore({
addresses: [], addresses: [],
minInvoicingDate: null, minInvoicingDate: null,
parallelism: null, parallelism: null,
invoicing: false,
isInvoicing: false,
status: null, status: null,
addressIndex: 0,
errors: [],
printer: null, printer: null,
nRequests: 0,
nPdfs: 0,
totalPdfs: 0,
formData: null, formData: null,
...initInvoicing,
}), }),
actions: { actions: {
async init() { async init() {
@ -117,12 +119,13 @@ export const useInvoiceOutGlobalStore = defineStore({
); );
throw new Error("There aren't addresses to invoice"); throw new Error("There aren't addresses to invoice");
} }
this.invoicing = false;
this.status = 'invoicing';
this.formData = formData; this.formData = formData;
this.addressIndex = 0; this.status = 'invoicing';
this.errors = []; //reset data
await this.invoiceClient(); for (const key in initInvoicing) {
this[key] = initInvoicing[key];
}
this.invoiceClient();
} catch (err) { } catch (err) {
this.handleError(err); this.handleError(err);
} }
@ -184,7 +187,6 @@ export const useInvoiceOutGlobalStore = defineStore({
async invoiceClient() { async invoiceClient() {
if (this.invoicing || this.nRequests >= this.parallelism) return; if (this.invoicing || this.nRequests >= this.parallelism) return;
const address = this.addresses[this.addressIndex]; const address = this.addresses[this.addressIndex];
if (!address || !this.status || this.status == 'stopping') { if (!address || !this.status || this.status == 'stopping') {
this.status = 'stopping'; this.status = 'stopping';
this.invoicing = false; this.invoicing = false;
@ -192,6 +194,7 @@ export const useInvoiceOutGlobalStore = defineStore({
} }
try { try {
this.invoicing = true; this.invoicing = true;
this.nRequests++;
const params = { const params = {
clientId: address.clientId, clientId: address.clientId,
addressId: address.id, addressId: address.id,
@ -215,6 +218,7 @@ export const useInvoiceOutGlobalStore = defineStore({
} }
} finally { } finally {
this.invoicing = false; this.invoicing = false;
this.nRequests--;
this.addressIndex++; this.addressIndex++;
this.invoiceClient(); this.invoiceClient();
} }