diff --git a/services/web/app/donor/models.py b/services/web/app/donor/models.py index 8cfa39081..7716f7548 100644 --- a/services/web/app/donor/models.py +++ b/services/web/app/donor/models.py @@ -41,7 +41,6 @@ class Donor(Base, UniqueIdentifierMixin, RefAuthorMixin, RefEditorMixin): class DonorToSample(Base, RefAuthorMixin, RefEditorMixin): - __versioned__ = {} sample_id = db.Column(db.Integer, db.ForeignKey("sample.id")) donor_id = db.Column(db.Integer, db.ForeignKey("donor.id")) diff --git a/services/web/app/static/js/all.js b/services/web/app/static/js/all.js index 7f773b479..4287df0b8 100644 --- a/services/web/app/static/js/all.js +++ b/services/web/app/static/js/all.js @@ -29,6 +29,104 @@ function get_metric(type) { return metric } +function render_sample_table(samples, div_id) { + + console.log(samples); + + $('#' + div_id).DataTable( { + data: samples, + dom: 'Bfrtip', + buttons: [ 'print', 'csv', 'colvis' ], + columnDefs: [ + { targets: -3, + visible:false}, { targets: -2, visible: false} + ], + columns: [ + { + "mData": {}, + "mRender": function (data, type, row) { + var col_data = ''; + col_data += render_colour(data["colour"]) + col_data += ""; + col_data += ' ' + col_data += data["uuid"]; + col_data += ""; + if (data["source"] != "New") { + + col_data += '
'; + col_data += '' + col_data += ' '; + col_data += data["parent"]["uuid"], + col_data += ""; + } + + return col_data + } + }, + + {data: "base_type"}, + { + "mData" : {}, + "mRender": function (data, type, row) { + var sample_type_information = data["sample_type_information"]; + + + if (data["base_type"] == "Fluid") { + return sample_type_information["fluid_type"]; + } + else if (data["base_type"] == "Cell") { + return sample_type_information["cellular_type"] + " > " + sample_type_information["tissue_type"]; + } + + + } + }, + { + "mData": {}, + "mRender": function (data, type, row) { + var percentage = data["remaining_quantity"] / data["quantity"] * 100 + "%" + var col_data = ''; + col_data += ''; + col_data += data["remaining_quantity"]+"/"+data["quantity"]+get_metric(data["base_type"]); + col_data += ''; + return col_data + } + }, + { + "mData": {}, + "mRender": function(data, type, row) { + var storage_data = data["storage"]; + + if (storage_data == null) { + return "Not stored." + } + + else if (storage_data["storage_type"] == "STB") { + var rack_info = storage_data["rack"]; + var html = ""; + html += " LIMBRACK-" + rack_info["id"]; + html += "" + return html + } + + else if (storage_data["storage_type"] == "STS") { + var shelf_info = storage_data["shelf"]; + var html = ""; + html += " LIMBSHF-" + shelf_info["id"]; + html += "" + return html + } + return data["storage"] + } + } + + + + ], + + }); +} + function render_author(author) { return author["first_name"] + " " + author["last_name"]; } @@ -78,7 +176,7 @@ function render_colour(colour) { } function render_content(label, content) { - if (content == undefined || content == "") { + if (content == undefined || content == "" ) { content = "Not Available." } return ''+ label + ':'+content+''; diff --git a/services/web/app/static/js/donor/view.js b/services/web/app/static/js/donor/view.js index e01c75b42..cd89d0a97 100644 --- a/services/web/app/static/js/donor/view.js +++ b/services/web/app/static/js/donor/view.js @@ -89,13 +89,13 @@ function render_sample_table(d) { return col_data } }, - + {data: "base_type"}, { "mData" : {}, "mRender": function (data, type, row) { var sample_type_information = data["sample_type_information"]; - + console.log(sample_type_information) if (data["base_type"] == "Fluid") { @@ -104,8 +104,8 @@ function render_sample_table(d) { else if (data["base_type"] == "Cell") { return sample_type_information["cellular_type"] + " > " + sample_type_information["tissue_type"]; } - - + + } }, { @@ -114,16 +114,16 @@ function render_sample_table(d) { var percentage = data["remaining_quantity"] / data["quantity"] * 100 + "%" var col_data = ''; col_data += ''; - col_data += data["remaining_quantity"]+"/"+data["quantity"]+get_metric(data["base_type"]); + col_data += data["remaining_quantity"]+"/"+data["quantity"]+get_metric(data["base_type"]); col_data += ''; return col_data } } - + ], - + }); } diff --git a/services/web/app/static/js/sample/aliquot/create.js b/services/web/app/static/js/sample/aliquot/create.js index 5f791e9ec..5eff12f35 100644 --- a/services/web/app/static/js/sample/aliquot/create.js +++ b/services/web/app/static/js/sample/aliquot/create.js @@ -173,7 +173,6 @@ function subtract_quantity() { if ((remaining_quantity - quantities) < 0) { $("#quantityalert").show(); - $("#submit").attr("disabled", true); } @@ -275,7 +274,6 @@ function make_new_form(indx) { row_form_html += '' row_form_html += '' row_form_html += '
'; - row_form_html += '
'; row_form_html += '' // End Row @@ -294,9 +292,6 @@ function make_new_form(indx) { subtract_quantity(); }); - $(".copy").click(function() { - copy_row(); - }) diff --git a/services/web/app/static/js/sample/information/index.js b/services/web/app/static/js/sample/information/index.js index d93b8b77a..85763cd43 100644 --- a/services/web/app/static/js/sample/information/index.js +++ b/services/web/app/static/js/sample/information/index.js @@ -47,103 +47,9 @@ function render_table(query) { $("#table_view").delay(300).fadeOut(); $("#loading").fadeIn(); + render_sample_table(d, "sampleTable") - $('#sampleTable').DataTable( { - data: d, - dom: 'Bfrtip', - buttons: [ 'print', 'csv', 'colvis' ], - columnDefs: [ - { targets: -3, - visible:false}, { targets: -2, visible: false} - ], - columns: [ - { - "mData": {}, - "mRender": function (data, type, row) { - var col_data = ''; - col_data += render_colour(data["colour"]) - col_data += ""; - col_data += ' ' - col_data += data["uuid"]; - col_data += ""; - if (data["source"] != "New") { - - col_data += '
'; - col_data += '' - col_data += ' '; - col_data += data["parent"]["uuid"], - col_data += ""; - } - - return col_data - } - }, - - {data: "base_type"}, - { - "mData" : {}, - "mRender": function (data, type, row) { - console.log(data) - var sample_type_information = data["sample_type_information"]; - - - if (data["base_type"] == "Fluid") { - return sample_type_information["fluid_type"]; - } - else if (data["base_type"] == "Cell") { - return sample_type_information["cellular_type"] + " > " + sample_type_information["tissue_type"]; - } - - - } - }, - { - "mData": {}, - "mRender": function (data, type, row) { - var percentage = data["remaining_quantity"] / data["quantity"] * 100 + "%" - var col_data = ''; - col_data += ''; - col_data += data["remaining_quantity"]+"/"+data["quantity"]+get_metric(data["base_type"]); - col_data += ''; - return col_data - } - }, - { - "mData": {}, - "mRender": function(data, type, row) { - var storage_data = data["storage"]; - - if (storage_data == null) { - return "Not stored." - } - - else if (storage_data["storage_type"] == "STB") { - var rack_info = storage_data["rack"]; - var html = ""; - html += " LIMBRACK-" + rack_info["id"]; - html += "" - return html - } - - else if (storage_data["storage_type"] == "STS") { - var shelf_info = storage_data["shelf"]; - var html = ""; - html += " LIMBSHF-" + shelf_info["id"]; - html += "" - return html - } - console.log(storage_data); - return data["storage"] - } - } - - - - ], - - }); - $("#loading").fadeOut(); $("#table_view").delay(300).fadeIn(); diff --git a/services/web/app/templates/sample/add/step_zero.html b/services/web/app/templates/sample/add/step_zero.html index e69de29bb..384c757a0 100644 --- a/services/web/app/templates/sample/add/step_zero.html +++ b/services/web/app/templates/sample/add/step_zero.html @@ -0,0 +1,20 @@ +{% extends "template.html" %} + +{% block title %}New Sample: Collection and Consent Information{% endblock %} + +{% block body %} + +
+
+

New Sample + Select Sample Type

+ {{ render_progress(1, 3) }} +
+
+ +
+ + +
+ +{% endblck %} \ No newline at end of file