myMedisys/tomcatfiles/mymedisys-frontend/WEB-INF/classes/scripts/medical/collect-medical-results.js

151 lines
3.5 KiB
JavaScript
Raw Normal View History

2023-09-06 05:56:42 +05:30
$(document).ready(function() {
component.initFile();
$("#doctorNameSelection").change(function() {
$("#divDocDetails").show();
var $selectedOption = $(this).find('option:selected');
var doctorId = $selectedOption.data('regno');
var doctorQualif = $selectedOption.data('email');
$("#doctorprofCls").text(doctorId);
$("#doctorqualiCls").text(doctorQualif);
});
// Past Date Picker
$(".pastDtPicker").each(function(i) {
var value = $(this).val();
$(".pastDtPicker").datetimepicker({
format: 'DD/MM/YYYY',
minDate: new Date(new Date().getFullYear() - 60, 01 - 1, 25),
maxDate: new Date(),
defaultDate: false,
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-arrow-up",
down: "fa fa-arrow-down",
previous: "fa fa-chevron-left",
next: "fa fa-chevron-right",
today: "fa fa-clock-o",
clear: "fa fa-trash-o"
},
widgetPositioning: {
horizontal: 'right',
vertical: 'auto'
}
}).val(value)
});
if ($("#remarks").length > 0) {
tinymce.init({
selector: "textarea#remarks",
theme: "modern",
height: 100,
menubar: ' ',
force_br_newlines: false,
force_p_newlines: false,
forced_root_block: '',
});
}
$('.diseaseSwitch').each(function() { new Switchery($(this)[0], $(this).data()); });
$('.diseaseSwitch').change(function() {
if ($('.diseaseSwitch').length == $('.diseaseSwitch:checked').length) {
$("#testResults").text("MEDICALLY FIT");
$("#testResults").parent().attr('class', 'ribbon ribbon-bookmark ribbon-right ribbon-success');
} else {
$("#testResults").text("MEDICALLY UNFIT");
$("#testResults").parent().attr('class', 'ribbon ribbon-bookmark ribbon-right ribbon-danger');
}
});
});
function popup(profId) {
portalUtil.showMainLoading(true);
$.ajax({
headers: {
'X-CSRF-Token': csrf_token
},
type: 'GET',
action: 'xhttp',
url: contextPath + '/resources/popup?wrkrProfId=' + profId,
contentType: "application/json; charset=utf-8",
success: function(data) {
portalUtil.showMainLoading(false);
bootbox.dialog({
size: "xl",
message: data,
className: "customPopup",
backdrop: true
});
},
error: function(data) {
portalUtil.showMainLoading(false);
}
});
}
$("form").submit(function() {
Swal.fire({
text: 'Are you sure you want to submit the Medical Result?',
type: 'question',
showCancelButton: true,
showConfirmButton: true,
cancelButtonText: 'Cancel',
confirmButtonText: 'Yes',
allowOutsideClick: false,
allowEscapeKey: false,
cancelButtonColor: '#999999',
confirmButtonColor: '#4CAF50'
}).then((result) => {
if (result.value) {
document.forms['applicationForm'].submit();
} else if (result.dismiss === swal.DismissReason.cancel) {
return false;
}
});
return false;
});
/*
var doctorProfId = $(e).val();
if(doctorProfId !=null && doctorProfId!=''){
document.getElementById('divDocDetails').hidden = false;
var method = "GET";
portalUtil.showMainLoading(true);
var inputUrl = contextPath + '/collectmr/getDoctorDetails?doctorProfId=' + doctorProfId;
$.ajax({
headers: { 'X-CSRF-Token': csrf_token },
type: method,
url: inputUrl,
}).done(function(data) {
document.getElementById("doctorprofCls").innerText = data.doctorId ;
document.getElementById("doctorqualiCls").innerText = data.doctorQualif;
portalUtil.showMainLoading(false);
});
}else{
document.getElementById('divDocDetails').hidden = true;
}
*/
// }