Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1098,6 +1098,7 @@ const form = reactive({
|
||||
kategori: '',
|
||||
askiliyan: '',
|
||||
yetiskinGarson: '',
|
||||
yasPayloadMap: {},
|
||||
seri: '',
|
||||
bedenLabels: [],
|
||||
bedenler: [],
|
||||
@@ -1256,6 +1257,7 @@ async function resetEditor(force = false) {
|
||||
drop: '',
|
||||
askiliyan: '',
|
||||
yetiskinGarson: '',
|
||||
yasPayloadMap: {},
|
||||
|
||||
adet: 0,
|
||||
fiyat: 0,
|
||||
@@ -1371,17 +1373,29 @@ const selectedRow = computed(() => {
|
||||
const groupOpen = reactive({})
|
||||
|
||||
function normalizeYetiskinGarsonToken (row) {
|
||||
const raw = String(
|
||||
row?.yetiskinGarson ||
|
||||
row?.YETISKIN_GARSON ||
|
||||
row?.YetiskinGarson ||
|
||||
row?.kategori ||
|
||||
row?.Kategori ||
|
||||
''
|
||||
).toUpperCase()
|
||||
const raw = [
|
||||
row?.yetiskinGarson,
|
||||
row?.YETISKIN_GARSON,
|
||||
row?.YetiskinGarson,
|
||||
row?.askiliyan,
|
||||
row?.AskiliYan,
|
||||
row?.kategori,
|
||||
row?.Kategori
|
||||
]
|
||||
.map(v => String(v || '').trim())
|
||||
.filter(Boolean)
|
||||
.join(' ')
|
||||
|
||||
if (raw.includes('GARSON')) return 'GARSON'
|
||||
if (raw.includes('YETISKIN') || raw.includes('YETİSKİN')) return 'YETISKIN'
|
||||
const normalized = raw
|
||||
.toUpperCase()
|
||||
.normalize('NFD')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.replace(/[^A-Z0-9/ ]+/g, ' ')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim()
|
||||
|
||||
if (normalized.includes('GARSON')) return 'GARSON'
|
||||
if (normalized.includes('YETISKIN')) return 'YETISKIN'
|
||||
return 'GENEL'
|
||||
}
|
||||
|
||||
@@ -1428,10 +1442,7 @@ const groupedRows = computed(() => {
|
||||
return order.map(bucketKey => {
|
||||
const grp = buckets[bucketKey]
|
||||
const schema = schemaMap?.[grp.grpKey]
|
||||
const schemaTitle = String(schema?.title || grp.grpKey || '').trim()
|
||||
const displayName = schemaTitle
|
||||
? `${grp.yg} ${grp.name} (${schemaTitle})`
|
||||
: `${grp.yg} ${grp.name}`
|
||||
const displayName = `${grp.yg} ${grp.name}`.trim()
|
||||
|
||||
return {
|
||||
...grp,
|
||||
@@ -2349,6 +2360,7 @@ async function hydrateEditorFromRow(row, opts = {}) {
|
||||
drop: row.drop || row.Drop || modelMeta?.Drop || '',
|
||||
askiliyan: rowAskili,
|
||||
yetiskinGarson: rowYetiskinGarson,
|
||||
yasPayloadMap: { ...(row.yasPayloadMap || {}) },
|
||||
kategori: rowKategori,
|
||||
aciklama: row.aciklama,
|
||||
fiyat: Number(row.fiyat || 0),
|
||||
@@ -2790,6 +2802,7 @@ async function onModelChange(modelCode) {
|
||||
kategori: d.Kategori || '',
|
||||
askiliyan: d.AskiliYan || '',
|
||||
yetiskinGarson: d.YETISKIN_GARSON || d.YetiskinGarson || d.AskiliYan || '',
|
||||
yasPayloadMap: {},
|
||||
aciklama: keep.aciklama,
|
||||
fiyat: keep.fiyat,
|
||||
adet: keep.adet,
|
||||
@@ -3096,12 +3109,34 @@ async function loadOrderInventory(merge = false) {
|
||||
console.log(`📦 MSSQL stok verisi geldi: ${data.length}`)
|
||||
console.table(data)
|
||||
|
||||
const pickPreferredYasPayloadLabel = (currentRaw, nextRaw) => {
|
||||
const cur = String(currentRaw || '').trim().toUpperCase()
|
||||
const nxt = String(nextRaw || '').trim().toUpperCase()
|
||||
if (!nxt) return cur
|
||||
if (!cur) return nxt
|
||||
const curYas = /YAS$|YAŞ$/.test(cur)
|
||||
const nxtYas = /YAS$|YAŞ$/.test(nxt)
|
||||
if (!curYas && nxtYas) return nxt
|
||||
return cur
|
||||
}
|
||||
|
||||
// 1️⃣ Normalize (gelen büyük harfli)
|
||||
const invMap = {}
|
||||
const invYasPayloadMap = {}
|
||||
for (const x of data) {
|
||||
const beden = normalizeBedenLabel(String(x.Beden || '').trim())
|
||||
const rawBeden = String(x.Beden || '').trim()
|
||||
const beden = normalizeBedenLabel(rawBeden)
|
||||
const stokDeger = Number(x.KullanilabilirAdet ?? 0)
|
||||
invMap[beden] = stokDeger
|
||||
|
||||
const rawUpper = rawBeden.toUpperCase()
|
||||
if (/^(\d+)\s*(Y|YAS|YAŞ)$/.test(rawUpper)) {
|
||||
const canonical = normalizeBedenLabel(rawUpper)
|
||||
invYasPayloadMap[canonical] = pickPreferredYasPayloadLabel(
|
||||
invYasPayloadMap[canonical],
|
||||
rawUpper
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 2️⃣ Form bedenlerine göre map oluştur
|
||||
@@ -3125,6 +3160,7 @@ async function loadOrderInventory(merge = false) {
|
||||
beden,
|
||||
stok
|
||||
}))
|
||||
form.yasPayloadMap = { ...(form.yasPayloadMap || {}), ...invYasPayloadMap }
|
||||
|
||||
console.log('✅ Stok haritası güncellendi:', stockMap.value)
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user