var help_text = Array(); help_text["daily_deduction"] = "
Enter the number of hours deducted for each day's leave.
This will normally be 8 hours per day if you work 5 days a week, otherwise 10 hours. Some older contracts may have different values.
"; help_text["average_hrs"] = "Enter the average non-call hours worked per week.
This is generally 10 hours per day, i.e. 40 hours if you work 4 days per week, 50 hours if 5 days etc.
If you asymmetrical weeks, enter the average across those weeks.
"; help_text["staff_id_number"] = "Enter your Waikato DHB staff ID number.
If you don't have one yet, enter 99999.
Please enter your mobile phone number, excluding spaces. If overseas, please enter in international format e.g. 614XXXXXXXX for Australia.
"; function ajax_error_handler(xhr, status, exception) { alert("Ajax error " + exception); } function verify_field(elem) { if($(elem).val() != "" ) $(elem).removeClass('input_error'); } function show_info_message(elem) { var help_item = $(elem).attr("id"); var pos = $(elem).position(); if(help_text[help_item] != undefined) { $("#ajax_box").html(help_text[help_item]); $("#ajax_box").css("width", 400); $("#ajax_box").css("text-align", "left"); var box_height = $("#ajax_box").outerHeight(); $("#ajax_box").css("top", pos.top - box_height); $("#ajax_box").css("left", pos.left); $("#ajax_box").css("display", "block"); } } function hide_info_message() { $("#ajax_box").html(""); $("#ajax_box").css("display", "none"); } function get_amion_data(elem) { var amion_id = $(elem).val(); if(amion_id == 0) { $("#user_data").css('display', 'block'); } else { $("#msg_box").removeClass("segment"); $("#msg_box").addClass("message_info"); $("#msg_box").html("Retrieving data from amion " + "
Data received, processing...
"); $("#msg_box").addClass("message_info"); $("#user_data").css("display", "block"); if(t.dhb_id != undefined) { $('#staff_id').val(t.dhb_id) } else { $('#staff_id').val("") } if(t.position != undefined) { $('#position').val(t.position) } else { $('#position').val("") } if(t.firstname != undefined) { $('#firstname').val(t.firstname) } else { $('#firstname').val("") } if(t.surname != undefined) { $('#surname').val(t.surname) } else { $('#surname').val("") } if(t.cell != undefined) { $('#cellphone').val(t.cell) } else { $('#cellphone').val("") } if(t.email != undefined) { $('#email').val(t.email) } else { $('#email').val("") } if(t.avg_hrs != undefined) { $('#avg_hrs').val(t.avg_hrs); hrs = parseInt(t.avg_hrs); if(hrs == 50) { $('#deduct_hrs').val(8); } else { $('#deduct_hrs').val(10); } } else { $('#avg_hrs').val(""); $('#deduct_hrs').val(10); } $("#msg_box").html("Please check and complete any missing details below before proceeding.
"); $("#password, #confirm_pwd").val(""); } function json_amion_detail_error(xhr, status, exception) { $("#msg_box").html("Unable to load user detail:
" + exception + "
");
$("#msg_box").addClass("message_error");
$("#main").css("display", "block");
}
function ajax_signup_json()
{
if($('#submit_form').val() == "update") {
$('#update').val('true');
} else {
$('#update').val('false');
}
var data = $('#signup').serialize();
$("#msg_box").html("Saving your details...
"); $.ajax({ type: 'POST', url: '/leavemanager/backend/ajax_signup_json.php', data: data, success: handle_signup_saved_json, error: json_signup_save_error, dataType: 'json' }); $("#main").css("display", "none"); $("#msg_box").removeClass("segment"); $("#msg_box").addClass("message_info"); $("#msg_box").html("Just a moment while we check your details and sign you up to the system...
"); $("#msg_box").css("display", "block"); } function ajax_signin_json() { var data = "username=" + $('#email').val(); data = data + "&password=" + $('#password').val(); data = data + "&loggingin=true&screenwidth=0&screenheight=0&colourdepth=0"; data = data + "&logintype=ajax"; $.ajax({ type: 'POST', url: '/leavemanager/backend/login.php', data: data, success: handle_signin_json, error: json_signin_error, dataType: 'json' }); } function json_signin_error(xhr, status, exception) { $("#msg_box").html("Unable to sign in:
" + exception + "
");
$("#msg_box").addClass("message_error");
$("#main").css("display", "block");
}
function handle_signin_json(t)
{
$("#msg_box").html("Sign in successful
"); $("#msg_box").removeClass("message_error").addClass("message_info"); $("#main").css("display", "block"); window.open('/leavemanager/index.php', '_self'); } function json_signup_save_error(xhr, status, exception) { $("#msg_box").html("Unable to save data:
" + exception + "
");
$("#msg_box").addClass("message_error");
$("#main").css("display", "block");
}
function handle_signup_saved_json(t)
{
$("#msg_box").css("display", "block");
$("#main").css("display", "block");
if(t.success)
{
var username = $('#firstname').val();
if($("#submit_form").value=="update")
{
htm = "Thanks " + username + ", your details have been updated
"; } else { htm = "Thanks " + username + ", you're all signed up
Give me a moment and I'll log you in
"; } $("#msg_box").html(htm); $("#msg_box").removeClass("message_error"); $("#user_data").css('display', 'none'); $("#welcome_message").css("display", "none"); ajax_signin_json(); } else { //there was an error htm = 'Sorry, I was unable to save your details
Please fix the following errors then click "Sign me up" again:
Problematic fields are highlighted.
"; htm += "