Merged PR 59: ass summarize scenario

This commit is contained in:
D'Alia, Florinda
2025-02-17 10:59:19 +00:00

View File

@@ -16,7 +16,7 @@
<div v-for="input in scenario.inputs" :key="input.name"
:class="['input-container', input.type === 'textarea' ? 'col-span-12' : '']">
<div v-if="input.type === 'singlefile'">
<div v-if="input.type === 'singlefile' || input.type === 'singlefile_acceptall'">
<label :for="input.name">
<b>{{ input.label }}</b>
<i
@@ -32,7 +32,7 @@
:url="uploadUrlPR"
@upload="(event) => onUpload(event, 'SingleFileUpload')"
:multiple="false"
accept=".docx"
:accept="acceptedFormats"
auto
:showUploadButton="false"
:showCancelButton="false"
@@ -356,6 +356,7 @@ const uploadUrlOther = ref("");
// File che l'utente ha selezionato
const uploadedFiles = ref([]);
const numberPrFiles = ref(0);
const acceptedFormats = ref(".docx");
// :url="`http://localhost:8081/uploadListFiles/${folderName}`"
// Stato per l'ID univoco della cartella
@@ -387,10 +388,12 @@ function stopTimer() {
const isInputFilled = computed(() => {
var isFilled = true;
if(scenario.value.inputs === undefined) {
console.log("No inputs found");
return false;
}
scenario.value.inputs.forEach(input => {
if(formData.value[input.name] === undefined || formData.value[input.name] === '') {
console.log("Input not filled: ", input.name);
isFilled= false;
}
});
@@ -426,6 +429,12 @@ watch(() => route.params.id, fetchScenario);
if (scenario.value.inputs.some((input) => input.name === 'MultiFileUpload' || input.name === 'SingleFileUpload')) {
reqMultiFile.value = true;
}
if(scenario.value.inputs.some((input) => input.type === 'singlefile_acceptall')){
acceptedFormats.value = ".docx, .pdf, .doc, .txt, .msg";
}
if(scenario.value.inputs.some((input) => input.type === 'singlefile')){
acceptedFormats.value = ".docx";
}
})
.catch(error => {
console.error("Error fetching scenario:", error);
@@ -813,7 +822,13 @@ if (xhr.status === 200) {
// Risposta OK
if(uploadType==='SingleFileUpload'){
formData.value['SingleFileUpload'] = "OK";
//formData.value['SingleFileUpload'] = "OK";
if (event.files && event.files.length > 0) {
console.log("File uploaded:", event.files);
formData.value['SingleFileUpload'] = event.files[0].name; // Nome del primo file
} else {
formData.value['SingleFileUpload'] = "UnknownFile";
}
numberPrFiles.value += 1;
console.log("Number of PR files: ", numberPrFiles.value);
}