Fix product performance grouped JSON build
This commit is contained in:
@@ -37,12 +37,14 @@
|
|||||||
/>
|
/>
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
v-model="detailLevelMenuOpen"
|
v-model="detailLevelMenuOpen"
|
||||||
|
split
|
||||||
dense
|
dense
|
||||||
outline
|
outline
|
||||||
color="primary"
|
color="primary"
|
||||||
:icon="allProductGroupsExpanded ? 'unfold_less' : 'unfold_more'"
|
:icon="allProductGroupsExpanded ? 'unfold_less' : 'unfold_more'"
|
||||||
:label="allProductGroupsExpanded ? 'Detayları Kapat' : 'Tüm Detayları Aç'"
|
:label="allProductGroupsExpanded ? 'Detayları Kapat' : 'Tüm Detayları Aç'"
|
||||||
:disable="pageBusy"
|
:disable="pageBusy"
|
||||||
|
@click="toggleAllProductGroups"
|
||||||
>
|
>
|
||||||
<div class="detail-level-menu">
|
<div class="detail-level-menu">
|
||||||
<q-option-group
|
<q-option-group
|
||||||
@@ -1623,9 +1625,14 @@ const tableVirtualSliceSize = 160
|
|||||||
const productThumbVirtualItemSize = 236
|
const productThumbVirtualItemSize = 236
|
||||||
const maxAutoExpandLevelByTab = {
|
const maxAutoExpandLevelByTab = {
|
||||||
products: 8,
|
products: 8,
|
||||||
product_detail: 4,
|
product_detail: 8,
|
||||||
idle: 7,
|
idle: 8,
|
||||||
sales_color_yaka_market_customer: 5
|
sales_color_yaka_market_customer: 8,
|
||||||
|
sales_product_country_segment_market_customer: 8,
|
||||||
|
sales_market_customer_product: 8,
|
||||||
|
sales_country_segment_market_customer_product: 8,
|
||||||
|
order_product_customers: 8,
|
||||||
|
order_market_details: 8
|
||||||
}
|
}
|
||||||
const performanceTabs = [
|
const performanceTabs = [
|
||||||
{ name: 'products', icon: 'dashboard', label: 'Genel Özet KPI' },
|
{ name: 'products', icon: 'dashboard', label: 'Genel Özet KPI' },
|
||||||
@@ -2631,7 +2638,7 @@ const selectedExpandThroughLevel = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function maxAutoExpandThroughLevelForTab (tabKey = activeTab.value) {
|
function maxAutoExpandThroughLevelForTab (tabKey = activeTab.value) {
|
||||||
return Number.isFinite(maxAutoExpandLevelByTab[tabKey]) ? maxAutoExpandLevelByTab[tabKey] : 1
|
return Number.isFinite(maxAutoExpandLevelByTab[tabKey]) ? maxAutoExpandLevelByTab[tabKey] : 8
|
||||||
}
|
}
|
||||||
|
|
||||||
function maxBackendExpandedKeysForTab (tabKey = activeTab.value) {
|
function maxBackendExpandedKeysForTab (tabKey = activeTab.value) {
|
||||||
@@ -2648,6 +2655,11 @@ const autoExpandThroughLevel = computed(() => {
|
|||||||
return Math.min(requestedLevel, lastGroupLevel, maxAutoExpandThroughLevelForTab())
|
return Math.min(requestedLevel, lastGroupLevel, maxAutoExpandThroughLevelForTab())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const fullExpandThroughLevel = computed(() => {
|
||||||
|
const lastGroupLevel = Math.max(0, activeGroupLevels.value.length - 2)
|
||||||
|
return Math.min(lastGroupLevel, maxAutoExpandThroughLevelForTab())
|
||||||
|
})
|
||||||
|
|
||||||
const tableFilterSourceMap = computed(() => ({
|
const tableFilterSourceMap = computed(() => ({
|
||||||
products: { rows: filterSourceRowsForTab('products', rows.value), columns: productColumns.value },
|
products: { rows: filterSourceRowsForTab('products', rows.value), columns: productColumns.value },
|
||||||
product_detail: { rows: filterSourceRowsForTab('product_detail', detailProductRows.value), columns: productDetailColumns.value },
|
product_detail: { rows: filterSourceRowsForTab('product_detail', detailProductRows.value), columns: productDetailColumns.value },
|
||||||
@@ -2693,7 +2705,9 @@ const activeGroupSourceRows = computed(() => {
|
|||||||
|
|
||||||
const columnFilterOptionMap = computed(() => {
|
const columnFilterOptionMap = computed(() => {
|
||||||
const out = {}
|
const out = {}
|
||||||
for (const [tableKey, source] of Object.entries(tableFilterSourceMap.value)) {
|
const tableKey = isProductKpiTab.value ? activeProductTableKey.value : activeTab.value
|
||||||
|
const source = tableFilterSourceMap.value[tableKey]
|
||||||
|
if (!source) return out
|
||||||
out[tableKey] = {}
|
out[tableKey] = {}
|
||||||
for (const col of source.columns) {
|
for (const col of source.columns) {
|
||||||
if (!isColumnFilterable(col.name)) continue
|
if (!isColumnFilterable(col.name)) continue
|
||||||
@@ -2711,7 +2725,6 @@ const columnFilterOptionMap = computed(() => {
|
|||||||
out[tableKey][col.name] = Array.from(seen.values())
|
out[tableKey][col.name] = Array.from(seen.values())
|
||||||
.sort((a, b) => String(a.label).localeCompare(String(b.label), 'tr', { numeric: true }))
|
.sort((a, b) => String(a.label).localeCompare(String(b.label), 'tr', { numeric: true }))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return out
|
return out
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -2733,6 +2746,18 @@ const displayIdleTableRows = computed(() => backendRowsForTab('idle', idleTableR
|
|||||||
const displayOrderProductCustomerTableRows = computed(() => backendRowsForTab('order_product_customers', orderProductCustomerTableRows.value))
|
const displayOrderProductCustomerTableRows = computed(() => backendRowsForTab('order_product_customers', orderProductCustomerTableRows.value))
|
||||||
const displayOrderMarketDetailTableRows = computed(() => backendRowsForTab('order_market_details', orderMarketDetailTableRows.value))
|
const displayOrderMarketDetailTableRows = computed(() => backendRowsForTab('order_market_details', orderMarketDetailTableRows.value))
|
||||||
const displayActiveSalesBreakdownTableRows = computed(() => backendRowsForTab(activeTab.value, activeSalesBreakdownTableRows.value))
|
const displayActiveSalesBreakdownTableRows = computed(() => backendRowsForTab(activeTab.value, activeSalesBreakdownTableRows.value))
|
||||||
|
const activeDisplayedTableRows = computed(() => {
|
||||||
|
if (isProductKpiTab.value) return displayProductKpiTableRows.value
|
||||||
|
if (activeTab.value === 'idle') return displayIdleTableRows.value
|
||||||
|
if (activeTab.value === 'order_product_customers') return displayOrderProductCustomerTableRows.value
|
||||||
|
if (activeTab.value === 'order_market_details') return displayOrderMarketDetailTableRows.value
|
||||||
|
if (salesBreakdownTabKeys.includes(activeTab.value)) return displayActiveSalesBreakdownTableRows.value
|
||||||
|
if (activeTab.value === 'general') return filteredGeneralRows.value
|
||||||
|
if (activeTab.value === 'markets') return filteredMarketRows.value
|
||||||
|
if (activeTab.value === 'countries') return filteredCountryRows.value
|
||||||
|
if (activeTab.value === 'customers') return filteredCustomerRows.value
|
||||||
|
return []
|
||||||
|
})
|
||||||
|
|
||||||
const detailMainGroupOptions = computed(() => {
|
const detailMainGroupOptions = computed(() => {
|
||||||
const grouped = new Map()
|
const grouped = new Map()
|
||||||
@@ -2785,7 +2810,7 @@ const productAutoExpandKeys = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const allProductGroupsExpanded = computed(() => {
|
const allProductGroupsExpanded = computed(() => {
|
||||||
return selectedExpandThroughLevel.value >= autoExpandThroughLevel.value
|
return selectedExpandThroughLevel.value >= fullExpandThroughLevel.value
|
||||||
})
|
})
|
||||||
|
|
||||||
function appendGroupRows (out, sourceRows, level, parentKeys, levels = groupLevels) {
|
function appendGroupRows (out, sourceRows, level, parentKeys, levels = groupLevels) {
|
||||||
@@ -3485,6 +3510,15 @@ function toggleGroup (key) {
|
|||||||
applyActiveExpansionThroughLevel(isGroupExpanded(key) ? level - 1 : level)
|
applyActiveExpansionThroughLevel(isGroupExpanded(key) ? level - 1 : level)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toggleAllProductGroups () {
|
||||||
|
if (allProductGroupsExpanded.value) await collapseAllProductGroups()
|
||||||
|
else {
|
||||||
|
detailLevelMenuOpen.value = false
|
||||||
|
applyActiveExpansionThroughLevel(fullExpandThroughLevel.value)
|
||||||
|
await nextTick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function collapseAllProductGroups () {
|
async function collapseAllProductGroups () {
|
||||||
if (bulkExpandLoading.value) return
|
if (bulkExpandLoading.value) return
|
||||||
detailLevelMenuOpen.value = false
|
detailLevelMenuOpen.value = false
|
||||||
@@ -3664,26 +3698,8 @@ function selectAllColumnFilterOptions (tableKey, name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runWithFilterBusy (apply) {
|
function runWithFilterBusy (apply) {
|
||||||
filterBusy.value = true
|
|
||||||
const done = () => {
|
|
||||||
filterBusy.value = false
|
|
||||||
syncExpansionAfterFilterChange()
|
|
||||||
}
|
|
||||||
const execute = () => {
|
|
||||||
apply()
|
apply()
|
||||||
if (typeof window === 'undefined') {
|
syncExpansionAfterFilterChange()
|
||||||
setTimeout(done, 0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
window.requestAnimationFrame(() => {
|
|
||||||
window.requestAnimationFrame(done)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (typeof window === 'undefined') {
|
|
||||||
execute()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
window.requestAnimationFrame(execute)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncExpansionAfterFilterChange () {
|
function syncExpansionAfterFilterChange () {
|
||||||
@@ -4819,17 +4835,7 @@ watch(activeTab, () => {
|
|||||||
setupTopScrollbarSync()
|
setupTopScrollbarSync()
|
||||||
})
|
})
|
||||||
|
|
||||||
watch([
|
watch(activeDisplayedTableRows, () => {
|
||||||
displayProductKpiTableRows,
|
|
||||||
displayIdleTableRows,
|
|
||||||
displayOrderProductCustomerTableRows,
|
|
||||||
displayOrderMarketDetailTableRows,
|
|
||||||
displayActiveSalesBreakdownTableRows,
|
|
||||||
filteredGeneralRows,
|
|
||||||
filteredMarketRows,
|
|
||||||
filteredCountryRows,
|
|
||||||
filteredCustomerRows
|
|
||||||
], () => {
|
|
||||||
setupTopScrollbarSync()
|
setupTopScrollbarSync()
|
||||||
}, { flush: 'post' })
|
}, { flush: 'post' })
|
||||||
|
|
||||||
@@ -4846,10 +4852,9 @@ watch(selectedDetailMainGroup, () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(productTableRows, tableRows => {
|
watch(activeDisplayedTableRows, tableRows => {
|
||||||
if (!isProductKpiTab.value) return
|
if (!isProductKpiTab.value) return
|
||||||
const sourceRows = activeTab.value === 'product_detail' ? displayDetailProductTableRows.value : tableRows
|
const imageRows = tableRows
|
||||||
const imageRows = sourceRows
|
|
||||||
.filter(row => !row.__group || groupShowsImage(row))
|
.filter(row => !row.__group || groupShowsImage(row))
|
||||||
.slice(0, 240)
|
.slice(0, 240)
|
||||||
void primeProductImages(imageRows)
|
void primeProductImages(imageRows)
|
||||||
|
|||||||
Reference in New Issue
Block a user