1app.controller('accountManagePaymentHistoryController', ['$scope', '$state', '$timeout', '$location', 'localStorageService', 'permissionsService', 'authenticationService', 'authorizeDotNetService', 'lists', 2 function ($scope, $state, $timeout, $location, localStorageService, permissionsService, authenticationService, authorizeDotNetService, lists) { 3 4 $scope.initializePage = function () { 5 $scope.$parent.activeChildView = $state.current.name.replace('accountManage.', ''); 6 7 // Check to make sure they are logged in as a user 8 permissionsService.isAuthenticated().then(function (results) { 9 if (!results.data) { 10 popMessage("error", "Not Authorized", "You are not authorized to view this page. Please login to continue."); 11 authenticationService.logout(); 12 $state.go('accountLogin'); 13 } else { 14 15 $scope.getPayments(); 16 17 } 18 }, function (error) { 19 popApiErrorMessage(error); 20 }); 21 }; 22 23 $scope.getPayments = function () { 24 25 $scope.isSearchInProgress = true; 26 27 if ($scope.pageNumber == null) { 28 $scope.pageNumber = 1; 29 } 30 if ($scope.pageSize == null) { 31 $scope.pageSize = 25; 32 } 33 34 authorizeDotNetService.getPaymentsByUserId( 35 $scope.pageNumber, 36 $scope.pageSize).then(function (results) { 37 38 $scope.payments = results.data.payments; 39 $scope.totalItems = results.data.totalRows[0].totalRows; 40 $scope.isSearchInProgress = false; 41 $scope.pageIsLoaded = true; 42 43 }, function (error) { 44 // Pop up an error 45 popApiErrorMessage(error); 46 }); 47 48 }; 49 50 51 $scope.getParseFloatAmount = function (amount) { 52 var parsedAmount = parseFloat(amount); 53 54 if (isNaN(parsedAmount)) { 55 parsedAmount = 0; 56 } 57 58 return parsedAmount; 59 }; 60 61 62 /*********************************************************************************************************************** 63 64 Table sorting and paging methods 65 66 */ 67 68 $scope.setSort = function (newSortField) { 69 // If the sort field is the same 70 if (newSortField == $scope.sortField) { 71 // set the sort direction to opposite of what it currently is 72 $scope.sortDirection == 'ASC' ? $scope.sortDirection = 'DESC' : $scope.sortDirection = 'ASC'; 73 } else { 74 // Set the sort field as the new field and set the sort direction 75 $scope.sortField = newSortField; 76 $scope.sortDirection = 'ASC'; 77 } 78 79 // Set the values in the query string 80 $scope.setQueryStringSearchParams(); 81 82 // Re-get the data 83 $scope.getPayments(); // CUSTOM PER CONTROLLER 84 }; 85 86 $scope.pageResults = function (pagination) { 87 $scope.pageNumber = pagination.page; 88 89 // Set the values in the query string 90 $scope.setQueryStringSearchParams(); 91 92 // Re-get the data 93 $scope.getPayments(); // CUSTOM PER CONTROLLER 94 }; 95 96 $scope.pageSizeChange = function (newpageSize) { 97 $scope.pageSize = newpageSize; 98 99 if ($scope.pageNumber * $scope.pageSize > $scope.totalItems && $scope.totalItems > 0) { 100 $scope.pageNumber = Math.ceil($scope.totalItems / $scope.pageSize); 101 } 102 103 // Set the values in the query string 104 $scope.setQueryStringSearchParams(); 105 106 // Re-get the data 107 $scope.getPayments(); // CUSTOM PER CONTROLLER 108 }; 109 110 $scope.setQueryStringSearchParams = function () { 111 112 $location.search($scope.queryStringPrefix + "f", $scope.filter); // CUSTOM PER CONTROLLER 113 114 $location.search($scope.queryStringPrefix + "p", $scope.pageNumber); 115 $location.search($scope.queryStringPrefix + "ps", $scope.pageSize); 116 $location.search($scope.queryStringPrefix + "s", $scope.sortField); 117 $location.search($scope.queryStringPrefix + "sd", $scope.sortDirection); 118 }; 119 120 $scope.getQueryStringSearchParams = function () { 121 122 if (getParameterByName($scope.queryStringPrefix + "f").length > 0) // CUSTOM PER CONTROLLER 123 $scope.filter = getParameterByName($scope.queryStringPrefix + "f"); 124 125 if (getParameterByName($scope.queryStringPrefix + "p").length > 0) 126 $scope.pageNumber = Number(getParameterByName($scope.queryStringPrefix + "p")); 127 if (getParameterByName($scope.queryStringPrefix + "ps").length > 0) 128 $scope.pageSize = Number(getParameterByName($scope.queryStringPrefix + "ps")); 129 if (getParameterByName($scope.queryStringPrefix + "s").length > 0) 130 $scope.sortField = getParameterByName($scope.queryStringPrefix + "s"); 131 if (getParameterByName($scope.queryStringPrefix + "sd").length > 0) 132 $scope.sortDirection = getParameterByName($scope.queryStringPrefix + "sd"); 133 }; 134 135 $scope.checkIfFilterChanged = function () { 136 if ($scope.filterChanged) { 137 $scope.pageNumber = 1; 138 $scope.filterChanged = false; 139 } 140 }; 141 142 // Set the default variables 143 $scope.availablePageSizes = lists.availablePageSizes;
144 145 $scope.queryStringPrefix = 'ph-'; // CUSTOM PER CONTROLLER 146 147 $scope.sortField = '[CreatedDate]'; // CUSTOM PER CONTROLLER 148 $scope.sortDirection = 'DESC'; 149 $scope.pageNumber = 1; 150 $scope.pageSize = 10; 151 $scope.totalItems = 0; 152 153 $scope.isSearchInProgress = false; 154 $scope.filterChanged = false; 155 156 // Check to see if any values got passed in the query string 157 $scope.getQueryStringSearchParams(); 158 159 /* 160 161 End table sorting and paging methods 162 163 ***********************************************************************************************************************/ 164 165 166 $scope.isCreditCard = function (item) { 167 return item.paymentProfileType == 'creditCard'; 168 }; 169 $scope.isECheck = function (item) { 170 return item.paymentProfileType == 'eCheck'; 171 }; 172 173 //initialize variables 174 $scope.user = localStorageService.get('AuthData'); 175 176 $scope.availablePageSizes = lists.availablePageSizes; 177 178 $scope.payments = []; 179 180 $scope.pageIsLoaded = false; 181 182 //If the page hasn't loaded after 1 second, signal that the ui can show the loading animation 183 $scope.canShowPageLoading = false; 184 $timeout(function () { $scope.canShowPageLoading = true; }, 1000); 185 186 //initialize Page 187 $scope.initializePage(); 188 } 189]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.