feat(wa): tambah tautan pelanggan (chat WA, Maps, detail, pool tiket) di notifikasi tiket
This commit is contained in:
1 parent
a711a9ebe2
commit
086565d195
2 files changed
+18
-2
No files matched your search
@@ -3499,6 +3499,14 @@ router.post('/tickets/create', requireAdminSession, express.urlencoded({ extende
|
||||
const custPhone = cust ? cust.phone : '-';
|
||||
const custAddr = cust ? cust.address : '-';
|
||||
|
||||
const _waDigits = String(custPhone || '').replace(/\D/g, '').replace(/^0/, '62');
|
||||
const _mapQ = (cust && cust.lat && cust.lng) ? (cust.lat + ',' + cust.lng) : String(custAddr || '');
|
||||
const _base = (getSetting('public_base_url', '') || getSetting('app_url', '') || ('http://' + (req.get('host') || ''))).replace(/\/+$/, '');
|
||||
const _links = `\n🔗 *Tautan Cepat:*\n` +
|
||||
(_waDigits ? `• 💬 Chat Pelanggan: https://wa.me/${_waDigits}\n` : '') +
|
||||
(_mapQ ? `• 📍 Lokasi: https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(_mapQ)}\n` : '') +
|
||||
`• 🧾 Detail Pelanggan: ${_base}/admin/customers?search=${encodeURIComponent(custPhone || custName)}\n` +
|
||||
`• 🛠️ Pool Tiket Teknisi: ${_base}/tech/pool`;
|
||||
const waMsg = `📌 *TUGAS TEKNISI BARU DARI ADMIN*\n\n` +
|
||||
`🎫 *ID Tiket:* #${ticketId}\n` +
|
||||
`👤 *Pelanggan/Objek:* ${custName}\n` +
|
||||
@@ -3506,7 +3514,7 @@ router.post('/tickets/create', requireAdminSession, express.urlencoded({ extende
|
||||
`📍 *Alamat:* ${custAddr}\n` +
|
||||
`📝 *Kendala/Tugas:* ${subject}\n` +
|
||||
`💬 *Detail Pesan:* ${message}\n\n` +
|
||||
`Silakan cek di portal teknisi/admin untuk menindaklanjuti.`;
|
||||
`Silakan cek di portal teknisi/admin untuk menindaklanjuti.` + _links;
|
||||
|
||||
// Send to assigned technician or broadcast to all active technicians if not assigned
|
||||
if (tech && tech.phone) {
|
||||
|
||||
@@ -2945,13 +2945,21 @@ router.post('/tickets/create', uploadCustomer.array('photos', 5), async (req, re
|
||||
const photoCount = photoPaths.length;
|
||||
const photoText = photoCount > 0 ? `\n📸 *Foto Masalah:* ${photoCount} foto terlampir` : '';
|
||||
|
||||
const _waDigits = normalizeWaDigits(customer ? customer.phone : '');
|
||||
const _mapQ = (customer && customer.lat && customer.lng) ? (customer.lat + ',' + customer.lng) : String(customer ? customer.address : '');
|
||||
const _base = (String(settings.public_base_url || '') || String(settings.app_url || '') || ('http://' + (req.get('host') || ''))).replace(/\/+$/, '');
|
||||
const _links = `\n🔗 *Tautan Cepat:*\n` +
|
||||
(_waDigits ? `• 💬 Chat Pelanggan: https://wa.me/${_waDigits}\n` : '') +
|
||||
(_mapQ ? `• 📍 Lokasi: https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(_mapQ)}\n` : '') +
|
||||
`• 🧾 Detail Pelanggan: ${_base}/admin/customers?search=${encodeURIComponent(customer ? (customer.phone || customer.name) : '')}\n` +
|
||||
`• 🛠️ Pool Tiket Teknisi: ${_base}/tech/pool`;
|
||||
const waMsg = `🎫 *TIKET KELUHAN BARU*\n\n` +
|
||||
`👤 *Pelanggan:* ${customer ? customer.name : 'Unknown'}\n` +
|
||||
`📞 *WhatsApp:* ${customer ? customer.phone : '-'}\n` +
|
||||
`📍 *Alamat:* ${customer ? customer.address : '-'}\n` +
|
||||
`📝 *Subjek:* ${subject}\n` +
|
||||
`💬 *Pesan:* ${message}${photoText}\n\n` +
|
||||
`Silakan cek di panel Admin/Teknisi untuk menindaklanjuti.`;
|
||||
`Silakan cek di panel Admin/Teknisi untuk menindaklanjuti.` + _links;
|
||||
|
||||
const recipients = new Set();
|
||||
if (settings.whatsapp_admin_numbers && settings.whatsapp_admin_numbers.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user