Fix product performance grouped JSON build
This commit is contained in:
@@ -631,7 +631,7 @@
|
||||
<template #body-cell-lMiktar="props">
|
||||
<q-td :props="props">
|
||||
<q-input
|
||||
:model-value="props.row.miktarInput"
|
||||
v-model="props.row.miktarInput"
|
||||
class="pcd-inline-input pcd-entry-input"
|
||||
color="primary"
|
||||
dense
|
||||
@@ -648,7 +648,7 @@
|
||||
<template #body-cell-inputPrice="props">
|
||||
<q-td :props="props">
|
||||
<q-input
|
||||
:model-value="props.row.inputPrice"
|
||||
v-model="props.row.inputPrice"
|
||||
class="pcd-inline-input pcd-entry-input"
|
||||
color="primary"
|
||||
dense
|
||||
@@ -665,7 +665,7 @@
|
||||
<template #body-cell-inputPricePrBr="props">
|
||||
<q-td :props="props">
|
||||
<q-select
|
||||
:model-value="props.row.inputPricePrBr"
|
||||
v-model="props.row.inputPricePrBr"
|
||||
class="pcd-inline-input pcd-entry-input"
|
||||
:options="priceCurrencyOptions"
|
||||
color="primary"
|
||||
@@ -679,20 +679,6 @@
|
||||
</q-td>
|
||||
</template>
|
||||
|
||||
<template #body-cell-lTutar="props">
|
||||
<q-td :props="props">
|
||||
{{ formatMoney(props.value) }}
|
||||
<span class="hidden">{{ captureRenderedGroupAmount(gi, grp, props.row, 'try', props.value) }}</span>
|
||||
</q-td>
|
||||
</template>
|
||||
|
||||
<template #body-cell-usdTutar="props">
|
||||
<q-td :props="props">
|
||||
{{ formatMoney(props.value) }}
|
||||
<span class="hidden">{{ captureRenderedGroupAmount(gi, grp, props.row, 'usd', props.value) }}</span>
|
||||
</q-td>
|
||||
</template>
|
||||
|
||||
<template #body-cell-sBirim="props">
|
||||
<q-td :props="props">
|
||||
<span>{{ props.value }}</span>
|
||||
@@ -2861,9 +2847,22 @@ function recalculateAllDetailRows () {
|
||||
...grp,
|
||||
items: (Array.isArray(grp?.items) ? grp.items : []).map(row => recalculateDetailRow({ ...row }, { preserveInputs: true }))
|
||||
}))
|
||||
refreshLiveGroupTotals()
|
||||
}
|
||||
|
||||
function resolveRowTRYTutar (row) {
|
||||
const quantity = resolveNumericRowQuantity(row)
|
||||
const inputPrice = resolveNumericRowInputPrice(row)
|
||||
const inputCurrency = resolveInputCurrency(row)
|
||||
const liveAmount = resolveTRYUnitPriceByInput(
|
||||
inputPrice,
|
||||
inputCurrency,
|
||||
resolveExchangeRateValue('USD'),
|
||||
resolveExchangeRateValue('EUR'),
|
||||
resolveExchangeRateValue('GBP')
|
||||
) * quantity
|
||||
|
||||
if (Number.isFinite(liveAmount) && inputPrice > 0) return liveAmount
|
||||
return parseMoneyInput(row?.lTutar)
|
||||
}
|
||||
|
||||
@@ -2887,7 +2886,7 @@ function resolveRowUSDTutar (row) {
|
||||
resolveExchangeRateValue('GBP')
|
||||
) * quantity
|
||||
|
||||
if (Number.isFinite(liveAmount) && inputPrice > 0 && quantity > 0) return liveAmount
|
||||
if (Number.isFinite(liveAmount) && inputPrice > 0) return liveAmount
|
||||
|
||||
const rawUSDAmount = row?.usdTutar
|
||||
if (rawUSDAmount !== undefined && rawUSDAmount !== null && String(rawUSDAmount).trim() !== '') {
|
||||
@@ -2912,6 +2911,25 @@ function shouldIncludeRowInGroupTotal (grp, row) {
|
||||
return normalizedValue !== '0' && normalizedValue !== 'false' && normalizedValue !== 'hayir'
|
||||
}
|
||||
|
||||
function refreshLiveGroupTotals () {
|
||||
detailGroups.value = detailGroups.value.map(group => {
|
||||
const totals = (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 })
|
||||
|
||||
return {
|
||||
...group,
|
||||
liveTryTotal: totals.tryTotal,
|
||||
liveUsdTotal: totals.usdTotal,
|
||||
liveQuantity: totals.quantity
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const pendingRenderedAmounts = new Map()
|
||||
let renderedAmountFlushScheduled = false
|
||||
|
||||
@@ -2966,22 +2984,16 @@ function resolveRenderedGroupRowCount (groupIndex) {
|
||||
|
||||
function resolveGroupTRYTutar (groupIndex, _revision) {
|
||||
const grp = detailGroups.value[groupIndex]
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? parseMoneyInput(row?.lTutar) : 0)
|
||||
), 0)
|
||||
return parseMoneyInput(grp?.liveTryTotal)
|
||||
}
|
||||
|
||||
function resolveGroupUSDTutar (groupIndex, _revision) {
|
||||
const grp = detailGroups.value[groupIndex]
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? parseMoneyInput(row?.usdTutar ?? row?.lTutarUSD) : 0)
|
||||
), 0)
|
||||
return parseMoneyInput(grp?.liveUsdTotal)
|
||||
}
|
||||
|
||||
function resolveGroupQuantity (grp) {
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + resolveNumericRowQuantity(row)
|
||||
), 0)
|
||||
return parseMoneyInput(grp?.liveQuantity)
|
||||
}
|
||||
|
||||
function groupKey (grp, gi) {
|
||||
@@ -3359,7 +3371,7 @@ function onRowQuantityInput (row, value) {
|
||||
}
|
||||
|
||||
function triggerUIUpdate () {
|
||||
groupTotalsRevision.value += 1
|
||||
refreshLiveGroupTotals()
|
||||
}
|
||||
|
||||
function normalizeRowQuantityDisplay (row) {
|
||||
|
||||
Reference in New Issue
Block a user