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>
11 $(document).ready(function() {
12 $('#metroRoadmServiceRequest').DataTable( {
13 "order": [[ 0, "asc" ]]
21 <div class="well well-sm">
22 <h3>Metro ROADM Service Request</h3>
25 <% if ( typeof result != 'undefined' ) {
26 if (result.code.length > 0) {
27 if ( result.code == 'success' ) { %>
28 <div class='alert alert-success' role='alert'>
30 for ( x in result.msg ){ %>
31 <div><%= result.msg[x] %></div>
35 <div class='alert alert-danger' role='danger'>
37 for ( x in result.msg ){ %>
38 <div><%= result.msg[x] %></div>
45 <% if( typeof privilege != 'undefined'){
46 var priv = privilege.privilege;
52 <div class="container-fluid">
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
64 <table id="metroRoadmServiceRequest" class="table table-hover table-condensed">
69 <th>NotificationURL</th>
72 <th>UpdateTimestamp</th>
83 <% if(priv == 'A'){ %>
89 <% rows.forEach( function(row) { %>
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') { %>
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>
126 <% include ../partials/metroroadm_service_request %>
128 <% include ../partials/footer %>
131 <script type="text/javascript">
132 function submitMetroRoadmServiceRequest(form)
136 var request_source = '';
137 var notification_url = '';
139 var request_timestamp = '';
140 var update_timestamp = '';
141 var request_status = '';
142 var processing_status = '';
143 var reason_code = '';
144 var reason_message = '';
150 var controller_id = '';
152 if ( form.name == 'addForm' )
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;
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;
190 if ( (request_id.value == null) || (request_id.value == "") || isblank(request_id.value) )
192 errorMsg += 'Request Id is required.\n';
194 if ( (action.value == null) || (action.value == "") || isblank(action.value) )
196 errorMsg += 'Action is required.\n';
198 if ( (request_timestamp.value == null) || (request_timestamp.value == "") || isblank(request_timestamp.value) )
200 errorMsg += 'Request Timestamp is required.\n';
202 if ( (request_status.value == null) || (request_status.value == "") || isblank(request_status.value) )
204 errorMsg += 'Request Status is required.\n';
206 if ( (processing_status.value == null) || (processing_status.value == "") || isblank(processing_status.value) )
208 errorMsg += 'Processing Status is required.\n';
210 if ( (service_id.value == null) || (service_id.value == "") || isblank(service_id.value) )
212 errorMsg += 'Service Id is required.\n';
214 if ( (controller_id.value == null) || (controller_id.value == "") || isblank(controller_id.value) )
216 errorMsg += 'Controller Id is required.\n';
218 if( errorMsg.length > 0 ) {
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');
228 if ( update_timestamp.length > 0 )
230 if (!isValid(update_timestamp.value)){
231 alert('Update Timestamp must be in format YYYY-MM-DD HH:MM:SS');
238 function isValid(dateString) {
239 if (dateString == '0000-00-00 00:00:00'){
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;
248 function 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) {
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;
269 $('#update_metroroadm_service_request').modal('show');
272 function deleteMetroRoadmServiceRequest(request_id) {
274 var url_string = encodeURI("/tunnel/deleteMetroRoadmServiceRequest?request_id=" + request_id );
277 message: "Are you sure you want to delete Metro ROADM Service Request? " + request_id,
278 callback: function(result) {
281 location.assign(url_string);