Skip to content

Commit

Permalink
Merge pull request #106 from abes-esr/ITEM-168-front-coder-lecran-de-…
Browse files Browse the repository at this point in the history
…chargement-du-fichier-enrichi

- Mise en place de l'écran de chargement du fichier enrichi et gestio…
  • Loading branch information
pierre-maraval authored Aug 21, 2024
2 parents 9ce8378 + 35a900f commit 043ac69
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 21 deletions.
8 changes: 6 additions & 2 deletions src/components/Dialog/DialogLancerTraitement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<v-card-actions class="justify-space-between">
<v-btn v-if="!isFinished" color="primary" @click="dialog = false" aria-label="Annuler">Annuler</v-btn>
<v-spacer v-else></v-spacer>
<v-btn v-if="!isFinished" color="primary" @click="confirm()" aria-label="Valider">Valider</v-btn>
<v-btn v-if="!isFinished && !isSuppDemande" color="primary" @click="confirm()" aria-label="Valider">Valider</v-btn>
<v-btn v-else color="primary" @click="router.push(route)" aria-label="OK">OK</v-btn>
</v-card-actions>
</v-card>
Expand All @@ -36,6 +36,10 @@ const props = defineProps({
type: Boolean,
default: false
},
rubrique: {
required: true,
type: String,
},
route: {
required: true,
type: String,
Expand All @@ -47,7 +51,7 @@ const isFinished = ref(false);
function confirm() {
emits('launch');
title.value = "Traitement validé";
body.value = "Votre demande est en cours de traitement.<br/>Un mail vous sera envoyé quand celui-ci sera terminé.<br/>Vous pouvez retrouver l'ensemble de vos demandes sur votre tableau de bord ITEM. Rubrique \"Gérer mes créations\".";
body.value = `Votre demande est en cours de traitement.<br/>Un mail vous sera envoyé quand celui-ci sera terminé.<br/>Vous pouvez retrouver l'ensemble de vos demandes sur votre tableau de bord ITEM. Rubrique ${props.rubrique}.`;
isFinished.value = true;
}
</script>
2 changes: 1 addition & 1 deletion src/views/Exemplarisation/ExempSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</v-col>
</v-row>
</v-container>
<dialog-lancer-traitement v-model="dialog" :is-loading="isLoading" route="/exemplarisation-tableau" @launch="launchDemande()"></dialog-lancer-traitement>
<dialog-lancer-traitement v-model="dialog" :is-loading="isLoading" rubrique="Gérer mes créations" route="/exemplarisation-tableau" @launch="launchDemande()"></dialog-lancer-traitement>
<dialog-suppression v-model="suppDialog" :demande="demande" return-to-accueil></dialog-suppression>
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/views/Modification/ModifSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</v-col>
</v-row>
</v-container>
<dialog-lancer-traitement v-model="dialog" :is-loading="isLoading" route="/modification-tableau" @launch="launchDemande()"></dialog-lancer-traitement>
<dialog-lancer-traitement v-model="dialog" :is-loading="isLoading" rubrique="Gérer mes modifications" route="/modification-tableau" @launch="launchDemande()"></dialog-lancer-traitement>
<dialog-suppression v-model="suppDialog" :demande="demande" return-to-accueil></dialog-suppression>
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/views/Recouvrement/RecouvSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" @click="router.replace('recouvrement-tableau')" aria-label="OK">OK</v-btn>
<v-btn color="primary" @click="router.push('recouvrement-tableau')" aria-label="OK">OK</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
Expand Down
84 changes: 68 additions & 16 deletions src/views/Suppression/SuppSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,14 @@
</v-stepper-item>
<v-divider></v-divider>
<v-stepper-item
:color="currentStep >= 3 ? '#295494' : ''"
:complete="currentStep > 3"
:color="currentStep >= 2 ? '#295494' : ''"
:complete="currentStep > 2"
editable
icon="mdi-numeric-4"
icon="mdi-numeric-3"
title="Envoi"
subtitle="du fichier"
>
</v-stepper-item>
<v-divider></v-divider>
<v-stepper-item
:color="currentStep >= 4 ? '#295494' : ''"
icon="mdi-numeric-5"
title="Simulation"
>
</v-stepper-item>
</v-stepper-header>

<v-stepper-window>
Expand All @@ -49,6 +42,7 @@
<v-spacer></v-spacer>
<v-btn
:disabled="!rcrSelected"
:loading="isLoading"
@click="createDemande"
>
Valider
Expand All @@ -57,7 +51,7 @@
</v-stepper-window-item>
<v-stepper-window-item>
<type-file v-if="!typeFileSelected" v-model="typeFileSelected" @clicked="setTypeSelected()"></type-file>
<select-file v-else-if="!isLoaded" v-model="fileSelected" :typeFile="typeFileSelected">Selection du fichier {{typeFileSelected}}</select-file>
<select-file v-else-if="!isLoaded" :is-loading="isLoading" v-model="fileSelected" :typeFile="typeFileSelected">Selection du fichier {{typeFileSelected}}</select-file>
<download-file v-if="isLoaded" :file-link="fileLink" :file-name="fileName" @clicked="isDownloaded = true">Téléchargement du fichier PPN/RCR/EPN</download-file>
<v-alert
v-if="alertMessage"
Expand All @@ -78,6 +72,7 @@
<v-btn
v-if="typeFileSelected && !isLoaded"
:disabled="!fileSelected"
:loading="isLoading"
@click="uploadFile()"
>
Envoyer
Expand All @@ -92,24 +87,61 @@
</v-container>
</v-stepper-window-item>
<v-stepper-window-item>
</v-stepper-window-item>
<v-stepper-window-item>

<select-file v-model="fileFinalSelected" :is-loading="isLoading" @deleted="deleteDemande()">Charger le
fichier des exemplaires à supprimer
</select-file>
<v-alert
v-if="alertMessage"
:type="alertType"
>
<span v-html="alertMessage"></span>
</v-alert>
<v-container class="d-flex justify-space-between">
<v-btn @click="prev">
précédent
</v-btn>
<v-btn
:disabled="!fileFinalSelected"
@click="uploadFileFinal()"
:loading="isLoading"
>
Lancer le traitement en production
</v-btn>
</v-container>
</v-stepper-window-item>
</v-stepper-window>
</v-stepper>
<v-dialog
v-model="dialog"
width="500"
>
<v-card>
<v-card-title class="headline" primary-title>Traitement validé</v-card-title>
<v-card-text>Votre demande est en cours de traitement.<br/>Un mail vous sera envoyé quand celui-ci sera
terminé.
<br>Vous pouvez retrouver l'ensemble de vos demandes sur votre tableau de bord ITEM. Rubrique "Gérer mes
suppressions".
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" @click="router.push('suppression-tableau')" aria-label="OK">OK</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-col>
</v-row>
</v-container>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import { 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";
import router from '@/router'
import Rcr from '@/components/Rcr.vue';
Expand All @@ -122,6 +154,7 @@ const props = defineProps({id: {type: String}});
const rcrSelected = ref();
const typeFileSelected = ref();
const fileFinalSelected = ref();
const fileSelected = ref();
const fileLink = ref('');
const fileName = ref('');
Expand All @@ -130,6 +163,7 @@ const isDownloaded = ref(false);
const isLoading = ref(false);
const alertMessage = ref('');
const alertType = ref('success');
const dialog = ref(false);
function createDemande() {
Expand Down Expand Up @@ -203,6 +237,24 @@ function changeEtape() {
}
}
function uploadFileFinal() {
alertMessage.value = '';
alertType.value = 'success';
isLoading.value = true;
demandesService.uploadDemande(demande.value.id, fileFinalSelected.value, 'SUPP')
.then(() => {
alertMessage.value = "Fichier envoyé";
dialog.value = true;
})
.catch(err => {
alertMessage.value = err.response.data.message;
alertType.value = 'error';
})
.finally(() => {
isLoading.value = false;
});
}
function prevSelectTypeFile(){
typeFileSelected.value = null;
changeEtape()
Expand Down

0 comments on commit 043ac69

Please sign in to comment.