<commit_before>//
// Created       : Sat May 05 13:15:20 IST 2012
// Last Modified : Fri Jul 06 15:18:26 IST 2012
//
// Copyright (C) 2012, <NAME> <<EMAIL>>
// All Rights Reserved
//
// Licensed under the GNU GPL v3
//

var pat_srp_table;
var doc_srp_table;
var newv_doc_table;

var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
            'Friday', 'Saturday'];
var shiftns = ['Morning', 'Afternoon'];

function dayOfWeek (date) {
    if (!(date instanceof Date)) {
	d = new Date();
	res = date.match(/(\d+)\/(\d+)\/(\d\d\d\d)/);
	d.setFullYear(res[3], res[2]-1, res[1]);
	date = d;
    }
        
    return days[date.getDay()];
}

function setupDeptNamesInControl () {
    var url = "/ajax/departments";
    $.getJSON(url, function(data) {
	console.log("Got " + data.count + " entries in ajax response.");
	$.each(data.departments, function(key) {
	    var name = data.departments[key][0];
	    var id   = data.departments[key][1];
	    $("#dept_doc_v").append("<option val=" + id + ">" + name 
				    + "</option>");
	});
    });
}

function validateNewPatient (event) {
    console.log('Validating new patient record...');

    var f_name     = $('#new_name').val();
    var f_age      = $('#new_age').val();
    var f_reg_date = $('#new_reg_date').val();
    var f_phone    = $('#new_phone').val();
    var f_addr     = $('#new_addr').val();
    var f_dept     = $('#newp_dept_list').val();
    var f_doc      = $('#newp_doc_list').val();

    var failed  = false;
    var errmsg  = "";

    if (f_name === "") {
        errmsg += "Name cannot be empty\n";
    }

    if (f_age === "") {
        errmsg += "Age field cannot be empty\n";
    } else {
    }

    if (f_dept == "-- Select --") {
	errmsg += "Please Select a department from the given list\n";
    }

    if (f_doc == "-- Select --") {
	errmsg += "Please Select a doctor from the given list\n";
    }

    if (f_reg_date === "") {
        f_reg_date = new Date();
    }

    if (errmsg != "") {
        alert(errmsg)
        return false;<commit_msg>Enforce relative details in new patient form<commit_after>//
// Created       : Sat May 05 13:15:20 IST 2012
// Last Modified : Fri Jul 06 15:18:26 IST 2012
//
// Copyright (C) 2012, <NAME> <<EMAIL>>
// All Rights Reserved
//
// Licensed under the GNU GPL v3
//

var pat_srp_table;
var doc_srp_table;
var newv_doc_table;

var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
            'Friday', 'Saturday'];
var shiftns = ['Morning', 'Afternoon'];

function dayOfWeek (date) {
    if (!(date instanceof Date)) {
	d = new Date();
	res = date.match(/(\d+)\/(\d+)\/(\d\d\d\d)/);
	d.setFullYear(res[3], res[2]-1, res[1]);
	date = d;
    }
        
    return days[date.getDay()];
}

function setupDeptNamesInControl () {
    var url = "/ajax/departments";
    $.getJSON(url, function(data) {
	console.log("Got " + data.count + " entries in ajax response.");
	$.each(data.departments, function(key) {
	    var name = data.departments[key][0];
	    var id   = data.departments[key][1];
	    $("#dept_doc_v").append("<option val=" + id + ">" + name 
				    + "</option>");
	});
    });
}

function validateNewPatient (event) {
    console.log('Validating new patient record...');

    var f_name     = $('#new_name').val();
    var f_age      = $('#new_age').val();
    var f_reg_date = $('#new_reg_date').val();
    var f_phone    = $('#new_phone').val();
    var f_addr     = $('#new_addr').val();
    var f_dept     = $('#newp_dept_list').val();
    var f_doc      = $('#newp_doc_list').val();
    var f_relname  = $('#new_relname').val();
    var f_relph    = $('#new_ph').val();
    var f_relrel   = $('#new_relrel').val();

    var failed  = false;
    var errmsg  = "";

    if (f_name === "") {
        errmsg += "Name cannot be empty\n";
    }

    if (f_age === "") {
        errmsg += "Age field cannot be empty\n";
    } else {
    }

    if (f_dept == "-- Select --") {
	errmsg += "Please Select a department from the given list\n";
    }

    if (f_doc == "-- Select --") {
	errmsg += "Please Select a doctor from the given list\n";
    }

    if (f_relname == "") {
	errmsg += "Emergency Contact details (name) cannot be empty\n";
    }

    if (f_relph == "") {
	errmsg += "Emergency Contact details (phone) cannot be empty\n";
    }

    if (f_relrel == "") {
	errmsg += "Emergency Contact details (relation) cannot be empty\n";
    }

    if (f_reg_date === "") {
        f_reg_date = new Date();
    }

    if (errmsg != "") {
        alert(errmsg)
        return false;
{'fraction_non_alphanumeric': 0.19501983252534155, 'fraction_numerical': 0.015425297487880123, 'mean_word_length': 2.551643192488263, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1727952', 'n_tokens_mistral': 1703, 'n_tokens_neox': 1573, 'n_words': 405}