Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -243,6 +243,7 @@ import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import { useQuasar } from 'quasar'
|
||||
import api from 'src/services/api'
|
||||
import { usePermission } from 'src/composables/usePermission'
|
||||
import { normalizeSearchText } from 'src/utils/searchText'
|
||||
import {
|
||||
detectBedenGroup,
|
||||
normalizeBedenLabel,
|
||||
@@ -339,6 +340,13 @@ function parseNumber(value) {
|
||||
return Number.isFinite(n) ? n : 0
|
||||
}
|
||||
|
||||
function sortByTotalQtyDesc(a, b) {
|
||||
const qa = Number(a?.totalQty || 0)
|
||||
const qb = Number(b?.totalQty || 0)
|
||||
if (qb !== qa) return qb - qa
|
||||
return String(a?.key || '').localeCompare(String(b?.key || ''), 'tr', { sensitivity: 'base' })
|
||||
}
|
||||
|
||||
function buildImageKey(code, color) {
|
||||
return `${String(code || '').trim().toUpperCase()}::${String(color || '').trim().toUpperCase()}`
|
||||
}
|
||||
@@ -491,7 +499,7 @@ async function ensureProductImage(code, color) {
|
||||
|
||||
const resolved = resolveProductImageUrl(first)
|
||||
|
||||
productImageCache.value[key] = resolved.publicUrl || resolved.contentUrl || ''
|
||||
productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
|
||||
productImageFallbackByKey.value[key] = resolved.contentUrl || ''
|
||||
} catch (err) {
|
||||
console.warn('[ProductStockByAttributes] product image fetch failed', { code, color, err })
|
||||
@@ -680,13 +688,17 @@ const level1Groups = computed(() => {
|
||||
})
|
||||
}
|
||||
|
||||
return Array.from(l1Map.values()).map((l1) => ({
|
||||
...l1,
|
||||
children: Array.from(l1.childrenMap.values()).map((l2) => ({
|
||||
...l2,
|
||||
children: Array.from(l2.childrenMap.values())
|
||||
return Array.from(l1Map.values())
|
||||
.map((l1) => ({
|
||||
...l1,
|
||||
children: Array.from(l1.childrenMap.values())
|
||||
.map((l2) => ({
|
||||
...l2,
|
||||
children: Array.from(l2.childrenMap.values()).sort(sortByTotalQtyDesc)
|
||||
}))
|
||||
.sort(sortByTotalQtyDesc)
|
||||
}))
|
||||
}))
|
||||
.sort(sortByTotalQtyDesc)
|
||||
})
|
||||
|
||||
function normalizeText(v) {
|
||||
@@ -748,10 +760,10 @@ function filterOptions(field, val, update) {
|
||||
})
|
||||
return
|
||||
}
|
||||
const needle = String(val || '').toLocaleLowerCase('tr-TR')
|
||||
const needle = normalizeSearchText(val)
|
||||
update(() => {
|
||||
filteredOptionLists.value[field] = source.filter((opt) =>
|
||||
String(opt || '').toLocaleLowerCase('tr-TR').includes(needle)
|
||||
normalizeSearchText(opt).includes(needle)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user