Skip to content

Commit

Permalink
fixed issue 54. #54
Browse files Browse the repository at this point in the history
  • Loading branch information
luissian committed Jan 3, 2022
1 parent be9a0ee commit f97ad1b
Showing 1 changed file with 64 additions and 57 deletions.
121 changes: 64 additions & 57 deletions iSkyLIMS_wetlab/templates/iSkyLIMS_wetlab/recordSample.html
Original file line number Diff line number Diff line change
Expand Up @@ -331,71 +331,78 @@ <h4>Your batch file was successfuly stored in iSkyLIMS database</h4>

<div class="panel panel-default" >
<div class="panel-heading"><h3>The following samples require additional information as requested by project.</h3></div>
<div class="panel-body" >
<br>
<br><br>

<form method="post" enctype="multipart/form-data" name="sampleprojectdata" id="sampleprojectdata" class="form-horizontal well" style="min-height: 500px;">
{% csrf_token %}
<div class="panel-body" >

<input type="hidden" name="action" value="sampleprojectdata"/>
<input type="hidden" name="pending_pre_defined" value="{{sample_recorded.pending_pre_defined_samples_id}}"/>
<input type="hidden" name="pre_defined_id" value="{{sample_recorded.updated_pre_defined_samples_id}}"/>
<input type="hidden" name="pre_defined_samples" value="{{sample_recorded.pre_defined_samples_name}}"/>
<input type="hidden" name="pre_defined_heading" value="{{sample_recorded.pre_defined_fields_heading_list}}"/>
<div id="spreadsheet_pre_def"></div>
<br>
<br><br>

<script>
var data_pre_def = [{% for values in sample_recorded.pre_defined_sample_data %}
[{% for value in values %}'{{value}}',{% endfor %}],
<form method="post" enctype="multipart/form-data" name="sampleprojectdata" id="sampleprojectdata" class="form-horizontal well" style="min-height: 500px;">
{% csrf_token %}
<div class="scrolling-wrapper">

<input type="hidden" name="action" value="sampleprojectdata"/>
<input type="hidden" name="pending_pre_defined" value="{{sample_recorded.pending_pre_defined_samples_id}}"/>
<input type="hidden" name="pre_defined_id" value="{{sample_recorded.updated_pre_defined_samples_id}}"/>
<input type="hidden" name="pre_defined_samples" value="{{sample_recorded.pre_defined_samples_name}}"/>
<input type="hidden" name="pre_defined_heading" value="{{sample_recorded.pre_defined_fields_heading_list}}"/>
<div id="spreadsheet_pre_def"></div>

<script>
var data_pre_def = [{% for values in sample_recorded.pre_defined_sample_data %}
[{% for value in values %}'{{value}}',{% endfor %}],
{% endfor %}
];

var pre_def_table = jexcel(document.getElementById('spreadsheet_pre_def'), {
data:data_pre_def,
columns: [
{ type: 'text', title:'Sample Name', width:150 , readOnly:true },
{% for name, type, options in sample_recorded.pre_defined_fields_heading_type %}
{% if type == 'Date' %}
{ type: 'calendar', title:'{{name}}', width:150 },
{% elif type == 'Option List'%}

{ type: 'dropdown', title:'{{name}}', width:150 , source: [{% for value in options %}"{{value}}",{% endfor %}] },
{% else %}
{ type: 'text', title:'{{name}}', width:150 },
{% endif %}
{% endfor %}
];
],
allowInsertColumn:false,
allowDeleteColumn:false,
allowRenameColumn:false,
csvFileName:'samples_projects_values',
minDimensions:[{{sample_recorded.pre_defined_fields_length}},{{sample_recorded.pre_defined_samples_length}}],
});
</script>
<br><br><br><br><br><br><br><br><br><br><br>
</div> <!-- end of scrolling -->
<br><br><br><br><br>
<input type="button" value="Download Spreadsheet" onclick="pre_def_table.download()"/>
<input class="btn pull-right btn-primary" type="submit" value="Submit">
</form>

var pre_def_table = jexcel(document.getElementById('spreadsheet_pre_def'), {
data:data_pre_def,
columns: [
{ type: 'text', title:'Sample Name', width:150 , readOnly:true },
{% for name, type, options in sample_recorded.pre_defined_fields_heading_type %}
{% if type == 'Date' %}
{ type: 'calendar', title:'{{name}}', width:150 },
{% elif type == 'Option List'%}

{ type: 'dropdown', title:'{{name}}', width:150 , source: [{% for value in options %}"{{value}}",{% endfor %}] },
{% else %}
{ type: 'text', title:'{{name}}', width:150 },
{% endif %}
{% endfor %}
],
allowInsertColumn:false,
allowDeleteColumn:false,
allowRenameColumn:false,
csvFileName:'samples_projects_values',
minDimensions:[{{sample_recorded.pre_defined_fields_length}},{{sample_recorded.pre_defined_samples_length}}],
<script>
$(document).ready(function () {
$("#sampleprojectdata").submit(function (e) {
//stop submitting the form to see the disabled button effect
// e.preventDefault();
//disable the submit button
var table_data = pre_def_table.getData()
var data_json = JSON.stringify(table_data)
$("<input />").attr("type", "hidden")
.attr("name", "table_data")
.attr("value", data_json)
.appendTo("#sampleprojectdata");
$("#btnSubmit").attr("disabled", true);
return true;
});
</script>
<br><br><br><br><br><br><br><br><br><br><br>
<input type="button" value="Download Spreadsheet" onclick="pre_def_table.download()"/>
<input class="btn pull-right btn-primary" type="submit" value="Submit">
</form>
<script>
$(document).ready(function () {
$("#sampleprojectdata").submit(function (e) {
//stop submitting the form to see the disabled button effect
// e.preventDefault();
//disable the submit button
var table_data = pre_def_table.getData()
var data_json = JSON.stringify(table_data)
$("<input />").attr("type", "hidden")
.attr("name", "table_data")
.attr("value", data_json)
.appendTo("#sampleprojectdata");
$("#btnSubmit").attr("disabled", true);
return true;
});
});
</script>
</script>

</div> <!-- end of panel body -->

</div> <!-- end of panel body -->
</div> <!--// end panel -->

</div> <!--// end col-sm-7 -->
Expand Down

0 comments on commit f97ad1b

Please sign in to comment.