nostrmarket/static/components/customer-orders/customer-orders.html
2023-07-18 16:40:43 +02:00

147 lines
No EOL
5.9 KiB
HTML

<div>
<q-card v-if="!merchantOrders?.length" bordered class="q-mb-md">
<q-card-section>
<strong>No products in cart!</strong>
</q-card-section>
</q-card>
<div v-for="merchant in merchantOrders">
<q-card bordered class="q-mb-md">
<q-item>
<q-item-section avatar>
<q-avatar>
<img v-if="merchant.profile?.picture" :src="merchant.profile?.picture">
<img v-else src="/nostrmarket/static/images/blank-avatar.webp">
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>
<strong>
<span v-text="merchant.profile?.name"></span>
</strong>
</q-item-label>
<q-item-label caption>
<span v-text="merchant.pubkey"></span>
</q-item-label>
</q-item-section>
</q-item>
<q-separator />
<q-card-section class="col-12">
<q-list>
<div v-for="order in merchant.orders" :key="order.id" class="q-mb-md">
<q-expansion-item dense expand-separator>
<template v-slot:header>
<q-item-section class="q-mt-sm">
<q-item-label><strong> <span v-text="order.stallName"></span> </strong>
<q-badge @click="showInvoice(order)" v-if="order.invoice?.human_readable_part?.amount"
color="orange" class="q-ml-lg">
<span v-text="formatCurrency(order.invoice?.human_readable_part?.amount / 1000, 'sat')"></span>
</q-badge></q-item-label>
<q-item-label>
<div class="text-caption text-grey ellipsis-2-lines">
<p v-if="order.createdAt"><span v-text="fromNow(order.createdAt)"></span></p>
</div>
</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label>
<q-badge :color="order.paid ? 'green' : 'gray'"><span
v-text="order.paid ? 'Paid' : 'Not Paid'"></span></q-badge>
<q-badge :color="order.shipped ? 'green' : 'gray'"><span
v-text="order.shipped ? 'Shipped' : 'Not Shipped'"></span></q-badge>
</q-item-label>
<q-item-label>
<div class="text-caption text-grey ellipsis-2-lines">
<p>
<span v-text="order.items?.length"></span>
<span v-text="order.items?.length === 1 ? 'product': 'products'"></span>
</p>
</div>
</q-item-label>
</q-item-section>
</template>
<q-separator></q-separator>
<q-card-section horizontal>
<q-card-section class="col-7">
<q-item-section class="q-mt-sm">
<q-item-label> <strong>Products</strong></q-item-label>
</q-item-section>
<q-item v-for="product in order.products" :key="product.id">
<q-item-section avatar>
<q-avatar>
<img v-if="product.images && product.images[0] || product.image"
:src="product.images[0] || product.image" />
<img v-else src="/nostrmarket/static/images/placeholder.png" />
</q-avatar>
</q-item-section>
<q-item-section class="q-mt-sm">
<q-item-label></q-item-label>
<q-item-label>
<strong>{{ product.orderedQuantity}} x {{ product.name}} </strong></q-item-label>
<q-item-label>
<div class="text-caption text-grey ellipsis-2-lines">
<p>{{ product.description }}</p>
</div>
</q-item-label>
</q-item-section>
</q-item>
</q-card-section>
<q-separator vertical />
<q-card-section>
<q-item-section class="q-mt-sm q-ml-sm">
<q-item-label> <strong>Shipping Zone: </strong>
<span v-text="order.shippingZone?.name || ''"></span>
</q-item-label>
</q-item-section>
<q-item-section class="q-mt-md q-ml-sm">
<q-item-label> <strong>Invoice: </strong>
<q-badge @click="showInvoice(order)" v-if="order.invoice?.human_readable_part?.amount"
color="orange" class="cursor-pointer">
<span v-text="formatCurrency(order.invoice?.human_readable_part?.amount / 1000, 'sat')"></span>
</q-badge>
<!-- <q-badge v-if="!order.paid">Request Invoice Again</q-badge> -->
</q-item-label>
</q-item-section>
</q-card-section>
</q-card-section>
<q-separator></q-separator>
<q-card-section v-if="order.messages" class="col-12">
<q-item-section class="q-mt-sm q-ml-sm">
<q-item-label> <strong>Messages: </strong>
</q-item-label>
</q-item-section>
<q-item-section class="q-mt-sm">
<q-item-label>
<ul>
<li v-for="(message, i) in order.messages" :key="i">
<span v-text="message"></span>
</li>
</ul>
</q-item-label>
</q-item-section>
</q-card-section>
</q-expansion-item>
<q-separator></q-separator>
</div>
</q-list>
</q-card-section>
</q-card>
</div>
</div>