Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1190,9 +1190,21 @@ const renkOptions2 = ref([])
|
||||
// Mode senkronu
|
||||
orderStore.mode = routeMode.value
|
||||
function resolveBedenValue(bedenMap, grpKey, v) {
|
||||
if (!bedenMap || !grpKey) return ''
|
||||
if (!bedenMap) return ''
|
||||
|
||||
const map = bedenMap[grpKey]
|
||||
const detectedGrpKey = Object.keys(bedenMap || {})
|
||||
.find(k => bedenMap?.[k] && typeof bedenMap[k] === 'object')
|
||||
const effectiveGrpKey =
|
||||
(grpKey != null && String(grpKey) !== '')
|
||||
? String(grpKey)
|
||||
: (detectedGrpKey !== undefined ? detectedGrpKey : '')
|
||||
|
||||
const map =
|
||||
(Object.prototype.hasOwnProperty.call(bedenMap, effectiveGrpKey) &&
|
||||
bedenMap[effectiveGrpKey] &&
|
||||
typeof bedenMap[effectiveGrpKey] === 'object')
|
||||
? bedenMap[effectiveGrpKey]
|
||||
: bedenMap
|
||||
if (!map) return ''
|
||||
|
||||
// 🔴 AKSBİR / boş beden KESİNLİKLE normalize edilmez
|
||||
@@ -1201,7 +1213,7 @@ function resolveBedenValue(bedenMap, grpKey, v) {
|
||||
}
|
||||
|
||||
// 🔹 Diğer bedenler normal akış
|
||||
return map[v] ?? ''
|
||||
return map[v] ?? map[normalizeBedenLabel(String(v))] ?? ''
|
||||
}
|
||||
|
||||
|
||||
@@ -2219,6 +2231,30 @@ async function hydrateEditorFromRow(row, opts = {}) {
|
||||
/* -------------------------------------------------------
|
||||
🧩 FORM BASIC
|
||||
------------------------------------------------------- */
|
||||
const firstGroupedKey = Object.keys(row?.bedenMap || {})
|
||||
.find(k => row?.bedenMap?.[k] && typeof row.bedenMap[k] === 'object')
|
||||
const firstGroupedMap =
|
||||
firstGroupedKey !== undefined
|
||||
? row?.bedenMap?.[firstGroupedKey]
|
||||
: null
|
||||
const rowGrpKey =
|
||||
row.grpKey ||
|
||||
detectBedenGroup(
|
||||
Object.keys(firstGroupedMap || {}),
|
||||
row.urunAnaGrubu || '',
|
||||
row.kategori || '',
|
||||
row.yetiskinGarson || row.YETISKIN_GARSON || row.askiliyan || '',
|
||||
row.urunAltGrubu || ''
|
||||
)
|
||||
|
||||
if (!rowGrpKey) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: 'Beden grubu SQL kural tablosundan belirlenemedi.'
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
Object.assign(form, {
|
||||
model: row.model,
|
||||
renk: row.renk,
|
||||
@@ -2230,7 +2266,7 @@ async function hydrateEditorFromRow(row, opts = {}) {
|
||||
fiyat: Number(row.fiyat || 0),
|
||||
pb: row.pb || aktifPB.value || 'USD',
|
||||
terminTarihi: toDateOnly(row.terminTarihi || ''),
|
||||
grpKey: row.grpKey
|
||||
grpKey: rowGrpKey
|
||||
})
|
||||
|
||||
/* =======================================================
|
||||
@@ -2250,7 +2286,7 @@ async function hydrateEditorFromRow(row, opts = {}) {
|
||||
const schema = orderStore.schemaMap?.[grpKey]
|
||||
|
||||
if (schema?.values?.length) {
|
||||
const rowMap = row?.bedenMap?.[grpKey] || {}
|
||||
const rowMap = row?.bedenMap?.[grpKey] || firstGroupedMap || {}
|
||||
|
||||
form.bedenLabels = [...schema.values]
|
||||
form.bedenler = form.bedenLabels.map(lbl =>
|
||||
@@ -2675,6 +2711,8 @@ async function onModelChange(modelCode) {
|
||||
/* =======================================================
|
||||
🔑 BEDEN GRUBU — TEK VE KESİN KARAR (SQL kural tabanı)
|
||||
======================================================= */
|
||||
await orderStore.ensureProductSizeMatchRules($q)
|
||||
|
||||
let bedenGrpKey = null
|
||||
try {
|
||||
bedenGrpKey = detectBedenGroup(
|
||||
|
||||
@@ -3846,10 +3846,16 @@ export function detectBedenGroup(bedenList, urunAnaGrubu = '', urunKategori = ''
|
||||
bedenList: list
|
||||
})
|
||||
}
|
||||
return ruleBased || ''
|
||||
return ruleBased || 'tak'
|
||||
}
|
||||
|
||||
return ''
|
||||
console.warn('⚠ product-size-match cache hazir degil, fallback=tak', {
|
||||
kategori: deriveKategoriToken(urunKategori, yetiskinGarson),
|
||||
urunAnaGrubu: normalizeTextForMatch(urunAnaGrubu || ''),
|
||||
urunAltGrubu: normalizeRuleAltGroup(urunAltGrubu),
|
||||
bedenList: list
|
||||
})
|
||||
return 'tak'
|
||||
|
||||
const rawAna = normalizeTextForMatch(urunAnaGrubu || '')
|
||||
const rawKat = normalizeTextForMatch(urunKategori || '')
|
||||
|
||||
Reference in New Issue
Block a user