org.onap migration
[vid.git] / epsdk-app-onap / src / main / webapp / WEB-INF / jsp / subscriberdetails.jsp
1 <%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
2 <div ng-controller="subscriberDetailsController">
3         <div>
4                 <h1 class="heading1" style="margin-top:20px;">Selected Subscriber's Service Instance Details:</h1>
5                 <div style="margin-top:30px">
6                         <table att-table table-data="tableData">
7
8                             <thead  att-table-row type="header">
9                                         <tr>
10                                             <th att-table-header key="viewSubDetails">View/Edit</th>
11                                                 <th att-table-header key="global-customer-id">Global Customer ID</th>
12                                     <th att-table-header key="subscriber-name">Subscriber Name</th>        
13                                     <th att-table-header key="service-type">Service Type</th>    
14                                     <th att-table-header key="service-instance-id">Service Instance ID</th>
15                                 </tr>
16                             </thead>
17                             <tbody att-table-row type="body" row-repeat="disData in displayData">
18                                 <tr>
19                                 <td att-table-body>
20                                  <div ng-controller="viewEditSubController">
21                       <a href="#" ng-click="postsubscriberID(disData.subscriberName)" alt="View/Edit">
22                              View/Edit
23                           </a>
24                    </div>
25                    </td>
26                                 <td att-table-body >{{disData.globalCustomerId}}</td>
27                                 <td att-table-body >{{disData.subscriberName}}</td>
28                                 <td att-table-body >{{disData.serviceType}}</td>
29                                 <td att-table-body >{{disData.serviceInstanceId}}</td>
30                                 </tr>     
31                             </tbody>      
32                         </table> 
33                 </div>
34         </div>  
35         <table><tr>
36         <td>
37         <div ng-controller="searchExistingSIController" align="left" >
38                 <button type="submit" ng-click="cancelSubDetails();" att-button
39                         btn-type="primary" size="small">Cancel</button>
40         </div>
41         </td></tr>
42         
43         </table>
44         
45 </div>
46 <!--  Temporary solution for footer overlapping the men after talking to EComp SDK developer on 06/25/2016 -->
47
48 <br>
49 <br>
50 <br>
51 <br>
52 <br>
53 <br>
54 <br>
55 <br>
56 <br>
57 <br>
58 <br>
59 <br>
60 <br>
61 <br>
62 <br>
63                 
64 <script>
65 app.controller("subscriberDetailsController", function ($scope,$http,modalService, $modal) { 
66         $scope.tableData=${model.customerInfo};
67         $scope.displayData= [];
68         $scope.subscriberData=[];
69         $scope.serviceInstanceData= new Array();
70         $scope.globalcustomerid = $scope.tableData['global-customer-id'];
71         $scope.subscriberName = $scope.tableData['subscriber-name'];
72         $scope.subscriberData = $scope.tableData['service-subscriptions'];
73            
74          $scope.setDisplaynoSTSI = function(){
75          $scope.displayData.push({
76                                 globalCustomerId : $scope.globalcustomerid,
77                             subscriberName   :  $scope.subscriberName,
78                             serviceType : "No Service Subscription Found",
79                             serviceInstanceId : "No Service Instance Found"
80                         });
81      }
82          
83          $scope.setDisplaynoSI = function(servcType){
84          $scope.displayData.push({
85                                 globalCustomerId : $scope.globalcustomerid,
86                             subscriberName   :  $scope.subscriberName,
87                             serviceType : servcType,
88                             serviceInstanceId : "No Service Instance Found"
89                         });
90      }
91          
92         if ($scope.subscriberData != null)
93                 {
94                     if ($scope.numberofSubscribers = $scope.subscriberData['service-subscription'] != null)
95                         {
96                                         $scope.numberofSubscribers = $scope.subscriberData['service-subscription'].length;
97                                         if ($scope.numberofSubscribers > 0)
98                                                 {
99                                                     var index = 0;
100                                                         for(i=0; i < $scope.numberofSubscribers; i++) {
101                                                                 $scope.serviceInstanceData[i] = new Array();
102                                                                 var servicesubscription = $scope.subscriberData['service-subscription'][i]; 
103                                                                 $scope.serviceInstanceData[i] = servicesubscription['service-instances'];
104                                                                 if ($scope.serviceInstanceData[i] != null)
105                                                                         {
106                                                                             if ($scope.serviceInstanceData[i]['service-instance'] != null)
107                                                                                 {
108                                                                                                 var numberofserviceInstance = $scope.serviceInstanceData[i]['service-instance'].length;
109                                                                                                 if (numberofserviceInstance > 0)
110                                                                                                         {
111                                                                                                                 for(j=0; j < numberofserviceInstance; j++)
112                                                                                                                 {
113                                                                                                                         $scope.displayData.push({
114                                                                                                                                 globalCustomerId : $scope.globalcustomerid,
115                                                                                                                             subscriberName   :  $scope.subscriberName,
116                                                                                                                             serviceType : servicesubscription['service-type'],
117                                                                                                                             serviceInstanceId : $scope.serviceInstanceData[i]['service-instance'][j]['service-instance-id']
118                                                                                                                         });
119                                                                                                                 }
120                                                                                                         }
121                                                                                                 else
122                                                                                                         {
123                                                                                                            $scope.setDisplaynoSI(servicesubscription['service-type']);
124                                                                                                         }
125                                                                                 }
126                                                                             else
127                                                                                 {
128                                                                                 $scope.setDisplaynoSI(servicesubscription['service-type']);
129                                                                                 }
130                                                                         }
131                                                                 else
132                                                                         {
133                                                                            $scope.setDisplaynoSI(servicesubscription['service-type']);
134                                                                         }
135                                                 }
136                                                 }
137                                         else
138                                                 {
139                                                   $scope.setDisplaynoSTSI();
140                                                 }
141                         }
142                     else
143                                 {
144                            $scope.setDisplaynoSTSI();
145                                 }
146                         }
147                 else
148                 {
149                          $scope.setDisplaynoSTSI();
150                 }
151         
152         
153 });
154
155 app.controller('viewEditSubController',['$scope','$http',function ($scope,$http) { 
156         
157         $scope.postsubscriberID = function(subID){
158                    $.ajax({
159                             url: "vieweditsub/subedit?"+"subscriberID="+encodeURIComponent(subID),
160                         type : "POST",
161                         success:function (response){
162                             window.location.href = 'instantiate.htm';
163                         },
164                         error:function( jqXHR, status,error ){
165                                 $("#errorInfo").show();
166                         }
167                         
168                 });
169                 }
170         
171 }]);
172
173 app.controller('searchExistingSIController',['$scope','$http',function ($scope,$http) { 
174         
175         $scope.cancelSubDetails = function(selectedSubscriber){
176                 
177                 window.location.href = 'searchexistingsi.htm';
178                 
179         }
180         
181 }]);
182 </script>
183
184