| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8" /> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <% include ../partials/head %> |
| <% include ../partials/header %> |
| <script type="text/javascript" src="/javascripts/admportal.js" async></script> |
| <title>SDNC-MLC AdminPortal</title> |
| <script class="init"> |
| $(document).ready(function() { |
| $('#partner_properties').DataTable( { |
| "order": [[ 0, "asc" ]] |
| } ); |
| } ); |
| </script> |
| |
| </head> |
| <body> |
| |
| <div class="well well-sm"> |
| <h3>Partner Properties</h3> |
| </div> |
| |
| <% if ( typeof result != 'undefined' ) { |
| if (result.code.length > 0) { |
| if ( result.code == 'success' ) { %> |
| <div class='alert alert-success' role='alert'> |
| <% |
| for ( x in result.msg ){ %> |
| <div><%= result.msg[x] %></div> |
| <% } %> |
| </div> |
| <% } else { %> |
| <div class='alert alert-danger' role='danger'> |
| <% |
| for ( x in result.msg ){ %> |
| <div><%= result.msg[x] %></div> |
| <% } %> |
| </div> |
| <% } %> |
| <% } %> |
| <% } %> |
| |
| <% if( typeof privilege != 'undefined'){ |
| var priv = privilege.privilege; |
| } else { |
| var priv = 'A'; |
| } %> |
| |
| |
| <div class="container-fluid"> |
| |
| <% if(priv == 'A'){ %> |
| <div class="actions" style="padding:15px 0px;"> |
| <button class="btn btn-primary" data-toggle="modal" data-target="#add_partner_properties"> |
| Add Partner Properties |
| </button> |
| </div> |
| <% } %> |
| |
| <table id="partner_properties" class="table table-hover table-condensed"> |
| <thead> |
| <tr> |
| <th>*Partner</th> |
| <th>*Username</th> |
| <th>*Password</th> |
| <% if(priv == 'A'){ %> |
| <th>Action</th> |
| <% } %> |
| </tr> |
| </thead> |
| <tbody> |
| <% rows.forEach( function(row) { %> |
| <tr> |
| <td><%= row.partner %></td> |
| <td><%= row.auth_username %></td> |
| <td>*****</td> |
| <% if(priv == 'A') { %> |
| <td> |
| <button type="button" class="btn btn-default btn-xs" |
| onclick="updatePartnerProperties('<%= row.partner %>','<%= row.auth_username %>','<%= row.auth_password %>');">Update</button> |
| <button type="button" class="btn btn-default btn-xs" |
| onclick="deletePartnerProperties('<%= row.partner %>');">Delete</button> |
| </td> |
| <% } %> |
| |
| </tr> |
| <% }); %> |
| </tbody> |
| </table> |
| |
| </div> |
| |
| <% include ../partials/partner_properties %> |
| <footer> |
| <% include ../partials/footer %> |
| </footer> |
| |
| <script type="text/javascript"> |
| function submitPartnerProperties(form) |
| { |
| var errorMsg=''; |
| var partner = ''; |
| var auth_username = ''; |
| var auth_password = ''; |
| var confirm_auth_password = ''; |
| |
| if ( form.name == 'addForm' ) |
| { |
| partner = form.nf_partner; |
| auth_username = form.nf_auth_username; |
| auth_password = form.nf_auth_password; |
| confirm_auth_password = form.nf_confirm_auth_password; |
| |
| if ( (partner.value == null) || (partner.value == "") || isblank(partner.value) ) |
| { |
| errorMsg += 'Partner is required.<br>'; |
| } |
| if( errorMsg.length > 0 ) { |
| bootbox.alert(errorMsg); |
| return; |
| } |
| if ( auth_password.value != confirm_auth_password.value ) |
| { |
| bootbox.alert('Passwords do not match.'); |
| return; |
| } |
| } |
| else |
| { |
| partner = form.uf_partner; |
| auth_username = form.uf_auth_username; |
| auth_password = form.uf_auth_password; |
| confirm_auth_password = form.uf_confirm_auth_password; |
| if ( auth_password.value != confirm_auth_password.value ) |
| { |
| bootbox.alert('Passwords do not match.'); |
| return; |
| } |
| } |
| form.submit(); |
| } |
| |
| function updatePartnerProperties(partner,auth_username,auth_password) { |
| |
| document.getElementById('uf_partner').value=partner; |
| document.getElementById('uf_key_partner').value=partner; |
| document.getElementById('uf_auth_username').value=auth_username; |
| document.getElementById('uf_auth_password').value=auth_password; |
| document.getElementById('uf_confirm_auth_password').value=auth_password; |
| |
| $('#update_partner_properties').modal('show'); |
| } |
| |
| function deletePartnerProperties(partner) { |
| |
| var url_string = encodeURI("/tunnel/deletePartnerProperties?partner=" + partner); |
| |
| bootbox.confirm({ |
| message: "Are you sure you want to delete Partner Property [ " + partner + " ]", |
| callback: function(result) { |
| if ( result ) |
| { |
| location.assign(url_string); |
| } |
| return; |
| }, |
| buttons: { |
| cancel: { |
| label: "Cancel" |
| }, |
| confirm: { |
| label: "Yes" |
| } |
| } |
| }); |
| } |
| |
| </script> |
| |
| </body> |
| </html> |
| |