// ***** -------------------- *****
// ***** web_app_about.js *****
// ***** -------------------- *****
$(document).on("click", '#btnContinue', function() {
if(typeof psuGrid != "undefined") {
var vm = String.fromCharCode(253);
var actTestDates = [];
var actCompositeScores = [];
var actMathScores = [];
var actScienceScores = [];
var actEnglishScores = [];
var actReadingScores = [];
var psuGridUID = 'grdWAAAct';
var arrActRows = psuGrid.getRows(psuGridUID);
for(var i in arrActRows) {
var row = arrActRows[i];
actTestDates.push(row["TEST.DATE"]);
actCompositeScores.push(row["COMPOSITE.SCORE"]);
actMathScores.push(row["MATH.COMPONENT.SCORE"]);
actScienceScores.push(row["SCIENCE.COMPONENT.SCORE"]);
actEnglishScores.push(row["ENGLISH.COMPONENT.SCORE"]);
actReadingScores.push(row["READING.COMPONENT.SCORE"]);
}
$("input[name='ACT.TEST.DATES']").val(actTestDates.join(vm));
$("input[name='ACT.COMPOSITE.SCORES']").val(actCompositeScores.join(vm));
$("input[name='ACT.MATH.SCORES']").val(actMathScores.join(vm));
$("input[name='ACT.SCIENCE.SCORES']").val(actScienceScores.join(vm));
$("input[name='ACT.ENGLISH.SCORES']").val(actEnglishScores.join(vm));
$("input[name='ACT.READING.SCORES']").val(actReadingScores.join(vm));
var satTestDates = [];
var satMathScores = [];
var satReadingScores = [];
var psuGridUID = 'grdWAASat';
var arrSatRows = psuGrid.getRows(psuGridUID);
for(var i in arrSatRows) {
var row = arrSatRows[i];
satTestDates.push(row["TEST.DATE"]);
satMathScores.push(row["MATH.COMPONENT.SCORE"]);
satReadingScores.push(row["CRITICAL.READING.COMPONENT.SCORE"]);
}
$("input[name='SAT.TEST.DATES']").val(satTestDates.join(vm));
$("input[name='SAT.MATH.SCORES']").val(satMathScores.join(vm));
$("input[name='SAT.READING.SCORES']").val(satReadingScores.join(vm));
}
var arrSSN = [];
$("input[name='SSN']").each(function () {
if($.trim($(this).val()) != "") {
arrSSN.push($(this).val());
}
});
// Comment out the following to prevent the SSN
// message from displaying in the ABOUT ME
// section of the web app following pressing
// SAVE, if the SSN has been populated.
// Colby - 16 Sept 2014
// if(arrSSN != 3) {
// arrSSN = [];
// }
// var ssn = arrSSN.join('-');
// var dom = $("#DOM").val();
// if(ssn == "" && dom == '1') {
// $.ajax({
// url: '/FAQ2JS',
// type: 'get',
// data: {FAQ: 'Q000274'},
// success: function(result) {
// result = $.trim(result);
// if(confirm(result)) {
// $("#frmAbout").submit();
// }
// }
// });
// } else {
$("#frmAbout").submit();
// }
});
$(document).on("change", "select[name='PRIM.LANG.ENG']", function() {
if($(this).val() == 'N') {
$("#divSectionBottom").show();
} else {
$("#divSectionBottom").hide();
}
});
$(document).on("focus", ".toeflField", function() {
$('#radEngReqToefl').attr("checked", true);
});
$(document).on("focus", ".ieltsField", function() {
$('#radEngReqIelts').attr("checked", true);
});
//$(document).on("focus", ".satField", function() {
// $('#radEngReqSat').attr("checked", true);
//});
//$(document).on("focus", ".actField", function() {
// $('#radEngReqAct').attr("checked", true);
//});
// DIALOG FOR SAT GRID
function func_grdWAASat(rowID) {
$("#radEngReqSat").attr("checked", true);
var dialogFuncs = new DialogFuncs();
function dlgFlds_grdWAASat() {
var arr = [];
arr.push({id: "txtSatTestDate", ref: "TestDate"});
arr.push({id: "txtSatMathComponentScore", ref: "MathComponentScore"});
arr.push({id: "txtSatCriticalReadingComponentScore", ref: "CriticalReadingComponentScore"});
return dialogFuncs.generateString(arr);
}
var dialog = $('
').appendTo('body');
dialog.dialog({
title: "SAT Test Information",
width: "auto",
height: "auto",
open: function() {
},
close:function(event, ui){
eval(dlgFlds_grdWAASat());
dialogFuncs.resetFormElements($fields);
dialogFuncs.resetValidation($fields);
dialog.remove();
},
buttons: [
{
text: "Continue",
click:function(){
eval(dlgFlds_grdWAASat());
dialogFuncs.resetValidation($fields);
if($valTestDate == '') {
dialogFuncs.displayError('Enter a Test Date.', $objTestDate);
return;
}
if($valMathComponentScore == '') {
dialogFuncs.displayError('Enter a Math Component Score.', $objMathComponentScore);
return;
}
if($valCriticalReadingComponentScore == '') {
dialogFuncs.displayError('Enter a Critical Reading Component Score.', $objCriticalReadingComponentScore);
return;
}
var targetRowID = '';
if(rowID) {
targetRowID = rowID;
} else {
targetRowID = 'id' + guid(true);
}
var links = '';
links += '';
links += '';
links += '';
links += ' ';
links += '';
links += '';
links += '';
var psuGridUID = 'grdWAASat';
var rowData = {};
rowData["ACTIONS"] = links;
rowData["TEST.DATE"] = $valTestDate;
rowData["MATH.COMPONENT.SCORE"] = $valMathComponentScore;
rowData["CRITICAL.READING.COMPONENT.SCORE"] = $valCriticalReadingComponentScore;
if(rowID) {
psuGrid.updateRow(psuGridUID, rowData, targetRowID);
} else {
psuGrid.addRow(psuGridUID, rowData, targetRowID);
}
dialog.dialog("close");
}
},
{
text: "Cancel",
click: function() {
dialog.dialog("close");
}
}],
modal:true
});
var loadURL = "/web.app.about?" + Math.random();
loadURL += "&MODE=DIALOG.SAT";
if(rowID) {
var psuGridUID = 'grdWAASat';
var rowData = psuGrid.getRow(psuGridUID, rowID);
for(var i in rowData) {
var val = rowData[i];
loadURL += '&' + i + '=' + encodeURIComponent(val);
}
}
dialog.load(loadURL, function(responseText, textStatus,XMLHttpRequest){
dialogFuncs.centerFixedNewWin(dialog);
});
}
//DIALOG FOR ACT GRID
function func_grdWAAAct(rowID) {
$("#radEngReqAct").attr("checked", true);
var dialogFuncs = new DialogFuncs();
function dlgFlds_grdWAAAct() {
var arr = [];
arr.push({id: "txtActTestDate", ref: "TestDate"});
arr.push({id: "lstActCompositeScore", ref: "CompositeScore"});
arr.push({id: "lstActMathComponentScore", ref: "MathComponentScore"});
arr.push({id: "lstActScienceComponentScore", ref: "ScienceComponentScore"});
arr.push({id: "lstActEnglishComponentScore", ref: "EnglishComponentScore"});
arr.push({id: "lstActReadingComponentScore", ref: "ReadingComponentScore"});
return dialogFuncs.generateString(arr);
}
var dialog = $('').appendTo('body');
dialog.dialog({
title: "ACT Test Information",
width: "auto",
height: "auto",
open: function() {
},
close:function(event, ui){
eval(dlgFlds_grdWAAAct());
dialogFuncs.resetFormElements($fields);
dialogFuncs.resetValidation($fields);
dialog.remove();
},
buttons: [
{
text: "Continue",
click:function(){
eval(dlgFlds_grdWAAAct());
dialogFuncs.resetValidation($fields);
if($valTestDate == '') {
dialogFuncs.displayError('Enter a Test Date.', $objTestDate);
return;
}
if($valCompositeScore == '') {
dialogFuncs.displayError('Enter a Composite Score.', $objCompositeScore);
return;
}
if($valEnglishComponentScore == '') {
dialogFuncs.displayError('Enter an English Component Score.', $objEnglishComponentScore);
return;
}
if($valMathComponentScore == '') {
dialogFuncs.displayError('Enter a Math Component Score.', $objMathComponentScore);
return;
}
if($valReadingComponentScore == '') {
dialogFuncs.displayError('Enter a Reading Component Score.', $objReadingComponentScore);
return;
}
if($valScienceComponentScore == '') {
dialogFuncs.displayError('Enter a Science Component Score.', $objScienceComponentScore);
return;
}
var targetRowID = '';
if(rowID) {
targetRowID = rowID;
} else {
targetRowID = 'id' + guid(true);
}
var links = '';
links += '';
links += '';
links += '';
links += ' ';
links += '';
links += '';
links += '';
var psuGridUID = 'grdWAAAct';
var rowData = {};
rowData["ACTIONS"] = links;
rowData["TEST.DATE"] = $valTestDate;
rowData["COMPOSITE.SCORE"] = $valCompositeScore;
rowData["MATH.COMPONENT.SCORE"] = $valMathComponentScore;
rowData["SCIENCE.COMPONENT.SCORE"] = $valScienceComponentScore;
rowData["ENGLISH.COMPONENT.SCORE"] = $valEnglishComponentScore;
rowData["READING.COMPONENT.SCORE"] = $valReadingComponentScore;
if(rowID) {
psuGrid.updateRow(psuGridUID, rowData, targetRowID);
} else {
psuGrid.addRow(psuGridUID, rowData, targetRowID);
}
dialog.dialog("close");
}
},
{
text: "Cancel",
click: function() {
dialog.dialog("close");
}
}],
modal:true
});
var loadURL = "/web.app.about?" + Math.random();
loadURL += "&MODE=DIALOG.ACT";
if(rowID) {
var psuGridUID = 'grdWAAAct';
var rowData = psuGrid.getRow(psuGridUID, rowID);
for(var i in rowData) {
var val = rowData[i];
loadURL += '&' + i + '=' + encodeURIComponent(val);
}
}
dialog.load(loadURL, function(responseText, textStatus,XMLHttpRequest){
dialogFuncs.centerFixedNewWin(dialog);
});
}
function guid() {
function _p8(s) {
var p = (Math.random().toString(16)+"000000000").substr(2,8);
return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ;
}
var res = _p8() + _p8(true) + _p8(true) + _p8();
if(arguments.length == 1) {
if(arguments[0] === true) {
res = res.replace(new RegExp('-', 'g'), '')
}
}
return res;
}
//Edit link of Sat Grid
$(document).on("click", "a[id^='lnkSatEdit_']", function(){
var rowID = $(this).attr('id').split('_').pop();
func_grdWAASat(rowID);
});
//Delete link of Sat Grid
$(document).on("click", "a[id^='lnkSatDelete_']", function(){
if(!confirm('Are you sure?')) {
return;
}
var rowID = $(this).attr('id').split('_').pop();
var psuGridUID = 'grdWAASat'
psuGrid.deleteRow(psuGridUID, rowID)
});
//Edit link of Act Grid
$(document).on("click", "a[id^='lnkActEdit_']", function(){
var rowID = $(this).attr('id').split('_').pop();
func_grdWAAAct(rowID);
});
//Delete link of Act Grid
$(document).on("click", "a[id^='lnkActDelete_']", function(){
if(!confirm('Are you sure?')) {
return;
}
var rowID = $(this).attr('id').split('_').pop();
var psuGridUID = 'grdWAAAct'
psuGrid.deleteRow(psuGridUID, rowID)
});