diff --git a/ui/src/pages/ProductionProductCostingHasCostDetail.vue b/ui/src/pages/ProductionProductCostingHasCostDetail.vue
index 562b0c3..c0922f3 100644
--- a/ui/src/pages/ProductionProductCostingHasCostDetail.vue
+++ b/ui/src/pages/ProductionProductCostingHasCostDetail.vue
@@ -469,7 +469,7 @@
- Grup Toplami TRY: {{ formatBarMoney(groupTotals[gi]?.tryTotal) }} | USD: {{ formatBarMoney(groupTotals[gi]?.usdTotal) }}
+ Grup Toplami TRY: {{ formatBarMoney(groupLiveTotals[gi]?.tryTotal) }} | USD: {{ formatBarMoney(groupLiveTotals[gi]?.usdTotal) }}
flatDetailRows.value.reduce((acc, row) =>
gbpTotal: 0
}))
+const groupLiveTotals = computed(() => {
+ // Explicitly depend on inline-edit events as QTable can update a row without
+ // invalidating computations owned by the parent component.
+ void groupTotalsRevision.value
+ return detailGroups.value.map(group => (
+ (Array.isArray(group?.items) ? group.items : []).reduce((acc, row) => {
+ if (!shouldIncludeRowInGroupTotal(group, row)) return acc
+ acc.tryTotal += resolveRowTRYTutar(row)
+ acc.usdTotal += resolveRowUSDTutar(row)
+ acc.quantity += resolveNumericRowQuantity(row)
+ return acc
+ }, { tryTotal: 0, usdTotal: 0, quantity: 0 })
+ ))
+})
+
const summaryOpen = ref(false)
function makeEmptySummaryRow (part) {
@@ -2887,22 +2902,9 @@ function shouldIncludeRowInGroupTotal (grp, row) {
return normalizeBooleanFlag(row?.maliyeteDahil ?? row?.maliyete_dahil ?? row?.Maliyete_dahil)
}
-function syncGroupTotals () {
- groupTotals.value = detailGroups.value.map(group => (
- (Array.isArray(group?.items) ? group.items : []).reduce((acc, row) => {
- if (!shouldIncludeRowInGroupTotal(group, row)) return acc
- // Sub-header must mirror the amounts already rendered in the row.
- acc.tryTotal += parseMoneyInput(row?.lTutar)
- acc.usdTotal += parseMoneyInput(row?.usdTutar ?? row?.lTutarUSD)
- acc.quantity += resolveNumericRowQuantity(row)
- return acc
- }, { tryTotal: 0, usdTotal: 0, quantity: 0 })
- ))
-}
-
function resolveGroupQuantity (grp) {
const groupIndex = detailGroups.value.indexOf(grp)
- return groupIndex >= 0 ? parseMoneyInput(groupTotals.value[groupIndex]?.quantity) : 0
+ return groupIndex >= 0 ? parseMoneyInput(groupLiveTotals.value[groupIndex]?.quantity) : 0
}
function groupKey (grp, gi) {
@@ -3278,10 +3280,7 @@ function onRowQuantityInput (row, value) {
}
function triggerUIUpdate () {
- syncGroupTotals()
- nextTick(() => {
- syncGroupTotals()
- })
+ groupTotalsRevision.value += 1
}
function normalizeRowQuantityDisplay (row) {
@@ -5220,18 +5219,6 @@ watch(
}
)
-watch(
- [detailGroups, exchangeRates],
- () => {
- syncGroupTotals()
- },
- {
- deep: true,
- flush: 'sync',
- immediate: true
- }
-)
-
onMounted(() => {
if (!canReadOrder.value) return
fetchDetail()