| 1 |
<div class="item-sales-tab-header"> |
| 2 |
<h2 class="subsection-title">Sales</h2> |
| 3 |
{% if !sales.is_empty() %} |
| 4 |
<button class="btn-secondary btn-compact" data-action="exportItemSalesCSV">Export CSV</button> |
| 5 |
{% endif %} |
| 6 |
</div> |
| 7 |
|
| 8 |
{% if sales.is_empty() %} |
| 9 |
<div class="content-section"> |
| 10 |
<p class="muted">No sales yet. Sales will appear here once your first purchase is completed.</p> |
| 11 |
</div> |
| 12 |
{% else %} |
| 13 |
<table class="data-table" id="item-sales-table"> |
| 14 |
<thead> |
| 15 |
<tr> |
| 16 |
<th>Date</th> |
| 17 |
<th>Buyer</th> |
| 18 |
<th>Amount</th> |
| 19 |
<th>Status</th> |
| 20 |
<th></th> |
| 21 |
</tr> |
| 22 |
</thead> |
| 23 |
<tbody> |
| 24 |
{% for sale in sales %} |
| 25 |
<tr id="sale-{{ sale.transaction_id }}"> |
| 26 |
<td>{{ sale.date }}</td> |
| 27 |
<td>{{ sale.buyer }}</td> |
| 28 |
<td>{{ sale.amount_display }}</td> |
| 29 |
<td><span class="badge {{ sale.status }}">{{ sale.status }}</span></td> |
| 30 |
<td> |
| 31 |
{% if sale.refundable %} |
| 32 |
<button class="btn-secondary small danger-text" |
| 33 |
hx-post="/api/items/{{ item.id }}/refund" |
| 34 |
hx-vals='{"transaction_id": "{{ sale.transaction_id }}"}' |
| 35 |
hx-confirm="Issue a full refund for {{ sale.amount_display }}? This cannot be undone." |
| 36 |
hx-target="#sale-{{ sale.transaction_id }}" |
| 37 |
hx-swap="outerHTML" |
| 38 |
data-hx-get="/dashboard/item/{{ item.id }}/tabs/sales" data-hx-target="#tab-content">Refund</button> |
| 39 |
{% endif %} |
| 40 |
</td> |
| 41 |
</tr> |
| 42 |
{% endfor %} |
| 43 |
</tbody> |
| 44 |
</table> |
| 45 |
{% endif %} |
| 46 |
|
| 47 |
<div id="tab-item-sales-cfg" hidden data-item-title="{{ item.title }}"></div> |
| 48 |
<script src="/static/tab-item-sales.js?v=0623"></script> |
| 49 |
|