Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-04-14 16:34:25 +03:00
parent 214677da1e
commit 47fc7a6178
4 changed files with 221 additions and 1 deletions

View File

@@ -262,6 +262,16 @@
@click="openNewRowEditor"
:disable="isClosedRow || isViewOnly || !canMutateRows"
/>
<q-btn
v-if="isEditMode && canBulkUpdateLineDueDates"
label="SATIR TERMINLERINI TOPLU GUNCELLE"
color="warning"
icon="event"
class="q-ml-sm"
:loading="orderStore.loading"
:disable="orderStore.loading || !canBulkUpdateLineDueDates"
@click="openBulkDueDateDialog"
/>
<q-btn
v-if="canSubmitOrder"
:label="isEditMode ? 'TÜMÜNÜ GÜNCELLE' : 'TÜMÜNÜ KAYDET'"
@@ -450,6 +460,41 @@
</div>
</template>
</div>
<!-- =======================================================
🔹 TOPLU TERMIN GUNCELLEME
======================================================== -->
<q-dialog v-model="showBulkDueDateDialog" persistent>
<q-card style="min-width: 420px; max-width: 90vw;">
<q-card-section class="text-subtitle1 text-weight-bold">
Satir Terminlerini Toplu Guncelle
</q-card-section>
<q-card-section class="q-pt-none">
<div class="q-mb-md">
Tum siparis satiri terminlerini sectiginiz tarihi koyarak guncellemek istediginize emin misiniz?
</div>
<q-input
v-model="bulkDueDateValue"
type="date"
label="Yeni Termin Tarihi"
filled
dense
autofocus
/>
</q-card-section>
<q-card-actions align="right">
<q-btn flat label="Iptal" v-close-popup />
<q-btn
color="primary"
label="Evet"
:loading="orderStore.loading"
@click="confirmBulkDueDateUpdate"
/>
</q-card-actions>
</q-card>
</q-dialog>
<!-- =======================================================
🔹 SATIR DÜZENLEYİCİ FORM (EDITOR)
======================================================== -->
@@ -883,6 +928,8 @@ console.log('🧩 Route parametresi alındı (setup başında):', orderHeaderID.
const aktifPB = ref('USD') // Varsayılan para birimi (Cari seçimiyle değişebilir)
// 🔹 Model detayları cache (product-detail API verilerini tutar)
const productCache = reactive({})
const showBulkDueDateDialog = ref(false)
const bulkDueDateValue = ref('')
const confirmAndSubmit = async () => {
if (orderStore.loading) return
@@ -918,6 +965,43 @@ const confirmAndSubmit = async () => {
}
}
function openBulkDueDateDialog() {
if (!canBulkUpdateLineDueDates.value) return
const firstRowDate = summaryRows.value?.find?.(row => !!row?.terminTarihi)?.terminTarihi || ''
bulkDueDateValue.value = toDateOnly(form.AverageDueDate || firstRowDate || dayjs().format('YYYY-MM-DD'))
showBulkDueDateDialog.value = true
}
async function confirmBulkDueDateUpdate() {
const dueDate = toDateOnly(bulkDueDateValue.value)
if (!dueDate) {
$q.notify({
type: 'warning',
message: 'Lutfen bir termin tarihi seciniz.'
})
return
}
try {
const result = await orderStore.bulkUpdateOrderLineDueDate(orderHeaderID.value, dueDate)
orderStore.applyBulkLineDueDateLocally(dueDate)
form.AverageDueDate = dueDate
showBulkDueDateDialog.value = false
$q.notify({
type: 'positive',
message: `Tum siparis satiri terminleri guncellendi (${Number(result?.updatedLines || 0)} satir).`
})
} catch (err) {
console.error('❌ confirmBulkDueDateUpdate hata:', err)
$q.notify({
type: 'negative',
message: err?.message || 'Satir terminleri guncellenemedi.'
})
}
}
/* ===========================================================
🗓️ SİPARİŞ TARİHLERİ — Varsayılan Değerler
@@ -939,6 +1023,14 @@ const canMutateRows = computed(() => {
if (isViewOnly.value) return false
return isEditMode.value ? canUpdateOrder.value : canWriteOrder.value
})
const canBulkUpdateLineDueDates = computed(() => {
if (!isEditMode.value) return false
if (isViewOnly.value) return false
if (isClosedOrder.value) return false
if (!canUpdateOrder.value) return false
if (!orderHeaderID.value) return false
return Array.isArray(orderStore.summaryRows) && orderStore.summaryRows.length > 0
})
function notifyNoPermission(message) {
$q.notify({