Fix product performance grouped JSON build
This commit is contained in:
@@ -469,7 +469,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
||||
Grup Toplami TRY: {{ formatBarMoney(groupLiveTotals[gi]?.tryTotal) }} | USD: {{ formatBarMoney(groupLiveTotals[gi]?.usdTotal) }}
|
||||
Grup Toplami TRY: {{ formatBarMoney(resolveGroupTRYTutar(grp, groupTotalsRevision)) }} | USD: {{ formatBarMoney(resolveGroupUSDTutar(grp, groupTotalsRevision)) }}
|
||||
<q-icon
|
||||
:name="isGroupOpen(grp, gi) ? 'expand_less' : 'expand_more'"
|
||||
size="18px"
|
||||
@@ -1578,21 +1578,6 @@ const toolbarSummary = computed(() => 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) {
|
||||
@@ -2899,12 +2884,26 @@ function shouldIncludeRowInGroupTotal (grp, row) {
|
||||
// CM1/CM2 sub-headers always show their full group value. For every other
|
||||
// group, the explicit "Maliyete Dahil" selection controls the subtotal.
|
||||
if (isCMGroupName(grp?.sAciklama3 || row?.sAciklama3)) return true
|
||||
return normalizeBooleanFlag(row?.maliyeteDahil ?? row?.maliyete_dahil ?? row?.Maliyete_dahil)
|
||||
if (typeof row?.maliyeteDahil === 'boolean') return row.maliyeteDahil
|
||||
return normalizeBooleanFlag(row?.maliyete_dahil ?? row?.Maliyete_dahil)
|
||||
}
|
||||
|
||||
function resolveGroupTRYTutar (grp, _revision) {
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveRowTRYTutar(row) : 0)
|
||||
), 0)
|
||||
}
|
||||
|
||||
function resolveGroupUSDTutar (grp, _revision) {
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveRowUSDTutar(row) : 0)
|
||||
), 0)
|
||||
}
|
||||
|
||||
function resolveGroupQuantity (grp) {
|
||||
const groupIndex = detailGroups.value.indexOf(grp)
|
||||
return groupIndex >= 0 ? parseMoneyInput(groupLiveTotals.value[groupIndex]?.quantity) : 0
|
||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||
total + resolveNumericRowQuantity(row)
|
||||
), 0)
|
||||
}
|
||||
|
||||
function groupKey (grp, gi) {
|
||||
@@ -3397,6 +3396,9 @@ async function fetchBulkItemPrices () {
|
||||
})
|
||||
})
|
||||
}))
|
||||
// Update sub-headers immediately after the bulk response is applied. Do
|
||||
// not wait for the optional previous-cost autofill request below.
|
||||
triggerUIUpdate()
|
||||
|
||||
$q.notify({
|
||||
type: appliedCount > 0 ? 'positive' : 'warning',
|
||||
@@ -3477,6 +3479,7 @@ async function fetchBulkItemPrices () {
|
||||
})
|
||||
})
|
||||
}))
|
||||
triggerUIUpdate()
|
||||
|
||||
if (filled > 0) {
|
||||
$q.notify({
|
||||
|
||||
Reference in New Issue
Block a user