Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-10 17:51:31 +03:00
parent d590732f38
commit aba71341b9
24 changed files with 299 additions and 160 deletions

View File

@@ -164,23 +164,10 @@ export const useUserDetailStore = defineStore('userDetail', {
this.error = null
try {
console.log('🟦 saveUser() START', id)
const payload = this.buildPayload()
console.log('📤 PUT payload', payload)
await put(`/users/${id}`, payload)
console.log('✅ PUT OK → REFETCH USER')
await this.fetchUser(id)
console.log('🔄 USER REFRESHED', {
hasPassword: this.hasPassword,
roles: this.form.roles,
departments: this.form.departments
})
} catch (e) {
console.error('❌ saveUser FAILED', e)
this.error = 'Kullanıcı güncellenemedi'
throw e
} finally {
@@ -196,26 +183,18 @@ export const useUserDetailStore = defineStore('userDetail', {
this.error = null
try {
console.log('🟢 createUser() START')
const payload = this.buildPayload()
console.log('📤 POST payload', payload)
const data = await post('/users', payload)
console.log('✅ CREATE OK response', data)
const newId = data?.id
if (!newId) {
throw new Error('CREATE response id yok')
}
console.log('🔁 FETCH NEW USER id=', newId)
await this.fetchUser(newId)
return newId
} catch (e) {
console.error('❌ createUser FAILED', e)
this.error = 'Kullanıcı oluşturulamadı'
throw e
} finally {

View File

@@ -138,18 +138,6 @@ export const useAuthStore = defineStore('auth', {
const perm = usePermissionStore()
await perm.fetchPermissions()
// 🧪 DEBUG (istersen sonra kaldır)
console.log('🔐 AUTH DEBUG', {
isAdmin: this.isAdmin,
users: perm.hasPermission('/api/users/list'),
orders: perm.hasPermission('/api/orders/list'),
logs: perm.hasPermission('/api/activity-logs'),
permissions: perm.hasPermission('/api/permissions/matrix')
})
return true
}
}

View File

@@ -53,6 +53,7 @@ export const useStatementAgingStore = defineStore('statementAging', {
const absUsd = Math.abs(usd)
const gun = Number(row?.gun_sayisi) || 0
const gunDoc = Number(row?.gun_sayisi_docdate) || 0
const usdBasedRate = Number(row?.currency_usd_rate) || 0
const aciklama = String(row?.aciklama || '').toUpperCase()
if (!masterMap[masterKey]) {
@@ -69,6 +70,9 @@ export const useStatementAgingStore = defineStore('statementAging', {
weighted_gun_sum: 0,
weighted_gun_doc_sum: 0,
weighted_base: 0,
kur_weighted_sum: 0,
kur_weighted_base: 0,
kur_fallback: 0,
ortalama_gun: 0,
ortalama_gun_docdate: 0
}
@@ -90,6 +94,9 @@ export const useStatementAgingStore = defineStore('statementAging', {
weighted_gun_sum: 0,
weighted_gun_doc_sum: 0,
weighted_base: 0,
kur_weighted_sum: 0,
kur_weighted_base: 0,
kur_fallback: 0,
ortalama_gun: 0,
ortalama_gun_docdate: 0
}
@@ -124,6 +131,18 @@ export const useStatementAgingStore = defineStore('statementAging', {
c.weighted_base += absUsd
c.weighted_gun_sum += absUsd * gun
c.weighted_gun_doc_sum += absUsd * gunDoc
if (usdBasedRate > 0) {
m.kur_weighted_base += absUsd
m.kur_weighted_sum += absUsd * usdBasedRate
c.kur_weighted_base += absUsd
c.kur_weighted_sum += absUsd * usdBasedRate
}
}
if (usdBasedRate > 0) {
m.kur_fallback = usdBasedRate
c.kur_fallback = usdBasedRate
}
if (!detailMap[currencyKey]) detailMap[currencyKey] = []
@@ -133,7 +152,7 @@ export const useStatementAgingStore = defineStore('statementAging', {
this.masterRows = Object.values(masterMap)
.map((m) => ({
...m,
kur: Math.abs(m.toplam_usd) > 0 ? (m.toplam_tutar / m.toplam_usd) : 0,
kur: m.kur_weighted_base > 0 ? (m.kur_weighted_sum / m.kur_weighted_base) : m.kur_fallback,
ortalama_gun: m.weighted_base > 0 ? (m.weighted_gun_sum / m.weighted_base) : 0,
ortalama_gun_docdate: m.weighted_base > 0 ? (m.weighted_gun_doc_sum / m.weighted_base) : 0
}))
@@ -143,7 +162,7 @@ export const useStatementAgingStore = defineStore('statementAging', {
for (const c of Object.values(currencyMap)) {
const row = {
...c,
kur: Math.abs(c.toplam_usd) > 0 ? (c.toplam_tutar / c.toplam_usd) : 0,
kur: c.kur_weighted_base > 0 ? (c.kur_weighted_sum / c.kur_weighted_base) : c.kur_fallback,
ortalama_gun: c.weighted_base > 0 ? (c.weighted_gun_sum / c.weighted_base) : 0,
ortalama_gun_docdate: c.weighted_base > 0 ? (c.weighted_gun_doc_sum / c.weighted_base) : 0
}
@@ -194,6 +213,8 @@ function normalizeRowKeys(row) {
gun_sayisi: Number(row.GunSayisi ?? row.gun_sayisi ?? 0),
gun_sayisi_docdate: Number(row.GunSayisi_DocDate ?? row.gun_sayisi_docdate ?? 0),
currency_try_rate: Number(row.CurrencyTryRate ?? row.currency_try_rate ?? 0),
usd_try_rate: Number(row.UsdTryRate ?? row.usd_try_rate ?? 0),
currency_usd_rate: Number(row.CurrencyUsdRate ?? row.currency_usd_rate ?? 0),
aciklama: row.Aciklama ?? row.aciklama ?? null,
doc_currency_code: row.DocCurrencyCode ?? row.doc_currency_code ?? null
}