diff --git a/custom/js/helper.js b/custom/js/helper.js
index 6ce7f60..9dff4ee 100644
--- a/custom/js/helper.js
+++ b/custom/js/helper.js
@@ -24,11 +24,15 @@ function renderClientList(data) {
+
+
+
+
+
+
+
+
+
+
![QR code]()
+
+
+
+
+
+
@@ -275,7 +293,7 @@ Wireguard Clients
// Edit client modal event
$(document).ready(function () {
- $("#modal_edit_client").on('shown.bs.modal', function (event) {
+ $("#modal_edit_client").on('show.bs.modal', function (event) {
let modal = $(this);
const button = $(event.relatedTarget);
const client_id = button.data('clientid');
@@ -415,7 +433,7 @@ Wireguard Clients
}
}
- $("#modal_email_client").on('shown.bs.modal', function (event) {
+ $("#modal_email_client").on('show.bs.modal', function (event) {
let modal = $(this);
const button = $(event.relatedTarget);
const client_id = button.data('clientid');
@@ -439,6 +457,31 @@ Wireguard Clients
});
});
+ $("#modal_qr_client").on('show.bs.modal', function (event) {
+ let modal = $(this);
+ const button = $(event.relatedTarget);
+ const client_id = button.data('clientid');
+ const QRCodeImg = modal.find("#qr_code");
+ QRCodeImg.hide();
+ $.ajax({
+ cache: false,
+ method: 'GET',
+ url: '/api/client/' + client_id,
+ dataType: 'json',
+ contentType: "application/json",
+ success: function (resp) {
+ const client = resp.Client;
+
+ modal.find(".modal-title").text("QR Code for " + client.name);
+ QRCodeImg.attr('src', resp.QRCode).show();
+ },
+ error: function (jqXHR, exception) {
+ const responseJson = jQuery.parseJSON(jqXHR.responseText);
+ toastr.error(responseJson['message']);
+ }
+ });
+ });
+
$(document).ready(function () {
$.validator.setDefaults({
submitHandler: function (form) {