feat: add merchant-details
This commit is contained in:
parent
69dcbcb002
commit
6c5299fe05
2 changed files with 85 additions and 0 deletions
37
static/components/merchant-details/merchant-details.html
Normal file
37
static/components/merchant-details/merchant-details.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<div>
|
||||
<q-btn-dropdown
|
||||
split
|
||||
unelevated
|
||||
color="primary"
|
||||
icon="storefront"
|
||||
label="Merchant"
|
||||
>
|
||||
<q-list>
|
||||
<q-item disable clickable v-close-popup>
|
||||
<q-item-section>
|
||||
<q-item-label>Merchant Profile</q-item-label>
|
||||
<q-item-label caption
|
||||
>Edit the merchand name, description, etc</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item @click="toggleMerchantKeys" clickable v-close-popup>
|
||||
<q-item-section>
|
||||
<q-item-label v-if="!showKeys">Show Keys</q-item-label>
|
||||
<q-item-label v-else>Hide Keys</q-item-label>
|
||||
<q-item-label caption
|
||||
>Show merchant public and private keys</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item @click="deleteMerchant" clickable v-close-popup>
|
||||
<q-item-section>
|
||||
<q-item-label>Delete Merchant</q-item-label>
|
||||
<q-item-label caption
|
||||
>Delete all stalls, products and orders</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list></q-btn-dropdown
|
||||
>
|
||||
</div>
|
||||
48
static/components/merchant-details/merchant-details.js
Normal file
48
static/components/merchant-details/merchant-details.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
async function merchantDetails(path) {
|
||||
const template = await loadTemplateAsync(path)
|
||||
Vue.component('merchant-details', {
|
||||
name: 'merchant-details',
|
||||
props: ['merchant-id', 'adminkey', 'inkey'],
|
||||
template,
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
showKeys: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleMerchantKeys: async function () {
|
||||
this.showKeys = !this.showKeys
|
||||
this.$emit('show-keys', this.showKeys)
|
||||
},
|
||||
deleteMerchant: function () {
|
||||
LNbits.utils
|
||||
.confirmDialog(
|
||||
`
|
||||
Stalls, products and orders will be deleted also!
|
||||
Are you sure you want to delete this merchant?
|
||||
`
|
||||
)
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await LNbits.api.request(
|
||||
'DELETE',
|
||||
'/nostrmarket/api/v1/merchant/' + this.merchantId,
|
||||
this.adminkey
|
||||
)
|
||||
this.$emit('merchant-deleted', this.merchantId)
|
||||
this.$q.notify({
|
||||
type: 'positive',
|
||||
message: 'Merchant Deleted',
|
||||
timeout: 5000
|
||||
})
|
||||
} catch (error) {
|
||||
console.warn(error)
|
||||
LNbits.utils.notifyApiError(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created: async function () {}
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue