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

@@ -186,8 +186,8 @@
<template #body-cell-usd_tutar="d">
<q-td :props="d" class="text-right">{{ formatAmount(d.row.usd_tutar) }}</q-td>
</template>
<template #body-cell-currency_try_rate="d">
<q-td :props="d" class="text-right">{{ formatAmount(d.row.currency_try_rate) }}</q-td>
<template #body-cell-currency_usd_rate="d">
<q-td :props="d" class="text-right">{{ formatAmount(d.row.currency_usd_rate) }}</q-td>
</template>
<template #body-cell-gun_sayisi="d">
<q-td :props="d" class="text-center">{{ formatAmount(d.row.gun_sayisi, 0) }}</q-td>
@@ -266,7 +266,7 @@ const detailColumns = [
{ name: 'odeme_doc_date', label: 'Ödeme DocDate', field: 'odeme_doc_date', align: 'left' },
{ name: 'eslesen_tutar', label: 'Eşleşen Tutar', field: 'eslesen_tutar', align: 'right' },
{ name: 'usd_tutar', label: 'USD Tutar', field: 'usd_tutar', align: 'right' },
{ name: 'currency_try_rate', label: 'Kur', field: 'currency_try_rate', align: 'right' },
{ name: 'currency_usd_rate', label: 'Kur', field: 'currency_usd_rate', align: 'right' },
{ name: 'gun_sayisi', label: 'Gün', field: 'gun_sayisi', align: 'center' },
{ name: 'gun_sayisi_docdate', label: 'Gün (DocDate)', field: 'gun_sayisi_docdate', align: 'center' },
{ name: 'aciklama', label: 'Açıklama', field: 'aciklama', align: 'left' },

View File

@@ -507,6 +507,7 @@ Vue
title="Cari Yaşlandırmalı Cari Bakiye Listesi"
:rows="store.summaryRows"
:columns="summaryColumns"
v-model:pagination="summaryPagination"
row-key="group_key"
:loading="store.loading"
flat
@@ -516,7 +517,6 @@ Vue
separator="cell"
hide-bottom
:rows-per-page-options="[0]"
:pagination="{ rowsPerPage: 0 }"
:table-style="{ tableLayout: 'fixed', width: '100%' }"
class="balance-table"
>
@@ -628,6 +628,12 @@ const store = useAccountAgingBalanceStore()
const expanded = ref({})
const allDetailsOpen = ref(false)
const filtersCollapsed = ref(false)
const summaryPagination = ref({
page: 1,
rowsPerPage: 0,
sortBy: 'ana_cari_kodu',
descending: false
})
const $q = useQuasar()
const { canRead, canExport } = usePermission()

View File

@@ -424,6 +424,7 @@
title="Cari Bakiye Listesi"
:rows="store.summaryRows"
:columns="summaryColumns"
v-model:pagination="summaryPagination"
row-key="group_key"
:loading="store.loading"
flat
@@ -433,7 +434,6 @@
separator="cell"
hide-bottom
:rows-per-page-options="[0]"
:pagination="{ rowsPerPage: 0 }"
:table-style="{ tableLayout: 'fixed', width: '100%' }"
class="balance-table"
>
@@ -531,6 +531,12 @@ const store = useCustomerBalanceListStore()
const expanded = ref({})
const allDetailsOpen = ref(false)
const filtersCollapsed = ref(false)
const summaryPagination = ref({
page: 1,
rowsPerPage: 0,
sortBy: 'ana_cari_kodu',
descending: false
})
const $q = useQuasar()
const { canRead, canExport } = usePermission()

View File

@@ -800,6 +800,7 @@ import dayjs from 'dayjs'
import api from 'src/services/api.js'
import { useAuthStore } from 'src/stores/authStore'
import { formatDateInput, formatDateDisplay } from 'src/utils/formatters'
import { normalizeSearchText } from 'src/utils/searchText'
import { usePermission } from 'src/composables/usePermission'
const { canRead, canWrite, canUpdate, canExport } = usePermission()
@@ -1956,13 +1957,13 @@ function filterCari(val, update) {
return
}
const needle = val.toLowerCase()
const needle = normalizeSearchText(val)
update(() => {
filteredCariOptions.value = cariOptions.value.filter(opt => {
const kod = (opt.Cari_Kod || '').toLowerCase()
const ad = (opt.Cari_Ad || '').toLowerCase()
const unvan = (opt.Unvan || '').toLowerCase()
const kod = normalizeSearchText(opt.Cari_Kod)
const ad = normalizeSearchText(opt.Cari_Ad)
const unvan = normalizeSearchText(opt.Unvan)
return `${kod} ${ad} ${unvan}`.includes(needle)
})
})
@@ -2575,9 +2576,9 @@ function filterModel(val, update) {
return
}
update(() => {
const needle = val.toLowerCase()
const needle = normalizeSearchText(val)
filteredModelOptions.value = modelOptions.value.filter(v =>
(v.label || '').toLowerCase().includes(needle)
normalizeSearchText(v.label).includes(needle)
)
})
}

