feat: show order details for customer
This commit is contained in:
parent
e6f2750272
commit
1a82fc030a
6 changed files with 27 additions and 13 deletions
|
|
@ -45,20 +45,22 @@
|
||||||
<div v-if="dm.isJson">
|
<div v-if="dm.isJson">
|
||||||
<div v-if="dm.message.type === 0">
|
<div v-if="dm.message.type === 0">
|
||||||
<strong>New order:</strong>
|
<strong>New order:</strong>
|
||||||
<span v-text="dm.message.id"></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="dm.message.type === 1">
|
<div v-else-if="dm.message.type === 1">
|
||||||
<strong>Invoice sent for order: </strong>
|
<strong>Invoice sent for order: </strong>
|
||||||
<span v-text="dm.message.id"></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="dm.message.type === 2">
|
<div v-else-if="dm.message.type === 2">
|
||||||
<q-badge v-if="dm.message.paid" color="green">Paid </q-badge>
|
<q-badge v-if="dm.message.paid" color="green">Paid </q-badge>
|
||||||
<q-badge v-if="dm.message.shipped" color="green">Shipped </q-badge>
|
<q-badge v-if="dm.message.shipped" color="green">Shipped </q-badge>
|
||||||
<span v-text="dm.message.message"></span><br>
|
<span v-text="dm.message.message"></span><br>
|
||||||
<span v-text="dm.message.id"></span>
|
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span v-text="dm.message.id" @click="showOrderDetails(dm.message.id)"
|
||||||
|
class="cursor-pointer"></span>
|
||||||
</div>
|
</div>
|
||||||
<q-badge @click="showMessageRawData(index)" class="cursor-pointer">...</q-badge>
|
<q-badge @click="showMessageRawData(index)" class="cursor-pointer">...</q-badge>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</q-chat-message>
|
</q-chat-message>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -89,11 +91,11 @@
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
<q-dialog v-model="showRawMessage" position="top">
|
<q-dialog v-model="showRawMessage" position="top">
|
||||||
<q-card class="q-pa-lg q-pt-xl" style="width: 500px">
|
<q-card class="q-pa-lg q-pt-xl" style="width: 500px">
|
||||||
<q-input filled dense type="textarea" rows="20" v-model.trim="rawMessage" label="Raw Data"></q-input>
|
<q-input filled dense type="textarea" rows="20" v-model.trim="rawMessage" label="Raw Data"></q-input>
|
||||||
<div class="row q-mt-lg">
|
<div class="row q-mt-lg">
|
||||||
|
|
||||||
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn>
|
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
</q-form>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,9 @@ async function directMessages(path) {
|
||||||
}
|
}
|
||||||
this.getCustomersDebounced()
|
this.getCustomersDebounced()
|
||||||
},
|
},
|
||||||
|
showOrderDetails: function (orderId) {
|
||||||
|
this.$emit('order-selected', orderId)
|
||||||
|
},
|
||||||
showClientOrders: function () {
|
showClientOrders: function () {
|
||||||
this.$emit('customer-selected', this.activePublicKey)
|
this.$emit('customer-selected', this.activePublicKey)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,6 @@ async function orderList(path) {
|
||||||
this.inkey
|
this.inkey
|
||||||
)
|
)
|
||||||
this.orders = data.map(s => ({ ...s, expanded: false }))
|
this.orders = data.map(s => ({ ...s, expanded: false }))
|
||||||
console.log("### this.orders", this.orders)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
|
|
@ -238,7 +237,13 @@ async function orderList(path) {
|
||||||
this.orders.unshift(order)
|
this.orders.unshift(order)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
orderSelected: async function (orderId) {
|
||||||
|
const order = await this.getOrder(orderId)
|
||||||
|
if (!order) return
|
||||||
|
order.expanded = true
|
||||||
|
order.isNew = false
|
||||||
|
this.orders = [order]
|
||||||
|
},
|
||||||
showShipOrderDialog: function (order) {
|
showShipOrderDialog: function (order) {
|
||||||
this.selectedOrder = order
|
this.selectedOrder = order
|
||||||
this.shippingMessage = order.shipped
|
this.shippingMessage = order.shipped
|
||||||
|
|
@ -274,7 +279,7 @@ async function orderList(path) {
|
||||||
)}`
|
)}`
|
||||||
return label
|
return label
|
||||||
},
|
},
|
||||||
orderPaid: function(orderId) {
|
orderPaid: function (orderId) {
|
||||||
const order = this.orders.find(o => o.id === orderId)
|
const order = this.orders.find(o => o.id === orderId)
|
||||||
if (order) {
|
if (order) {
|
||||||
order.paid = true
|
order.paid = true
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,9 @@ const merchant = async () => {
|
||||||
filterOrdersForCustomer: function (customerPubkey) {
|
filterOrdersForCustomer: function (customerPubkey) {
|
||||||
this.orderPubkey = customerPubkey
|
this.orderPubkey = customerPubkey
|
||||||
},
|
},
|
||||||
|
showOrderDetails: async function (orderId) {
|
||||||
|
await this.$refs.orderListRef.orderSelected(orderId)
|
||||||
|
},
|
||||||
waitForNotifications: async function () {
|
waitForNotifications: async function () {
|
||||||
if (!this.merchant) return
|
if (!this.merchant) return
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@
|
||||||
:active-chat-customer="activeChatCustomer"
|
:active-chat-customer="activeChatCustomer"
|
||||||
:merchant-id="merchant.id"
|
:merchant-id="merchant.id"
|
||||||
@customer-selected="filterOrdersForCustomer"
|
@customer-selected="filterOrdersForCustomer"
|
||||||
|
@order-selected="showOrderDetails"
|
||||||
>
|
>
|
||||||
</direct-messages>
|
</direct-messages>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ from typing import List, Optional
|
||||||
from fastapi import Depends
|
from fastapi import Depends
|
||||||
from fastapi.exceptions import HTTPException
|
from fastapi.exceptions import HTTPException
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from lnbits.core.services import websocketUpdater
|
|
||||||
|
|
||||||
|
from lnbits.core.services import websocketUpdater
|
||||||
from lnbits.decorators import (
|
from lnbits.decorators import (
|
||||||
WalletTypeInfo,
|
WalletTypeInfo,
|
||||||
check_admin,
|
check_admin,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue