replaced alert message on file upload

This commit is contained in:
Luis Aleixo 2023-07-20 15:24:39 +02:00
parent ab0ec4c4ca
commit effc606fc9
2 changed files with 7 additions and 4 deletions

View file

@ -28,9 +28,11 @@ const CO2_data_form = [
clearFittingResultComponent();
const files = document.getElementById("file_upload").files;
if (files.length === 0) {
alert("Please choose any file...");
$("#upload-error").show();
return;
}
} else {
$("#upload-error").hide();
};
const file = files[0];
const extension = file.name.substring(file.name.lastIndexOf(".")).toUpperCase();
extension === ".XLS" || extension === ".XLSX"
@ -120,6 +122,7 @@ const CO2_data_form = [
}
if (submit) {
$($(obj).data('target')).modal('show');
$("#upload-error").hide();
}
return submit;
}
@ -242,6 +245,7 @@ function submitFittingAlgorithm(url) {
$('#fitting_ventilation_states').val('');
$('span.error_text').remove();
$('#DIVCO2_fitting_result, #CO2_input_data_div').hide();
$('#DIVCO2_fitting_to_submit').hide();
$('#CO2_data_plot').attr('src', '');
// Update the ventilation scheme components

View file

@ -297,7 +297,6 @@
</div>
</div>
</div>
</div>
<br/>
@ -331,7 +330,7 @@
<!-- Input element to upload an excel file -->
<input type="file" id="file_upload" />
<button type="button" class="btn btn-primary btn-sm" onclick="uploadFile('{{ get_calculator_url() }}/co2-fit/plot');">Upload</button>
<br>
<div id="upload-error" class="mb-0 mt-2 alert alert-danger" style="display: none" role="alert">Please choose any file...</div>
<br>
<!-- table to display the excel data -->
<table id="display_excel_data" border="1" style="width: 70%; margin-left: auto; margin-right: auto"></table>