fix: long product name in order details

This commit is contained in:
Vlad Stan 2023-11-06 12:41:53 +02:00
parent 8ab688dc41
commit 751271eb65
2 changed files with 10 additions and 4 deletions

View file

@ -89,7 +89,9 @@
<div class="col-1">{{item.quantity}}</div> <div class="col-1">{{item.quantity}}</div>
<div class="col-1">x</div> <div class="col-1">x</div>
<div class="col-4"> <div class="col-4">
{{productName(props.row, item.product_id)}} <p :title="productName(props.row, item.product_id)">
{{shortLabel(productName(props.row, item.product_id))}}
</p>
</div> </div>
<div class="col-2"> <div class="col-2">
{{productPrice(props.row, item.product_id)}} {{productPrice(props.row, item.product_id)}}
@ -207,4 +209,4 @@
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</div> </div>

View file

@ -130,6 +130,10 @@ async function orderList(path) {
formatFiat(value, currency) { formatFiat(value, currency) {
return Math.trunc(value) + ' ' + currency return Math.trunc(value) + ' ' + currency
}, },
shortLabel(value = ''){
if (value.length <= 44) return value
return value.substring(0, 20) + '...'
},
productName: function (order, productId) { productName: function (order, productId) {
product = order.extra.products.find(p => p.id === productId) product = order.extra.products.find(p => p.id === productId)
if (product) { if (product) {
@ -287,7 +291,7 @@ async function orderList(path) {
const order = await this.getOrder(orderData.id) const order = await this.getOrder(orderData.id)
this.orders.unshift(order) this.orders.unshift(order)
} }
} }
}, },
orderSelected: async function (orderId, eventId) { orderSelected: async function (orderId, eventId) {
@ -305,7 +309,7 @@ async function orderList(path) {
restoredOrder.isNew = false restoredOrder.isNew = false
this.orders = [restoredOrder] this.orders = [restoredOrder]
} }
}) })
return return
} }