Measurements and Timepoint interaction in Lesion Table and tools
This commit is contained in:
1 parent
5363880e40
commit
b49c36493e
15 files changed
+300
-383
No files matched your search
@@ -1,22 +1,36 @@
|
||||
var lastAddedLesionData;
|
||||
|
||||
//fill selectLesionLocation element
|
||||
var lesionLocationsArray = [
|
||||
{location:"Brain Brainstem",hasDescription:false, description:""},
|
||||
{location:"Brain Cerebellum Left",hasDescription:false, description:""},
|
||||
{location:"Brain Cerebrum Left",hasDescription:false, description:""},
|
||||
{location:"Brain Cerebrum Right",hasDescription:false, description:""},
|
||||
{location:"Brain Multiple Sites",hasDescription:false, description:""}
|
||||
];
|
||||
var lesionLocationsArray = [{
|
||||
location: "Brain Brainstem",
|
||||
hasDescription: false,
|
||||
description: ""
|
||||
}, {
|
||||
location: "Brain Cerebellum Left",
|
||||
hasDescription: false,
|
||||
description: ""
|
||||
}, {
|
||||
location: "Brain Cerebrum Left",
|
||||
hasDescription: false,
|
||||
description: ""
|
||||
}, {
|
||||
location: "Brain Cerebrum Right",
|
||||
hasDescription: false,
|
||||
description: ""
|
||||
}, {
|
||||
location: "Brain Multiple Sites",
|
||||
hasDescription: false,
|
||||
description: ""
|
||||
}];
|
||||
|
||||
Template.lesionLocationDialog.onRendered(function () {
|
||||
Template.lesionLocationDialog.onRendered(function() {
|
||||
console.log(this.data);
|
||||
|
||||
function fillSelectLesionLocation () {
|
||||
function fillSelectLesionLocation() {
|
||||
var el = $("#selectLesionLocation");
|
||||
el.find('option:not(:first)').remove();
|
||||
$.each(lesionLocationsArray, function(key, value) {
|
||||
el.append("<option value='" + key+ "'>" + value.location + "</option>");
|
||||
el.append("<option value='" + key + "'>" + value.location + "</option>");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,7 +39,7 @@ Template.lesionLocationDialog.onRendered(function () {
|
||||
|
||||
// Observe Measurements Collection Changes
|
||||
Measurements.find().observe({
|
||||
added: function (lesionData) {
|
||||
added: function(lesionData) {
|
||||
lastAddedLesionData = lesionData;
|
||||
},
|
||||
changed: function(lesionData) {
|
||||
@@ -35,44 +49,44 @@ Template.lesionLocationDialog.onRendered(function () {
|
||||
});
|
||||
|
||||
Template.lesionLocationDialog.events({
|
||||
'click button#btnCloseLesionPopup': function (e) {
|
||||
'click button#btnCloseLesionPopup': function(e) {
|
||||
$("#lesionDialog").modal("hide");
|
||||
// TODO: Remove lastAddedLesionData from canvas
|
||||
// TODO: Remove lastAddedLesionData from collection
|
||||
|
||||
},
|
||||
|
||||
'change select#selectLesionLocation': function (e) {
|
||||
'change select#selectLesionLocation': function(e) {
|
||||
var el = $(e.target);
|
||||
var selectedLocationIndex = el.val();
|
||||
if(selectedLocationIndex !== "-1"){
|
||||
|
||||
// Get selected location data
|
||||
var locationObj = lesionLocationsArray[selectedLocationIndex];
|
||||
|
||||
// Gets active lesion measurement data that is latest added data
|
||||
var activeLesionMeasurementData = Session.get("lesionMeasurementData");
|
||||
|
||||
// Adds location data to trialPatientLocations array and returns locationUID
|
||||
var locationUID = measurementManagerDAL.addNewLocation(locationObj);
|
||||
|
||||
// Linkk locationUID with activeLesionMeasurementData
|
||||
activeLesionMeasurementData.locationUID = locationUID;
|
||||
|
||||
// Adds lesion data to timepoints array
|
||||
measurementManagerDAL.addLesionData(activeLesionMeasurementData);
|
||||
|
||||
// Trigger location selected event
|
||||
$(document).trigger("lesionLocationSelected",locationObj);
|
||||
|
||||
// Set activeModule parameters in index.html
|
||||
$("#lesionDialog").modal("hide");
|
||||
|
||||
// Select first option
|
||||
el.val($("#selectLesionLocation option:first").val());
|
||||
|
||||
// Set lesion location selected session to prevent open
|
||||
Session.set("lesionLocationSelected", true);
|
||||
if (selectedLocationIndex < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get selected location data
|
||||
var locationObj = lesionLocationsArray[selectedLocationIndex];
|
||||
|
||||
// Gets active lesion measurement data that is latest added data
|
||||
var activeLesionMeasurementData = Session.get("lesionMeasurementData");
|
||||
|
||||
// Adds location data to trialPatientLocations array and returns locationUID
|
||||
var locationUID = measurementManagerDAL.addNewLocation(locationObj);
|
||||
|
||||
// Linkk locationUID with activeLesionMeasurementData
|
||||
activeLesionMeasurementData.locationUID = locationUID;
|
||||
|
||||
// Adds lesion data to timepoints array
|
||||
measurementManagerDAL.addLesionData(activeLesionMeasurementData);
|
||||
|
||||
// Trigger location selected event
|
||||
$(document).trigger("lesionLocationSelected", locationObj);
|
||||
|
||||
// Set activeModule parameters in index.html
|
||||
$("#lesionDialog").modal("hide");
|
||||
|
||||
// Select first option
|
||||
el.val($("#selectLesionLocation option:first").val());
|
||||
|
||||
// Set lesion location selected session to prevent open
|
||||
Session.set("lesionLocationSelected", true);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user