some cleanup

This commit is contained in:
Tiago Vasconcelos 2022-10-25 11:57:01 +01:00
parent 4dcb8d2ca0
commit 227eaeae75
2 changed files with 15 additions and 23 deletions

View file

@ -580,6 +580,7 @@
<q-tr :props="props"> <q-tr :props="props">
<q-td auto-width> <q-td auto-width>
<q-btn <q-btn
disabled
unelevated unelevated
dense dense
size="xs" size="xs"
@ -670,7 +671,7 @@
:href="'/diagonalley/stalls/' + props.row.id" :href="'/diagonalley/stalls/' + props.row.id"
target="_blank" target="_blank"
></q-btn> ></q-btn>
<q-tooltip> Link to pass to stall relay </q-tooltip> <q-tooltip> Stall simple UI shopping cart </q-tooltip>
</q-td> </q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
{{ col.value }} {{ col.value }}
@ -1952,17 +1953,22 @@
}) })
}) })
}, },
shipOrder: function (order_id) { shipOrder(order_id){
var self = this
LNbits.api LNbits.api
.request( .request(
'GET', 'GET',
'/diagonalley/api/v1/orders/shipped/' + order_id, '/diagonalley/api/v1/orders/shipped/' + order_id,
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then((response) => {
self.orders.push(mapOrders(response.data)) console.log(response.data)
this.orders = _.reject(this.orders, (obj) => {
return obj.id == order_id
})
this.orders.push(mapOrders(response.data))
})
.catch((error) => {
LNbits.utils.notifyApiError(error)
}) })
}, },
exportOrdersCSV: function () { exportOrdersCSV: function () {
@ -1999,7 +2005,7 @@
] ]
} }
} }
console.log({chat}) //console.log({chat})
this.$q.localStorage.set(`lnbits.diagonalley.${this.g.user.id}`, { this.$q.localStorage.set(`lnbits.diagonalley.${this.g.user.id}`, {
...data, ...data,
chat chat
@ -2014,28 +2020,16 @@
let idx = this.orders.findIndex(f => f.invoiceid == key) let idx = this.orders.findIndex(f => f.invoiceid == key)
if (!lastMsgs[key]) { if (!lastMsgs[key]) {
this.updateLastSeenMsg(key) this.updateLastSeenMsg(key)
//this.orders[idx].unread = true
return return
} }
console.log(
'Key',
key,
'saved:',
lastMsgs[key].timestamp,
'messages: ',
Math.max(...this.messages[key].map(c => c.timestamp)),
lastMsgs[key].timestamp <
Math.max(...this.messages[key].map(c => c.timestamp))
)
if ( if (
lastMsgs[key].timestamp < lastMsgs[key].timestamp <
Math.max(...this.messages[key].map(c => c.timestamp)) Math.max(...this.messages[key].map(c => c.timestamp))
) { ) {
this.$set(this.orders[idx], 'unread', true) this.$set(this.orders[idx], 'unread', true)
// this.orders[idx].unread = true
} else { } else {
this.$set(this.orders[idx], 'unread', false) this.$set(this.orders[idx], 'unread', false)
// this.orders[idx].unread = false
} }
console.log('Order:', this.orders[idx]) console.log('Order:', this.orders[idx])
} }

View file

@ -286,8 +286,6 @@ async def api_diagonalley_order_create(data: createOrder):
"payment_request": payment_request, "payment_request": payment_request,
"order_reference": ref, "order_reference": ref,
} }
# order = await create_diagonalley_order(wallet_id=wallet.wallet.id, data=data)
# return order.dict()
@diagonalley_ext.get("/api/v1/orders/payments/{payment_hash}") @diagonalley_ext.get("/api/v1/orders/payments/{payment_hash}")
@ -352,7 +350,7 @@ async def api_diagonalley_order_shipped(
"SELECT * FROM diagonalley.orders WHERE id = ?", (order_id,) "SELECT * FROM diagonalley.orders WHERE id = ?", (order_id,)
) )
return [order.dict() for order in get_diagonalley_orders(order["wallet"])] return order
###List products based on stall id ###List products based on stall id