Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ui/src/pages/OrderList.vue
This commit is contained in:
2026-02-13 07:48:38 +03:00

View File

@@ -1,12 +1,12 @@
<template>
<q-page v-if="canReadOrder" class="ol-page">
<!-- 🍠Sticky Filter -->
<q-page class="ol-page">
<!-- 🔍 Sticky Filter -->
<div class="ol-filter-bar">
<!-- 🹠TEK SATIR FLEX -->
<!-- 🔹 TEK SATIR FLEX -->
<div class="ol-filter-row">
<!-- 🍠Arama -->
<!-- 🔍 Arama -->
<q-input
class="ol-filter-input ol-search"
dense
@@ -21,7 +21,7 @@
</template>
</q-input>
<!-- 🧾 Cari Kodu -->
<!-- 🧾 Cari Kodu -->
<q-input
class="ol-filter-input"
dense
@@ -31,7 +31,7 @@
clearable
/>
<!-- ğŸ Sipariş Tarihi -->
<!-- 📅 Sipariş Tarihi -->
<q-input
class="ol-filter-input"
dense
@@ -41,11 +41,10 @@
type="date"
/>
<!-- 😠Butonlar -->
<!-- 🔘 Butonlar -->
<div class="ol-filter-actions">
<q-btn
v-if="canReadOrder"
label="Temizle"
icon="clear"
color="grey-7"
@@ -59,7 +58,6 @@
</q-btn>
<q-btn
v-if="canReadOrder"
label="Yenile"
color="primary"
icon="refresh"
@@ -68,7 +66,6 @@
/>
<q-btn
v-if="canExportOrder"
label="Excel'e Aktar"
icon="download"
color="primary"
@@ -80,26 +77,13 @@
</div>
<!-- 🰠Toplam -->
<!-- 💰 Toplam -->
<div class="ol-filter-total">
<span>
Toplam USD:
Toplam Görünen Sipariş Tutarı (USD):
<strong>
{{ store.totalVisibleUSD.toLocaleString('tr-TR', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) }}
{{ store.totalVisibleUSD.toLocaleString('tr-TR', { minimumFractionDigits: 2 }) }}
USD
</strong>
</span>
<span>
Paketlenen USD:
<strong>
{{ store.totalPackedVisibleUSD.toLocaleString('tr-TR', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) }}
</strong>
</span>
<span>
Paketlenme %:
<strong>
{{ store.packedVisibleRatePct.toLocaleString('tr-TR', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) }}
</strong>
</span>
</div>
</div>
@@ -107,7 +91,7 @@
</div>
<!-- ğŸ ORDER LIST TABLE -->
<!-- 📋 ORDER LIST TABLE -->
<q-table
title="Mevcut Siparişler"
class="ol-table"
@@ -119,18 +103,16 @@
:rows="store.filteredOrders"
:columns="columns"
:loading="store.loading"
:table-style="tableStyle"
no-data-label="Sipariş bulunamadı"
:rows-per-page-options="[0]"
hide-bottom
>
<!-- ğŸ PDF + DURUM -->
<!-- 📄 PDF + DURUM -->
<template #body-cell-IsCreditableConfirmed="props">
<q-td :props="props" class="text-center q-gutter-sm">
<q-btn
v-if="canExportOrder"
icon="picture_as_pdf"
color="red"
flat
@@ -154,7 +136,7 @@
</q-td>
</template>
<!-- ğŸ Tarih -->
<!-- 📅 Tarih -->
<template #body-cell-OrderDate="props">
<q-td :props="props" class="text-center">
{{ formatDate(props.row.OrderDate) }}
@@ -167,7 +149,7 @@
</q-td>
</template>
<!-- 🧾 Cari Adı â 2 Satır -->
<!-- 🧾 Cari Adı 2 Satır -->
<template #body-cell-CurrAccDescription="props">
<q-td :props="props" class="ol-col-cari ol-col-multiline">
{{ props.value }}
@@ -177,7 +159,7 @@
</q-td>
</template>
<!-- 🝠ıklama â 5 Satır -->
<!-- 📝 ıklama 5 Satır -->
<template #body-cell-Description="props">
<q-td :props="props" class="ol-col-desc ol-col-multiline">
{{ props.value }}
@@ -187,11 +169,10 @@
</q-td>
</template>
<!-- ğŸ aç -->
<!-- 🔗 Aç -->
<template #body-cell-select="props">
<q-td :props="props" class="text-center">
<q-btn
v-if="canUpdateOrder"
icon="open_in_new"
color="primary"
flat
@@ -199,7 +180,7 @@
dense
@click="selectOrder(props.row)"
>
<q-tooltip>Siparişi aç</q-tooltip>
<q-tooltip>Siparişi Aç</q-tooltip>
</q-btn>
</q-td>
</template>
@@ -212,16 +193,10 @@
</q-banner>
</q-page>
<q-page v-else class="q-pa-md flex flex-center">
<div class="text-negative text-subtitle1">
Bu module erisim yetkiniz yok.
</div>
</q-page>
</template>
<script setup>
import { computed, onMounted, watch } from 'vue'
import { onMounted, watch } from 'vue'
import { useRouter } from 'vue-router'
import { useQuasar } from 'quasar'
@@ -229,12 +204,11 @@ import { useOrderListStore } from 'src/stores/OrdernewListStore'
import { useAuthStore } from 'src/stores/authStore'
import { usePermission } from 'src/composables/usePermission'
const { canRead, canWrite, canUpdate, canExport } = usePermission()
const { canRead, canWrite, canUpdate } = usePermission()
const canReadOrder = canRead('order')
const canWriteOrder = canWrite('order')
const canUpdateOrder = canUpdate('order')
const canExportOrder = canExport('order')
/* =========================
INIT
@@ -243,13 +217,9 @@ const canExportOrder = canExport('order')
const router = useRouter()
const $q = useQuasar()
// ⚠️ ÖNCE store tanımlanır
// ⚠️ ÖNCE store tanımlanır
const store = useOrderListStore()
const tableStyle = computed(() => ({
minWidth: $q.screen.lt.lg ? '1280px' : '100%'
}))
/* =========================
SEARCH DEBOUNCE
========================= */
@@ -271,15 +241,14 @@ watch(
HELPERS
========================= */
function exportExcel () {
if (!canExportOrder.value) {
$q.notify({ type: 'negative', message: 'Excel export yetkiniz yok', position: 'top-right' })
return
}
const auth = useAuthStore()
if (!auth?.token) {
$q.notify({ type: 'negative', message: 'Oturum bulunamadı', position: 'top-right' })
$q.notify({
type: 'negative',
message: 'Oturum bulunamadı',
position: 'top-right'
})
return
}
@@ -292,43 +261,19 @@ function exportExcel () {
const url = `http://localhost:8080/api/orders/export?${params.toString()}`
fetch(url, {
method: 'GET',
headers: { Authorization: `Bearer ${auth.token}` }
})
.then(async res => {
// ✅ 200 değilse EXCEL İNDİRME
if (!res.ok) {
const text = await res.text()
throw new Error(`HTTP ${res.status} - ${text}`)
headers: {
Authorization: `Bearer ${auth.token}`
}
// ✅ Content-Type kontrol (debug için)
const ct = res.headers.get('content-type') || ''
if (!ct.includes('spreadsheetml.sheet')) {
const text = await res.text()
throw new Error(`Beklenmeyen Content-Type: ${ct} | Body: ${text}`)
}
return res.blob()
})
.then(res => res.blob())
.then(blob => {
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = 'siparis_listesi.xlsx'
link.click()
})
.catch(err => {
$q.notify({
type: 'negative',
message: 'Excel export hatası: ' + (err?.message || err),
position: 'top-right',
timeout: 8000
})
console.error(err)
})
}
function formatDate (s) {
if (!s) return ''
const [y, m, d] = s.split('-')
@@ -340,18 +285,12 @@ function formatDate (s) {
========================= */
const columns = [
{
name: 'select',
label: '',
field: 'select',
align: 'center',
sortable: false,
style: 'width:42px; min-width:42px; max-width:42px; padding:2px 4px;',
headerStyle: 'width:42px; min-width:42px; max-width:42px; padding:2px 4px;'
},
{ name: 'OrderNumber', label: 'Sipariş No', field: 'OrderNumber', align: 'left', sortable: true, style: 'width:108px; min-width:108px;', headerStyle: 'width:108px; min-width:108px;' },
{ name: 'OrderDate', label: 'Tarih', field: 'OrderDate', align: 'center', sortable: true, style: 'width:78px; min-width:78px;', headerStyle: 'width:78px; min-width:78px;' },
{ name: 'CurrAccCode', label: 'Cari Kod', field: 'CurrAccCode', align: 'left', sortable: true, style: 'width:78px; min-width:78px;', headerStyle: 'width:78px; min-width:78px;' },
{ name: 'select', label: '', field: 'select', align: 'center', sortable: false },
{ name: 'OrderNumber', label: 'Sipariş No', field: 'OrderNumber', align: 'left', sortable: true },
{ name: 'OrderDate', label: 'Tarih', field: 'OrderDate', align: 'center', sortable: true },
{ name: 'CurrAccCode', label: 'Cari Kod', field: 'CurrAccCode', align: 'left', sortable: true },
{
name: 'CurrAccDescription',
@@ -361,13 +300,14 @@ const columns = [
sortable: true,
classes: 'ol-col-cari',
headerClasses: 'ol-col-cari',
style: 'width:130px; min-width:130px; max-width:130px;',
headerStyle: 'width:130px; min-width:130px; max-width:130px;'
style: 'max-width:200px'
},
{ name: 'MusteriTemsilcisi', label: 'Temsilci', field: 'MusteriTemsilcisi', align: 'left', sortable: true, style: 'width:78px; min-width:78px;', headerStyle: 'width:78px; min-width:78px;' },
{ name: 'Piyasa', label: 'Piyasa', field: 'Piyasa', align: 'left', sortable: true, style: 'width:74px; min-width:74px;', headerStyle: 'width:74px; min-width:74px;' },
{ name: 'CreditableConfirmedDate', label: 'Onay', field: 'CreditableConfirmedDate', align: 'center', sortable: true, style: 'width:82px; min-width:82px;', headerStyle: 'width:82px; min-width:82px;' },
{ name: 'DocCurrencyCode', label: 'PB', field: 'DocCurrencyCode', align: 'center', sortable: true, style: 'width:46px; min-width:46px;', headerStyle: 'width:46px; min-width:46px;' },
{ name: 'MusteriTemsilcisi', label: 'Temsilci', field: 'MusteriTemsilcisi', align: 'left', sortable: true },
{ name: 'Piyasa', label: 'Piyasa', field: 'Piyasa', align: 'left', sortable: true },
{ name: 'CreditableConfirmedDate', label: 'Onay', field: 'CreditableConfirmedDate', align: 'center', sortable: true },
{ name: 'DocCurrencyCode', label: 'PB', field: 'DocCurrencyCode', align: 'center', sortable: true },
{
name: 'TotalAmount',
@@ -375,8 +315,6 @@ const columns = [
field: 'TotalAmount',
align: 'right',
sortable: true,
style: 'width:94px; min-width:94px;',
headerStyle: 'width:94px; min-width:94px;',
format: (val, row) =>
Number(val || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 }) +
' ' + row.DocCurrencyCode
@@ -388,49 +326,11 @@ const columns = [
field: 'TotalAmountUSD',
align: 'right',
sortable: true,
style: 'width:96px; min-width:96px;',
headerStyle: 'width:96px; min-width:96px;',
format: val =>
Number(val || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 }) + ' USD'
},
{
name: 'PackedAmount',
label: 'Paket Tutar',
field: 'PackedAmount',
align: 'right',
sortable: true,
style: 'width:98px; min-width:98px;',
headerStyle: 'width:98px; min-width:98px;',
format: (val, row) =>
Number(val || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 }) +
' ' + (row.DocCurrencyCode || '')
},
{
name: 'PackedUSD',
label: 'Paket USD',
field: 'PackedUSD',
align: 'right',
sortable: true,
style: 'width:96px; min-width:96px;',
headerStyle: 'width:96px; min-width:96px;',
format: val =>
Number(val || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 }) + ' USD'
},
{
name: 'PackedRatePct',
label: 'Paket %',
field: 'PackedRatePct',
align: 'right',
sortable: true,
style: 'width:72px; min-width:72px;',
headerStyle: 'width:72px; min-width:72px;',
format: val =>
Number(val || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 }) + ' %'
},
{ name: 'IsCreditableConfirmed', label: 'Durum', field: 'IsCreditableConfirmed', align: 'center', sortable: true, style: 'width:66px; min-width:66px;', headerStyle: 'width:66px; min-width:66px;' },
{ name: 'IsCreditableConfirmed', label: 'Durum', field: 'IsCreditableConfirmed', align: 'center', sortable: true },
{
name: 'Description',
@@ -440,10 +340,10 @@ const columns = [
sortable: false,
classes: 'ol-col-desc',
headerClasses: 'ol-col-desc',
style: 'width:130px; min-width:130px; max-width:130px;',
headerStyle: 'width:130px; min-width:130px; max-width:130px;'
style: 'max-width:220px'
},
{ name: 'pdf', label: 'PDF', field: 'pdf', align: 'center', sortable: false, style: 'width:44px; min-width:44px;', headerStyle: 'width:44px; min-width:44px;' }
{ name: 'pdf', label: 'PDF', field: 'pdf', align: 'center', sortable: false }
]
/* =========================
@@ -451,11 +351,6 @@ const columns = [
========================= */
function selectOrder (row) {
if (!canUpdateOrder.value) {
$q.notify({ type: 'negative', message: 'Siparis guncelleme yetkiniz yok' })
return
}
if (!row?.OrderHeaderID) {
$q.notify({ type: 'warning', message: 'OrderHeaderID bulunamadı' })
return
@@ -469,11 +364,6 @@ function selectOrder (row) {
}
async function printPDF (row) {
if (!canExportOrder.value) {
$q.notify({ type: 'negative', message: 'PDF export yetkiniz yok' })
return
}
if (!row?.OrderHeaderID) return
const token = useAuthStore().token
@@ -512,55 +402,7 @@ function clearFilters () {
========================= */
onMounted(() => {
if (canReadOrder.value) {
store.fetchOrders()
}
})
</script>
<style scoped>
.ol-page {
padding: 8px;
}
.ol-table :deep(.q-table thead th) {
font-size: 11px;
line-height: 1.1;
font-weight: 700;
padding: 3px 6px;
white-space: nowrap;
}
.ol-table :deep(.q-table tbody td) {
font-size: 11px;
line-height: 1.15;
padding: 2px 6px;
white-space: nowrap;
}
.ol-col-multiline {
white-space: normal !important;
word-break: break-word;
line-height: 1.1;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.ol-filter-total {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
font-size: 12px;
}
@media (max-width: 1600px) {
.ol-table :deep(.q-table thead th),
.ol-table :deep(.q-table tbody td) {
font-size: 10px;
padding: 2px 4px;
}
}
</style>