diff --git a/CHANGELOG.md b/CHANGELOG.md
index 555b4f0ba..9f493764a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
+### Fixed
+
+- (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro
+
## [2414.01] - 2024-04-04
### Added
diff --git a/cypress.config.js b/cypress.config.js
index 1934f833e..e2046d6c4 100644
--- a/cypress.config.js
+++ b/cypress.config.js
@@ -3,6 +3,7 @@ const { defineConfig } = require('cypress');
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:9000/',
+ experimentalStudio: true,
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js',
diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue
index 47836c05b..02e84849c 100644
--- a/src/components/CreateNewPostcodeForm.vue
+++ b/src/components/CreateNewPostcodeForm.vue
@@ -28,8 +28,23 @@ const countriesOptions = ref([]);
const provincesOptions = ref([]);
const townsLocationOptions = ref([]);
-const onDataSaved = (dataSaved) => {
- emit('onDataSaved', dataSaved);
+const onDataSaved = (formData) => {
+ const newPostcode = {
+ ...formData
+ };
+ const townObject = townsLocationOptions.value.find(
+ ({id}) => id === formData.townFk
+ );
+ newPostcode.town = townObject?.name;
+ const provinceObject = provincesOptions.value.find(
+ ({id}) => id === formData.provinceFk
+ );
+ newPostcode.province = provinceObject?.name;
+ const countryObject = countriesOptions.value.find(
+ ({id}) => id === formData.countryFk
+ );
+ newPostcode.country = countryObject?.country;
+ emit('onDataSaved', newPostcode);
};
const onCityCreated = async ({ name, provinceFk }, formData) => {
@@ -73,7 +88,7 @@ const onProvinceCreated = async ({ name }, formData) => {
:title="t('New postcode')"
:subtitle="t('Please, ensure you put the correct data!')"
:form-initial-data="postcodeFormData"
- @on-data-saved="onDataSaved($event)"
+ @on-data-saved="onDataSaved"
>
diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue
index 6f91035ff..a7af0044b 100644
--- a/src/components/FormModel.vue
+++ b/src/components/FormModel.vue
@@ -101,16 +101,16 @@ onMounted(async () => {
});
onBeforeRouteLeave((to, from, next) => {
- if (!hasChanges.value) next();
-
- quasar.dialog({
- component: VnConfirm,
- componentProps: {
- title: t('Unsaved changes will be lost'),
- message: t('Are you sure exit without saving?'),
- promise: () => next(),
- },
- });
+ if (hasChanges.value)
+ quasar.dialog({
+ component: VnConfirm,
+ componentProps: {
+ title: t('Unsaved changes will be lost'),
+ message: t('Are you sure exit without saving?'),
+ promise: () => next(),
+ },
+ });
+ else next();
});
onUnmounted(() => {
@@ -132,12 +132,12 @@ const formUrl = computed(() => $props.url);
const defaultButtons = computed(() => ({
save: {
color: 'primary',
- icon: 'restart_alt',
+ icon: 'save',
label: 'globals.save',
},
reset: {
color: 'primary',
- icon: 'save',
+ icon: 'restart_alt',
label: 'globals.reset',
},
...$props.defaultButtons,
diff --git a/src/components/common/VnCurrency.vue b/src/components/common/VnCurrency.vue
index 660c4e979..b892e5012 100644
--- a/src/components/common/VnCurrency.vue
+++ b/src/components/common/VnCurrency.vue
@@ -5,7 +5,7 @@ import { useCapitalize } from 'src/composables/useCapitalize';
import VnInput from 'src/components/common/VnInput.vue';
const props = defineProps({
- modelValue: { type: String, default: '' },
+ modelValue: { type: [String, Number], default: '' },
});
const { t } = useI18n();
diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue
index eeb7aebd1..9ed48ca15 100644
--- a/src/components/common/VnLocation.vue
+++ b/src/components/common/VnLocation.vue
@@ -88,6 +88,10 @@ function locationFilter(search = '') {
function handleFetch(data) {
postcodesOptions.value = data;
}
+function onDataSaved(newPostcode) {
+ postcodesOptions.value.push(newPostcode);
+ value.value = newPostcode.code;
+}
-
+
-
+
{{ opt.code }}
{{ showLabel(opt) }}
diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue
index 794e4cc8f..c1cc78f54 100644
--- a/src/components/common/VnLog.vue
+++ b/src/components/common/VnLog.vue
@@ -1030,7 +1030,7 @@ en:
ticketCreated: Created
created: Created
isChargedToMana: Charged to mana
- hasToPickUp: Has to pick Up
+ pickup: Type of pickup
dmsFk: Document ID
text: Description
claimStateFk: Claim State
@@ -1069,7 +1069,7 @@ es:
ticketCreated: Creado
created: Creado
isChargedToMana: Cargado a maná
- hasToPickUp: Se debe recoger
+ pickup: Se debe recoger
dmsFk: ID documento
text: Descripción
claimStateFk: Estado de la reclamación
diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index b6b81f2d5..2c5a579c8 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -1,5 +1,5 @@
import { onMounted, ref, computed } from 'vue';
-import { useRouter, useRoute } from 'vue-router';
+import { useRoute } from 'vue-router';
import axios from 'axios';
import { useArrayDataStore } from 'stores/useArrayDataStore';
import { buildFilter } from 'filters/filterPanel';
@@ -15,7 +15,6 @@ export function useArrayData(key, userOptions) {
const store = arrayDataStore.get(key);
const hasMoreData = ref(false);
- const router = useRouter();
const route = useRoute();
let canceller = null;
@@ -105,7 +104,7 @@ export function useArrayData(key, userOptions) {
for (const row of response.data) store.data.push(row);
} else {
store.data = response.data;
- if (!document.querySelectorAll('[role="dialog"]'))
+ if (!document.querySelectorAll('[role="dialog"]').length)
updateRouter && updateStateParams();
}
@@ -188,11 +187,15 @@ export function useArrayData(key, userOptions) {
if (store.userParams && Object.keys(store.userParams).length !== 0)
query.params = JSON.stringify(store.userParams);
- if (router)
- router.replace({
- path: route.path,
- query: query,
- });
+ const url = new URL(window.location.href);
+ const { hash: currentHash } = url;
+ const [currentRoute] = currentHash.split('?');
+
+ const params = new URLSearchParams();
+ for (const param in query) params.append(param, query[param]);
+
+ url.hash = currentRoute + '?' + params.toString();
+ window.history.pushState({}, '', url.hash);
}
const totalRows = computed(() => (store.data && store.data.length) || 0);
diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js
index 9b6ec06e3..07e8c383d 100644
--- a/src/i18n/en/index.js
+++ b/src/i18n/en/index.js
@@ -544,6 +544,7 @@ export default {
assignedTo: 'Assigned',
attendedBy: 'Attended by',
created: 'Created',
+ pickup: 'Pickup',
state: 'State',
details: 'Details',
item: 'Item',
@@ -565,13 +566,19 @@ export default {
responsible: 'Responsible',
worker: 'Worker',
redelivery: 'Redelivery',
+ null: 'No',
+ agency: 'Agency',
+ delivery: 'Delivery',
},
basicData: {
customer: 'Customer',
assignedTo: 'Assigned',
created: 'Created',
state: 'State',
- picked: 'Picked',
+ pickup: 'Pickup',
+ null: 'No',
+ agency: 'Agency',
+ delivery: 'Delivery',
},
photo: {
fileDescription: 'Claim id {claimId} from client {clientName} id {clientId}',
diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js
index 31e571565..0e7b57880 100644
--- a/src/i18n/es/index.js
+++ b/src/i18n/es/index.js
@@ -543,6 +543,7 @@ export default {
assignedTo: 'Asignada a',
attendedBy: 'Atendida por',
created: 'Creada',
+ pickup: 'Recogida',
state: 'Estado',
details: 'Detalles',
item: 'Artículo',
@@ -564,13 +565,19 @@ export default {
responsible: 'Responsable',
worker: 'Trabajador',
redelivery: 'Devolución',
+ null: 'No',
+ agency: 'Agencia',
+ delivery: 'Reparto',
},
basicData: {
customer: 'Cliente',
assignedTo: 'Asignada a',
created: 'Creada',
state: 'Estado',
- picked: 'Recogida',
+ pickup: 'Recogida',
+ null: 'No',
+ agency: 'Agencia',
+ delivery: 'Reparto',
},
photo: {
fileDescription:
diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue
index c7c5ab8a2..56717c628 100644
--- a/src/pages/Claim/Card/ClaimBasicData.vue
+++ b/src/pages/Claim/Card/ClaimBasicData.vue
@@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
+import axios from 'axios';
import { useSession } from 'src/composables/useSession';
const route = useRoute();
@@ -24,7 +25,7 @@ const claimFilter = {
'workerFk',
'claimStateFk',
'packages',
- 'hasToPickUp',
+ 'pickup',
],
include: [
{
@@ -50,6 +51,20 @@ function setClaimStates(data) {
claimStates.value = data;
claimStatesCopy.value = data;
}
+let optionsList;
+async function getEnumValues() {
+ optionsList = [{ id: null, description: t('claim.basicData.null') }];
+ const { data } = await axios.get(`Applications/get-enum-values`, {
+ params: {
+ schema: 'vn',
+ table: 'claim',
+ column: 'pickup',
+ },
+ });
+ for (let value of data)
+ optionsList.push({ id: value, description: t(`claim.basicData.${value}`) });
+}
+getEnumValues();
const workerFilter = {
options: workers,
@@ -168,13 +183,19 @@ const statesFilter = {
type="number"
/>
-
-
-
+
+
diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index 612e0d755..19e3f00ef 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -220,10 +220,9 @@ function openDialog(dmsId) {
/>
-
diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue
index 3eb9365d2..5d3e82824 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue
@@ -32,6 +32,13 @@ const invoiceInFormRef = ref();
const expensesRef = ref();
const newExpenseRef = ref();
+defineProps({
+ actionIcon: {
+ type: String,
+ default: 'add',
+ },
+});
+
const columns = computed(() => [
{
name: 'expense',
@@ -207,17 +214,16 @@ async function addExpense() {
@click.stop="value = null"
class="cursor-pointer"
/>
-
{{ t('Create expense') }}
-
+
@@ -470,6 +476,11 @@ async function addExpense() {
.q-item {
min-height: 0;
}
+.default-icon {
+ cursor: pointer;
+ border-radius: 50px;
+ background-color: $primary;
+}
es:
diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js
index 7ea82d71d..68f096220 100644
--- a/src/router/modules/worker.js
+++ b/src/router/modules/worker.js
@@ -97,17 +97,6 @@ export default {
component: () =>
import('src/pages/Worker/Card/WorkerNotes.vue'),
},
- {
- path: 'create',
- name: 'WorkerNoteCreate',
- meta: {
- title: 'note-create',
- },
- component: () =>
- import(
- 'src/pages/Worker/components/WorkerNoteCreate.vue'
- ),
- },
],
},
{
diff --git a/test/cypress/integration/VnLocation.spec.js b/test/cypress/integration/VnLocation.spec.js
index 5892e3ad5..3a90afce9 100644
--- a/test/cypress/integration/VnLocation.spec.js
+++ b/test/cypress/integration/VnLocation.spec.js
@@ -8,41 +8,41 @@ describe('VnLocation', () => {
cy.visit('/#/worker/create');
cy.waitForElement('.q-card');
});
-
- it('Show all options', function() {
- cy.get(inputLocation).click();
- cy.get(locationOptions).should('have.length',5);
+ it('Show all options', function() {
+ cy.get(inputLocation).click();
+ cy.get(locationOptions).should('have.length.at.least',5);
});
-
- it('input filter location as "al"', function() {
+ it('input filter location as "al"', function() {
cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('al');
- cy.get(locationOptions).should('have.length',3);
+ cy.get(locationOptions).should('have.length.at.least',3);
});
it('input filter location as "ecuador"', function() {
cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('ecuador');
- cy.get(locationOptions).should('have.length',1);
+ cy.get(locationOptions).should('have.length.at.least',1);
cy.get(`${locationOptions}:nth-child(1)`).click();
cy.get(':nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon').click();
-
});
});
describe('Fiscal-data',()=>{
- const inputLocation = ':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control';
-
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/supplier/567/fiscal-data', {timeout: 2000});
cy.waitForElement('.q-card');
});
-
- it('Show locations options', function() {
- cy.get(inputLocation).click();
- cy.get(locationOptions).should('have.length', 5);
+ it('Create postCode', function() {
+ cy.get(':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon').click();
+ cy.get(' .q-card > h1').should('have.text', 'New postcode');
+ cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').clear('12');
+ cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').type('1234453');
+ cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'Valencia');
+ cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control ', 'Province one');
+ cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'España');
+ cy.get('.q-mt-lg > .q-btn--standard').click();
});
});
})
diff --git a/test/cypress/integration/vnSearchBar.spec.js b/test/cypress/integration/vnSearchBar.spec.js
index 3db789773..f1f3a9e82 100644
--- a/test/cypress/integration/vnSearchBar.spec.js
+++ b/test/cypress/integration/vnSearchBar.spec.js
@@ -36,7 +36,7 @@ describe('VnSearchBar', () => {
const checkCardListAndUrl = (expectedLength) => {
cy.get(cardList).then(($cardList) => {
expect($cardList.find('.q-card').length).to.equal(expectedLength);
- cy.url().then((currentUrl) => expect(currentUrl).to.equal(url));
+ cy.url().then((currentUrl) => expect(currentUrl).to.contain(url));
});
};
});
diff --git a/test/vitest/__tests__/components/common/VnLog.spec.js b/test/vitest/__tests__/components/common/VnLog.spec.js
index b654bff9b..53d2732a0 100644
--- a/test/vitest/__tests__/components/common/VnLog.spec.js
+++ b/test/vitest/__tests__/components/common/VnLog.spec.js
@@ -38,10 +38,10 @@ describe('VnLog', () => {
action: 'update',
changedModel: 'Claim',
oldInstance: {
- hasToPickUp: false,
+ pickup: null,
},
newInstance: {
- hasToPickUp: true,
+ pickup: 'agency',
},
creationDate: '2023-09-18T12:25:34.000Z',
changedModelId: '1',
diff --git a/test/vitest/__tests__/composables/useArrayData.spec.js b/test/vitest/__tests__/composables/useArrayData.spec.js
new file mode 100644
index 000000000..ae0ca7368
--- /dev/null
+++ b/test/vitest/__tests__/composables/useArrayData.spec.js
@@ -0,0 +1,31 @@
+import { describe, expect, it, beforeAll } from 'vitest';
+import { axios } from 'app/test/vitest/helper';
+import { useArrayData } from 'composables/useArrayData';
+
+describe('useArrayData', () => {
+ let arrayData;
+ beforeAll(() => {
+ axios.get.mockResolvedValue({ data: [] });
+ arrayData = useArrayData('InvoiceIn', { url: 'invoice-in/list' });
+ Object.defineProperty(window.location, 'href', {
+ writable: true,
+ value: 'localhost:9000/invoice-in/list',
+ });
+
+ // Mock the window.history.pushState method within useArrayData
+ window.history.pushState = (data, title, url) => (window.location.href = url);
+
+ // Mock the URL constructor within useArrayData
+ global.URL = class URL {
+ constructor(url) {
+ this.hash = url.split('localhost:9000/')[1];
+ }
+ };
+ });
+
+ it('should add the params to the url', async () => {
+ arrayData.store.userParams = { supplierFk: 2 };
+ arrayData.updateStateParams();
+ expect(window.location.href).contain('params=%7B%22supplierFk%22%3A2%7D');
+ });
+});