diff --git a/package.json b/package.json index 753f22d..4123e74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Item", - "version": "3.0.0", + "version": "3.0.1-SNAPSHOT", "scripts": { "dev": "vite", "build": "vite build", diff --git a/src/components/Email.vue b/src/components/Email.vue index 7cae58e..338754b 100644 --- a/src/components/Email.vue +++ b/src/components/Email.vue @@ -5,7 +5,10 @@ Modifier les informations de votre compte - + Votre adresse mail est obligatoire pour utiliser l'application. Pour ajouter plusieurs adresses mail, séparez-les par des points virgules ; @@ -17,7 +20,7 @@ id="email" v-model="emailModel" :rules="rules" - @keyup.enter="validate()"> + > { emailModel.value = props.email; }); -function validate() { - if(!props.email){ - itemService.creerEmail(props.userId, emailModel.value) - .then(result => { - emits('validate', result.data.email); - }) - .catch(err => { - messageError.value = err.response.data.message; - throw err; - }); - } else { - itemService.modifierEmail(props.userId, emailModel.value) - .then(result => { - emits('validate', result.data.email); - }) - .catch(err => { - messageError.value = err.response.data.message; - throw err; - }); +async function validate() { + if(!isDisabled.value) { + if (!props.email) { + itemService.creerEmail(props.userId, emailModel.value) + .then(result => { + emits('validate', result.data.email); + }) + .catch(err => { + messageError.value = err.response.data.message; + throw err; + }); + } else { + itemService.modifierEmail(props.userId, emailModel.value) + .then(result => { + emits('validate', result.data.email); + }) + .catch(err => { + messageError.value = err.response.data.message; + throw err; + }); + } } } diff --git a/src/components/Simulation.vue b/src/components/Simulation.vue index b44d60f..cfe89eb 100644 --- a/src/components/Simulation.vue +++ b/src/components/Simulation.vue @@ -53,7 +53,7 @@ import RecapDemande from '@/components/RecapDemande.vue'; import NavigateNotice from '@/components/NavigateNotice.vue'; import { onMounted, ref } from 'vue'; -import demandesService from '@/service/ItemService'; +import itemService from '@/service/ItemService'; const props = defineProps({ demande: { @@ -103,7 +103,7 @@ onMounted(() => { function refresh() { isLoading.value = true; alertMessageError.value = null; - demandesService.simulerLigne(props.demande.id, nbNotice.value.nbNoticeEnCours, props.demande.type) + itemService.simulerLigne(props.demande.id, nbNotice.value.nbNoticeEnCours, props.demande.type) .then(response => { numeroPPNNotice.value = response.data[0]; noticeAvant.value = response.data[1]; diff --git a/src/views/Suppression/SuppSteps.vue b/src/views/Suppression/SuppSteps.vue index 01dfb33..93c43ff 100644 --- a/src/views/Suppression/SuppSteps.vue +++ b/src/views/Suppression/SuppSteps.vue @@ -1,7 +1,7 @@ @@ -139,10 +139,12 @@ import { onMounted, ref } from 'vue'; import TypeFile from '@/components/Supp/TypeFile.vue'; import SelectFile from '@/components/SelectFile.vue'; -import demandesService from '@/service/ItemService'; +import itemService from '@/service/ItemService'; import DownloadFile from "@/components/Modif/DownloadFile.vue"; import router from '@/router' import Rcr from '@/components/Rcr.vue'; +import Simulation from "@/components/Simulation.vue"; +import DialogLancerTraitement from '@/components/Dialog/DialogLancerTraitement.vue'; import DialogSuppression from '@/components/Dialog/DialogSuppression.vue'; const currentStep = ref(0); @@ -167,7 +169,7 @@ const suppDialog = ref(false); onMounted(()=>{ if (props.id) { - demandesService.getDemande(props.id, "SUPP") + itemService.getDemande(props.id, "SUPP") .then(response => { demande.value = response.data; switch (demande.value.etatDemande) { @@ -188,6 +190,11 @@ onMounted(()=>{ typeFileSelected.value = demande.value.typeSuppression; currentStep.value = 2; break; + case 'En simulation': + rcrSelected.value = demande.value.rcr; + typeFileSelected.value = demande.value.typeSuppression; + currentStep.value = 3; + break; } }).catch(() => { router.replace("/suppression"); @@ -201,7 +208,7 @@ function createDemande() { next(); } else if (demande.value) { isLoading.value = true; - demandesService.modifierRcrDemande(demande.value.id, rcrSelected.value, 'SUPP') + itemService.modifierRcrDemande(demande.value.id, rcrSelected.value, 'SUPP') .then(response => { demande.value = response.data; next(); @@ -212,7 +219,7 @@ function createDemande() { }); } else { isLoading.value = true; - demandesService.creerDemande(rcrSelected.value, 'SUPP') + itemService.creerDemande(rcrSelected.value, 'SUPP') .then(response => { demande.value = response.data; next(); @@ -228,11 +235,11 @@ function uploadFile() { alertMessage.value = ''; alertType.value = 'success'; isLoading.value = true; - demandesService.uploadDemande(demande.value.id, fileSelected.value, 'SUPP') + itemService.uploadDemande(demande.value.id, fileSelected.value, 'SUPP') .then(() => { alertMessage.value = "Fichier envoyé"; isLoaded.value = true; - demandesService.getFile(demande.value.id, 'SUPP','fichier_prepare', '.csv') + itemService.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); @@ -248,19 +255,19 @@ function uploadFile() { }); } function setTypeSelected(){ - demandesService.modifierTypeFileDemande(demande.value.id, typeFileSelected.value) + itemService.modifierTypeFileDemande(demande.value.id, typeFileSelected.value) } function changeEtape() { if (((currentStep.value + 1) === 1) || ((currentStep.value + 1) === 2 && !typeFileSelected.value)) { - demandesService.choixEtape(demande.value.id, 1, 'SUPP') + itemService.choixEtape(demande.value.id, 1, 'SUPP') .then(response => { demande.value = response.data; }); typeFileSelected.value = null; } if ((currentStep.value + 1) === 2 && typeFileSelected.value) { //Changement d'etat pour le chargement du fichier car le back est perdu sinon - demandesService.choixEtape(demande.value.id, 2, 'SUPP') + itemService.choixEtape(demande.value.id, 2, 'SUPP') .then(response => { demande.value = response.data; }); @@ -271,10 +278,10 @@ function uploadFileFinal() { alertMessage.value = ''; alertType.value = 'success'; isLoading.value = true; - demandesService.uploadDemande(demande.value.id, fileFinalSelected.value, 'SUPP') + itemService.uploadDemande(demande.value.id, fileFinalSelected.value, 'SUPP') .then(() => { alertMessage.value = "Fichier envoyé"; - dialog.value = true; + next(); }) .catch(err => { alertMessage.value = err.response.data.message; @@ -313,6 +320,16 @@ function raz(){ isDownloaded.value = false; } +function launchDemande(){ + isLoading.value = true; + itemService.lancerDemande(demande.value.id,'SUPP') + .then(response => { + demande.value = response.data; + }).finally(() => { + isLoading.value = false; + }) +} + function deleteDemande() { suppDialog.value = true; }