From 4974192b2153fc3dda874ce9466ad98aabe1ced7 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Wed, 29 Mar 2023 17:02:31 +0300 Subject: [PATCH] feat: navigate from chat to orders --- .../direct-messages/direct-messages.html | 16 +++++++++++++++- .../direct-messages/direct-messages.js | 3 +++ static/components/order-list/order-list.js | 11 ++++++++++- static/js/index.js | 4 ++++ templates/nostrmarket/index.html | 3 ++- 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/static/components/direct-messages/direct-messages.html b/static/components/direct-messages/direct-messages.html index 409ea3a..7a91447 100644 --- a/static/components/direct-messages/direct-messages.html +++ b/static/components/direct-messages/direct-messages.html @@ -1,7 +1,21 @@
-
Messages
+
+
+
Messages
+
+
+ Client Orders +
+
diff --git a/static/components/direct-messages/direct-messages.js b/static/components/direct-messages/direct-messages.js index ba965c5..2542ffa 100644 --- a/static/components/direct-messages/direct-messages.js +++ b/static/components/direct-messages/direct-messages.js @@ -81,6 +81,9 @@ async function directMessages(path) { LNbits.utils.notifyApiError(error) } }, + showClientOrders: function () { + this.$emit('customer-selected', this.activePublicKey) + }, selectActiveCustomer: async function () { await this.getDirectMessages(this.activePublicKey) }, diff --git a/static/components/order-list/order-list.js b/static/components/order-list/order-list.js index e40c7ef..ae50fc0 100644 --- a/static/components/order-list/order-list.js +++ b/static/components/order-list/order-list.js @@ -2,9 +2,18 @@ async function orderList(path) { const template = await loadTemplateAsync(path) Vue.component('order-list', { name: 'order-list', - props: ['stall-id', 'adminkey', 'inkey'], + props: ['stall-id', 'customer-pubkey-filter', 'adminkey', 'inkey'], template, + watch: { + customerPubkeyFilter: async function (n) { + this.search.publicKey = n + this.search.isPaid = {label: 'All', id: null} + this.search.isShipped = {label: 'All', id: null} + await this.getOrders() + } + }, + data: function () { return { orders: [], diff --git a/static/js/index.js b/static/js/index.js index 5d572b9..8b8b882 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -21,6 +21,7 @@ const merchant = async () => { merchant: {}, shippingZones: [], activeChatCustomer: '', + orderPubkey: null, showKeys: false, importKeyDialog: { show: false, @@ -103,6 +104,9 @@ const merchant = async () => { customerSelectedForOrder: function (customerPubkey) { this.activeChatCustomer = customerPubkey }, + filterOrdersForCustomer: function (customerPubkey) { + this.orderPubkey = customerPubkey + }, waitForNotifications: function () { try { const scheme = location.protocol === 'http:' ? 'ws' : 'wss' diff --git a/templates/nostrmarket/index.html b/templates/nostrmarket/index.html index 74e9af8..b9b8a82 100644 --- a/templates/nostrmarket/index.html +++ b/templates/nostrmarket/index.html @@ -66,6 +66,7 @@
@@ -149,8 +150,8 @@ :inkey="g.user.wallets[0].inkey" :adminkey="g.user.wallets[0].adminkey" :active-chat-customer="activeChatCustomer" + @customer-selected="filterOrdersForCustomer" > -