View File

@@ -213,6 +213,7 @@ import { computed, onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useQuasar } from 'quasar'
import { useOrderProductionItemStore } from 'src/stores/OrderProductionItemStore'
import { normalizeSearchText } from 'src/utils/searchText'
const route = useRoute()
const $q = useQuasar()
@@ -278,18 +279,18 @@ function formatDate (val) {
}
const filteredProducts = computed(() => {
const needle = String(productSearch.value || '').toLowerCase()
const needle = normalizeSearchText(productSearch.value)
if (!needle) return productOptions.value.slice(0, 50)
return productOptions.value.filter(p =>
String(p?.ProductCode || '').toLowerCase().includes(needle)
normalizeSearchText(p?.ProductCode).includes(needle)
).slice(0, 50)
})
const filteredRows = computed(() => {
const needle = String(descFilter.value || '').toLowerCase().trim()
const needle = normalizeSearchText(descFilter.value)
if (!needle) return rows.value
return rows.value.filter(r =>
String(r?.OldDesc || '').toLowerCase().includes(needle)
normalizeSearchText(r?.OldDesc).includes(needle)
)
})

View File

@@ -243,6 +243,7 @@ import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useQuasar } from 'quasar'
import api from 'src/services/api'
import { usePermission } from 'src/composables/usePermission'
import { normalizeSearchText } from 'src/utils/searchText'
import {
detectBedenGroup,
normalizeBedenLabel,
@@ -339,6 +340,13 @@ function parseNumber(value) {
return Number.isFinite(n) ? n : 0
}
function sortByTotalQtyDesc(a, b) {
const qa = Number(a?.totalQty || 0)
const qb = Number(b?.totalQty || 0)
if (qb !== qa) return qb - qa
return String(a?.key || '').localeCompare(String(b?.key || ''), 'tr', { sensitivity: 'base' })
}
function buildImageKey(code, color) {
return `${String(code || '').trim().toUpperCase()}::${String(color || '').trim().toUpperCase()}`
}
@@ -491,7 +499,7 @@ async function ensureProductImage(code, color) {
const resolved = resolveProductImageUrl(first)
productImageCache.value[key] = resolved.publicUrl || resolved.contentUrl || ''
productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
productImageFallbackByKey.value[key] = resolved.contentUrl || ''
} catch (err) {
console.warn('[ProductStockByAttributes] product image fetch failed', { code, color, err })
@@ -680,13 +688,17 @@ const level1Groups = computed(() => {
})
}
return Array.from(l1Map.values()).map((l1) => ({
...l1,
children: Array.from(l1.childrenMap.values()).map((l2) => ({
...l2,
children: Array.from(l2.childrenMap.values())
return Array.from(l1Map.values())
.map((l1) => ({
...l1,
children: Array.from(l1.childrenMap.values())
.map((l2) => ({
...l2,
children: Array.from(l2.childrenMap.values()).sort(sortByTotalQtyDesc)
}))
.sort(sortByTotalQtyDesc)
}))
}))
.sort(sortByTotalQtyDesc)
})
function normalizeText(v) {
@@ -748,10 +760,10 @@ function filterOptions(field, val, update) {
})
return
}
const needle = String(val || '').toLocaleLowerCase('tr-TR')
const needle = normalizeSearchText(val)
update(() => {
filteredOptionLists.value[field] = source.filter((opt) =>
String(opt || '').toLocaleLowerCase('tr-TR').includes(needle)
normalizeSearchText(opt).includes(needle)
)
})
}

View File

