Fix flaky CanUsePOSCart

This commit is contained in:
nicolas.dorier
2025-06-13 09:36:13 +09:00
parent 9f04bd473a
commit 7fdd01d01e
3 changed files with 3 additions and 11 deletions

View File

@@ -96,10 +96,10 @@
}
@if (item.Inventory.HasValue)
{
<span class="badge text-bg-warning inventory" v-text="inventoryText(@index)">
<span class="badge text-bg-warning inventory">
@if (item.Inventory > 0)
{
<span>@ViewLocalizer["{0} left", item.Inventory.ToString()]</span>
<span>@StringLocalizer["{0} left", item.Inventory.ToString()]</span>
}
else
{

View File

@@ -140,7 +140,7 @@
}
@if (item.Inventory.HasValue)
{
<span class="badge text-bg-warning inventory" v-text="inventoryText(@index)">
<span class="badge text-bg-warning inventory">
@if (item.Inventory > 0)
{
<span>@ViewLocalizer["{0} left", item.Inventory.ToString()]</span>

View File

@@ -291,14 +291,6 @@ const posCommon = {
return item.inventory == null || item.inventory > (itemInCart ? itemInCart.count : 0)
},
inventoryText(index) {
const item = this.items[index]
if (item.inventory == null) return null
const itemInCart = this.cart.find(lineItem => lineItem.id === item.id)
const left = item.inventory - (itemInCart ? itemInCart.count : 0)
return left > 0 ? `${item.inventory} left` : 'Sold out'
},
addToCart(index, count) {
if (!this.inStock(index)) return null;