Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-29 22:41:02 +03:00
parent 96ede55936
commit 05c6103a3a
10 changed files with 629 additions and 92 deletions

View File

@@ -835,6 +835,7 @@ const $q = useQuasar()
const orderStore = useOrderEntryStore()
const orderentryStore = useOrderEntryStore()
orderStore.initSchemaMap()
void orderStore.ensureProductSizeMatchRules()
const schemaSource = computed(() =>
Object.keys(orderStore?.schemaMap || {}).length
@@ -1777,6 +1778,7 @@ watch(() => orderStore.replaceRouteSignal, async (id) => {
/* -------------------- LIFECYCLE -------------------- */
onMounted(async () => {
await orderStore.ensureProductSizeMatchRules()
await nextTick()
/* ---------------- UI ---------------- */
@@ -2671,17 +2673,16 @@ async function onModelChange(modelCode) {
})
/* =======================================================
🔑 BEDEN GRUBU — TEK VE KESİN KARAR
- ÖNCE detectBedenGroup (accent/garson/yas kurallarını içerir)
- Sonra güvenli fallback
🔑 BEDEN GRUBU — TEK VE KESİN KARAR (SQL kural tabanı)
======================================================= */
let bedenGrpKey = null
try {
bedenGrpKey = detectBedenGroup(
null,
form.urunAnaGrubu,
form.kategori || form.urunAltGrubu,
form.yetiskinGarson || form.askiliyan
form.kategori || '',
form.yetiskinGarson || form.askiliyan,
form.urunAltGrubu || ''
)
} catch (e) {
console.warn('⚠️ detectBedenGroup hata:', e)
@@ -2689,42 +2690,13 @@ async function onModelChange(modelCode) {
}
if (!bedenGrpKey) {
const anaNRaw = String(form.urunAnaGrubu || '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
.trim()
const katN = String(form.kategori || form.urunAltGrubu || '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
.trim()
const ygN = String(form.yetiskinGarson || form.askiliyan || '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
.trim()
const anaN =
(katN.includes('yetiskin') && anaNRaw.includes('gomlek klasik'))
? anaNRaw.replace('gomlek klasik', 'gomlek ata yaka')
: anaNRaw
const hasGarsonMeta =
anaN.includes('garson') ||
katN.includes('garson') ||
katN.includes('yetiskin/garson') ||
ygN.includes('garson') ||
ygN.includes('yetiskin/garson')
if (hasGarsonMeta) bedenGrpKey = 'yas'
else if (anaN.includes('pantolon') || katN.includes('pantolon')) bedenGrpKey = 'pan'
else if (anaN.includes('gomlek') || katN.includes('gomlek')) bedenGrpKey = 'gom'
else if (anaN.includes('ayakkabi') || katN.includes('ayakkabi')) bedenGrpKey = 'ayk'
$q.notify({
type: 'negative',
message: 'Beden grubu eşleşmesi bulunamadı (kategori/ana grup/alt grup).'
})
return
}
// ✅ Son fallback
if (!bedenGrpKey) bedenGrpKey = 'tak'
form.grpKey = bedenGrpKey
console.log('🧭 Editor grpKey set edildi →', bedenGrpKey)
// ✅ Editor bedenleri hemen aç (UI seed) — schemaMap tek kaynak

View File

@@ -875,7 +875,8 @@ function toggleAllDetails() {
function buildLevel3Rows(grp3) {
const byKey = new Map()
const gk = activeGrpKey.value || 'tak'
const gk = activeGrpKey.value
if (!gk) return []
for (const item of grp3.items || []) {
const model = String(item.Urun_Kodu || '').trim()
@@ -1235,6 +1236,7 @@ async function fetchStockByAttributes() {
if (!orderStore.schemaMap || !Object.keys(orderStore.schemaMap).length) {
orderStore.initSchemaMap()
}
await orderStore.ensureProductSizeMatchRules()
const res = await api.get('/product-stock-query-by-attributes', { params })
const list = Array.isArray(res?.data) ? res.data : []
@@ -1249,14 +1251,27 @@ async function fetchStockByAttributes() {
const grpKey = detectBedenGroup(
list.map((x) => x?.Beden || ''),
first?.URUN_ANA_GRUBU || '',
first?.YETISKIN_GARSON || ''
first?.KATEGORI || first?.YETISKIN_GARSON || '',
first?.YETISKIN_GARSON || '',
first?.URUN_ALT_GRUBU || ''
)
const schemaMap = Object.keys(orderStore.schemaMap || {}).length
? orderStore.schemaMap
: storeSchemaByKey
activeGrpKey.value = grpKey || 'tak'
activeSchema.value = schemaMap?.[grpKey] || storeSchemaByKey.tak
if (!grpKey || !schemaMap?.[grpKey]) {
rawRows.value = []
openState.value = {}
errorMessage.value = 'Beden grubu eşleşmesi bulunamadı.'
$q.notify({
type: 'negative',
position: 'top-right',
message: 'Beden grubu eşleşmesi bulunamadı (kategori/ana grup/alt grup).'
})
return
}
activeGrpKey.value = grpKey
activeSchema.value = schemaMap[grpKey]
rawRows.value = list
productImageCache.value = {}
@@ -1491,7 +1506,8 @@ function resetForm() {
void loadFilterOptions(true)
}
onMounted(() => {
onMounted(async () => {
await orderStore.ensureProductSizeMatchRules()
void loadFilterOptions(true)
window.addEventListener('mousemove', onFullscreenMouseMove)
window.addEventListener('mouseup', onFullscreenMouseUp)

View File

@@ -850,7 +850,8 @@ function toggleAllDetails() {
function buildLevel3Rows(grp3) {
const byKey = new Map()
const gk = activeGrpKey.value || 'tak'
const gk = activeGrpKey.value
if (!gk) return []
for (const item of grp3.items || []) {
const model = String(item.Urun_Kodu || '').trim()
@@ -1045,6 +1046,7 @@ async function fetchStockByCode() {
if (!orderStore.schemaMap || !Object.keys(orderStore.schemaMap).length) {
orderStore.initSchemaMap()
}
await orderStore.ensureProductSizeMatchRules()
const res = await api.get('/product-stock-query', { params: { code } })
const list = Array.isArray(res?.data) ? res.data : []
@@ -1059,14 +1061,27 @@ async function fetchStockByCode() {
const grpKey = detectBedenGroup(
list.map((x) => x?.Beden || ''),
first?.URUN_ANA_GRUBU || '',
first?.YETISKIN_GARSON || ''
first?.KATEGORI || first?.YETISKIN_GARSON || '',
first?.YETISKIN_GARSON || '',
first?.URUN_ALT_GRUBU || ''
)
const schemaMap = Object.keys(orderStore.schemaMap || {}).length
? orderStore.schemaMap
: storeSchemaByKey
activeGrpKey.value = grpKey || 'tak'
activeSchema.value = schemaMap?.[grpKey] || storeSchemaByKey.tak
if (!grpKey || !schemaMap?.[grpKey]) {
rawRows.value = []
openState.value = {}
errorMessage.value = 'Beden grubu eşleşmesi bulunamadı.'
$q.notify({
type: 'negative',
position: 'top-right',
message: 'Beden grubu eşleşmesi bulunamadı (kategori/ana grup/alt grup).'
})
return
}
activeGrpKey.value = grpKey
activeSchema.value = schemaMap[grpKey]
rawRows.value = list
productImageCache.value = {}
@@ -1308,7 +1323,8 @@ onUnmounted(() => {
productImageBlobUrls.value = []
})
onMounted(() => {
onMounted(async () => {
await orderStore.ensureProductSizeMatchRules()
loadProductOptions()
window.addEventListener('mousemove', onFullscreenMouseMove)
window.addEventListener('mouseup', onFullscreenMouseUp)