/* test_helpers.js - helper utilities for testing the processes */

// js functions to fill the forms for testing stuff

// ajax helper to delete all members
function delete_members(){
    log("delete_members()");
    // hit the delete members method in the test utils
    $('#test_result').load('/utils/delete_members');
}

// ajax helper to delete all registrations
function delete_registrations(){
    log("delete_registrations()");
    // hit the delete registrations method in the test utils
    $('#test_result').load('/utils/delete_registrations');
}

function fill_member(){
    log("fill_member running");

    $('#name_first').attr('value', 'Test');
    $('#name_last').attr('value', 'Duncan');
    $('#phone_home').attr('value', '604-734-1294');
    $('#email_address').attr('value', 'iain@momcafe.net');
    $('#address').attr('value', '1-1455 W 15th Ave');
    $('#city').attr('value', 'Vancouver');
    $('#province').attr('value', 'BC');
    $('#postal_code').attr('value', 'v6h 1s4');
    $('#country').attr('value', 'Canada');
}

function fill_registration(){
    log("fill_registration running");

    $('#registration_form_name_first').attr('value', 'Test');
    $('#registration_form_name_last').attr('value', 'Duncan');
    $('#registration_form_phone_home').attr('value', '604-734-1294');
    $('#registration_form_email_address').attr('value', 'iain@momcafe.net');
    $('#registration_form_address').attr('value', '1-1455 W 15th Ave');
    $('#registration_form_city').attr('value', 'Vancouver');
    $('#registration_form_province').attr('value', 'BC');
    $('#registration_form_postal_code').attr('value', 'v6h 1s4');
    $('#registration_form_country').attr('value', 'Canada');
    
    // open up childcare and set some children
    $('#registration_form_tr_children').removeClass('closed');
    $('.childrow').removeClass('closed');
    $('#registration_form_childcare').attr('checked','checked');
    $('#registration_form_children').attr('value','2');
    
    $('#registration_form_child_1_name_first').attr('value', 'Test Child 1');
    $('#registration_form_child_1_name_last').attr('value', 'Duncan');
    $('#registration_form_child_1_age').attr('value', '7');
    $('#registration_form_child_2_name_first').attr('value', 'Test Child 2');
    $('#registration_form_child_2_name_last').attr('value', 'Duncan');
    $('#registration_form_child_2_age').attr('value', '4');
}

