Files

68 lines
2.8 KiB
JavaScript
Executable File

$(document).ready(function () {
//This is the code to highlight each row on the patient episode when it is selected
$('.radio-option').click(function () {
// Retrieving a session we stored of the previous table row and removing the class from that particular table row
var id_in_session = $.session.get("myVar");
$("#my_row" + id_in_session).removeClass('color-tr');
$('#my_row' + $(this).val()).addClass('color-tr');
$("#my_row2" + id_in_session).addClass('info');
//Removing the yellow from the inpatient rows as well
$("#my_row2" + id_in_session).removeClass('color-tr');
var id = $(this).val();
// Store a session of the current selected table row's id
$.session.set("myVar", id);
});
$('.radio-option-inpatient').click(function () {
// Retrieving a session we stored of the previous table row and removing the class from that particular table row
var id_in_session = $.session.get("myVar");
$("#my_row2" + id_in_session).removeClass('color-tr');
$("#my_row2" + id_in_session).addClass('info');
$("#my_row2" + $(this).val()).removeClass('info'); // the info one
$('#my_row2' + $(this).val()).addClass('color-tr');
//Removing the yellow from the outpatient rows as well
$("#my_row" + id_in_session).removeClass('color-tr');
var id = $(this).val();
// Store a session of the current selected table row's id
$.session.set("myVar", id);
});
// //Ajax to submit the Ocupation
// $("#submit_allergies1").click(function () {
// // alert("The button has been clicked!");
// var patient_id = $("#allergy_patient_id").val();
// var allergies = $("#allergies").val();
// alert(patient_id);
// alert(allergies);
// // Returns successful data submission message when the entered information is stored in database.
// var dataString = 'patient_id=' + patient_id + "&allergies=" + allergies;
// if (patient_id == '') {
// alert("Please select a patient first!");
// } else if (allergies == '') {
// alert("Please check atleast one allergic reation!");
// } else {
// //AJAX code to submit form.
// $.ajax({
// type: "POST",
// url: "pages/allergies/submit_allergies.php",
// data: dataString,
// cache: false,
// success: function (result) {
// alert(result);
// //This is to reload the dropdown for the occupations dropdown
// $("#known_allergies").load('pages/patients/get_allergies.php');
// }
// });
// }
// return false;
// });
});