blob: efc81afe8e4024ca7975f8406c9f07b080b6799d [file] [log] [blame]
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05001<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8" />
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <% include ../partials/head %>
7 <% include ../partials/header %>
8 <script type="text/javascript" src="/javascripts/admportal.js" async></script>
9 <title>SDN-C AdminPortal</title>
10<script class="init">
11 $(document).ready(function() {
12 $('#metroRoadmServiceRequest').DataTable( {
13 "order": [[ 0, "asc" ]]
14 } );
15} );
16</script>
17
18</head>
19<body>
20
21<div class="well well-sm">
22<h3>Metro ROADM Service Request</h3>
23</div>
24
25<% if ( typeof result != 'undefined' ) {
26 if (result.code.length > 0) {
27 if ( result.code == 'success' ) { %>
28 <div class='alert alert-success' role='alert'>
29 <%
30 for ( x in result.msg ){ %>
31 <div><%= result.msg[x] %></div>
32 <% } %>
33 </div>
34 <% } else { %>
35 <div class='alert alert-danger' role='danger'>
36 <%
37 for ( x in result.msg ){ %>
38 <div><%= result.msg[x] %></div>
39 <% } %>
40 </div>
41 <% } %>
42 <% } %>
43<% } %>
44
45<% if( typeof privilege != 'undefined'){
46 var priv = privilege.privilege;
47} else {
48 var priv = 'A';
49} %>
50
51
52<div class="container-fluid">
53
54 <!--
55 <% if(priv == 'A'){ %>
56 <div class="actions" style="padding:15px 0px;">
57 <button class="btn btn-primary" data-toggle="modal" data-target="#add_metroroadm_service_request">
58 Add Metro ROADM Serice Request
59 </button>
60 </div>
61 <% } %>
62 -->
63
64 <table id="metroRoadmServiceRequest" class="table table-hover table-condensed">
65 <thead>
66 <tr>
67 <th>ReqId</th>
68 <th>ReqSource</th>
69 <th>NotificationURL</th>
70 <th>Action</th>
71 <th>ReqTimestamp</th>
72 <th>UpdateTimestamp</th>
73 <th>ReqStatus</th>
74 <th>ProcStatus</th>
75 <th>ReasonCode</th>
76 <th>ReasonMsg</th>
77 <th>ServiceId</th>
78 <th>CommonId</th>
79 <th>Clli_A</th>
80 <th>Clli_Z</th>
81 <th>Customer</th>
82 <th>ControllerId</th>
83 <% if(priv == 'A'){ %>
84 <th>Action</th>
85 <% } %>
86 </tr>
87 </thead>
88 <tbody>
89 <% rows.forEach( function(row) { %>
90 <tr>
91 <td><%= row.request_id %></td>
92 <td><%= row.request_source %></td>
93 <td><%= row.notification_url %></td>
94 <td><%= row.action %></td>
95 <td><%= row.request_timestamp %></td>
96 <td><%= row.update_timestamp %></td>
97 <td><%= row.request_status %></td>
98 <td><%= row.processing_status %></td>
99 <td><%= row.reason_code %></td>
100 <td><%= row.reason_message %></td>
101 <td><%= row.service_id %></td>
102 <td><%= row.common_id %></td>
103 <td><%= row.clli_a %></td>
104 <td><%= row.clli_z %></td>
105 <td><%= row.customer %></td>
106 <td><%= row.controller_id %></td>
107 <% if(priv == 'A') { %>
108 <td>
109 <button type="button" class="btn btn-default btn-xs"
110 onclick="updateMetroRoadmServiceRequest('<%=row.request_id %>','<%= row.request_source %>',
111 '<%=row.notification_url %>','<%= row.action %>','<%= row.request_timestamp %>',
112 '<%= row.update_timestamp %>','<%= row.request_status %>', '<%= row.processing_status %>',
113 '<%= row.reason_code %>', '<%= row.reason_message %>','<%= row.service_id %>',
114 '<%= row.common_id %>','<%= row.clli_a %>', '<%= row.clli_z %>','<%= row.customer %>',
115 '<%= row.controller_id %>');">Update</button>
116 <button type="button" class="btn btn-default btn-xs"
117 onclick="deleteMetroRoadmServiceRequest('<%= row.request_id %>');">Delete</button>
118 </td>
119 <% } %>
120 </tr>
121 <% }); %>
122 </tbody>
123 </table>
124</div>
125
126<% include ../partials/metroroadm_service_request %>
127<footer>
128 <% include ../partials/footer %>
129</footer>
130
131<script type="text/javascript">
132function submitMetroRoadmServiceRequest(form)
133{
134 var errorMsg='';
135 var request_id='';
136 var request_source = '';
137 var notification_url = '';
138 var action = '';
139 var request_timestamp = '';
140 var update_timestamp = '';
141 var request_status = '';
142 var processing_status = '';
143 var reason_code = '';
144 var reason_message = '';
145 var service_id = '';
146 var common_id = '';
147 var clli_a = '';
148 var clli_z = '';
149 var customer = '';
150 var controller_id = '';
151
152 if ( form.name == 'addForm' )
153 {
154 request_id = form.nf_request_id;
155 request_source = form.nf_request_source;
156 notification_url = form.nf_notification_url;
157 action = form.nf_l_action;
158 request_timestamp = form.nf_request_timestamp;
159 update_timestamp = form.nf_update_timestamp;
160 request_status = form.nf_request_status;
161 processing_status = form.nf_processing_status;
162 reason_code = form.nf_reason_code;
163 reason_message = form.nf_reason_message;
164 service_id = form.nf_service_id;
165 common_id = form.nf_common_id;
166 clli_a = form.nf_clli_a;
167 clli_z = form.nf_clli_z;
168 customer = form.nf_customer;
169 controller_id = form.nf_controller_id;
170 }
171 else
172 {
173 request_id = form.uf_request_id;
174 request_source = form.uf_request_source;
175 notification_url = form.uf_notification_url;
176 action = form.uf_l_action;
177 request_timestamp = form.uf_request_timestamp;
178 update_timestamp = form.uf_update_timestamp;
179 request_status = form.uf_request_status;
180 processing_status = form.uf_processing_status;
181 reason_code = form.uf_reason_code;
182 reason_message = form.uf_reason_message;
183 service_id = form.uf_service_id;
184 common_id = form.uf_common_id;
185 clli_a = form.uf_clli_a;
186 clli_z = form.uf_clli_z;
187 customer = form.uf_customer;
188 controller_id = form.uf_controller_id;
189 }
190 if ( (request_id.value == null) || (request_id.value == "") || isblank(request_id.value) )
191 {
192 errorMsg += 'Request Id is required.\n';
193 }
194 if ( (action.value == null) || (action.value == "") || isblank(action.value) )
195 {
196 errorMsg += 'Action is required.\n';
197 }
198 if ( (request_timestamp.value == null) || (request_timestamp.value == "") || isblank(request_timestamp.value) )
199 {
200 errorMsg += 'Request Timestamp is required.\n';
201 }
202 if ( (request_status.value == null) || (request_status.value == "") || isblank(request_status.value) )
203 {
204 errorMsg += 'Request Status is required.\n';
205 }
206 if ( (processing_status.value == null) || (processing_status.value == "") || isblank(processing_status.value) )
207 {
208 errorMsg += 'Processing Status is required.\n';
209 }
210 if ( (service_id.value == null) || (service_id.value == "") || isblank(service_id.value) )
211 {
212 errorMsg += 'Service Id is required.\n';
213 }
214 if ( (controller_id.value == null) || (controller_id.value == "") || isblank(controller_id.value) )
215 {
216 errorMsg += 'Controller Id is required.\n';
217 }
218 if( errorMsg.length > 0 ) {
219 alert(errorMsg);
220 return;
221 }
222
223 // edit request_timestamp, update_timestamp
224 if (!isValid(request_timestamp.value)){
225 alert('Request Timestamp must be in format YYYY-MM-DD HH:MM:SS');
226 return;
227 }
228 if ( update_timestamp.length > 0 )
229 {
230 if (!isValid(update_timestamp.value)){
231 alert('Update Timestamp must be in format YYYY-MM-DD HH:MM:SS');
232 return;
233 }
234 }
235 form.submit();
236}
237
238function isValid(dateString) {
239 if (dateString == '0000-00-00 00:00:00'){
240 return(true);
241 }
242 var minDate = new Date('1970-01-01 00:00:01');
243 var maxDate = new Date('2038-01-19 03:14:07');
244 var date = new Date(dateString);
245 return date > minDate && date < maxDate;
246}
247
248function updateMetroRoadmServiceRequest(request_id,request_source,notification_url,action,request_timestamp,update_timestamp,
249 request_status,processing_status,reason_code,reason_message,service_id,common_id,clli_a,clli_z,customer,controller_id) {
250
251 document.getElementById('uf_request_id').value=request_id;
252 document.getElementById('uf_key_request_id').value=request_id;
253 document.getElementById('uf_request_source').value=request_source;
254 document.getElementById('uf_notification_url').value=notification_url;
255 document.getElementById('uf_l_action').value=action;
256 document.getElementById('uf_request_timestamp').value=request_timestamp;
257 document.getElementById('uf_update_timestamp').value=update_timestamp;
258 document.getElementById('uf_request_status').value=request_status;
259 document.getElementById('uf_processing_status').value=processing_status;
260 document.getElementById('uf_reason_code').value=reason_code;
261 document.getElementById('uf_reason_message').value=reason_message;
262 document.getElementById('uf_service_id').value=service_id;
263 document.getElementById('uf_common_id').value=common_id;
264 document.getElementById('uf_clli_a').value=clli_a;
265 document.getElementById('uf_clli_z').value=clli_z;
266 document.getElementById('uf_customer').value=customer;
267 document.getElementById('uf_controller_id').value=controller_id;
268
269 $('#update_metroroadm_service_request').modal('show');
270}
271
272function deleteMetroRoadmServiceRequest(request_id) {
273
274 var url_string = encodeURI("/tunnel/deleteMetroRoadmServiceRequest?request_id=" + request_id );
275
276 bootbox.confirm({
277 message: "Are you sure you want to delete Metro ROADM Service Request? " + request_id,
278 callback: function(result) {
279 if ( result )
280 {
281 location.assign(url_string);
282 }
283 return;
284 },
285 buttons: {
286 cancel: {
287 label: "Cancel"
288 },
289 confirm: {
290 label: "Yes"
291 }
292 }
293 });
294}
295
296</script>
297
298</body>
299</html>
300