From 18e7736704bfe8b737d6f888f3eaca12fc4069cd Mon Sep 17 00:00:00 2001 From: Jerome Villiseck Date: Wed, 10 Jul 2024 11:18:56 +0200 Subject: [PATCH 01/16] - Optionnal chaining - Correction gestion des erreurs --- src/App.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index 41b0c44..45b51ae 100644 --- a/src/App.vue +++ b/src/App.vue @@ -73,11 +73,10 @@ function addError(error) { } newError.description = 'Erreur ' + error.response.status } - if(error.response.data.detail){ - newError.description = error.response.data.detail - } - if(error.response.data.message){ - newError.description = error.response.data.message + if (error?.response?.data?.detail) { + newError.description = error.response.data.detail; + } else if (error?.response?.data?.message) { + newError.description = error.response.data.message; } if(error.request.url){ newError.description = 'Problème de disponibilité du fichier demandé' From cb2a1dae39dddb2f234f92f3ea86f3c6f94c1d24 Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Thu, 11 Jul 2024 15:17:21 +0200 Subject: [PATCH 02/16] fix mail --- src/components/Email.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Email.vue b/src/components/Email.vue index af1022a..e7f42c5 100644 --- a/src/components/Email.vue +++ b/src/components/Email.vue @@ -81,7 +81,7 @@ onMounted(() => { }); function validate() { - if(props.email){ + if(!props.email){ demandesService.creerEmail(props.userId, emailModel.value) .then(result => { emits('validate', result.data.email); From 3a843654a31ed3f0d7a174b52535417fe6697b20 Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Thu, 11 Jul 2024 15:28:57 +0200 Subject: [PATCH 03/16] fix mail --- src/views/Utilisateur/ModificationEmail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Utilisateur/ModificationEmail.vue b/src/views/Utilisateur/ModificationEmail.vue index 5c7e462..467987b 100644 --- a/src/views/Utilisateur/ModificationEmail.vue +++ b/src/views/Utilisateur/ModificationEmail.vue @@ -20,7 +20,7 @@ const user = authStore.getUser function setEmailUser(email){ user.value.email = email; - authStore.set + authStore.setUser(user); router.push('Accueil'); } From 186b1b3ef21d457f0e86bde83ee0098f2e76da25 Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Fri, 12 Jul 2024 08:31:01 +0200 Subject: [PATCH 04/16] fix bug user.email --- src/views/Utilisateur/ModificationEmail.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/views/Utilisateur/ModificationEmail.vue b/src/views/Utilisateur/ModificationEmail.vue index 467987b..4d05a35 100644 --- a/src/views/Utilisateur/ModificationEmail.vue +++ b/src/views/Utilisateur/ModificationEmail.vue @@ -11,7 +11,6 @@ diff --git a/src/views/Suppression/SuppTable.vue b/src/views/Suppression/SuppTable.vue new file mode 100644 index 0000000..9f8876b --- /dev/null +++ b/src/views/Suppression/SuppTable.vue @@ -0,0 +1,8 @@ + + + + + From 7aec294a43f7f85685a8a10f86011b6ea07d105d Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Mon, 15 Jul 2024 14:12:07 +0200 Subject: [PATCH 08/16] Ajout select Type File --- src/components/Supp/TypeFile.vue | 36 +++++++++++++++++++++++++++++ src/store/authStore.js | 1 + src/views/Suppression/SuppSteps.vue | 13 ++++++----- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 src/components/Supp/TypeFile.vue diff --git a/src/components/Supp/TypeFile.vue b/src/components/Supp/TypeFile.vue new file mode 100644 index 0000000..064acee --- /dev/null +++ b/src/components/Supp/TypeFile.vue @@ -0,0 +1,36 @@ + + diff --git a/src/store/authStore.js b/src/store/authStore.js index 196ed00..0e685fa 100644 --- a/src/store/authStore.js +++ b/src/store/authStore.js @@ -6,6 +6,7 @@ export const useAuthStore = defineStore('auth', { token: sessionStorage.getItem('token'), authenticated: !!sessionStorage.getItem('token'), }), + getters: { getUser: (state) => state.user, isAuthenticated: (state) => state.authenticated, diff --git a/src/views/Suppression/SuppSteps.vue b/src/views/Suppression/SuppSteps.vue index 1b36e92..151eb6e 100644 --- a/src/views/Suppression/SuppSteps.vue +++ b/src/views/Suppression/SuppSteps.vue @@ -7,7 +7,7 @@ --> - + < @@ -73,6 +73,7 @@ From 2952c4ef8c1d47d5c89ea3b042a6e8fb1bb913d3 Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Tue, 16 Jul 2024 11:46:42 +0200 Subject: [PATCH 11/16] Ajout message erreur pour upload file --- src/views/Suppression/SuppSteps.vue | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/views/Suppression/SuppSteps.vue b/src/views/Suppression/SuppSteps.vue index 8ce8896..3530ff5 100644 --- a/src/views/Suppression/SuppSteps.vue +++ b/src/views/Suppression/SuppSteps.vue @@ -58,8 +58,17 @@ Selection du fichier {{typeFileSelected}} + + + - + + précédent + + précédent From 4edb01f331da8c1c8ee9b6888704def418cc1684 Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Tue, 16 Jul 2024 11:50:57 +0200 Subject: [PATCH 12/16] Ajout RCR --- src/views/Suppression/SuppSteps.vue | 57 ++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/src/views/Suppression/SuppSteps.vue b/src/views/Suppression/SuppSteps.vue index 3530ff5..6723db8 100644 --- a/src/views/Suppression/SuppSteps.vue +++ b/src/views/Suppression/SuppSteps.vue @@ -44,16 +44,16 @@ - - - - - - - - - - + + + + + Valider + + @@ -107,19 +107,42 @@ const demande = ref(); const emits = defineEmits(['backendError']); const props = defineProps({id: {type: String}}); +const rcrSelected = ref(); const typeFileSelected = ref(); const fileSelected = ref(); const isLoading = ref(false); const alertMessage = ref(''); const alertType = ref('success'); -onMounted(() => { - demandesService.creerDemande('341725201', 'SUPP') - .then(response => { - demande.value = response.data; - next(); - }) -}) + +function createDemande() { + if (demande.value && (rcrSelected.value === demande.value.rcr)) { + next(); + } else if (demande.value) { + isLoading.value = true; + demandesService.modifierRcrDemande(demande.value.id, rcrSelected.value, 'SUPP') + .then(response => { + demande.value = response.data; + next(); + }).catch(err => { + emits('backendError', err); + }).finally(() => { + isLoading.value = false; + }); + } else { + isLoading.value = true; + demandesService.creerDemande(rcrSelected.value, 'SUPP') + .then(response => { + demande.value = response.data; + next(); + }).catch(err => { + emits('backendError', err); + }).finally(() => { + isLoading.value = false; + }); + } +} + function uploadFile() { alertMessage.value = ''; alertType.value = 'success'; From 6d7e261726d84c802420f7498bda1f72a7255968 Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Wed, 17 Jul 2024 08:46:20 +0200 Subject: [PATCH 13/16] update --- src/views/Suppression/SuppSteps.vue | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/views/Suppression/SuppSteps.vue b/src/views/Suppression/SuppSteps.vue index 6723db8..6f1ea32 100644 --- a/src/views/Suppression/SuppSteps.vue +++ b/src/views/Suppression/SuppSteps.vue @@ -57,7 +57,8 @@ - Selection du fichier {{typeFileSelected}} + Selection du fichier {{typeFileSelected}} + Envoyer + + Suivant + @@ -97,6 +103,8 @@ import { onMounted, ref } from 'vue'; import TypeFile from '@/components/Supp/TypeFile.vue'; import SelectFile from '@/components/SelectFile.vue'; import demandesService from '@/service/DemandesService'; +import {tr} from "vuetify/locale"; +import DownloadFile from "@/components/Modif/DownloadFile.vue"; @@ -110,6 +118,9 @@ const props = defineProps({id: {type: String}}); const rcrSelected = ref(); const typeFileSelected = ref(); const fileSelected = ref(); +const fileLink = ref(''); +const fileName = ref(''); +const isLoaded = ref(false) const isLoading = ref(false); const alertMessage = ref(''); const alertType = ref('success'); @@ -147,9 +158,16 @@ function uploadFile() { alertMessage.value = ''; alertType.value = 'success'; isLoading.value = true; - demandesService.uploadDemande(1, fileSelected.value, 'SUPP') + demandesService.uploadDemande(demande.value.id, fileSelected.value, 'SUPP') .then(() => { alertMessage.value = "Fichier envoyé"; + isLoaded.value = true; + demandesService.getFile(demande.value.id, 'SUPP','fichier_prepare', '.csv') + .then(response => { + let blob = new Blob([response.data], {type: 'application/csv'}); + fileLink.value = window.URL.createObjectURL(blob); + fileName.value = `fichier_demande_${demande.value.id}.csv`; + }) }) .catch(err => { alertMessage.value = err.response.data.message; @@ -177,5 +195,6 @@ function raz(){ isLoading.value = false; alertMessage.value = ''; alertType.value = 'success'; + isLoaded.value = false; } From d1b63fc6fc8725699a998f122320070ab1142fd5 Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Wed, 17 Jul 2024 14:04:25 +0200 Subject: [PATCH 14/16] =?UTF-8?q?Ajout=20variable=20dans=20composant=20pou?= =?UTF-8?q?r=20DL=20le=20fichier=20pr=C3=A9par=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Suppression/SuppSteps.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Suppression/SuppSteps.vue b/src/views/Suppression/SuppSteps.vue index 6f1ea32..7f1ca28 100644 --- a/src/views/Suppression/SuppSteps.vue +++ b/src/views/Suppression/SuppSteps.vue @@ -58,7 +58,7 @@ Selection du fichier {{typeFileSelected}} - + Date: Wed, 17 Jul 2024 14:13:20 +0200 Subject: [PATCH 15/16] ajout bouton next --- src/views/Suppression/SuppSteps.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/views/Suppression/SuppSteps.vue b/src/views/Suppression/SuppSteps.vue index 7f1ca28..d728b00 100644 --- a/src/views/Suppression/SuppSteps.vue +++ b/src/views/Suppression/SuppSteps.vue @@ -58,7 +58,7 @@ Selection du fichier {{typeFileSelected}} - + Téléchargement du fichier PPN/RCR/EPN - + + précédent + + précédent @@ -81,6 +84,8 @@ Suivant @@ -120,7 +125,8 @@ const typeFileSelected = ref(); const fileSelected = ref(); const fileLink = ref(''); const fileName = ref(''); -const isLoaded = ref(false) +const isLoaded = ref(false); +const isDownloaded = ref(false); const isLoading = ref(false); const alertMessage = ref(''); const alertType = ref('success'); @@ -181,6 +187,9 @@ function prevSelectTypeFile(){ typeFileSelected.value = null; raz(); } +function prevSelectFile(){ + raz(); +} function next() { currentStep.value++; raz(); @@ -196,5 +205,6 @@ function raz(){ alertMessage.value = ''; alertType.value = 'success'; isLoaded.value = false; + isDownloaded.value = false; } From 40b2ffcf77d6a992c703326a0507d88fc0c4b56e Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Thu, 18 Jul 2024 10:36:26 +0200 Subject: [PATCH 16/16] Reformat Accueil Comme ItemV2 Ajout Btn page supp et tableau supp --- src/components/Home/BtnAccueil.vue | 40 +++++++++++------------ src/router/index.js | 7 ++++ src/views/Accueil.vue | 51 ++++++++++++++++++------------ 3 files changed, 57 insertions(+), 41 deletions(-) diff --git a/src/components/Home/BtnAccueil.vue b/src/components/Home/BtnAccueil.vue index c11fe99..1ab9873 100644 --- a/src/components/Home/BtnAccueil.vue +++ b/src/components/Home/BtnAccueil.vue @@ -1,14 +1,24 @@ - diff --git a/src/router/index.js b/src/router/index.js index 2c8a5f6..f9457e2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ import Accueil from '@/views/Accueil.vue'; import ModificationEmail from '@/views/Utilisateur/ModificationEmail.vue'; import demandesService from '@/service/DemandesService' import {useAuthStore} from '@/store/authStore' +import SuppTable from "@/views/Suppression/SuppTable.vue"; const routes = [ { @@ -66,6 +67,12 @@ const routes = [ component: RecouvTable, meta: {requiresAuth: true} }, + { + path: '/suppression-tableau', + name: 'suppression-tableau', + component: SuppTable, + meta: {requiresAuth: true} + }, { path: '/modification', name: 'modification', diff --git a/src/views/Accueil.vue b/src/views/Accueil.vue index cd15e3f..8bafeb1 100644 --- a/src/views/Accueil.vue +++ b/src/views/Accueil.vue @@ -1,37 +1,46 @@