Skip to content

Commit

Permalink
- Gestion de l'événement mettant à jour de demande en back avec le ty…
Browse files Browse the repository at this point in the history
…pe de fichier

- Gestion des libellés dans les input de chargement des fichiers
  • Loading branch information
jvk88511334 committed Aug 20, 2024
1 parent d3bf15d commit abbb7fe
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
15 changes: 12 additions & 3 deletions src/components/SelectFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,29 @@
aria-label="Dépôt du fichier"
v-model="fileCharged"
ref="fileInput"
label="Cliquez pour charger votre fichier complété (format .txt ou .csv obligatoire)"
:label="label"
>
</v-file-input>
</v-card-text>
</v-card>
</template>
<script setup>
import { ref } from 'vue';
import {computed, ref} from 'vue'
const fileCharged = defineModel();
const props = defineProps( {isLoading: { type: Boolean}})
const props = defineProps( {isLoading: { type: Boolean}, typeFile: { type: String}})
const emits = defineEmits(['deleted']);
const isValidFile = ref(false)
const label = computed(() => {
if (props.typeFile === 'PPN'){
return 'Cliquez pour charger votre liste de PPN (Fichier PPN sur une colonne, format .txt ou .csv obligatoire)';
} else if (props.typeFile === 'EPN'){
return 'Cliquez pour charger votre liste d’EPN (Fichier EPN sur une colonne, format .txt ou .csv obligatoire)';
} else {
return 'Cliquez pour charger votre fichier complété (format .txt ou .csv obligatoire)';
}
})
const rules = ref([
value => {
if(!value[0]) {
Expand Down
8 changes: 5 additions & 3 deletions src/components/Supp/TypeFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@
</template>
<script setup>
const emits = defineEmits(['clicked'])
const props = defineProps({
isLoading: {
type: Boolean,
default: false
}
})
const typeFile = defineModel();
const types = ['PPN','EPN']
const model = defineModel();
const types = ['PPN','EPN'];
function onClick(type) {
typeFile.value = type;
model.value = type;
emits('clicked')
}
</script>
Expand Down
3 changes: 3 additions & 0 deletions src/service/DemandesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export class DemandesService {
modifierCommentaireDemande(id, commentaire, typeDemande){
return this.client.patch(`demandes/${typeDemande}/${id}?commentaire=${commentaire}`);
}
modifierTypeFileDemande(id, typeFileDemande){
return this.client.patch(`demandes/SUPP/${id}?typeSupp=${typeFileDemande}`);
}

uploadDemande(id, file, typeDemande){
const config = { headers: {
Expand Down
8 changes: 6 additions & 2 deletions src/views/Suppression/SuppSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
</v-container>
</v-stepper-window-item>
<v-stepper-window-item>
<type-file v-if="!typeFileSelected" v-model="typeFileSelected"></type-file>
<select-file v-else-if="!isLoaded" v-model="fileSelected">Selection du fichier {{typeFileSelected}}</select-file>
<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>
<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 Down Expand Up @@ -183,6 +183,10 @@ function uploadFile() {
isLoading.value = false;
});
}
function setTypeSelected(){
demandesService.modifierTypeFileDemande(demande.value.id, typeFileSelected.value)
}
function prevSelectTypeFile(){
typeFileSelected.value = null;
raz();
Expand Down

0 comments on commit abbb7fe

Please sign in to comment.