| 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/governmentgrants.us/vx/usa/js/ |
Upload File : |
site.controller('Members', function($rootScope, $scope, $http, $window, $timeout, $interval) {
$scope.prefChanged = false;
$scope.userState = "";
$scope.toggleFundingGoal = false;
$scope.searching = {};
$scope.isSearching = false;
$scope.glossarySelection = "";
$scope.courseTotal = $rootScope.courseTotal;
$scope.showCategories = true;
$scope.showSubCategories = false;
$scope.showSubSubCategories = false;
$scope.showMap = false;
$scope.wantsState = false;
$scope.hasChangedCategory = false;
$rootScope.selectedCategory.state = "";
$rootScope.searchFields.state = "";
$rootScope.searchFields.category_name = "";
$rootScope.searchFields.bread_crumb_id = "";
$rootScope.searchFields.category_bread_crumb_id = "";
$rootScope.searchFields.sub_category_bread_crumb_id = "";
$rootScope.searchFields.sub_sub_category_bread_crumb_id = "";
$rootScope.searchFields.categories_id = "";
$rootScope.searchFields.subcategories_id = "";
$rootScope.searchFields.minorities_id = "";
$rootScope.searchFields.industries_id = "";
$rootScope.searchFields.has_state_filter = false;
$rootScope.searchFields.sub_category_name = "";
$rootScope.searchFields.sub_categories_id = "";
$rootScope.searchFields.sub_subcategories_id = "";
$rootScope.searchFields.sub_minorities_id = "";
$rootScope.searchFields.sub_industries_id = "";
$rootScope.searchFields.sub_has_state_filter = false;
$rootScope.searchFields.sub_sub_category_name = "";
$rootScope.searchFields.sub_sub_categories_id = "";
$rootScope.searchFields.sub_sub_subcategories_id = "";
$rootScope.searchFields.sub_sub_minorities_id = "";
$rootScope.searchFields.sub_sub_industries_id = "";
$rootScope.searchFields.sub_sub_has_state_filter = false;
$scope.setCountryMap = function (e, category) { //This is named stupid, this is how you change categories
$scope.showMap = false;
var elem = e.target;
var elemClass = $(elem).parent().attr('class');
var dummy = '<div class="iconDummy"></div>';
$('#slot1').css({ width: "40px", height: "40px" });
$('#slot1Text').show();
var newBlock = $(elem).parent().clone();
newBlock.removeClass('iconItem').addClass('iconItemSelected');
newBlock.find('.icon').css({ height: 20 });
newBlock.css({ top: 0, left: 0, width: 40, height: 40 }).appendTo("#slot1");
$rootScope.searchFields.bread_crumb_id = category.id;
$rootScope.searchFields.category_bread_crumb_id = category.id;
$rootScope.searchFields.category_name = category.category_name;
$rootScope.searchFields.categories_id = category.categories_id;
$rootScope.searchFields.subcategories_id = category.subcategories_id;
$rootScope.searchFields.minorities_id = category.minorities_id;
$rootScope.searchFields.industries_id = category.industries_id;
$rootScope.searchFields.sub_crumbs = category.sub_crumbs;
if(category.sub_crumbs.length>0) {
$scope.showSubCategories = true;
} else {
$scope.showSubCategories = false;
}
$rootScope.searchFields.has_state_filter = (category.has_state_filter=='1') ? true : false;
$scope.showCategories = false;
if (!$rootScope.searchFields.state && $rootScope.searchFields.has_state_filter && $scope.wantsState)
{
$scope.showMap = true;
}
if(category.category_name=='Rent Assistance' && $rootScope.newest_apps_only == 0) {
$scope.showMap = true;
}
$scope.$parent.grant = {};
$scope.getMoreGrants(1,'Clicked Category',category.category_name);
};
$scope.setCountryMapSub = function (e, category) { //This is named stupid, this is how you change subcategories
var elem = e.target;
var elemClass = $(elem).parent().attr('class');
var dummy = '<div class="iconDummy"></div>';
$('#slot1Sub').css({ width: "40px", height: "40px" });
$('#slot1SubText').show();
var newBlock = $(elem).parent().clone();
newBlock.removeClass('iconItem').addClass('iconItemSelected');
newBlock.find('.icon').css({ height: 20 });
newBlock.css({ top: 0, left: 0, width: 40, height: 40 }).appendTo("#slot1Sub");
$rootScope.searchFields.bread_crumb_id = category.id;
$rootScope.searchFields.sub_category_bread_crumb_id = category.id;
$rootScope.searchFields.sub_category_name = category.category_name;
$rootScope.searchFields.sub_categories_id = category.categories_id;
$rootScope.searchFields.sub_subcategories_id = category.subcategories_id;
$rootScope.searchFields.sub_minorities_id = category.minorities_id;
$rootScope.searchFields.sub_industries_id = category.industries_id;
$rootScope.searchFields.sub_sub_crumbs = category.sub_crumbs;
if(category.sub_crumbs.length>0) {
$scope.showSubSubCategories = true;
} else {
$scope.showSubSubCategories = false;
}
$rootScope.searchFields.sub_has_state_filter = (category.has_state_filter=='1') ? true : false;
$scope.showSubCategories = false;
if (!$rootScope.searchFields.state && $rootScope.searchFields.has_state_filter && $scope.wantsState)
{
$scope.showMap = true;
}
$scope.$parent.grant = {};
$scope.getMoreGrants(1,'Clicked SubCategory',category.category_name);
};
$scope.setCountryMapSubSub = function (e, category) { //This is named stupid, this is how you change sub-subcategories
var elem = e.target;
var elemClass = $(elem).parent().attr('class');
var dummy = '<div class="iconDummy"></div>';
$('#slot1SubSub').css({ width: "40px", height: "40px" });
$('#slot1SubSubText').show();
var newBlock = $(elem).parent().clone();
newBlock.removeClass('iconItem').addClass('iconItemSelected');
newBlock.find('.icon').css({ height: 20 });
newBlock.css({ top: 0, left: 0, width: 40, height: 40 }).appendTo("#slot1SubSub");
$rootScope.searchFields.bread_crumb_id = category.id;
$rootScope.searchFields.sub_sub_category_bread_crumb_id = category.id;
$rootScope.searchFields.sub_sub_category_name = category.category_name;
$rootScope.searchFields.sub_sub_categories_id = category.categories_id;
$rootScope.searchFields.sub_sub_subcategories_id = category.subcategories_id;
$rootScope.searchFields.sub_sub_minorities_id = category.minorities_id;
$rootScope.searchFields.sub_sub_industries_id = category.industries_id;
$rootScope.searchFields.sub_sub_has_state_filter = (category.has_state_filter=='1') ? true : false;
$scope.showSubSubCategories = false;
if (!$rootScope.searchFields.state && $rootScope.searchFields.has_state_filter && $scope.wantsState)
{
$scope.showMap = true;
}
$scope.$parent.grant = {};
$scope.getMoreGrants(1,'Clicked SubSubCategory',category.category_name);
};
$scope.resetBreadCrumbs = function() {
$rootScope.grant = "";
$rootScope.selectedCategory.state = "";
$rootScope.searchFields.state = "";
$rootScope.searchFields.bread_crumb_id = "";
$rootScope.searchFields.category_bread_crumb_id = "";
$rootScope.searchFields.sub_category_bread_crumb_id = "";
$rootScope.searchFields.sub_sub_category_bread_crumb_id = "";
$rootScope.searchFields.category_name = "";
$rootScope.searchFields.categories_id = "";
$rootScope.searchFields.subcategories_id = "";
$rootScope.searchFields.minorities_id = "";
$rootScope.searchFields.industries_id = "";
$rootScope.searchFields.has_state_filter = false;
$rootScope.searchFields.sub_category_name = "";
$rootScope.searchFields.sub_categories_id = "";
$rootScope.searchFields.sub_subcategories_id = "";
$rootScope.searchFields.sub_minorities_id = "";
$rootScope.searchFields.sub_industries_id = "";
$rootScope.searchFields.sub_has_state_filter = false;
$rootScope.searchFields.sub_sub_category_name = "";
$rootScope.searchFields.sub_sub_categories_id = "";
$rootScope.searchFields.sub_sub_subcategories_id = "";
$rootScope.searchFields.sub_sub_minorities_id = "";
$rootScope.searchFields.sub_sub_industries_id = "";
$rootScope.searchFields.sub_sub_has_state_filter = false;
$rootScope.searchFields.sub_sub_crumbs = [];
$rootScope.searchFields.sub_crumbs = [];
$scope.wantsState = false;
$scope.showCategories = true;
$scope.showSubCategories = false;
$scope.showSubSubCategories = false;
$scope.hasChangedCategory = false;
$scope.showMap = false;
$scope.$parent.grant = {};
$scope.getMoreGrants(1,'Clicked Home','Cleared Categories');
};
$scope.clearStateSelection = function () {
$rootScope.selectedCategory.state = "";
$rootScope.searchFields.state = "";
$scope.wantsState = false;
$scope.getMoreGrants(1);
};
$scope.clearSubCategory = function () {
$rootScope.searchFields.sub_category_name = "";
$rootScope.searchFields.sub_categories_id = "";
$rootScope.searchFields.sub_subcategories_id = "";
$rootScope.searchFields.sub_minorities_id = "";
$rootScope.searchFields.sub_industries_id = "";
$rootScope.searchFields.sub_has_state_filter = false;
if($rootScope.searchFields.sub_crumbs.length>0) {
$scope.showSubCategories = true;
} else {
$scope.showSubCategories = false;
}
$rootScope.searchFields.bread_crumb_id = $rootScope.searchFields.category_bread_crumb_id;
$rootScope.searchFields.sub_category_bread_crumb_id = "";
$rootScope.searchFields.sub_sub_category_bread_crumb_id = "";
$rootScope.searchFields.sub_sub_category_name = "";
$rootScope.searchFields.sub_sub_categories_id = "";
$rootScope.searchFields.sub_sub_subcategories_id = "";
$rootScope.searchFields.sub_sub_minorities_id = "";
$rootScope.searchFields.sub_sub_industries_id = "";
$rootScope.searchFields.sub_sub_has_state_filter = false;
$rootScope.searchFields.sub_sub_crumbs = [];
$scope.showSubSubCategories = false;
if($rootScope.searchFields.bread_crumb_id=='46') { //Back to rent assistance
$scope.showMap = true;
}
$scope.$parent.grant = {};
$scope.clearStateSelection();
$scope.getMoreGrants(1,'Clicked Breadcrumb','Cleared Subcategory');
};
$scope.clearSubSubCategory = function () {
$rootScope.searchFields.sub_sub_category_name = "";
$rootScope.searchFields.sub_sub_categories_id = "";
$rootScope.searchFields.sub_sub_subcategories_id = "";
$rootScope.searchFields.sub_sub_minorities_id = "";
$rootScope.searchFields.sub_sub_industries_id = "";
$rootScope.searchFields.sub_sub_has_state_filter = false;
if($rootScope.searchFields.sub_crumbs.length>0) {
$scope.showSubSubCategories = true;
} else {
$scope.showSubSubCategories = false;
}
$rootScope.searchFields.bread_crumb_id = $rootScope.searchFields.sub_category_bread_crumb_id;
$rootScope.searchFields.sub_sub_category_bread_crumb_id = "";
$scope.$parent.grant = {};
$scope.clearStateSelection();
$scope.getMoreGrants(1,'Clicked Breadcrumb','Cleared SubSubcategory');
};
$scope.setCategorySelect = function () {
$scope.showCategories = true;
$scope.hasChangedCategory = true;
if ($scope.wantsState)
{
$scope.showMap = false;
$scope.wantsState = false;
}
$scope.showSubCategories = false;
$rootScope.searchFields.sub_category_name = "";
$rootScope.searchFields.sub_categories_id = "";
$rootScope.searchFields.sub_subcategories_id = "";
$rootScope.searchFields.sub_minorities_id = "";
$rootScope.searchFields.sub_industries_id = "";
$rootScope.searchFields.sub_has_state_filter = false;
$('#slot1SubText').hide();
$scope.showSubSubCategories = false;
$rootScope.searchFields.sub_sub_category_name = "";
$rootScope.searchFields.sub_sub_categories_id = "";
$rootScope.searchFields.sub_sub_subcategories_id = "";
$rootScope.searchFields.sub_sub_minorities_id = "";
$rootScope.searchFields.sub_sub_industries_id = "";
$rootScope.searchFields.sub_sub_has_state_filter = false;
$('#slot1SubSubText').hide();
};
$scope.setSubCategorySelect = function () {
$scope.showSubCategories = true;
$scope.showSubSubCategories = false;
$rootScope.searchFields.sub_sub_category_name = "";
$rootScope.searchFields.sub_sub_categories_id = "";
$rootScope.searchFields.sub_sub_subcategories_id = "";
$rootScope.searchFields.sub_sub_minorities_id = "";
$rootScope.searchFields.sub_sub_industries_id = "";
$rootScope.searchFields.sub_sub_has_state_filter = false;
$('#slot1SubSubText').hide();
};
$scope.setSubSubCategorySelect = function () {
$scope.showSubSubCategories = true;
};
$scope.setMapSelect = function () {
$scope.showCategories = false;
if ($scope.wantsState) {
$scope.showMap = true;
$scope.wantsState = false;
}
};
$scope.doesWantState = function () {
$scope.wantsState = !$scope.wantsState;
}
var timer;
$scope.setSearchResults = function(searchResults) {
$http({
method : 'POST',
url : '/vx/usa/functions/setSearchResults.php',
data : "results="+searchResults,
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
//$scope.resetGrantList();
});
};
$scope.resetGrantList = function() {
$('#overlayMessageTitle').text("Resetting Grants");
$('#showOverlayMessage').show(1, function(){
$http({
method : 'POST',
url : '/vx/usa/layout/inc/prefGrants.php',
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.grantList = response.data.grantList;
$('#showOverlayMessage').hide();
$scope.prefChanged = false;
});
});
};
$scope.setUserCategory = function(userCategory, action) {
$scope.prefChanged = true;
if(userCategory) {
if(userCategory.id != '') {
$http({
method : 'POST',
url : '/vx/usa/functions/setUserCategory.php',
data : "category="+userCategory.id+"&action="+action,
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.userData.sub_categories = response.data.userCategories;
});
}
else {
alert("Please select a Category");
}
}
};
$scope.setUserState = function(userData) {
$scope.prefChanged = true;
if (userState != "")
{
$http({
method : 'POST',
url : '/vx/usa/functions/setUserState.php',
data : "state="+userData.state_short,
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.userData.state = response.data.state;
$rootScope.userData.state_short = response.data.stateShort;
$rootScope.userData.state_icon = response.data.stateIcon;
$scope.toggleUserState = false;
});
}
else
{
alert("Please select a State");
}
};
$scope.fundingGoal = function(amount) {
$('#prefFundingAmount').find('.saving').fadeIn(100, function(){
$http({
method : 'POST',
url : '/vx/usa/functions/fundingGoal.php',
data : "amount="+amount,
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.difference = ($scope.userPreferences.funding_goal - $scope.userPreferences.grants_applied_total);
$rootScope.userPreferences.funding_goals = amount;
$('#prefFundingAmount').find('.saving').fadeOut(1000);
$scope.toggleFundingGoal = false;
});
});
};
$scope.setSpreadClass = function(deadlineSpread, spread, type) {
$scope.class = "";
if(deadlineSpread < 7 && deadlineSpread > 3 && spread == 'Days') {
if(type == "text") {
$scope.class = 'orange';
}
else {
$scope.class = 'light-orange-border';
}
}
else if(deadlineSpread <= 3 && deadlineSpread > 1 && spread == 'Days') {
if(type == "text") {
$scope.class = 'redish';
}
else {
$scope.class = 'light-orange-border';
}
}
else if(deadlineSpread == 1 && spread == 'Day') {
if(type == "text") {
$scope.class = 'redish';
}
else {
$scope.class = 'light-red-border';
}
}
else {
if(type == "text") {
$scope.class = 'medium-gray';
}
else {
$scope.class = 'white-border';
}
}
return $scope.class;
};
$scope.saveAccount = function(userData) {
$('#accountErrors').hide();
$('#accountSaving').fadeIn(200, function() {
$http({
method : 'POST',
url : '/vx/usa/account/functions/saveAccount.php',
data : $.param(userData),
dataType: 'json',
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$('#accountSaving').fadeOut(500);
if(response.data.password == "updated") {
$('#accountPassword').show().delay(2000).slideUp(300);
$scope.userData.password = "";
$scope.userData.confirmPassword = "";
}
if(response.data.result == "success") {
$rootScope.sessionData.email = $scope.userData.email;
$rootScope.sessionData.firstName = $scope.userData.first;
$rootScope.sessionData.lastName = $scope.userData.last;
}
else {
var errors = response.data.errors;
var errorHTML = '<div class="relative iblock f20 dark-gray"><u>There was a problem</u></div><br>';
for(x = 0; x < errors.length; x++)
{
errorHTML += errors[x]+"<br>";
}
$('#accountErrors').html(errorHTML);
$('#accountErrors').show();
}
},
function errorCallback(response)
{
});
});
};
$scope.startTutorial = function() {
$http({
method : "POST",
url : "/vx/usa/functions/setTutorial.php",
data : "step=start",
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$('body').removeClass('tutorialTime');
$rootScope.tutorialStep = 0;
});
};
$scope.stopKeywordHelp = function() {
$http({
method : "POST",
url : "/vx/usa/functions/setTutorial.php",
data : "step=keyword",
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$('#keywordHelp').fadeOut(300);
});
};
angular.element(document).ready(function () {
if($rootScope.currentPage == "Members") {
//$scope.resetGrantList();
}
});
angular.element($window).bind("scroll", function() {
});
$scope.grantType = function(type) {
$scope.class = "";
if(type == "Grant") {
$scope.class = "lred";
}
else if(type == "Investor") {
$scope.class = "blue";
}
else if(type == "Loan") {
$scope.class = "green";
}
else if(type == "Contract") {
$scope.class = "blue";
}
else if(type == "Other") {
$scope.class = "";
}
return $scope.class;
};
$scope.grantTypeTitle = function(type) {
$scope.title = "";
if(type == "Grant") {
$scope.title = "These are monies given away that do not need to be paid back";
}
else if(type == "Investor") {
$scope.title = "These are monies usually given away in exchange for a share of profits or property";
}
else if(type == "Loan") {
$scope.title = "These are monies that must be paid back to the lender";
}
else if(type == "Contract") {
$scope.title = "";
}
else if(type == "Other") {
$scope.title = "";
}
return $scope.title;
};
$scope.setGlossaryLetter = function(letter)
{
if($scope.glossarySelection == letter) {
$scope.glossarySelection = "";
}
else {
$scope.glossarySelection = letter;
}
};
$scope.startCourse = function(course) {
if(!$rootScope.phone) {
$('#bodyNavigation').show().css('width', '280px');
$('#bodyContainer').css('width', 'auto');
}
};
$scope.setAlert = function(alert) {
$http({
method : 'POST',
url : '/vx/usa/alerts/functions/setAlert.php',
data : $.param(alert),
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.myAlerts = response.data.my_alerts;
});
};
$scope.setSearchExamples = function() {
$http({
method : "POST",
url : "/vx/usa/functions/setTutorial.php",
data : "step=searchExample",
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
});
};
$scope.imageSrc = function(src) {
return src;
};
$scope.sendToAdvanced = function(searching) {
window.location = '/vx/usa/search/?keyword='+searching.keyword;
};
});
site.controller('Subscriptions', function($rootScope, $scope, $http, $window, $timeout, $filter) {
$scope.subscribe = function(ref) {
var loc = '/vx/usa/members/';
if(arguments.length>1) {
loc = arguments[1];
}
$('#subscribeLoader').fadeIn(100, function(){
$http({
method : 'POST',
url : '/vx/usa/functions/subscribe.php',
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
if(response.data.result == "success")
{
window.location = loc;
/*if(ref != '')
{
$('#subscriptionForm').submit();
}
else
{
$rootScope.userPreferences.monthlySubscription = true;
}*/
}
});
});
};
});
site.controller('Resources', function($rootScope, $scope, $http, $window, $timeout, $filter) {
$scope.setResource = false;
$scope.loadResource = function(slug) {
$('.navigationSelected').removeClass('navigationSelected').addClass('navigationButton');
$('#btn'+slug).removeClass('navigationButton').addClass('navigationSelected');
$('#learnMore').hide();
$('.resourceContent').hide();
$("html, body").animate({ scrollTop: 0 }, "slow");
$('#'+slug).show();
};
});
site.controller('Funding', function($rootScope, $scope, $http, $window, $timeout, $filter) {
$scope.editGoal = false;
$scope.fundingGoal = function(amount) {
$('#fundingGoalForm').find('.saving').fadeIn(100, function(){
$http({
method : 'POST',
url : '/vx/usa/functions/fundingGoal.php',
data : "amount="+amount,
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.difference = ($rootScope.userPreferences.funding_goal - $rootScope.userPreferences.grants_applied_total);
$rootScope.userPreferences.funding_goals = amount;
$('#fundingGoalForm').find('.saving').fadeOut(1000);
$scope.editGoal = false;
if($rootScope.fStep == 1)
{
$rootScope.fStep = 2;
//console.log($rootScope.fStep);
$('#mobileFunding').fadeOut(200);
}
});
});
};
});
site.controller('CoursesNavigation', function($rootScope, $scope, $http, $window, $timeout) {
$scope.subOpen = false;
$scope.openSections = [];
$scope.section = [];
$scope.setCourse = false;
$scope.courseLoad = function(course) {
$scope.viewedSection = false;
if($scope.section[course.section]) {
$scope.openSections[course.section] = true;
$rootScope.activeSection = course.section;
$rootScope.courseSection = '/vx/usa/course/'+$rootScope.course+'/sections/'+course.section+'.php?section='+course.section;
$scope.viewedSection = true;
if($rootScope.phone && course.sub.length <= 0) {
$scope.setCourse = false;
}
}
else {
if($scope.openSections[course.section])
{
$scope.openSections[course.section] = false;
$rootScope.activeSection = 0;
$rootScope.courseSection = $rootScope.courseSectionDefault;
}
else {
if($scope.activeSection == course.section) {
$rootScope.activeSection = 0;
$rootScope.courseSection = $rootScope.courseSectionDefault;
}
else {
$rootScope.activeSection = course.section;
$rootScope.courseSection = '/vx/usa/course/'+$rootScope.course+'/sections/'+course.section+'.php?section='+course.section;
$scope.viewedSection = true;
if($rootScope.phone && course.sub.length <= 0) {
$scope.setCourse = false;
}
}
}
}
if($scope.viewedSection && !course.complete) {
$http({
method : "POST",
url : "/vx/usa/functions/setCourse.php",
data : "course="+course.course,
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
course.complete = 1;
$scope.allComplete = false;
if(course.isSub) {
for(var i in $rootScope.courseSections) {
if($rootScope.courseSections[i].key == course.key) {
for(var x in $rootScope.courseSections[i].sub) {
if($rootScope.courseSections[i].sub[x].complete) {
$scope.allComplete = true;
continue;
}
else {
$scope.allComplete = false;
break;
}
}
}
}
if($scope.allComplete) {
for(var i in $rootScope.courseSections) {
if($rootScope.courseSections[i].key == course.key && !$rootScope.courseSections[i].isSub) {
$rootScope.courseSections[i].allComplete = 1;
break;
}
}
}
}
$rootScope.coursesComplete++;
var progressPercent = ((100/$rootScope.courseTotal) * $rootScope.coursesComplete);
$rootScope.animateTrainingStats(progressPercent, null, 10);
});
}
//if(course.section % 1 != 0) {
$('html, body').animate({ scrollTop: 0 }, '350');
//}
};
});
site.controller('Applied', function($rootScope, $scope, $http, $window, $timeout, $filter) {
$scope.removeGrant = function(grant) {
$http({
method : "POST",
url : "/vx/usa/functions/removeAppliedGrant.php",
data : "grant="+grant,
dataType : "json",
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
$rootScope.userPreferences.grants_applied_total = response.data.newTotal;
$rootScope.difference = ($rootScope.userPreferences.funding_goal - $rootScope.userPreferences.grants_applied_total);
$('#grant'+grant).slideUp(300, function() {
$('#grant'+grant).remove();
});
});
};
});