add date to orders list
This commit is contained in:
parent
310cf50d5c
commit
bbc4bbfa31
2 changed files with 13 additions and 9 deletions
|
|
@ -71,7 +71,7 @@
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<q-card-section style="height: calc(100vh - 120px)">
|
<q-card-section>
|
||||||
<q-table
|
<q-table
|
||||||
title="Orders"
|
title="Orders"
|
||||||
:data="ordersList"
|
:data="ordersList"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ async function chatDialog(path) {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
dialog: false,
|
dialog: false,
|
||||||
isChat: false,
|
isChat: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
pool: null,
|
pool: null,
|
||||||
nostrMessages: [],
|
nostrMessages: [],
|
||||||
|
|
@ -22,6 +22,13 @@ async function chatDialog(path) {
|
||||||
label: 'ID',
|
label: 'ID',
|
||||||
field: 'id'
|
field: 'id'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'created_at',
|
||||||
|
align: 'left',
|
||||||
|
label: 'Created/Updated',
|
||||||
|
field: 'created_at',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'paid',
|
name: 'paid',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
@ -62,10 +69,9 @@ async function chatDialog(path) {
|
||||||
.reduce((acc, cur) => {
|
.reduce((acc, cur) => {
|
||||||
const obj = JSON.parse(cur.msg)
|
const obj = JSON.parse(cur.msg)
|
||||||
const key = obj.id
|
const key = obj.id
|
||||||
const curGroup = acc[key] ?? {}
|
const curGroup = acc[key] ?? {created_at: cur.timestamp}
|
||||||
return {...acc, [key]: {...curGroup, ...obj}}
|
return {...acc, [key]: {...curGroup, ...obj}}
|
||||||
}, {})
|
}, {})
|
||||||
console.log(orders)
|
|
||||||
return Object.values(orders)
|
return Object.values(orders)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -85,11 +91,11 @@ async function chatDialog(path) {
|
||||||
let sub = this.pool.sub(Array.from(this.relays), [
|
let sub = this.pool.sub(Array.from(this.relays), [
|
||||||
{
|
{
|
||||||
kinds: [4],
|
kinds: [4],
|
||||||
authors: [this.account.pubkey, this.merchant]
|
authors: [this.account.pubkey]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
kinds: [4],
|
kinds: [4],
|
||||||
'#p': [this.account.pubkey, this.merchant]
|
'#p': [this.account.pubkey]
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
sub.on('eose', () => {
|
sub.on('eose', () => {
|
||||||
|
|
@ -98,9 +104,7 @@ async function chatDialog(path) {
|
||||||
})
|
})
|
||||||
sub.on('event', async event => {
|
sub.on('event', async event => {
|
||||||
let mine = event.pubkey == this.account.pubkey
|
let mine = event.pubkey == this.account.pubkey
|
||||||
let sender = mine
|
let sender = mine ? this.merchant : event.pubkey
|
||||||
? event.tags.find(([k, v]) => k === 'p' && v && v !== '')[1]
|
|
||||||
: event.pubkey
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let plaintext
|
let plaintext
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue