Fix product performance grouped JSON build
This commit is contained in:
@@ -465,19 +465,19 @@
|
|||||||
<div class="sub-left">
|
<div class="sub-left">
|
||||||
<span class="pcd-sub-title">{{ grp.sAciklama3 || 'TANIMSIZ' }}</span>
|
<span class="pcd-sub-title">{{ grp.sAciklama3 || 'TANIMSIZ' }}</span>
|
||||||
<span v-if="normalizeGroupName(grp.sAciklama3) === 'FABRIC'" class="pcd-sub-mt-qty">
|
<span v-if="normalizeGroupName(grp.sAciklama3) === 'FABRIC'" class="pcd-sub-mt-qty">
|
||||||
Toplam Miktar: {{ formatBarQuantity(resolveGroupQuantity(grp)) }} MT
|
Toplam Miktar: {{ formatBarQuantity(resolveGroupQuantity(grp, gi)) }} MT
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
||||||
<span class="pcd-group-total-text">
|
<span class="pcd-group-total-text">
|
||||||
Grup Toplamı TRY: {{ formatBarMoney(resolveGroupTRYTutar(grp, groupTotalsRevision)) }}
|
Grup Toplamı TRY: {{ formatBarMoney(resolveGroupTRYTutar(grp, gi, groupTotalsRevision)) }}
|
||||||
<span class="pcd-group-total-divider">|</span>
|
<span class="pcd-group-total-divider">|</span>
|
||||||
USD: {{ formatBarMoney(resolveGroupUSDTutar(grp, groupTotalsRevision)) }}
|
USD: {{ formatBarMoney(resolveGroupUSDTutar(grp, gi, groupTotalsRevision)) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="pcd-group-debug">
|
<span class="pcd-group-debug">
|
||||||
Tanı: {{ resolveGroupIncludedCount(grp) }}/{{ rowsForGroupTotal(grp).length }} kalem
|
Tanı: {{ resolveGroupIncludedCount(grp, gi) }}/{{ rowsForGroupTotal(grp, gi).length }} kalem
|
||||||
<span>|</span>
|
<span>|</span>
|
||||||
Ham TRY: {{ formatBarMoney(resolveGroupRawTRYTutar(grp)) }}
|
Ham TRY: {{ formatBarMoney(resolveGroupRawTRYTutar(grp, gi)) }}
|
||||||
</span>
|
</span>
|
||||||
<q-icon
|
<q-icon
|
||||||
:name="isGroupOpen(grp, gi) ? 'expand_less' : 'expand_more'"
|
:name="isGroupOpen(grp, gi) ? 'expand_less' : 'expand_more'"
|
||||||
@@ -489,6 +489,7 @@
|
|||||||
|
|
||||||
<q-table
|
<q-table
|
||||||
v-if="isGroupOpen(grp, gi)"
|
v-if="isGroupOpen(grp, gi)"
|
||||||
|
:ref="el => setGroupTableRef(gi, el)"
|
||||||
class="pcd-detail-table"
|
class="pcd-detail-table"
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
@@ -1126,6 +1127,7 @@ const detailLoading = ref(false)
|
|||||||
const detailError = ref('')
|
const detailError = ref('')
|
||||||
const detailGroups = ref([])
|
const detailGroups = ref([])
|
||||||
const groupTotalsRevision = ref(0)
|
const groupTotalsRevision = ref(0)
|
||||||
|
const groupTableRefs = ref([])
|
||||||
const detailHeader = ref(null)
|
const detailHeader = ref(null)
|
||||||
const costDate = ref('')
|
const costDate = ref('')
|
||||||
const exchangeRates = ref(createEmptyExchangeRates())
|
const exchangeRates = ref(createEmptyExchangeRates())
|
||||||
@@ -2909,19 +2911,25 @@ function shouldIncludeRowInGroupTotal (grp, row) {
|
|||||||
return normalizedValue !== '0' && normalizedValue !== 'false' && normalizedValue !== 'hayir'
|
return normalizedValue !== '0' && normalizedValue !== 'false' && normalizedValue !== 'hayir'
|
||||||
}
|
}
|
||||||
|
|
||||||
function rowsForGroupTotal (grp) {
|
function setGroupTableRef (groupIndex, tableRef) {
|
||||||
// Use the exact row collection rendered by the QTable under this header.
|
groupTableRefs.value[groupIndex] = tableRef || null
|
||||||
// The flattened list can temporarily hold stale row objects during QTable
|
}
|
||||||
// inline edits and bulk replacements.
|
|
||||||
|
function rowsForGroupTotal (grp, groupIndex) {
|
||||||
|
const tableRef = groupTableRefs.value[groupIndex]
|
||||||
|
if (tableRef && typeof tableRef.getFilteredSortedRows === 'function') {
|
||||||
|
const renderedRows = tableRef.getFilteredSortedRows()
|
||||||
|
if (Array.isArray(renderedRows)) return renderedRows
|
||||||
|
}
|
||||||
return Array.isArray(grp?.items) ? grp.items : []
|
return Array.isArray(grp?.items) ? grp.items : []
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveGroupIncludedCount (grp) {
|
function resolveGroupIncludedCount (grp, groupIndex) {
|
||||||
return rowsForGroupTotal(grp).filter(row => shouldIncludeRowInGroupTotal(grp, row)).length
|
return rowsForGroupTotal(grp, groupIndex).filter(row => shouldIncludeRowInGroupTotal(grp, row)).length
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveGroupRawTRYTutar (grp) {
|
function resolveGroupRawTRYTutar (grp, groupIndex) {
|
||||||
return rowsForGroupTotal(grp).reduce((total, row) => total + parseMoneyInput(row?.lTutar), 0)
|
return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => total + parseMoneyInput(row?.lTutar), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveGroupRowTRYAmount (row) {
|
function resolveGroupRowTRYAmount (row) {
|
||||||
@@ -2938,20 +2946,20 @@ function resolveGroupRowUSDAmount (row) {
|
|||||||
return lastValidAmount !== 0 ? lastValidAmount : resolveRowUSDTutar(row)
|
return lastValidAmount !== 0 ? lastValidAmount : resolveRowUSDTutar(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveGroupTRYTutar (grp, _revision) {
|
function resolveGroupTRYTutar (grp, groupIndex, _revision) {
|
||||||
return rowsForGroupTotal(grp).reduce((total, row) => (
|
return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => (
|
||||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveGroupRowTRYAmount(row) : 0)
|
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveGroupRowTRYAmount(row) : 0)
|
||||||
), 0)
|
), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveGroupUSDTutar (grp, _revision) {
|
function resolveGroupUSDTutar (grp, groupIndex, _revision) {
|
||||||
return rowsForGroupTotal(grp).reduce((total, row) => (
|
return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => (
|
||||||
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveGroupRowUSDAmount(row) : 0)
|
total + (shouldIncludeRowInGroupTotal(grp, row) ? resolveGroupRowUSDAmount(row) : 0)
|
||||||
), 0)
|
), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveGroupQuantity (grp) {
|
function resolveGroupQuantity (grp, groupIndex) {
|
||||||
return rowsForGroupTotal(grp).reduce((total, row) => (
|
return rowsForGroupTotal(grp, groupIndex).reduce((total, row) => (
|
||||||
total + resolveNumericRowQuantity(row)
|
total + resolveNumericRowQuantity(row)
|
||||||
), 0)
|
), 0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user