From 5d523519c3add4c126bdd1300dbd1ec84705ee20 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 31 Aug 2020 00:09:29 -0300 Subject: [PATCH] bring back code mysteriously deleted in 79d5befe0ce4ea1745b74d68ac62bc95c3dbfb80 fixes https://github.com/lnbits/lnbits/issues/73 --- lnbits/extensions/withdraw/static/js/index.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/lnbits/extensions/withdraw/static/js/index.js b/lnbits/extensions/withdraw/static/js/index.js index 70f3992b..8aa2f78a 100644 --- a/lnbits/extensions/withdraw/static/js/index.js +++ b/lnbits/extensions/withdraw/static/js/index.js @@ -59,6 +59,15 @@ new Vue({ is_unique: false } }, + simpleformDialog: { + show: false, + data: { + is_unique: false, + title: 'Vouchers', + min_withdrawable: 0, + wait_time: 1 + } + }, qrCodeDialog: { show: false, data: null @@ -97,9 +106,17 @@ new Vue({ is_unique: false } }, + simplecloseFormDialog: function () { + this.simpleformDialog.data = { + is_unique: false + } + }, openQrCodeDialog: function (linkId) { var link = _.findWhere(this.withdrawLinks, {id: linkId}) + this.qrCodeDialog.data = _.clone(link) + console.log(this.qrCodeDialog.data) + this.qrCodeDialog.data.url = window.location.hostname this.qrCodeDialog.show = true }, openUpdateDialog: function (linkId) { @@ -127,6 +144,23 @@ new Vue({ this.createWithdrawLink(wallet, data) } }, + simplesendFormData: function () { + var wallet = _.findWhere(this.g.user.wallets, { + id: this.simpleformDialog.data.wallet + }) + var data = _.omit(this.simpleformDialog.data, 'wallet') + + data.wait_time = 1 + data.min_withdrawable = data.max_withdrawable + data.title = 'vouchers' + data.is_unique = true + + if (data.id) { + this.updateWithdrawLink(wallet, data) + } else { + this.createWithdrawLink(wallet, data) + } + }, updateWithdrawLink: function (wallet, data) { var self = this @@ -164,6 +198,7 @@ new Vue({ .then(function (response) { self.withdrawLinks.push(mapWithdrawLink(response.data)) self.formDialog.show = false + self.simpleformDialog.show = false }) .catch(function (error) { LNbits.utils.notifyApiError(error)