Initial commit: DMH Patient Registration Flask app
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
/* Simple AJAX Code-Kit (SACK) v1.6.1 */
|
||||
/* ©2005 Gregory Wild-Smith */
|
||||
/* www.twilightuniverse.com */
|
||||
/* Software licenced under a modified X11 licence,
|
||||
see documentation or authors website for more details */
|
||||
|
||||
function sack(file) {
|
||||
this.xmlhttp = null;
|
||||
|
||||
this.resetData = function() {
|
||||
this.method = "POST";
|
||||
this.queryStringSeparator = "?";
|
||||
this.argumentSeparator = "&";
|
||||
this.URLString = "";
|
||||
this.encodeURIString = true;
|
||||
this.execute = false;
|
||||
this.element = null;
|
||||
this.elementObj = null;
|
||||
this.requestFile = file;
|
||||
this.vars = new Object();
|
||||
this.responseStatus = new Array(2);
|
||||
};
|
||||
|
||||
this.resetFunctions = function() {
|
||||
this.onLoading = function() { };
|
||||
this.onLoaded = function() { };
|
||||
this.onInteractive = function() { };
|
||||
this.onCompletion = function() { };
|
||||
this.onError = function() { };
|
||||
this.onFail = function() { };
|
||||
};
|
||||
|
||||
this.reset = function() {
|
||||
this.resetFunctions();
|
||||
this.resetData();
|
||||
};
|
||||
|
||||
this.createAJAX = function() {
|
||||
try {
|
||||
this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e1) {
|
||||
try {
|
||||
this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (e2) {
|
||||
this.xmlhttp = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (! this.xmlhttp) {
|
||||
if (typeof XMLHttpRequest != "undefined") {
|
||||
this.xmlhttp = new XMLHttpRequest();
|
||||
} else {
|
||||
this.failed = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.setVar = function(name, value){
|
||||
this.vars[name] = Array(value, false);
|
||||
};
|
||||
|
||||
this.encVar = function(name, value, returnvars) {
|
||||
if (true == returnvars) {
|
||||
return Array(encodeURIComponent(name), encodeURIComponent(value));
|
||||
} else {
|
||||
this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
|
||||
}
|
||||
}
|
||||
|
||||
this.processURLString = function(string, encode) {
|
||||
encoded = encodeURIComponent(this.argumentSeparator);
|
||||
regexp = new RegExp(this.argumentSeparator + "|" + encoded);
|
||||
varArray = string.split(regexp);
|
||||
for (i = 0; i < varArray.length; i++){
|
||||
urlVars = varArray[i].split("=");
|
||||
if (true == encode){
|
||||
this.encVar(urlVars[0], urlVars[1]);
|
||||
} else {
|
||||
this.setVar(urlVars[0], urlVars[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.createURLString = function(urlstring) {
|
||||
if (this.encodeURIString && this.URLString.length) {
|
||||
this.processURLString(this.URLString, true);
|
||||
}
|
||||
|
||||
if (urlstring) {
|
||||
if (this.URLString.length) {
|
||||
this.URLString += this.argumentSeparator + urlstring;
|
||||
} else {
|
||||
this.URLString = urlstring;
|
||||
}
|
||||
}
|
||||
|
||||
// prevents caching of URLString
|
||||
this.setVar("rndval", new Date().getTime());
|
||||
|
||||
urlstringtemp = new Array();
|
||||
for (key in this.vars) {
|
||||
if (false == this.vars[key][1] && true == this.encodeURIString) {
|
||||
encoded = this.encVar(key, this.vars[key][0], true);
|
||||
delete this.vars[key];
|
||||
this.vars[encoded[0]] = Array(encoded[1], true);
|
||||
key = encoded[0];
|
||||
}
|
||||
|
||||
urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
|
||||
}
|
||||
if (urlstring){
|
||||
this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
|
||||
} else {
|
||||
this.URLString += urlstringtemp.join(this.argumentSeparator);
|
||||
}
|
||||
}
|
||||
|
||||
this.runResponse = function() {
|
||||
eval(this.response);
|
||||
}
|
||||
|
||||
this.runAJAX = function(urlstring) {
|
||||
if (this.failed) {
|
||||
this.onFail();
|
||||
} else {
|
||||
this.createURLString(urlstring);
|
||||
if (this.element) {
|
||||
this.elementObj = document.getElementById(this.element);
|
||||
}
|
||||
if (this.xmlhttp) {
|
||||
var self = this;
|
||||
if (this.method == "GET") {
|
||||
totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
|
||||
this.xmlhttp.open(this.method, totalurlstring, true);
|
||||
} else {
|
||||
this.xmlhttp.open(this.method, this.requestFile, true);
|
||||
try {
|
||||
this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
this.xmlhttp.onreadystatechange = function() {
|
||||
switch (self.xmlhttp.readyState) {
|
||||
case 1:
|
||||
self.onLoading();
|
||||
break;
|
||||
case 2:
|
||||
self.onLoaded();
|
||||
break;
|
||||
case 3:
|
||||
self.onInteractive();
|
||||
break;
|
||||
case 4:
|
||||
self.response = self.xmlhttp.responseText;
|
||||
self.responseXML = self.xmlhttp.responseXML;
|
||||
self.responseStatus[0] = self.xmlhttp.status;
|
||||
self.responseStatus[1] = self.xmlhttp.statusText;
|
||||
|
||||
if (self.execute) {
|
||||
self.runResponse();
|
||||
}
|
||||
|
||||
if (self.elementObj) {
|
||||
elemNodeName = self.elementObj.nodeName;
|
||||
elemNodeName.toLowerCase();
|
||||
if (elemNodeName == "input"
|
||||
|| elemNodeName == "select"
|
||||
|| elemNodeName == "option"
|
||||
|| elemNodeName == "textarea") {
|
||||
self.elementObj.value = self.response;
|
||||
} else {
|
||||
self.elementObj.innerHTML = self.response;
|
||||
}
|
||||
}
|
||||
if (self.responseStatus[0] == "200") {
|
||||
self.onCompletion();
|
||||
} else {
|
||||
self.onError();
|
||||
}
|
||||
|
||||
self.URLString = "";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
this.xmlhttp.send(this.URLString);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.reset();
|
||||
this.createAJAX();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
.dmh-modal-overlay {
|
||||
position: fixed; inset: 0; background: rgba(0,0,0,0.45);
|
||||
display: flex; align-items: center; justify-content: center; z-index: 10000;
|
||||
}
|
||||
.dmh-modal-box {
|
||||
background: #fff; padding: 20px 24px; border-radius: 6px;
|
||||
max-width: 380px; width: 90%; box-shadow: 0 6px 24px rgba(0,0,0,0.25);
|
||||
text-align: center;
|
||||
}
|
||||
.dmh-modal-msg { margin: 0 0 16px; font-size: 16px; color: #222; }
|
||||
.dmh-modal-actions { display: flex; justify-content: center; gap: 12px; }
|
||||
.dmh-modal-btn {
|
||||
padding: 6px 18px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;
|
||||
}
|
||||
.dmh-modal-ok { background: #28a745; color: #fff; }
|
||||
.dmh-modal-cancel { background: #6c757d; color: #fff; }
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Lightweight $.alert and $.confirm modal implementation */
|
||||
(function($) {
|
||||
if (!$) return;
|
||||
|
||||
function showModal(message, isConfirm, callback) {
|
||||
var overlay = document.createElement("div");
|
||||
overlay.className = "dmh-modal-overlay";
|
||||
var box = document.createElement("div");
|
||||
box.className = "dmh-modal-box";
|
||||
|
||||
var msgEl = document.createElement("p");
|
||||
msgEl.className = "dmh-modal-msg";
|
||||
msgEl.textContent = message;
|
||||
box.appendChild(msgEl);
|
||||
|
||||
var actions = document.createElement("div");
|
||||
actions.className = "dmh-modal-actions";
|
||||
|
||||
var okBtn = document.createElement("button");
|
||||
okBtn.type = "button";
|
||||
okBtn.className = "dmh-modal-btn dmh-modal-ok";
|
||||
okBtn.textContent = "OK";
|
||||
okBtn.onclick = function() {
|
||||
document.body.removeChild(overlay);
|
||||
if (callback) callback(true);
|
||||
};
|
||||
actions.appendChild(okBtn);
|
||||
|
||||
if (isConfirm) {
|
||||
var cancelBtn = document.createElement("button");
|
||||
cancelBtn.type = "button";
|
||||
cancelBtn.className = "dmh-modal-btn dmh-modal-cancel";
|
||||
cancelBtn.textContent = "Cancel";
|
||||
cancelBtn.onclick = function() {
|
||||
document.body.removeChild(overlay);
|
||||
if (callback) callback(false);
|
||||
};
|
||||
actions.appendChild(cancelBtn);
|
||||
}
|
||||
|
||||
box.appendChild(actions);
|
||||
overlay.appendChild(box);
|
||||
document.body.appendChild(overlay);
|
||||
okBtn.focus();
|
||||
}
|
||||
|
||||
$.alert = function(msg) { showModal(msg, false, null); };
|
||||
$.confirm = function(msg, cb) { showModal(msg, true, cb); };
|
||||
})(window.$);
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/* Lightweight canvas image upload resizer plugin */
|
||||
(function($) {
|
||||
if (!$ || !$.fn) return;
|
||||
$.fn.imageUploadResizer = function(options) {
|
||||
options = options || {};
|
||||
var maxW = options.max_width || 1000;
|
||||
var maxH = options.max_height || 1000;
|
||||
var quality = options.quality || 0.8;
|
||||
var skip = options.do_not_resize || [];
|
||||
|
||||
this.els.forEach(function(input) {
|
||||
input.addEventListener("change", function(event) {
|
||||
var file = event.target.files && event.target.files[0];
|
||||
if (!file) return;
|
||||
if (input.id === "ptnPhoto" && typeof window.loadFile === "function") {
|
||||
window.loadFile(event);
|
||||
}
|
||||
var ext = (file.name.split(".").pop() || "").toLowerCase();
|
||||
if (skip.indexOf(ext) !== -1 || file.type.indexOf("image/") !== 0) return;
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
var img = new Image();
|
||||
img.onload = function() {
|
||||
var w = img.width, h = img.height;
|
||||
if (w <= maxW && h <= maxH) return;
|
||||
var ratio = Math.min(maxW / w, maxH / h);
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = Math.round(w * ratio);
|
||||
canvas.height = Math.round(h * ratio);
|
||||
canvas.getContext("2d").drawImage(img, 0, 0, canvas.width, canvas.height);
|
||||
canvas.toBlob(function(blob) {
|
||||
if (!blob || typeof DataTransfer === "undefined") return;
|
||||
var resized = new File([blob], file.name, { type: file.type || "image/jpeg" });
|
||||
var dt = new DataTransfer();
|
||||
dt.items.add(resized);
|
||||
input.files = dt.files;
|
||||
}, file.type || "image/jpeg", quality);
|
||||
};
|
||||
img.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
});
|
||||
return this;
|
||||
};
|
||||
})(window.jQuery || window.$);
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/* Local jQuery alias for imageUploadResizer noConflict block */
|
||||
(function(global) {
|
||||
if (!global.jQuery) return;
|
||||
global.$ = global.jQuery;
|
||||
})(window);
|
||||
@@ -0,0 +1,512 @@
|
||||
// JavaScript Document
|
||||
|
||||
String.prototype.trim = function()
|
||||
{
|
||||
return this.replace(/^\s+|\s+$/g,"");
|
||||
}
|
||||
String.prototype.ltrim = function()
|
||||
{
|
||||
return this.replace(/^\s+/,"");
|
||||
}
|
||||
|
||||
String.prototype.rtrim = function()
|
||||
{
|
||||
return this.replace(/\s+$/,"");
|
||||
}
|
||||
|
||||
function stopRKey(evt)
|
||||
{
|
||||
var evt = (evt) ? evt : ((event) ? event : null);
|
||||
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
|
||||
if ((evt.keyCode == 13) && (node.type=="text")) { getClientData(); return false; }
|
||||
}
|
||||
|
||||
document.onkeypress = stopRKey;
|
||||
|
||||
var ajax = new sack();
|
||||
function getState(country,state,other_state,city,other_city)
|
||||
{
|
||||
document.getElementById("citydiv").innerHTML="<select class='custom-select d-block w-100' name='other_city' id='other_city'><option value=''>-- Select --</option></select>";
|
||||
ajax.requestFile = 'getState.php?countryId='+country+'&stateId='+state+'&other_state='+other_state+'&cityId='+city+'&other_city='+other_city;
|
||||
ajax.onCompletion = showState;
|
||||
ajax.runAJAX();
|
||||
getCity(country,state,other_state,city,other_city);
|
||||
}
|
||||
function showState()
|
||||
{
|
||||
document.getElementById("statediv").innerHTML=ajax.response;
|
||||
}
|
||||
|
||||
var ajax1 = new sack();
|
||||
function getCity(country,state,other_state,city,other_city)
|
||||
{
|
||||
ajax1.requestFile = 'getCity.php?countryId='+country+'&stateId='+state+'&other_state='+other_state+'&cityId='+city+'&other_city='+other_city;
|
||||
ajax1.onCompletion = showCity;
|
||||
ajax1.runAJAX();
|
||||
}
|
||||
function showCity()
|
||||
{
|
||||
document.getElementById("citydiv").innerHTML=ajax1.response
|
||||
}
|
||||
|
||||
var ajax3 = new sack();
|
||||
function p_getState(country,state,other_state,city,other_city)
|
||||
{
|
||||
document.getElementById("p_citydiv").innerHTML="<select class='custom-select d-block w-100' name='p_city' id='p_city'><option value=''>-- Select --</option></select>";
|
||||
ajax3.requestFile = 'p_getState.php?countryId='+country+'&stateId='+state+'&other_state='+other_state+'&cityId='+city+'&other_city='+other_city;
|
||||
ajax3.onCompletion = p_showState;
|
||||
ajax3.runAJAX();
|
||||
p_getCity(country,state,other_state,city,other_city);
|
||||
}
|
||||
function p_showState()
|
||||
{
|
||||
document.getElementById("p_statediv").innerHTML=ajax3.response;
|
||||
}
|
||||
|
||||
var ajax4 = new sack();
|
||||
function p_getCity(country,state,other_state,city,other_city)
|
||||
{
|
||||
ajax4.requestFile = 'p_getCity.php?countryId='+country+'&stateId='+state+'&other_state='+other_state+'&cityId='+city+'&other_city='+other_city;
|
||||
ajax4.onCompletion = p_showCity;
|
||||
ajax4.runAJAX();
|
||||
}
|
||||
function p_showCity()
|
||||
{
|
||||
document.getElementById("p_citydiv").innerHTML=ajax4.response
|
||||
}
|
||||
|
||||
function setDOB()
|
||||
{
|
||||
var age = document.getElementById("age").value;
|
||||
var e = document.getElementById("ageUnit");
|
||||
var ageUnit = e.options[e.selectedIndex].value;
|
||||
if(ageUnit == 0) {
|
||||
ageUnit = "years";
|
||||
} else if(ageUnit == 1) {
|
||||
ageUnit = "months";
|
||||
} else if(ageUnit == 2) {
|
||||
ageUnit = "days";
|
||||
} else if(ageUnit == 3) {
|
||||
ageUnit = "weeks";
|
||||
}
|
||||
age= parseInt(age);
|
||||
|
||||
if(age <= 0 || isNaN(age) )
|
||||
{
|
||||
$.alert("Patient age should be greater than zero.");
|
||||
document.getElementById("age").value = '';
|
||||
return false;
|
||||
}
|
||||
if( age >= 100 && ageUnit == "years" )
|
||||
{
|
||||
var confirmStatus = confirm("Patient's age is more than 100 Years. Do you want to proceed?");
|
||||
if(confirmStatus == false)
|
||||
{
|
||||
document.getElementById("age").value = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var ajaxDOB = new sack();
|
||||
ajaxDOB.requestFile = 'getDOB.php?age='+age+'&ageUnit='+ageUnit;
|
||||
ajaxDOB.onCompletion = showDOB;
|
||||
ajaxDOB.runAJAX();
|
||||
function showDOB()
|
||||
{
|
||||
document.getElementById("dob").value=ajaxDOB.response;
|
||||
document.getElementById("approx_dob").value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function validateForm(e, docum)
|
||||
{
|
||||
if(docum.title.value.trim() == '')
|
||||
{
|
||||
//alert("Please Select Title");
|
||||
$.alert('Please Select Title');
|
||||
docum.title.focus();
|
||||
return false;
|
||||
}
|
||||
if(docum.lname.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Enter Last Name");
|
||||
docum.lname.select();
|
||||
docum.lname.focus();
|
||||
return false;
|
||||
}
|
||||
if(docum.fname.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Enter First Name");
|
||||
docum.fname.select();
|
||||
docum.fname.focus();
|
||||
return false;
|
||||
}
|
||||
if( docum.pan_no.value.trim() != '' )
|
||||
{
|
||||
var panVal = docum.pan_no.value.trim();
|
||||
var regpan = /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
|
||||
if(regpan.test(panVal))
|
||||
{
|
||||
//return true;
|
||||
} else {
|
||||
$.alert("Enter Valid Pan Card Number");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(docum.aadhar_no.value.trim() != '')
|
||||
{
|
||||
if( isNaN(docum.aadhar_no.value.trim()) )
|
||||
{
|
||||
$.alert("Please Enter Numbers In Aadhar Number");
|
||||
docum.aadhar_no.select();
|
||||
docum.aadhar_no.focus();
|
||||
return false;
|
||||
} else {
|
||||
var adhr = docum.aadhar_no.value.trim();
|
||||
if(adhr.length < 12)
|
||||
{
|
||||
$.alert("Please Enter 12 Digit Aadhar Number");
|
||||
docum.aadhar_no.select();
|
||||
docum.aadhar_no.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( docum.dob.value.trim() == '' || docum.age.value.trim() == '' )
|
||||
{
|
||||
$.alert("Please Enter Date Of Birth Or Age.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if( docum.gender.value.trim() == 2 )
|
||||
{
|
||||
if( docum.marital_status.value.trim() == '' )
|
||||
{
|
||||
$.alert("Please Choose Marital Status.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if( docum.marital_status.value.trim() != 'Single' )
|
||||
{
|
||||
if( docum.dom.value.trim() == '' )
|
||||
{
|
||||
$.alert("Please Enter Date Of Marriage.");
|
||||
return false;
|
||||
}
|
||||
if( docum.bmname.value.trim() == '' )
|
||||
{
|
||||
$.alert("Please Enter Before Marriage Name.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(docum.patient_income.value.trim() != '')
|
||||
{
|
||||
if( isNaN(docum.patient_income.value.trim()) )
|
||||
{
|
||||
$.alert("Please Enter Numbers In Monthly Income");
|
||||
docum.patient_income.select();
|
||||
docum.patient_income.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(docum.address1.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Enter House Name/Appt.No Details");
|
||||
docum.address1.select();
|
||||
docum.address1.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(docum.country.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Select Country");
|
||||
docum.country.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var stateField = docum.state || docum.other_state;
|
||||
if(!stateField || stateField.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Select State");
|
||||
if(stateField) stateField.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var cityField = docum.city || docum.other_city;
|
||||
if(!cityField || cityField.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Select City");
|
||||
if(cityField) cityField.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(docum.pincode.value.trim() != '')
|
||||
{
|
||||
if( isNaN(docum.pincode.value.trim()) )
|
||||
{
|
||||
$.alert("Please Enter Numbers In Pin Number");
|
||||
docum.pincode.select();
|
||||
docum.pincode.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(docum.cell_phone.value.trim() != '')
|
||||
{
|
||||
if( isNaN(docum.cell_phone.value.trim()) )
|
||||
{
|
||||
$.alert("Please Enter Numbers In Cell Number");
|
||||
docum.cell_phone.select();
|
||||
docum.cell_phone.focus();
|
||||
return false;
|
||||
} else {
|
||||
var adhr1 = docum.cell_phone.value.trim();
|
||||
if(adhr1.length != 10)
|
||||
{
|
||||
$.alert("Please Enter 10 Digit Cell Number");
|
||||
docum.cell_phone.select();
|
||||
docum.cell_phone.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(docum.email.value.trim() != '')
|
||||
{
|
||||
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(docum.email.value.trim()))
|
||||
{
|
||||
|
||||
} else {
|
||||
$.alert("You have entered an invalid email address!")
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(docum.emg_person.value.trim() == '' || docum.emg_person1.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Enter Emergency Contact Person");
|
||||
docum.emg_person.select();
|
||||
docum.emg_person.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(docum.relation.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Select Relation With Patient");
|
||||
docum.relation.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(docum.emg_no.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Enter Emergency Contact Number");
|
||||
docum.emg_no.select();
|
||||
docum.emg_no.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
if(docum.re_persone.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Enter Name Of Representative");
|
||||
docum.re_persone.select();
|
||||
docum.re_persone.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(docum.re_relation.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Select Representative Relation To Patient");
|
||||
docum.re_relation.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(docum.id_file.value.trim() == '')
|
||||
{
|
||||
$.alert("Please Upload Identity Proof");
|
||||
docum.id_file.focus();
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
var fileInput = document.getElementById('id_file');
|
||||
var filePath = fileInput.value;
|
||||
var allowedExtensions = /(\.jpg|\.jpeg|\.png|\.gif|\.pdf)$/i;
|
||||
if (!allowedExtensions.exec(filePath)) {
|
||||
alert('Invalid file type');
|
||||
fileInput.value = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(document.getElementById("txtcaptcha").value.trim()=="")
|
||||
{
|
||||
document.getElementById("txtcaptcha").focus();
|
||||
$.alert("Enter captcha text.");
|
||||
return false;
|
||||
}
|
||||
var mainCaptchaEl = document.getElementById('mainCaptcha');
|
||||
if(mainCaptchaEl)
|
||||
{
|
||||
var string1 = mainCaptchaEl.value.split(' ').join('');
|
||||
var string2 = document.getElementById('txtcaptcha').value.split(' ').join('');
|
||||
if(string1 !== string2)
|
||||
{
|
||||
document.getElementById('txtcaptcha').value = '';
|
||||
$.alert("Invalid Captcha Text!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$.confirm('Do you want to save the details..?',function(a){ if( a == true ) {
|
||||
//document.getElementById("SaveDB").value = 'Save';
|
||||
document.getElementById("vm").focus();
|
||||
document.getElementById("vm").select();
|
||||
document.getElementById("loader").style.display = "block";
|
||||
document.getElementById("SaveData").style.display = "none";
|
||||
document.getElementById("form").submit();
|
||||
} } );
|
||||
/*if( !confirm('Do you want to save the details..?') )
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
document.getElementById("vm").focus();
|
||||
document.getElementById("vm").select();
|
||||
return false;
|
||||
}
|
||||
|
||||
function selGender(val)
|
||||
{
|
||||
if(val == 1 || val == 10 || val == 14)
|
||||
document.getElementById("gender").selectedIndex = 1;
|
||||
else if( val == 16 )
|
||||
document.getElementById("gender").selectedIndex = 4;
|
||||
else if( val == 15 )
|
||||
document.getElementById("gender").selectedIndex = 5;
|
||||
else if( val == 2 || val == 3 || val == 4 || val == 11 || val == 12 || val == 13 )
|
||||
document.getElementById("gender").selectedIndex = 2;
|
||||
else
|
||||
document.getElementById("gender").selectedIndex = 0;
|
||||
|
||||
if( val == 2 || val == 3 || val == 4 || val == 11 || val == 12 || val == 13 )
|
||||
$("#divMarried1,#divMarried2").show();
|
||||
else
|
||||
$("#divMarried1,#divMarried2").hide();
|
||||
}
|
||||
|
||||
//alert(getAge('15/05/2019'));
|
||||
function getAge(dateString)
|
||||
{
|
||||
document.getElementById("approx_dob").value = 0;
|
||||
var now = new Date();
|
||||
var today = new Date(now.getYear(),now.getMonth(),now.getDate());
|
||||
|
||||
var yearNow = now.getYear();
|
||||
var monthNow = now.getMonth();
|
||||
var dateNow = now.getDate();
|
||||
|
||||
var tempDate = dateString.split("/");
|
||||
var y = tempDate[2]; //dateString.substring(6,10);
|
||||
var m = tempDate[1]-1; //dateString.substring(0,2)-1;
|
||||
var d = tempDate[0]; //dateString.substring(3,5);
|
||||
|
||||
var dob = new Date( y, m, d );
|
||||
|
||||
var yearDob = dob.getYear();
|
||||
var monthDob = dob.getMonth();
|
||||
var dateDob = dob.getDate();
|
||||
var age = {};
|
||||
var ageString = "";
|
||||
var yearString = "";
|
||||
var monthString = "";
|
||||
var dayString = "";
|
||||
|
||||
|
||||
yearAge = yearNow - yearDob;
|
||||
|
||||
if (monthNow >= monthDob)
|
||||
var monthAge = monthNow - monthDob;
|
||||
else {
|
||||
yearAge--;
|
||||
var monthAge = 12 + monthNow -monthDob;
|
||||
}
|
||||
|
||||
if (dateNow >= dateDob)
|
||||
var dateAge = dateNow - dateDob;
|
||||
else {
|
||||
monthAge--;
|
||||
var dateAge = 31 + dateNow - dateDob;
|
||||
|
||||
if (monthAge < 0) {
|
||||
monthAge = 11;
|
||||
yearAge--;
|
||||
}
|
||||
}
|
||||
|
||||
age = { years:yearAge, months:monthAge, days:dateAge };
|
||||
|
||||
if ( age.years > 1 ) yearString = " years";
|
||||
else yearString = " year";
|
||||
if ( age.months> 1 ) monthString = " months";
|
||||
else monthString = " month";
|
||||
if ( age.days > 1 ) dayString = " days";
|
||||
else dayString = " day";
|
||||
|
||||
if ( (age.years > 0) && (age.months > 0) && (age.days > 0) )
|
||||
{ document.getElementById('age').value = age.years; document.getElementById("ageUnit").selectedIndex = 0; }
|
||||
else if ( (age.years == 0) && (age.months == 0) && (age.days > 0) )
|
||||
{ document.getElementById('age').value = age.days; document.getElementById("ageUnit").selectedIndex = 2; }
|
||||
else if ( (age.years > 0) && (age.months == 0) && (age.days == 0) )
|
||||
{ document.getElementById('age').value = age.years; document.getElementById("ageUnit").selectedIndex = 0; }
|
||||
else if ( (age.years > 0) && (age.months > 0) && (age.days == 0) )
|
||||
{ document.getElementById('age').value = age.years; document.getElementById("ageUnit").selectedIndex = 0; }
|
||||
else if ( (age.years == 0) && (age.months > 0) && (age.days > 0) )
|
||||
{ document.getElementById('age').value = age.months; document.getElementById("ageUnit").selectedIndex = 1; }
|
||||
else if ( (age.years > 0) && (age.months == 0) && (age.days > 0) )
|
||||
{ document.getElementById('age').value = age.years; document.getElementById("ageUnit").selectedIndex = 0; }
|
||||
else if ( (age.years == 0) && (age.months > 0) && (age.days == 0) )
|
||||
{ document.getElementById('age').value = age.months; document.getElementById("ageUnit").selectedIndex = 1; }
|
||||
else ageString = "Oops! Could not calculate age!";
|
||||
|
||||
return ageString;
|
||||
}
|
||||
|
||||
function FillBilling(f)
|
||||
{
|
||||
if(f.copy.checked == true)
|
||||
{
|
||||
f.p_address1.value = f.address1.value;
|
||||
f.p_address2.value = f.address2.value;
|
||||
f.p_post_office.value = f.post_office.value;
|
||||
f.p_pincode.value = f.pincode.value;
|
||||
f.p_phone.value = f.phone.value;
|
||||
|
||||
$('#p_country').html($('#country').html());
|
||||
f.p_country.value = f.country.value;
|
||||
if(document.getElementById("country").value == 38)
|
||||
{
|
||||
document.getElementById("p_statediv").innerHTML = "<select class='custom-select d-block w-100' name='p_state' id='p_state' onchange=p_getCity('',this.value,'','','');></select>";
|
||||
document.getElementById("p_citydiv").innerHTML = "<select class='custom-select d-block w-100' name='p_city' id='p_city'></select>";
|
||||
$('#p_state').html($('#state').html());
|
||||
$('#p_city').html($('#city').html());
|
||||
f.p_state.value = f.state.value;
|
||||
f.p_city.value = f.city.value;
|
||||
} else
|
||||
{
|
||||
p_getState(f.country.value, '', f.other_state.value, '', f.other_city.value);
|
||||
}
|
||||
} else {
|
||||
f.p_address1.value = '';
|
||||
f.p_address2.value = '';
|
||||
f.p_post_office.value = '';
|
||||
f.p_pincode.value = '';
|
||||
f.p_phone.value = '';
|
||||
f.p_country.value = '38';
|
||||
p_getState('38', '', '', '', '');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user