This commit is contained in:
ben 2022-08-27 17:26:17 +01:00
parent 5ba624761c
commit 20dbd879b1

View file

@ -9,6 +9,7 @@ const mapCards = obj => {
return obj return obj
} }
new Vue({ new Vue({
el: '#vue', el: '#vue',
mixins: [windowMixin], mixins: [windowMixin],
@ -18,7 +19,6 @@ new Vue({
cards: [], cards: [],
hits: [], hits: [],
refunds: [], refunds: [],
lnurlLink: location.hostname + '/boltcards/api/v1/scan/',
cardDialog: { cardDialog: {
show: false, show: false,
data: { data: {
@ -44,10 +44,10 @@ new Vue({
field: 'counter' field: 'counter'
}, },
{ {
name: 'uid', name: 'withdraw',
align: 'left', align: 'left',
label: 'Card ID', label: 'Withdraw ID',
field: 'uid' field: 'withdraw'
} }
], ],
pagination: { pagination: {
@ -66,7 +66,7 @@ new Vue({
name: 'refund_amount', name: 'refund_amount',
align: 'left', align: 'left',
label: 'Refund Amount', label: 'Refund Amount',
field: 'oldrefund_amount_ctr' field: 'refund_amount'
}, },
{ {
name: 'time', name: 'time',
@ -140,13 +140,12 @@ new Vue({
.request( .request(
'GET', 'GET',
'/boltcards/api/v1/cards?all_wallets=true', '/boltcards/api/v1/cards?all_wallets=true',
this.g.user.wallets[0].adminkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.cards = response.data.map(function (obj) { self.cards = response.data.map(function (obj) {
return mapCards(obj) return mapCards(obj)
}) })
console.log(self.cards)
}) })
}, },
getHits: function () { getHits: function () {
@ -162,7 +161,6 @@ new Vue({
obj.card_name = self.cards.find(d => d.id == obj.card_id).card_name obj.card_name = self.cards.find(d => d.id == obj.card_id).card_name
return mapCards(obj) return mapCards(obj)
}) })
console.log(self.hits)
}) })
}, },
getRefunds: function () { getRefunds: function () {
@ -175,10 +173,8 @@ new Vue({
) )
.then(function (response) { .then(function (response) {
self.refunds = response.data.map(function (obj) { self.refunds = response.data.map(function (obj) {
obj.card_name = self.cards.find(d => d.id == obj.card_id).card_name
return mapCards(obj) return mapCards(obj)
}) })
console.log(self.hits)
}) })
}, },
openQrCodeDialog(cardId) { openQrCodeDialog(cardId) {
@ -252,7 +248,6 @@ new Vue({
}, },
updateCardDialog: function (formId) { updateCardDialog: function (formId) {
var card = _.findWhere(this.cards, {id: formId}) var card = _.findWhere(this.cards, {id: formId})
console.log(card.id)
this.cardDialog.data = _.clone(card) this.cardDialog.data = _.clone(card)
this.cardDialog.temp.k0 = this.cardDialog.data.k0 this.cardDialog.temp.k0 = this.cardDialog.data.k0
@ -274,8 +269,6 @@ new Vue({
data.prev_k2 = this.cardDialog.temp.k2 data.prev_k2 = this.cardDialog.temp.k2
} }
console.log(data)
LNbits.api LNbits.api
.request( .request(
'PUT', 'PUT',
@ -320,7 +313,13 @@ new Vue({
}, },
exportCardsCSV: function () { exportCardsCSV: function () {
LNbits.utils.exportCSV(this.cardsTable.columns, this.cards) LNbits.utils.exportCSV(this.cardsTable.columns, this.cards)
} },
exportHitsCSV: function () {
LNbits.utils.exportCSV(this.hitsTable.columns, this.hits)
},
exportRefundsCSV: function () {
LNbits.utils.exportCSV(this.refundsTable.columns, this.refunds)
},
}, },
created: function () { created: function () {
if (this.g.user.wallets.length) { if (this.g.user.wallets.length) {