Skip to content

Commit

Permalink
Ajout RCR
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelQuetin committed Jul 16, 2024
1 parent 2952c4e commit 4edb01f
Showing 1 changed file with 40 additions and 17 deletions.
57 changes: 40 additions & 17 deletions src/views/Suppression/SuppSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@

<v-stepper-window>
<v-stepper-window-item>
<!-- <rcr v-model="rcrSelected" :is-loading="isLoading"></rcr>-->
<!-- <v-container class="d-flex justify-space-between">-->
<!-- <v-spacer></v-spacer>-->
<!-- <v-btn-->
<!-- :disabled="!rcrSelected"-->
<!-- @click="createDemande"-->
<!-- >-->
<!-- Valider-->
<!-- </v-btn>-->
<!-- </v-container>-->
<rcr v-model="rcrSelected" :is-loading="isLoading"></rcr>
<v-container class="d-flex justify-space-between">
<v-spacer></v-spacer>
<v-btn
:disabled="!rcrSelected"
@click="createDemande"
>
Valider
</v-btn>
</v-container>
</v-stepper-window-item>
<v-stepper-window-item>
<type-file v-if="!typeFileSelected" v-model="typeFileSelected"></type-file>
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 4edb01f

Please sign in to comment.