Skip to content

Commit

Permalink
Merge pull request #191 from abes-esr/develop
Browse files Browse the repository at this point in the history
Merge dev dans test
  • Loading branch information
SamuelQuetin authored Dec 9, 2024
2 parents fe0f750 + 5884f37 commit ce536fb
Show file tree
Hide file tree
Showing 11 changed files with 347 additions and 244 deletions.
51 changes: 25 additions & 26 deletions src/components/Simulation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@

<recap-demande :demande="demande"></recap-demande>
<!-- CONTENU SIMULATION -->
<v-alert icon="mdi-alert" type="error" v-if="alertMessageError" class="my-3" border="left">Simulation impossible : {{ alertMessageError }}</v-alert>
<v-alert icon="mdi-alert" type="error" v-if="alertMessageError" class="my-3" border="left">Simulation impossible :
{{ alertMessageError }}
</v-alert>
<v-card flat class="pb-2">
<v-card-title class="d-flex justify-space-between custom-card-title">
<span>Ecran de simulation</span>
<v-btn depressed variant="text" @click="deleted()" prepend-icon="mdi-delete">Supprimer</v-btn>
</v-card-title>
<!--TEMPLATE DE SIMULATION-->
<v-alert type="warning" class="my-3 pa-2" dense prominent border="left">
<v-alert type="warning" class="my-3 pa-2" dense prominent border="left">
Cet écran est une <strong>prévisualisation</strong> du traitement.<br>
Il s'agit de la <strong>dernière étape</strong> avant de lancer le traitement en <strong>base de
production</strong>. Merci de <strong>vérifier vos données</strong>.
Expand All @@ -36,7 +38,7 @@
</v-card>
</v-col>
<v-col cols="12" sm="12" md="2" class="pb-10">
<navigate-notice v-model="nbNotice" @clicked="refresh()"></navigate-notice>
<navigate-notice v-model="nbNotice" @clicked="refresh(nbNotice.nbNoticeEnCours)"></navigate-notice>
</v-col>
<v-col cols="12" sm="12" md="5"> <!--Exemplaire à créer-->
<v-card class="pa-1 mr-1" outlined tile>
Expand All @@ -54,7 +56,7 @@
import RecapDemande from '@/components/RecapDemande.vue';
import NavigateNotice from '@/components/NavigateNotice.vue';
import { onMounted, ref } from 'vue';
import { onMounted, ref, watchEffect } from 'vue';
import itemService from '@/service/ItemService';
const props = defineProps({
Expand All @@ -71,48 +73,44 @@ const props = defineProps({
default: 'Après'
}
});
const emits = defineEmits(['deleted'])
const emits = defineEmits(['deleted']);
const nbNotice = ref({
nbNoticeEnCours: 0,
nbTotalNotice: 0
});
const numeroPPNNotice = ref();
const noticeAvant = ref("");
const noticeApres = ref("");
const noticeAvant = ref('');
const noticeApres = ref('');
const isLoading = ref(true);
const alertMessageError = ref();
onMounted(() => {
itemService.getNbLigneFichier(props.demande.id, props.demande.type)
.then(response => {
nbNotice.value.nbTotalNotice = response.data;
});
itemService.simulerLigne(props.demande.id, 0, props.demande.type)
.then(response => {
numeroPPNNotice.value = response.data[0];
noticeAvant.value = response.data[1];
noticeApres.value = response.data[2];
})
.catch(err => {
alertMessageError.value = err.response.data.message
})
.finally(() => {
isLoading.value = false;
});
refresh(0);
});
watchEffect(() => {
if (props.demande.etatDemande === 'En simulation') {
refresh(0);
}
});
function refresh() {
//nbNotice.value.nbNoticeEnCours
function refresh(nbNoticeEnCours) {
isLoading.value = true;
alertMessageError.value = null;
itemService.simulerLigne(props.demande.id, nbNotice.value.nbNoticeEnCours, props.demande.type)
itemService.getNbLigneFichier(props.demande.id, props.demande.type)
.then(response => {
nbNotice.value.nbTotalNotice = response.data;
});
itemService.simulerLigne(props.demande.id, nbNoticeEnCours, props.demande.type)
.then(response => {
numeroPPNNotice.value = response.data[0];
noticeAvant.value = response.data[1];
noticeApres.value = response.data[2];
})
.catch(err => {
alertMessageError.value = err.response.data.message
alertMessageError.value = err.response.data.message;
})
.finally(() => {
isLoading.value = false;
Expand All @@ -134,6 +132,7 @@ h4 {
font-size: x-large;
font-weight: normal;
}
h5 {
font-size: x-large;
font-weight: normal;
Expand Down
23 changes: 13 additions & 10 deletions src/components/Supp/BtnStop.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<template>
<v-btn icon="mdi-stop" variant="plain" @click="click">
<v-btn icon="mdi-stop" variant="plain" @click="click">
</v-btn>
<dialog-confirmation-stop v-model="dialog" :id="id" @stop="emits('stop')">
<dialog-confirmation-stop v-model="dialog" :id="id" @stop="emits('stop')" @on-error="throwError">
</dialog-confirmation-stop>
</template>
<script setup>
import DialogConfirmationStop from "@/components/Supp/DialogConfirmationStop.vue";
import {ref} from "vue";
import DialogConfirmationStop from '@/components/Supp/DialogConfirmationStop.vue';
import { ref } from 'vue';
const emits = defineEmits(['stop'])
const emits = defineEmits(['stop', 'onError']);
const props = defineProps({
id:{
required:true,
type:Number
id: {
required: true,
type: Number
}
})
});
const dialog = ref(false);
function click() {
dialog.value = true
dialog.value = true;
}
function throwError(err) {
emits('onError', err);
}
</script>
28 changes: 16 additions & 12 deletions src/components/Supp/DialogConfirmationStop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<v-card>
<v-card-title>Confirmation</v-card-title>
<v-card-text>
Voulez vous vraiment stopper le traitement sur la demande N°{{id}} ?
Voulez vous vraiment stopper le traitement sur la demande N°{{ id }} ?
</v-card-text>
<v-card-actions>
<v-btn @click="dialog=false">Refuser</v-btn>
Expand All @@ -13,21 +13,25 @@
</v-dialog>
</template>
<script setup>
import itemService from "@/service/ItemService";
import itemService from '@/service/ItemService';
const emits = defineEmits(['stop'])
const emits = defineEmits(['stop', 'onError']);
const dialog = defineModel();
const props = defineProps({
id:{
required:true,
type:Number
id: {
required: true,
type: Number
}
})
});
function stopDemande(){
itemService.stopDemande(props.id).finally(() => {
dialog.value = false;
emits('stop');
});
function stopDemande() {
itemService.stopDemande(props.id)
.catch(err => {
emits('onError', err);
})
.finally(() => {
dialog.value = false;
emits('stop');
});
}
</script>
4 changes: 4 additions & 0 deletions src/service/ItemService.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ export class ItemService {
stopDemande(id) {
return this.client.patch('stopDemandeSupp/' + id);
}

restaurerDemande(id, typeDemande) {
return this.client.patch('restaurerDemande/' + typeDemande + '/' + id )
}
}

export default new ItemService()
Loading

0 comments on commit ce536fb

Please sign in to comment.