diff --git a/POS/src/components/sale/EditItemDialog.vue b/POS/src/components/sale/EditItemDialog.vue index 5234006f..de2dbe33 100644 --- a/POS/src/components/sale/EditItemDialog.vue +++ b/POS/src/components/sale/EditItemDialog.vue @@ -32,15 +32,23 @@
-

- {{ localItem.item_name }} -

-

+

{{ formatCurrency(localItem.price_list_rate || localItem.rate) }} / {{ localItem.stock_uom || 'Nos' }}

+ +
+ + +
+
@@ -246,6 +254,7 @@ const emit = defineEmits(["update:modelValue", "update-item"]) // Local state const localItem = ref(null) +const localItemName = ref("") const localQuantity = ref(1) const localUom = ref("") const localRate = ref(0) @@ -278,6 +287,7 @@ watch( (newItem) => { if (newItem) { localItem.value = { ...newItem } + localItemName.value = newItem.item_name || "" localQuantity.value = newItem.quantity || 1 localUom.value = newItem.uom || newItem.stock_uom || "Nos" localRate.value = newItem.rate || 0 @@ -455,6 +465,7 @@ function formatCurrency(amount) { function updateItem() { const updatedItem = { ...localItem.value, + item_name: localItemName.value, quantity: localQuantity.value, uom: localUom.value, rate: localRate.value, @@ -495,6 +506,7 @@ input[type="number"]::-webkit-outer-spin-button { } input[type="number"] { + appearance: textfield; -moz-appearance: textfield; } diff --git a/POS/src/stores/posCart.js b/POS/src/stores/posCart.js index 80f86e8d..02a8ca36 100644 --- a/POS/src/stores/posCart.js +++ b/POS/src/stores/posCart.js @@ -506,29 +506,30 @@ export const usePOSCartStore = defineStore("posCart", () => { } } - // Update all provided details - if (updatedDetails.quantity !== undefined) { - cartItem.quantity = updatedDetails.quantity - } - // Don't update rate directly - let recalculateItem compute it from price_list_rate and discount - // if (updatedDetails.rate !== undefined) { - // cartItem.rate = updatedDetails.rate - // } - if (updatedDetails.warehouse !== undefined) { - cartItem.warehouse = updatedDetails.warehouse - } - if (updatedDetails.discount_percentage !== undefined) { - cartItem.discount_percentage = updatedDetails.discount_percentage - } - if (updatedDetails.discount_amount !== undefined) { - cartItem.discount_amount = updatedDetails.discount_amount - } - // Update price_list_rate if provided (for UOM changes) - if (updatedDetails.price_list_rate !== undefined) { - cartItem.price_list_rate = updatedDetails.price_list_rate - } - - // Recalculate item totals (this will compute the correct rate from price_list_rate and discount) + // Update all provided details + if (updatedDetails.item_name !== undefined) { + cartItem.item_name = updatedDetails.item_name + } + if (updatedDetails.quantity !== undefined) { + cartItem.quantity = updatedDetails.quantity + } + // Don't update rate directly - let recalculateItem compute it from price_list_rate and discount + // if (updatedDetails.rate !== undefined) { + // cartItem.rate = updatedDetails.rate + // } + if (updatedDetails.warehouse !== undefined) { + cartItem.warehouse = updatedDetails.warehouse + } + if (updatedDetails.discount_percentage !== undefined) { + cartItem.discount_percentage = updatedDetails.discount_percentage + } + if (updatedDetails.discount_amount !== undefined) { + cartItem.discount_amount = updatedDetails.discount_amount + } + // Update price_list_rate if provided (for UOM changes) + if (updatedDetails.price_list_rate !== undefined) { + cartItem.price_list_rate = updatedDetails.price_list_rate + } // Recalculate item totals (this will compute the correct rate from price_list_rate and discount) recalculateItem(cartItem) // Rebuild cache after item update to ensure totals are accurate