@@ -241,6 +241,7 @@ import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useQuasar } from 'quasar'
import api from 'src/services/api'
import { usePermission } from 'src/composables/usePermission'
import { normalizeSearchText } from 'src/utils/searchText'
import {
detectBedenGroup,
normalizeBedenLabel,
@@ -446,7 +447,7 @@ async function ensureProductImage(code, color) {
if (!first) first = list[0] || null
const resolved = resolveProductImageUrl(first)
productImageCache.value[key] = resolved.publicUrl || resolved.contentUrl || ''
productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
productImageFallbackByKey.value[key] = resolved.contentUrl || ''
} catch (err) {
console.warn('[ProductStockQuery] product image fetch failed', { code, color, err })
@@ -651,10 +652,10 @@ function filterProducts(val, update) {
})
return
}
const needle = String(val || '').toLocaleLowerCase('tr-TR')
const needle = normalizeSearchText(val)
update(() => {
filteredProductOptions.value = productOptions.value.filter(opt =>
String(opt.label || '').toLocaleLowerCase('tr-TR').includes(needle)
normalizeSearchText(opt.label).includes(needle)
)
})
}

View File

@@ -96,6 +96,7 @@
import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { usePermission } from 'src/composables/usePermission'
import { normalizeSearchText } from 'src/utils/searchText'
const { canRead, canWrite } = usePermission()
@@ -175,9 +176,10 @@ const filters = ref({
const filteredRows = computed(() => {
return rows.value.filter(r => {
const workOrderNoNeedle = normalizeSearchText(filters.value.workOrderNo)
if (
filters.value.workOrderNo &&
!r.workOrderNo.includes(filters.value.workOrderNo)
workOrderNoNeedle &&
!normalizeSearchText(r.workOrderNo).includes(workOrderNoNeedle)
) return false
if (

View File

@@ -276,6 +276,7 @@ import { useStatementdetailStore } from 'src/stores/statementdetailStore'
import { useDownloadstpdfStore } from 'src/stores/downloadstpdfStore'
import dayjs from 'dayjs'
import { usePermission } from 'src/composables/usePermission'
import { normalizeSearchText } from 'src/utils/searchText'
const { canRead, canExport } = usePermission()
const canReadFinance = canRead('finance')
@@ -297,10 +298,10 @@ function filterCari(val, update) {
update(() => { filteredOptions.value = accountStore.accountOptions })
return
}
const needle = val.toLowerCase()
const needle = normalizeSearchText(val)
update(() => {
filteredOptions.value = accountStore.accountOptions.filter(o =>
o.label.toLowerCase().includes(needle) || o.value.toLowerCase().includes(needle)
normalizeSearchText(o.label).includes(needle) || normalizeSearchText(o.value).includes(needle)
)
})
}

View File

@@ -404,8 +404,6 @@ async function onSave () {
}
try {
console.log('🟢 onSave() START', { mode: mode.value })
if (form.value.mobile) {
form.value.mobile = form.value.mobile.replace(/_/g, '').trim()
}
@@ -415,8 +413,6 @@ async function onSave () {
if (isNew.value) {
id = await store.createUser()
console.log('➡️ CREATE → EDIT MODE id=', id)
// 🔄 EDIT MODEA GEÇ
router.replace({
name: 'user-edit',
@@ -431,7 +427,6 @@ async function onSave () {
$q.notify({ type: 'positive', message: 'İşlem başarılı' })
} catch (e) {
console.error('❌ onSave ERROR', e)
$q.notify({ type: 'negative', message: store.error || 'İşlem başarısız' })
}
}

View File

@@ -323,9 +323,6 @@ function filterCari (val, update) {
onMounted(async () => {
await accountStore.fetchAccounts()
console.log("ACCOUNTS LEN:", accountStore.accounts?.length)
console.log("OPTIONS LEN:", accountStore.accountOptions?.length)
console.log("FIRST 5:", accountStore.accountOptions?.slice(0,5))
filteredOptions.value = accountStore.accountOptions

View File

@@ -26,13 +26,6 @@ export default route(function () {
const auth = useAuthStore()
const perm = usePermissionStore()
if (typeof window !== 'undefined') {
console.warn('🧭 ROUTE GUARD HIT:', {
path: to.fullPath,
meta: to.meta
})
}
if (typeof window !== 'undefined' && process.env.DEV) {
window.__auth = auth
window.__perm = perm

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
}

View File

@@ -0,0 +1,7 @@
export function normalizeSearchText (value) {
return String(value || '')
.toLocaleLowerCase('tr-TR')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.trim()
}