summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/resources/WEB-INF/jsp/subscriberdetails.jsp
blob: ca92b1529bcd1e412a504a320da37ca8a2bb303c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
<div ng-controller="subscriberDetailsController">
	<div>
		<h1 class="heading1" style="margin-top:20px;">Selected Subscriber's Service Instance Details:</h1>
		<div style="margin-top:30px">
		 	<table att-table table-data="tableData">

			    <thead  att-table-row type="header">
					<tr>
					    <th att-table-header key="viewSubDetails">View/Edit</th>
						<th att-table-header key="global-customer-id">Global Customer ID</th>
			            <th att-table-header key="subscriber-name">Subscriber Name</th>        
			            <th att-table-header key="service-type">Service Type</th>    
			            <th att-table-header key="service-instance-id">Service Instance ID</th>
			        </tr>
			    </thead>
			    <tbody att-table-row type="body" row-repeat="disData in displayData">
			        <tr>
			        <td att-table-body>
			         <div ng-controller="viewEditSubController">
    	              <a href="#" ng-click="postsubscriberID(disData.subscriberName)" alt="View/Edit">
                  	     View/Edit
	                  </a>
            	   </div>
            	   </td>
		            	<td att-table-body >{{disData.globalCustomerId}}</td>
		            	<td att-table-body >{{disData.subscriberName}}</td>
		            	<td att-table-body >{{disData.serviceType}}</td>
		            	<td att-table-body >{{disData.serviceInstanceId}}</td>
			        </tr>     
			    </tbody>	  
			</table> 
		</div>
	</div>	
	<table><tr>
	<td>
	<div ng-controller="searchExistingSIController" align="left" >
		<button type="submit" ng-click="cancelSubDetails();" att-button
			btn-type="primary" size="small">Cancel</button>
	</div>
	</td></tr>
	
	</table>
	
</div>
<!--  Temporary solution for footer overlapping the men after talking to EComp SDK developer on 06/25/2016 -->

<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
		
<script>
app.controller("subscriberDetailsController", function ($scope,$http,modalService, $modal) { 
	$scope.tableData=${model.customerInfo};
	$scope.displayData= [];
	$scope.subscriberData=[];
	$scope.serviceInstanceData= new Array();
	$scope.globalcustomerid = $scope.tableData['global-customer-id'];
	$scope.subscriberName = $scope.tableData['subscriber-name'];
	$scope.subscriberData = $scope.tableData['service-subscriptions'];
	   
	 $scope.setDisplaynoSTSI = function(){
    	 $scope.displayData.push({
				globalCustomerId : $scope.globalcustomerid,
			    subscriberName   :  $scope.subscriberName,
			    serviceType : "No Service Subscription Found",
			    serviceInstanceId : "No Service Instance Found"
			});
     }
	 
	 $scope.setDisplaynoSI = function(servcType){
    	 $scope.displayData.push({
				globalCustomerId : $scope.globalcustomerid,
			    subscriberName   :  $scope.subscriberName,
			    serviceType : servcType,
			    serviceInstanceId : "No Service Instance Found"
			});
     }
	 
	if ($scope.subscriberData != null)
		{
		    if ($scope.numberofSubscribers = $scope.subscriberData['service-subscription'] != null)
		    	{
					$scope.numberofSubscribers = $scope.subscriberData['service-subscription'].length;
					if ($scope.numberofSubscribers > 0)
						{
						    var index = 0;
							for(i=0; i < $scope.numberofSubscribers; i++) {
								$scope.serviceInstanceData[i] = new Array();
								var servicesubscription = $scope.subscriberData['service-subscription'][i]; 
								$scope.serviceInstanceData[i] = servicesubscription['service-instances'];
								if ($scope.serviceInstanceData[i] != null)
									{
									    if ($scope.serviceInstanceData[i]['service-instance'] != null)
									    	{
												var numberofserviceInstance = $scope.serviceInstanceData[i]['service-instance'].length;
												if (numberofserviceInstance > 0)
													{
														for(j=0; j < numberofserviceInstance; j++)
														{
															$scope.displayData.push({
																globalCustomerId : $scope.globalcustomerid,
															    subscriberName   :  $scope.subscriberName,
															    serviceType : servicesubscription['service-type'],
															    serviceInstanceId : $scope.serviceInstanceData[i]['service-instance'][j]['service-instance-id']
															});
														}
													}
												else
													{
													   $scope.setDisplaynoSI(servicesubscription['service-type']);
													}
									    	}
									    else
										{
									    	$scope.setDisplaynoSI(servicesubscription['service-type']);
										}
									}
								else
									{
									   $scope.setDisplaynoSI(servicesubscription['service-type']);
									}
					        }
						}
					else
						{
						  $scope.setDisplaynoSTSI();
						}
		    	}
		    else
				{
		    	   $scope.setDisplaynoSTSI();
				}
			}
		else
		{
			 $scope.setDisplaynoSTSI();
		}
	
	
});

app.controller('viewEditSubController',['$scope','$http',function ($scope,$http) { 
	
	$scope.postsubscriberID = function(subID){
		   $.ajax({
		            url: "vieweditsub/subedit?"+"subscriberID="+encodeURIComponent(subID),
	                type : "POST",
	                success:function (response){
	                    window.location.href = 'instantiate.htm';
	                },
	                error:function( jqXHR, status,error ){
	                	$("#errorInfo").show();
	                }
	                
	        });
		}
	
}]);

app.controller('searchExistingSIController',['$scope','$http',function ($scope,$http) { 
	
	$scope.cancelSubDetails = function(selectedSubscriber){
 		
		window.location.href = 'searchexistingsi.htm';
		
	}
	
}]);
</script>