Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -400,6 +400,26 @@ export const useOrderEntryStore = defineStore('orderentry', {
|
||||
}
|
||||
,
|
||||
|
||||
async sendOrderToMarketMails(orderId) {
|
||||
const id = String(orderId || this.header?.OrderHeaderID || '').trim()
|
||||
if (!id) {
|
||||
throw new Error('Sipariş ID bulunamadı')
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await api.post('/order/send-market-mail', {
|
||||
orderHeaderID: id
|
||||
})
|
||||
return res?.data || {}
|
||||
} catch (err) {
|
||||
const detail = await extractApiErrorDetail(err)
|
||||
const status = err?.status || err?.response?.status || '-'
|
||||
console.error(`❌ sendOrderToMarketMails hata [${status}] order=${id}: ${detail}`)
|
||||
throw new Error(detail)
|
||||
}
|
||||
}
|
||||
,
|
||||
|
||||
async downloadOrderPdf(id = null) {
|
||||
try {
|
||||
const orderId = id || this.header?.OrderHeaderID
|
||||
@@ -2845,6 +2865,23 @@ export const useOrderEntryStore = defineStore('orderentry', {
|
||||
productCache
|
||||
})
|
||||
|
||||
// 📧 Piyasa eşleşen alıcılara sipariş PDF gönderimi (kayıt başarılı olduktan sonra)
|
||||
try {
|
||||
const mailRes = await this.sendOrderToMarketMails(serverOrderId)
|
||||
const sentCount = Number(mailRes?.sentCount || 0)
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: sentCount > 0
|
||||
? `Sipariş PDF mail gönderildi (${sentCount} alıcı)`
|
||||
: 'Sipariş PDF mail gönderimi tamamlandı'
|
||||
})
|
||||
} catch (mailErr) {
|
||||
$q.notify({
|
||||
type: 'warning',
|
||||
message: `Sipariş kaydedildi, mail gönderilemedi: ${mailErr?.message || 'Bilinmeyen hata'}`
|
||||
})
|
||||
}
|
||||
|
||||
/* =======================================================
|
||||
❓ USER NEXT STEP
|
||||
======================================================= */
|
||||
|
||||
Reference in New Issue
Block a user