mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 11:41:31 +00:00
updated streamline-setup v2
This commit is contained in:
+96
@@ -0,0 +1,96 @@
|
||||
function addRow(tableID) {
|
||||
|
||||
var table = document.getElementById(tableID);
|
||||
|
||||
var rowCount = table.rows.length;
|
||||
var row = table.insertRow(rowCount);
|
||||
|
||||
var colCount = table.rows[0].cells.length;
|
||||
|
||||
for (var i = 0; i < colCount; i++) {
|
||||
|
||||
var newcell = row.insertCell(i);
|
||||
newcell.innerHTML = table.rows[1].cells[i].innerHTML;
|
||||
|
||||
/* set new id for the symptom select tag which is found in the first cell of every row
|
||||
* this makes the symptom select tag id dynamic and different for each table row
|
||||
* the id should be the rowCount +1000 to avoid a similar id with prompt div tag id set below
|
||||
*/
|
||||
if (i == 1) {
|
||||
newcell.childNodes[1].id = (rowCount + 1000);
|
||||
//alert(newcell.childNodes[1].nodeName);
|
||||
}
|
||||
/*
|
||||
* set new value for the prompt div tag
|
||||
*/
|
||||
if (i == 3) {
|
||||
table.rows[rowCount].cells[3].innerHTML = '';
|
||||
table.rows[rowCount].cells[3].innerHTML = '<div id="' + rowCount + '" class="text-center"></div>';
|
||||
}
|
||||
|
||||
if (i == 4) {
|
||||
var promptId = rowCount + 100;
|
||||
|
||||
table.rows[rowCount].cells[4].innerHTML = '';
|
||||
table.rows[rowCount].cells[4].innerHTML = '<div id="' + promptId + '" class="text-center"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function deleteRow(tableID) {
|
||||
try {
|
||||
var table = document.getElementById(tableID);
|
||||
var rowCount = table.rows.length;
|
||||
|
||||
for (var i = 0; i < rowCount; i++) {
|
||||
var row = table.rows[i];
|
||||
var chkbox = row.cells[0].childNodes[0];
|
||||
if (null != chkbox && true == chkbox.checked) {
|
||||
if (rowCount <= 2) {
|
||||
alert("Cannot delete all the rows.");
|
||||
break;
|
||||
}
|
||||
table.deleteRow(i);
|
||||
rowCount--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*code for selecting symptoms
|
||||
*/
|
||||
|
||||
|
||||
function showPrompt(symptom_id, prompt_div_id) {
|
||||
|
||||
if (symptom_id == ""){
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/triage/get_prompt',
|
||||
data: {'symptom_id' : symptom_id},
|
||||
success: function(response){
|
||||
|
||||
var returnText = response.split('&&&&');
|
||||
|
||||
var prompt = returnText[0];
|
||||
var reference = returnText[1];
|
||||
|
||||
document.getElementById((prompt_div_id - 1000)).innerHTML = '<p style="color: #C85F6A;">' + prompt + '</p>';
|
||||
document.getElementById(prompt_div_id - 900).innerHTML = reference;
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
alert(JSON.stringify(jqXHR));
|
||||
console.log(JSON.stringify(jqXHR));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user