org.onap migration
[vid.git] / epsdk-app-onap / src / main / webapp / WEB-INF / jsp / createnewserviceinstance.jsp
1 <script>
2 app.controller('createNewSIController',['$scope','$http',function ($scope,$http) { 
3         
4     $scope.searchCategory = "";
5     $scope.searchString = "";
6         $scope.tableData=[];
7         $scope.displayData=[];
8         $scope.selectedSubscriber = $scope.tableData[0]; 
9     $scope.selectedServiceType = "Select Service Type";
10         function escapeRegExp(str) {
11                 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|\&]/g, " ");
12         }
13         $scope.serviceTypes=["Select Service Type", "uCPE-VMS", "SDN-L3-BONDING", "SDN-ETHERNET-INTERNET"];
14         
15         $scope.getSubscribers = function(refresh){
16  
17                 var refreshTxt = 'refresh_subscribers';
18                 var getTxt = 'get_subscribers';
19                 var selectedTxt = getTxt;
20                 if (refresh)
21                         selectedTxt = refreshTxt;
22                 $http.get(selectedTxt).
23                         then(function(response){
24                                 var data = JSON.parse(response.data.result);
25                                 $scope.tableData = data['customer'];
26                                 $scope.initSubscriberList();
27                         })
28                         .catch(function(data,status){
29                         console.log("Error: " + status + " : " + data);                                         
30                         })
31                         .finally(function() {
32                                 
33                         });
34                 
35         }
36  
37
38         $scope.initSubscriberList = function () {
39                 //$scope.selectedSubscriber = $scope.selectedSubscriber['subscriber-name'] || $scope.tableData[0]['subscriber-name'];
40                 $scope.selectedSubscriber = 'Select Subscriber Name';
41         }
42         
43         $scope.initSrvcTypeList = function () {
44                 $scope.selectedServiceType = $scope.serviceTypes[0];  
45         }
46
47         $scope.getSubscriberDetails = function(selectedSubscriber){
48                 if (selectedSubscriber == 'Select Subscriber Name')
49                         return;
50                 $http.get('createsubscriber/' + encodeURIComponent(selectedSubscriber)).
51                 then(function(response){
52                 //      window.location.href = 'createsubscriberdetails.htm';
53                 })
54                 .catch(function(data,status){
55                 console.log("Error: " + status + " : " + data);                                         
56                 })
57                 .finally(function() {
58                         
59                 });
60         }
61         
62         $scope.disableSubmitBtn = function (subName, svcType) {
63                 return (typeof subName === "undefined") && (svcType == 'Select Service Type');
64                 //return (subName == 'Select Subscriber Name') && (svcType == 'Select Service Type');
65         }
66         
67     $scope.cancelCreateSI = function(selectedSubscriber){
68                 
69                 window.location.href = 'welcome.htm';
70                 
71         }
72         
73         $scope.getSubscribers(false);
74         //$scope.initSubscriberList();
75         
76 }]);
77
78
79 </script>
80
81 <div ng-controller="createNewSIController">
82      
83      <h1 class="heading1"><center>Create New Service Instance</center></h1>
84         
85
86 <BR>
87  <table> <tr>
88    
89    <td width="5%" align="left">
90         <!--  <a ng-click="getSubscriberDetails(selectedSubscriber['global-customer-id']);" ng-disabled="disableSubmitBtn(selectedSubscriber['subscriber-name'], selectedServiceType);" ><img src="static/fusion/images/plus.png"></a>-->
91   <input type="image" ng-click="getSubscriberDetails(selectedSubscriber['global-customer-id']);" ng-disabled="disableSubmitBtn(selectedSubscriber['subscriber-name'], selectedServiceType);" src="static/fusion/images/plus.png"/>
92    </td>
93    
94         <td style="width:10%" align="left"><div class="fn-ebz-container">       
95                 <label  class="fn-ebz-text-label">Subscriber:</label>
96                 </div> </td>
97         <td style="width:30%"><div class="fn-ebz-container">
98                 <select  ng-model="selectedSubscriber"  ng-options="resultdata['subscriber-name'] for resultdata in tableData" required>
99                 <option value="">Select Subscriber Name</option>
100                 </select>
101         </div></td>
102          <td width="5%" align="left">
103                   <input type="image" ng-click="getSubscribers(true);" src="static/fusion/images/refresh.jpg"/>
104       </td>
105         
106         <td width="5%"> </td>
107 <td style="width:10%" align="left">
108
109     
110         <div class="fn-ebz-container">  
111                 <label  class="fn-ebz-text-label">Service Type:</label>
112         </div> </td>
113     <td style="width:32%"><div class="fn-ebz-container">
114                 <select  ng-model="selectedServiceType"  ng-options="sType for sType in serviceTypes" ng-init="initSrvcTypeList();" ></select>
115         </div> </td>
116         
117         <td width="5%"> </td>
118         
119     </tr>
120     </table>
121  
122         <center>
123                 <button type="cancel" ng-click="cancelCreateSI();" att-button size="small">Cancel</button>
124         </center>
125         
126
127
128 </div>
129 <!--  Temporary solution for footer overlapping the men after talking to EComp SDK developer on 06/16/2016 -->
130 <br>
131 <br>
132 <br>
133 <br>
134 <br>
135 <br>
136 <br>
137 <br>
138 <br>
139 <br>
140 <br>
141 <br>
142 <br>
143 <br>
144 <br>
145
146