diff --git a/ui/src/pages/ProductionProductCostingHasCostDetail.vue b/ui/src/pages/ProductionProductCostingHasCostDetail.vue index 543f825..7c20e21 100644 --- a/ui/src/pages/ProductionProductCostingHasCostDetail.vue +++ b/ui/src/pages/ProductionProductCostingHasCostDetail.vue @@ -470,14 +470,9 @@
- Grup Toplamı TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }} + Grup Toplamı TRY: {{ formatBarMoney(grp.tryTotal) }} | - USD: {{ formatBarMoney(resolveGroupUSDTutar(gi, groupTotalsRevision)) }} - - - Tanı: {{ resolveRenderedGroupIncludedCount(gi) }}/{{ resolveRenderedGroupRowCount(gi) }} kalem - | - Ham TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }} + USD: {{ formatBarMoney(grp.usdTotal) }} recalculateDetailRow({ ...row }, { preserveInputs: true })) })) - refreshLiveGroupTotals() } function resolveRowTRYTutar (row) { @@ -2931,74 +2923,6 @@ const detailGroupsWithTotals = computed(() => ( }) )) -function refreshLiveGroupTotals () { - // Totals are derived directly from reactive rows. The revision only forces - // Quasar's table/sub-header render after an in-place row edit. - groupTotalsRevision.value += 1 -} - -const pendingRenderedAmounts = new Map() -let renderedAmountFlushScheduled = false - -function captureRenderedGroupAmount (groupIndex, grp, row, currency, value) { - const rowKey = String(row?.__rowKey || row?.nOnMLDetNo || row?.sKodu || '').trim() - const cacheKey = `${groupIndex}:${rowKey}` - const previousPending = pendingRenderedAmounts.get(cacheKey) || {} - pendingRenderedAmounts.set(cacheKey, { - ...previousPending, - groupIndex, - rowKey, - included: shouldIncludeRowInGroupTotal(grp, row), - [currency]: parseMoneyInput(value) - }) - - if (!renderedAmountFlushScheduled) { - renderedAmountFlushScheduled = true - Promise.resolve().then(() => { - const next = { ...renderedGroupAmounts.value } - let changed = false - pendingRenderedAmounts.forEach(entry => { - const groupRows = { ...(next[entry.groupIndex] || {}) } - const previous = groupRows[entry.rowKey] || {} - if (previous.try !== entry.try || previous.usd !== entry.usd || previous.included !== entry.included) { - groupRows[entry.rowKey] = { ...previous, ...entry } - changed = true - } - next[entry.groupIndex] = groupRows - }) - pendingRenderedAmounts.clear() - renderedAmountFlushScheduled = false - if (changed) { - renderedGroupAmounts.value = next - groupTotalsRevision.value += 1 - } - }) - } - return '' -} - -function renderedRowsForGroup (groupIndex) { - return Object.values(renderedGroupAmounts.value[groupIndex] || {}) -} - -function resolveRenderedGroupIncludedCount (groupIndex) { - const grp = detailGroups.value[groupIndex] - return (Array.isArray(grp?.items) ? grp.items : []).filter(row => shouldIncludeRowInGroupTotal(grp, row)).length -} - -function resolveRenderedGroupRowCount (groupIndex) { - const grp = detailGroups.value[groupIndex] - return Array.isArray(grp?.items) ? grp.items.length : 0 -} - -function resolveGroupTRYTutar (groupIndex, _revision) { - return parseMoneyInput(detailGroupsWithTotals.value[groupIndex]?.tryTotal) -} - -function resolveGroupUSDTutar (groupIndex, _revision) { - return parseMoneyInput(detailGroupsWithTotals.value[groupIndex]?.usdTotal) -} - function resolveGroupQuantity (grp) { return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => ( total + resolveNumericRowQuantity(row) @@ -3121,8 +3045,6 @@ async function fetchDetail (options = {}) { detailLoading.value = true detailError.value = '' detailGroups.value = [] - renderedGroupAmounts.value = {} - pendingRenderedAmounts.clear() detailHeader.value = null costDate.value = '' exchangeRates.value = createEmptyExchangeRates() @@ -3380,7 +3302,7 @@ function onRowQuantityInput (row, value) { } function triggerUIUpdate () { - refreshLiveGroupTotals() + // detailGroupsWithTotals is computed from the reactive row fields. } function normalizeRowQuantityDisplay (row) {