Fix product performance grouped JSON build
This commit is contained in:
@@ -470,14 +470,9 @@
|
||||
</div>
|
||||
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
||||
<span class="pcd-group-total-text">
|
||||
Grup Toplamı TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }}
|
||||
Grup Toplamı TRY: {{ formatBarMoney(grp.tryTotal) }}
|
||||
<span class="pcd-group-total-divider">|</span>
|
||||
USD: {{ formatBarMoney(resolveGroupUSDTutar(gi, groupTotalsRevision)) }}
|
||||
</span>
|
||||
<span class="pcd-group-debug">
|
||||
Tanı: {{ resolveRenderedGroupIncludedCount(gi) }}/{{ resolveRenderedGroupRowCount(gi) }} kalem
|
||||
<span>|</span>
|
||||
Ham TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }}
|
||||
USD: {{ formatBarMoney(grp.usdTotal) }}
|
||||
</span>
|
||||
<q-icon
|
||||
:name="isGroupOpen(grp, gi) ? 'expand_less' : 'expand_more'"
|
||||
@@ -1125,8 +1120,6 @@ const canReadOrder = canRead('order')
|
||||
const detailLoading = ref(false)
|
||||
const detailError = ref('')
|
||||
const detailGroups = ref([])
|
||||
const groupTotalsRevision = ref(0)
|
||||
const renderedGroupAmounts = ref({})
|
||||
const detailHeader = ref(null)
|
||||
const costDate = ref('')
|
||||
const exchangeRates = ref(createEmptyExchangeRates())
|
||||
@@ -2847,7 +2840,6 @@ function recalculateAllDetailRows () {
|
||||
...grp,
|
||||
items: (Array.isArray(grp?.items) ? grp.items : []).map(row => 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) {
|
||||
|
||||
Reference in New Issue
Block a user