From d162da7e172860b8b69de123e983dac5dc9fb55e Mon Sep 17 00:00:00 2001 From: Julien Leray Date: Wed, 27 Nov 2024 16:38:46 +0100 Subject: [PATCH] small fix on the pr including not validated collec, color snackbar & dynamic items by page select --- .../ddt/_departement/collectivites/index.vue | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pages/ddt/_departement/collectivites/index.vue b/pages/ddt/_departement/collectivites/index.vue index 575010e7..b8605e6d 100644 --- a/pages/ddt/_departement/collectivites/index.vue +++ b/pages/ddt/_departement/collectivites/index.vue @@ -16,7 +16,7 @@ @@ -247,12 +247,12 @@ - {{ snackText }} + {{ snackVal.text }} @@ -274,10 +274,11 @@ export default { return { onlyNotValidatedFilterOn: false, snackbar: false, - snackText: '', + snackVal: { text: '', type: 'success' }, toValidate: [], areValidate: [], page: 1, + nbItemsByPage: 10, selectedCollectiviteTypesFilter: ['COM', 'CA', 'CC', 'EPT', 'SM', 'SIVU', 'PETR'], collectiviteTypeFilterItems: [ { text: 'Communes', value: 'COM' }, @@ -313,8 +314,9 @@ export default { return this.collectivites.filter(collectivite => !validatedCodes.includes(collectivite.code)) }, currentPageItems () { - const start = (this.page - 1) * 10 - const end = start + 10 + console.log('nbItemsByPage: ', this.nbItemsByPage) + const start = (this.page - 1) * this.nbItemsByPage + const end = start + this.nbItemsByPage return this.collectivites.slice(start, end) }, // Check if all current page items are selected @@ -355,7 +357,8 @@ export default { this.areValidate = data if (!success) { this.snackbar = true - this.snackText = `ERREUR: ${error}` + + this.snackVal = { text: `ERREUR: ${error}`, type: 'error' } } }, async cancelValidation (codeCollec) { @@ -364,7 +367,7 @@ export default { this.areValidate = data if (!success) { this.snackbar = true - this.snackText = `ERREUR: ${error}` + this.snackVal = { text: `ERREUR: ${error}`, type: 'error' } } await this.fetchValidation() }, @@ -376,7 +379,7 @@ export default { const { success, error } = await this.$enquete.validateCollectivites(collectivitesToValidate) if (!success) { this.snackbar = true - this.snackText = `ERREUR: ${error}` + this.snackVal = { text: `ERREUR: ${error}`, type: 'error' } } await this.fetchValidation() this.toValidate = []