make the report initial commit -- there is work todo here still.
This commit is contained in:
parent
abbe0a28bf
commit
b5fe55d2e0
130
create_report.html
Normal file
130
create_report.html
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<html>
|
||||
<header>
|
||||
|
||||
<link href="bootstrap-5.0.2-dist/css/bootstrap.min.css" rel="stylesheet" ></link>
|
||||
<script src="bootstrap-5.0.2-dist/js/bootstrap.bundle.min.js" ></script>
|
||||
</header>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<label class = "form-label" for="sample_chooser">choose the sample</label>
|
||||
<select class="form-select" name="sample_chooser" id = "sample_chooser"></select>
|
||||
</div>
|
||||
</div>
|
||||
<h1>ok here are the results</h1>
|
||||
|
||||
<p> Fungal to Bacterial ratio: <span id="BtoF"> </span></p>
|
||||
|
||||
<table class="table" id = "nematode_scan" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
functional group
|
||||
</th>
|
||||
<th>
|
||||
count
|
||||
</th>
|
||||
<th>
|
||||
number per m³
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<table class="table" id = "main_scan" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
organism [unit]
|
||||
</th>
|
||||
<th>
|
||||
quantity
|
||||
</th>
|
||||
<th>
|
||||
standard deviation
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
var db;
|
||||
let openRequest = indexedDB.open("my_db");
|
||||
var sample;
|
||||
var samples = {};
|
||||
|
||||
openRequest.onerror = function() {
|
||||
console.error("Error", openRequest.error);
|
||||
};
|
||||
|
||||
openRequest.onsuccess = function() {
|
||||
db = openRequest.result;
|
||||
get_all_samples();
|
||||
// continue working with database using db object
|
||||
};
|
||||
|
||||
function get_all_samples(){
|
||||
const request = db.transaction('sample')
|
||||
.objectStore('sample')
|
||||
.openCursor();
|
||||
request.onsuccess = ()=> {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
// Access the current record
|
||||
make_sample_chooser(cursor.value, cursor.key);
|
||||
sample = cursor.key;
|
||||
// Move to the next record
|
||||
cursor.continue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
request.onerror = (err)=> {
|
||||
console.error(`Error to get all setups: ${err}`)
|
||||
}
|
||||
}
|
||||
|
||||
var sample_chooser = document.querySelector("#sample_chooser");
|
||||
|
||||
function make_sample_chooser(sample, key){
|
||||
let sampleID = document.createElement("option");
|
||||
let text = document.createTextNode(sample.Name);
|
||||
sampleID.value = key;
|
||||
samples[key] = sample;
|
||||
sampleID.appendChild(text);
|
||||
sample_chooser.appendChild(sampleID);
|
||||
}
|
||||
|
||||
sample_chooser.addEventListener("change", change_sample);
|
||||
function change_sample(){
|
||||
sample = samples[this.value];
|
||||
};
|
||||
|
||||
function get_results(){
|
||||
const request = db.transaction('main_scan')
|
||||
.objectStore('main_scan')
|
||||
.openCursor();
|
||||
request.onsuccess = ()=> {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
// Access the current record
|
||||
if (cursor.value.sampleID = sample_chooser.value)
|
||||
render_main_scan_table(cursor.value, cursor.key);
|
||||
sample = cursor.key;
|
||||
// Move to the next record
|
||||
cursor.continue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
request.onerror = (err)=> {
|
||||
console.error(`Error to get all setups: ${err}`)
|
||||
}
|
||||
}
|
||||
function render_main_scan_table(result, key)
|
||||
</script>
|
||||
</html>
|
||||
Loading…
Reference in a new issue