| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/usagrantapplication.org/vx_/js/ |
Upload File : |
app.controller('SiteContent', function ($rootScope, $scope, $http, $window, $location, $document, $anchorScroll) {
console.log("Site Content Controllers Loaded");
//$rootScope.formHandler = false;
$scope.startSignup = function (data) {
$http({
method: 'POST',
url: '/layout/functions/startSignup.php',
data: $.param(data),
dataType: 'json',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.lead = response.data.lead;
$rootScope.lead = ($rootScope.lead * 1);
if ($rootScope.lead > 0)
{
window.location = '/order/';
}
});
};
$scope.setApplication = function () {
$http({
method: 'POST',
url: '/layout/functions/setApplication.php',
data: $.param($rootScope.signUp),
dataType: 'json',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
});
};
$scope.quickSignUp = function (data) {
$http({
method: 'POST',
url: '/layout/functions/startSignup.php',
data: $.param(data),
dataType: 'json',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.lead = response.data.lead;
$rootScope.lead = ($rootScope.lead * 1);
if ($rootScope.lead > 0) {
window.location = '/order/';
}
});
};
$scope.hasACategory = function () {
for($i in $rootScope.signUp.category) {
if($rootScope.signUp.category[$i]=='yes') {
return true;
}
}
return false;
};
$scope.setCategorySelection = function (set) {
var s = $rootScope.signUp.category[set];
if (s == "yes")
{
s = "no";
}
else
{
s = "yes";
}
$rootScope.signUp.category = [];
$rootScope.signUp.category[set] = s;
};
$scope.answerKey = [];
$scope.answerKey[1] = ["True"];
$scope.answerKey[2] = ["Maybe"];
$scope.answerKey[3] = ["True"];
$scope.answerKey[4] = ["False"];
$scope.answerKey[5] = ["Depends"];
$scope.answerKey[6] = ["False"];
$scope.answerKey[7] = ["All"];
$scope.answerKey[8] = ["Competitive"];
$scope.answerKey[9] = ["Hard"];
$scope.answerKey[10] = ["All the Above"];
$scope.answers = [];
$scope.answers[1] = [];
$scope.answers[2] = [];
$scope.answers[3] = [];
$scope.answers[4] = [];
$scope.answers[5] = [];
$scope.answers[6] = [];
$scope.answers[7] = [];
$scope.answers[8] = [];
$scope.answers[9] = [];
$scope.answers[10] = [];
$scope.correct = [];
$scope.correctAnswers = [];
$scope.setQuestion = function (question, title, type) {
if (type == "single") {
if ($scope.answers[question][0] == title) {
$scope.answers[question][0] = "";
}
else {
$scope.answers[question][0] = title;
}
}
else {
var index = $scope.answers[question].indexOf(title);
if (index !== -1) {
$scope.answers[question].splice(index, 1);
}
else {
$scope.answers[question].push(title);
}
}
var cindex = $scope.correctAnswers.indexOf(question);
if ($scope.isCorrect(question)) {
$scope.correctAnswers.push(question);
}
else {
if (cindex !== -1) {
$scope.correctAnswers.splice(cindex, 1);
}
}
};
$scope.inAnswers = function (question, value, type) {
var inthere = false;
if (type == "single") {
if ($scope.answers[question][0] == value) {
inthere = true;
}
}
else {
for (var i in $scope.answers[question]) {
if ($scope.answers[question][i] === value) {
inthere = true;
}
}
}
return inthere;
};
$scope.isCorrect = function (question) {
$scope.correct = [];
for (var a in $scope.answers[question]) {
for (var k in $scope.answerKey[question]) {
if ($scope.answerKey[question][k] == $scope.answers[question][a]) {
$scope.correct.push($scope.answers[question][a]);
}
}
}
if ($scope.answers[question].length == $scope.correct.length && $scope.answerKey[question].length == $scope.correct.length) {
return true;
}
else {
return false;
}
};
$scope.setScore = function () {
var score = {};
var len = 0;
for (var i in $scope.answerKey) {
len++
}
var clen = 0;
for (var i in $scope.correctAnswers) {
clen++
}
var percentage = Math.round((100 / len) * clen);
score.percentage = percentage;
score.total = len;
score.correct = clen;
score.incorrect = (len - clen);
return score;
};
$scope.scrollToTop = function () {
$('html,body').scrollTop(0);
};
$scope.setApplyNow = function () {
$('html,body').scrollTop(0);
$http({
method: 'POST',
url: '/layout/functions/setApplyNow.php',
dataType: 'json',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
});
};
});