Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-24 08:59:36 +03:00
parent efdd11a2a7
commit 196e42394a
2 changed files with 29 additions and 9 deletions

View File

@@ -1088,6 +1088,7 @@ const form = reactive({
drop: '',
kategori: '',
askiliyan: '',
yetiskinGarson: '',
seri: '',
bedenLabels: [],
bedenler: [],
@@ -1233,6 +1234,7 @@ async function resetEditor(force = false) {
urunIcerik: '',
drop: '',
askiliyan: '',
yetiskinGarson: '',
adet: 0,
fiyat: 0,
@@ -2661,6 +2663,7 @@ async function onModelChange(modelCode) {
drop: d.Drop || '',
kategori: d.Kategori || '',
askiliyan: d.AskiliYan || '',
yetiskinGarson: d.YETISKIN_GARSON || d.YetiskinGarson || d.AskiliYan || '',
aciklama: keep.aciklama,
fiyat: keep.fiyat,
adet: keep.adet,
@@ -2678,7 +2681,7 @@ async function onModelChange(modelCode) {
null,
form.urunAnaGrubu,
form.kategori || form.urunAltGrubu,
form.askiliyan
form.yetiskinGarson || form.askiliyan
)
} catch (e) {
console.warn('⚠️ detectBedenGroup hata:', e)
@@ -2696,7 +2699,7 @@ async function onModelChange(modelCode) {
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
.trim()
const ygN = String(form.askiliyan || '')
const ygN = String(form.yetiskinGarson || form.askiliyan || '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
@@ -2975,8 +2978,8 @@ async function loadOrderInventory(merge = false) {
// 2⃣ Form bedenlerine göre map oluştur
const newMap = {}
for (const lbl of form.bedenLabels || []) {
const key = lbl?.trim() === '' ? ' ' : lbl.trim()
newMap[lbl] = invMap[key] ?? 0
const key = lbl?.trim() === '' ? ' ' : normalizeBedenLabel(lbl)
newMap[lbl] = invMap[key] ?? invMap[lbl] ?? 0
}
// 3⃣ Merge veya replace

View File

@@ -2562,8 +2562,12 @@ export const useOrderEntryStore = defineStore('orderentry', {
}
const finalStockMap = {}
for (const lbl of form.bedenLabels) {
finalStockMap[lbl] = apiStockMap[lbl] ?? 0
for (const lbl of (form.bedenLabels || [])) {
const normalizedLbl =
lbl == null || String(lbl).trim() === ''
? ' '
: normalizeBedenLabel(String(lbl))
finalStockMap[lbl] = apiStockMap[normalizedLbl] ?? apiStockMap[lbl] ?? 0
}
stockMap.value = { ...finalStockMap }
@@ -3138,6 +3142,16 @@ export const useOrderEntryStore = defineStore('orderentry', {
return s
}
// UI'de yas grubu 2/4/6... gösterilir; payload'a 2Y/4Y/6... yazılır.
const toPayloadBeden = (grpKey, v) => {
const base = normBeden(v)
if (!base) return ''
if (grpKey === 'yas' && /^\d+$/.test(base)) {
return `${base}Y`
}
return base
}
/* =========================
USER META
========================== */
@@ -3383,16 +3397,19 @@ export const useOrderEntryStore = defineStore('orderentry', {
const qty = toNum(qtyRaw)
// ✅ payload beden: '' / 'S' / 'M' ...
const bedenPayload = normBeden(bedenRaw)
// ✅ UI/combokey için kanonik beden (yas'ta 2/4/6...)
const bedenCanonical = normBeden(bedenRaw)
// ✅ payload beden: yas grubunda 2Y/4Y/6..., diğerlerinde normal
const bedenPayload = toPayloadBeden(grpKey, bedenRaw)
// ✅ combokey beden: boşsa '_' ile stabil kalsın
const bedenKey = bedenPayload || '_'
const bedenKey = bedenCanonical || '_'
let orderLineId = ''
if (this.mode === 'edit') {
// lineIdMap anahtarı sizde hangi bedenle tutuluyorsa ikisini de dene
orderLineId =
safeStr(lineIdMap?.[bedenKey]) ||
safeStr(lineIdMap?.[bedenCanonical]) ||
safeStr(lineIdMap?.[bedenPayload]) ||
safeStr(lineIdMap?.[' ']) ||
(Object.keys(map).length === 1