fix: more UI stuff

This commit is contained in:
Vlad Stan 2023-07-12 16:03:10 +03:00
parent 3864200ffa
commit c3c141cac4
4 changed files with 35 additions and 16 deletions

View file

@ -1,7 +1,7 @@
<div> <div>
<q-card v-if="!merchantOrders?.length" bordered class="q-mb-md"> <q-card v-if="!merchantOrders?.length" bordered class="q-mb-md">
<q-card-section> <q-card-section>
<strong>No products in cart!</strong> <strong>No orders!</strong>
</q-card-section> </q-card-section>
</q-card> </q-card>
<div v-for="merchant in merchantOrders"> <div v-for="merchant in merchantOrders">
@ -99,11 +99,16 @@
</q-card-section> </q-card-section>
<q-separator vertical /> <q-separator vertical />
<q-card-section> <q-card-section>
<q-item-section class="q-mt-sm q-ml-sm"> <q-item-section class="q-mt-md q-ml-sm">
<q-item-label> <strong>Shipping Zone: </strong> <q-item-label> <strong>Shipping Zone: </strong>
<span v-text="order.shippingZone?.name || ''"></span> <span v-text="order.shippingZone?.name || ''"></span>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section v-if="order.message" class="q-mt-md q-ml-sm">
<q-item-label> <strong>Message: </strong>
<span v-text="order.message"></span>
</q-item-label>
</q-item-section>
<q-item-section class="q-mt-md q-ml-sm"> <q-item-section class="q-mt-md q-ml-sm">
<q-item-label> <strong>Invoice: </strong> <q-item-label> <strong>Invoice: </strong>
<q-badge @click="showInvoice(order)" v-if="order.invoice?.human_readable_part?.amount" <q-badge @click="showInvoice(order)" v-if="order.invoice?.human_readable_part?.amount"
@ -116,6 +121,17 @@
</q-card-section> </q-card-section>
</q-card-section> </q-card-section>
<q-separator></q-separator> <q-separator></q-separator>
<q-card-section class="col-12">
<q-item-section class="q-mt-sm q-ml-sm">
<q-item-label> <strong>Order ID: </strong>
</q-item-label>
</q-item-section>
<q-item-section class="q-mt-sm">
<q-item-label>
<span v-text="order.id"></span>
</q-item-label>
</q-item-section>
</q-card-section>
<q-card-section v-if="order.messages" class="col-12"> <q-card-section v-if="order.messages" class="col-12">
<q-item-section class="q-mt-sm q-ml-sm"> <q-item-section class="q-mt-sm q-ml-sm">
<q-item-label> <strong>Messages: </strong> <q-item-label> <strong>Messages: </strong>
@ -132,6 +148,7 @@
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-card-section> </q-card-section>
</q-expansion-item> </q-expansion-item>
<q-separator></q-separator> <q-separator></q-separator>
</div> </div>

View file

@ -141,7 +141,7 @@
<q-btn @click="goToShoppingCart" flat color="gray"> <q-btn @click="goToShoppingCart" flat color="gray">
Back Back
</q-btn> </q-btn>
<q-btn @click="orderConfirmed = true" flat color="primary"> <q-btn @click="confirmOrder" flat color="primary">
Confirm Confirm
</q-btn> </q-btn>
</div> </div>

View file

@ -61,6 +61,17 @@ async function shoppingCartCheckout(path) {
this.shippingZone = zone this.shippingZone = zone
}, },
confirmOrder: function () {
if (!this.shippingZone) {
this.$q.notify({
timeout: 5000,
type: 'warning',
message: 'Please select a shipping zone!',
})
return
}
this.orderConfirmed = true
},
async placeOrder() { async placeOrder() {
if (!this.shippingZone) { if (!this.shippingZone) {
this.$q.notify({ this.$q.notify({
@ -103,7 +114,7 @@ async function shoppingCartCheckout(path) {
this.$emit('place-order', { event, order }) this.$emit('place-order', { event, order })
}, },
goToShoppingCart: function(){ goToShoppingCart: function () {
this.$emit('change-page', 'shopping-cart-list') this.$emit('change-page', 'shopping-cart-list')
} }
}, },

View file

@ -842,29 +842,20 @@ const market = async () => {
orders.unshift({ orders.unshift({
...orderUpdate, ...orderUpdate,
eventCreatedAt, eventCreatedAt,
createdAt: eventCreatedAt, createdAt: eventCreatedAt
messages: orderUpdate.message ? [orderUpdate.message] : []
}) })
this.orders[pubkey] = orders this.orders[pubkey] = orders
this.$q.localStorage.set(`nostrmarket.orders.${pubkey}`, orders) this.$q.localStorage.set(`nostrmarket.orders.${pubkey}`, orders)
return return
} }
if (orderUpdate.message) {
order.messages.push(orderUpdate.message)
}
if (orderUpdate.type === 0) { if (orderUpdate.type === 0) {
order.createdAt = eventCreatedAt order.createdAt = eventCreatedAt
order = { ...order, ...orderUpdate } order = { ...order, ...orderUpdate, message: order.message || orderUpdate.message }
} else if (orderUpdate.type === 1) { } else {
order = order.eventCreatedAt < eventCreatedAt ? { ...order, ...orderUpdate } : { ...orderUpdate, ...order } order = order.eventCreatedAt < eventCreatedAt ? { ...order, ...orderUpdate } : { ...orderUpdate, ...order }
} else if (orderUpdate.type === 2) {
order.paid = orderUpdate.paid
order.shipped = orderUpdate.shipped
} }
orders = [order].concat(orders.filter(o => o.id !== order.id)) orders = [order].concat(orders.filter(o => o.id !== order.id))
this.orders[pubkey] = orders this.orders[pubkey] = orders
this.$q.localStorage.set(`nostrmarket.orders.${pubkey}`, orders) this.$q.localStorage.set(`nostrmarket.orders.${pubkey}`, orders)