PageSourceSearch

https://fxboss.firstcitizens.com/app/components/accounts/account_activity.js?v=31082026-1758

js firstcitizens.com collected 2026-09-24 21:51:11 UTC 8,474 bytes, 209 lines download raw bytes

1var app = angular.module('bossApp');
2app.controller('accountActivityCtrl', ['$filter','$scope', '$http', '$state', '$stateParams', 'TransactionService', 'SearchService','$interpolate','AccountSummaryService',
3    function($filter,$scope, $http, $state, $stateParams, TransactionService, SearchService,$interpolate,AccountSummaryService) {
4        $scope.loading = true;
5        $scope.noRecordMsg = "No records available to display.";
6        $scope.numberOfDecimals = 2;
7		$scope.csvFileName = "transaction.csv"
8		
9        TransactionService.getStaticInformation().then(function(response) {
10            $scope.transactionType = response.responseObj;
11            getTransaction();
12		});
13		
14        function getTransaction() {
15			$scope.noDataErrorMsg = '';
16            TransactionService.getTransactionList($stateParams.accountId).then(function(response) {
17				if(!response.success){
18					$scope.noDataErrorMsg = response.errorResponse ? response.errorResponse: 'Account Not Found';
19					$scope.loading=false;
20					return;
21				}
22                var responseObj = response.responseObj;
23                //bankAccount
24                $scope.bankAccount = responseObj.bankAccount;
25                
26				if($scope.bankAccount.isExternal){
27					var accountActivity = (responseObj.bankAccountTransactions) ? responseObj.bankAccountTransactions : [];
28					var activityList = getFormattedActivityList(accountActivity);
29					$scope.accountActivity = angular.copy(activityList);
30				}
31				 $scope.advancedSearch();
32				 if($scope.bankAccount.isExternal){
33					 AccountSummaryService.plaidGetAccountBalance($scope.bankAccount.id).then(function(response) {
34						externalAccBalances=response.data;
35						if($scope.bankAccount.isExternal && externalAccBalances && externalAccBalances[$scope.bankAccount.id]){
36							$scope.bankAccount.availableBalance=externalAccBalances[$scope.bankAccount.id].availableBalance;
37							$scope.bankAccount.ledgerBalance=externalAccBalances[$scope.bankAccount.id].currentBalance;
38						}
39						});
40				 }else{
41					 if($scope.bankAccount.accountType=="MCA"){
42						 getLedgerBalance($scope.bankAccount.accountNumber)
43					 }else{
44						 getAccountBalance($scope.bankAccount.id);
45					 }
46				 }
47				 
48            });
49        }
50		
51		function getLedgerBalance(_accountNumber){
52			if(_accountNumber){
53				AccountSummaryService.getLedgerBalance(_accountNumber).then(function(response){
54					if(response.success){
55						$scope.bankAccount.accountBalance = response.responseObj.availableBalance;
56						$scope.bankAccount.ledgerBalance = response.responseObj.ledgerBalance;
57					}
58				});
59			}
60		}
61		
62		//It will fetch the Available balance for DDA accounts & Ledger balance for MCA accounts
63		function getAccountBalance(_id){
64			if(_id){
65				AccountSummaryService.getAccountBalance(_id).then(function(response){
66					if(response.success){
67						$scope.bankAccount.accountBalance = response.responseObj.availableBalance;
68						$scope.bankAccount.ledgerBalance = response.responseObj.ledgerBalance;
69					}
70				});
71			}
72		}
73		
74        function getFormattedActivityList(accountActivity) {
75            for (var i in accountActivity) {
76                /*var dateStr = angular.copy(accountActivity[i].transactionDate);
77                var array = dateStr.toString().split(',');
78                var year=parseInt(array[0]);
79                var month=parseInt(array[1])-1;
80                var day=parseInt(array[2]);
81            	var date=new Date(year,month,day)
82                accountActivity[i].transactionDate = angular.copy(date);*/
83            	accountActivity[i].transactionDate = $filter('date')(accountActivity[i].transactionDate, 'MM/dd/y'); //GT-435
84            	accountActivity[i].postingDate = $filter('date')(accountActivity[i].postingDate, 'MM/dd/y');
85            }
86            return accountActivity;
87        }
88        /**
89         *  Format transactions to be downloaded properly.
90         */
91		 function get3MonthOldDate(){
92			 var date = new Date();
93			 date.setMonth(date.getMonth() - 3);
94			 return date;
95		 }
96		 var _searchDefault = {
97			 description: undefined,
98			 dateFrom: get3MonthOldDate(),
99			 dateTo : new Date(),
100			 type : undefined,
101			 amountFrom : undefined,
102			 amountTo : undefined,
103			 amount : undefined
104		 };
105		 $scope.search = angular.copy(_searchDefault);
106		 
107        $scope.getListToBeConverted = function() {
108			// Create name for csv file.
109				var accountName = $scope.$eval($interpolate( "{{bankAccount.accountName}} - *****{{bankAccount.accountNumber | displayLastChar : 4}}" ))
110				$scope.csvFileName = accountName+".csv";
111			// format the csv file.
112				var activityList = angular.copy($scope.accountActivity);
113				var updatedActivityList = [];
114				var activity = {
115					type:"Type",
116					transactionDate: "Transaction Date",
117					postingDate: "Posting Date",
118					description: "Description",
119					amount: "Amount",
120					remainingBalance : "Ledger Balance",
121					status: "Status"
122				};
123				updatedActivityList.push(activity);
124				for(var i in activityList){
125					var _transaction = angular.copy(activity);
126					_transaction.type = angular.copy(activityList[i].creditDebitType);
127					// format date
128					_transaction.transactionDate = angular.copy(activityList[i].transactionDate);
129					_transaction.postingDate = angular.copy(activityList[i].postingDate);
130					_transaction.description = angular.copy(activityList[i].description);
131					_transaction.amount = angular.copy(activityList[i].amount);
132					_transaction.remainingBalance = angular.copy(activityList[i].availableBalancePostTransaction);
133					_transaction.status = angular.copy(activityList[i].status);
134					var _activityObj = angular.copy(_transaction);
135					updatedActivityList.push(_activityObj);
136				}
137				
138                return updatedActivityList;
139            }
140			/**
141             * Advanced Search Filter.
142             */
143        $scope.toggleSmartSearch = false;
144        $scope.searchTooltipText = "Open Advanced Search.";
145        $scope.displayAdvancedSearch = function() {
146            $scope.toggleSmartSearch = angular.copy(!$scope.toggleSmartSearch);
147            var _toggle = angular.copy($scope.toggleSmartSearch);
148            $scope.searchTooltipText = (_toggle) ? "Close Advanced Search." : "Open Advanced Search.";
149
150        }
151        $scope.advancedSearch = function() {
152            var search = angular.copy($scope.search);
153            if (isSearchFieldsValid(search)) {
154            	var dateString = new Date(search.dateFrom).toUTCString();
155				dateString = dateString.split(' ').slice(0, 4).join(' ');
156				var fromDate=new Date(dateString);
157                SearchService.searchTransactions($scope.bankAccount.accountNumber, search.description, search.type, fromDate, search.dateTo, search.amountFrom, search.amountTo, search.amount,$scope.bankAccount.id).then(function(response) {
158					var activityList = getFormattedActivityList(response);
159					$scope.accountActivity = angular.copy(activityList);
160                   
161					// Paginations
162					$scope.tableViewby = "10";
163					$scope.tableTotalItems = $scope.accountActivity.length;
164					$scope.tableCurrentPage = 1;
165					$scope.tableItemsPerPage = $scope.tableViewby;
166
167					$scope.setTableItemsPerPage = function(num) {
168						$scope.tableItemsPerPage = num;
169						$scope.tableCurrentPage = 1; //reset to first page
170					}
171					$scope.loading = false;
172				});
173            }
174        }
175        $scope.resetSearchCriteria = function() {
176            $scope.search = angular.copy(_searchDefault); // defaults all search criteria.
177            $scope.advancedSearch();
178        }
179
180        function isSearchFieldsValid(search) {
181			var isValid = false;
182            if (search) {
183                if (search.accountNumber || search.description || search.type || search.dateFrom || search.dateTo || search.amountFrom || search.amountTo || search.amount) {
184                    isValid = true;
185                }
186            }
187            return isValid;
188        }
189        /**
190         * Date picker selector.
191         */
192        $scope.config = {
193            openDateFromCal: false,
194            openDateToCal: false
195
196        };
197        $scope.openDateFrom = function($event) {
198            $event.preventDefault();
199            $event.stopPropagation();
200            $scope.config.openDateFromCal = true;
201        }
202        $scope.openDateTo = function($event) {
203            $event.preventDefault();
204            $event.stopPropagation();
205            $scope.config.openDateToCal = true;
206        }
207        
208	}
209]);

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.