Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item 62 priorité 1 3 cas 2 suppression à partir d'un fichier epn #104

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
27 changes: 25 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,11 +183,33 @@ function uploadFile() {
isLoading.value = false;
});
}
function setTypeSelected(){
demandesService.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')
.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')
.then(response => {
demande.value = response.data;
});
}
}

function prevSelectTypeFile(){
typeFileSelected.value = null;
changeEtape()
raz();
}
function prevSelectFile(){
changeEtape()
raz();
}
function next() {
Expand All @@ -197,6 +219,7 @@ function next() {

function prev() {
currentStep.value--;
changeEtape()
raz();
}

Expand Down
Loading