GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 4f400b...27c2a7 )
by Keith
80:08
created

ng   A

Complexity

Conditions 5

Size

Total Lines 20
Code Lines 11

Duplication

Lines 20
Ratio 100 %

Importance

Changes 0
Metric Value
cc 5
eloc 11
dl 20
loc 20
rs 9.3333
c 0
b 0
f 0
1 View Code Duplication
"use strict";
2
app.controller('thirdPartyEntry2CreateController', ['$scope', '$state', 'Security', 'MessageService', function ($scope, $state, Security, MessageService) {
3
	$scope.directiveScopeDict = {};
4
    $scope.directiveCtrlDict = {};
5
	
6
    function Initialize(){
7
        var processForm = {};
8
9
        $scope.processForm = processForm;
10
		$scope.processForm.Record = {};
11
    }
12
    Initialize();
13
	
14
	$scope.BackToParentState = function(){
15
		$state.go('rc-55-list-third-party');
16
	}
17
18
    $scope.EventListener = function(scope, iElement, iAttrs, controller){
19
		var tagName = iElement[0].tagName.toLowerCase();
20
		var prgmID = scope.programId;
21
		var scopeID = scope.$id;
0 ignored issues
show
Unused Code introduced by
The variable scopeID seems to be never used. Consider removing it.
Loading history...
22
		var hashID = tagName + '_' + prgmID;
23
24
		if($scope.directiveScopeDict[hashID] == null || typeof($scope.directiveScopeDict[hashID]) == "undefined"){
25
			$scope.directiveScopeDict[hashID] = scope;
26
			$scope.directiveCtrlDict[hashID] = controller;
27
28
		}
29
		
30
        iElement.ready(function() {
31
			if(tagName=="process"){
32
				$scope.GetThirdPartyRecord();
33
				$scope.ResetForm();
34
			}
35
        })
36
    }
37
	
38
	$scope.GetThirdPartyRecord = function(){
39
		var name = "process_dp54tp"
40
		
41
		$scope.directiveCtrlDict[name].ngModel.InquiryCriteria.Action = "create";
42
		
43
		$scope.directiveScopeDict[name].InquiryData();
44
	}
45
	$scope.ResetForm = function(){
46
		var name = "process_dp54tp"
47
		$scope.directiveCtrlDict[name].ngModel.ProcessRecord = {Name: ""};
48
	}
49
50
    $scope.SetDefaultValue = function(scope, iElement, iAttrs, controller){
51
		
52
    }
53
54
    $scope.StatusChange = function(fieldName, newValue, newObj, scope, iElement, iAttrs, controller){
55
    }
56
57
    $scope.ValidateBuffer = function(scope, iElement, iAttrs, controller){
58
        return true;
59
    }
60
	$scope.CustomInquiryDataResult = function(responseObj, httpStatusCode, scope, iElement, attrs, ctrl){
61
		if(responseObj.data.computerLanguage.num_rows){
62
			/*
63
			ctrl.ThirdParty = responseObj.data.thirdParty.data[0];
64
			
65
			ctrl.ngModel.ProcessRecord = ctrl.ThirdParty;
66
			*/
67
			console.dir(scope)
68
			console.dir(ctrl)
69
			//ctrl.ngModel.ProcessRecord = Object.assign({}, ctrl.ThirdParty);
70
			//ctrl.ngModel.ProcessRecord = ctrl.ThirdParty;
71
			ctrl.ngModel.ProcessCriteria.ThirdPartyLang = [];
72
			
73
			ctrl.ThirdPartyLang = responseObj.data.thirdPartyLang.data;
74
			ctrl.ComputerLanguage = ExtractComputerLang(responseObj.data.computerLanguage.data, responseObj.data.thirdPartyLang.data);
75
			ctrl.ngModel.ProcessCriteria.ThirdPartyLang = ExtractThirdPartyLang(responseObj.data.computerLanguage.data, responseObj.data.thirdPartyLang.data);
76
		}
77
		
78
	}
79
	
80
	function ExtractComputerLang(comLangRows, thirdPartyLang){
81
		var name = "process_dp54tp";
82
		var ctrl = $scope.directiveCtrlDict[name];
0 ignored issues
show
Unused Code introduced by
The variable ctrl seems to be never used. Consider removing it.
Loading history...
83
		
84
		var langArray = comLangRows.slice();
85
		
86
		// use forEach() will actual update the array
87
		langArray.forEach(comLangObj => {
88
			comLangObj.isSelect = false;
89
		});
90
		return langArray;
91
	}
92
	
93
	function ExtractThirdPartyLang(comLangRows, thirdPartyLang){
94
		var name = "process_dp54tp";
95
		var ctrl = $scope.directiveCtrlDict[name];
0 ignored issues
show
Unused Code introduced by
The variable ctrl seems to be never used. Consider removing it.
Loading history...
96
		
97
		var langArray = comLangRows.slice();
98
		
99
		// use forEach() will actual update the array
100
		langArray.forEach(comLangObj => {
101
			var thirdPartLangObj = thirdPartyLang.filter(x => x.LanguageID === comLangObj.LanguageID);
102
			
103
			// if exist in thirdPartyLang, assign to processCriteria
104
			if(Object.keys(thirdPartLangObj).length === 0){
0 ignored issues
show
Comprehensibility Documentation Best Practice introduced by
This code block is empty. Consider removing it or adding a comment to explain.
Loading history...
105
			}else{
106
				comLangObj.isSelect = true;
107
				//ctrl.ngModel.ProcessCriteria.ThirdPartyLang.push(comLangObj);
108
			}
109
		});
110
		var selectedLangArray = langArray.filter(x => x.isSelect == true);
111
		return selectedLangArray;
112
	}
113
	
114
	$scope.ToggleThirdPartyLang = function(comLangRow){
115
		var name = "process_dp54tp";
116
		var ctrl = $scope.directiveCtrlDict[name];
117
		var thirdPartyLangArray = ctrl.ngModel.ProcessCriteria.ThirdPartyLang;
118
		comLangRow.isSelect = !comLangRow.isSelect;
119
		
120
		// remove from ProcessCriteria
121
		var selectedLangArray = thirdPartyLangArray.filter(x => x.LanguageID != comLangRow.LanguageID);
122
		
123
		// add to ProcessCriteria
124
		if(comLangRow.isSelect){
125
			selectedLangArray.push(comLangRow);
126
		}
127
		
128
		ctrl.ngModel.ProcessCriteria.ThirdPartyLang = selectedLangArray;
129
	}
130
	
131
	$scope.CreateData = function(){
132
		var name = "process_dp54tp";
133
		var scope = $scope.directiveScopeDict[name];
134
		var ctrl = $scope.directiveCtrlDict[name];
135
		ctrl.ngModel.ProcessCriteria.Editmode = "create";
136
		scope.SubmitData();
137
	}
138
	
139
	$scope.CustomSubmitDataResult = function(responseObj, httpStatusCode, scope, iElement, attrs, ctrl){
140
		//$scope.GetThirdPartyRecord();
141
		
142
		if(responseObj.status == "success"){
143
			$scope.ResetForm();
144
			//$scope.GetThirdPartyRecord();
145
			
146
			ctrl.ComputerLanguage.forEach(comLangObj => {
147
				comLangObj.isSelect = false;
148
			});
149
			ctrl.ngModel.ProcessCriteria.ThirdPartyLang = [];
150
		}
151
	}
152
}]);
153