Update: 2026-05-15 15:02:14

This commit is contained in:
Hamza-Ayed
2026-05-15 15:02:14 +03:00
parent 54a4acdcab
commit 7ee897ff3d
6 changed files with 277 additions and 45 deletions

View File

@@ -29,6 +29,7 @@ $routes = [
'v1/companies/delete' => ['POST', 'companies/delete.php'],
'v1/invoices' => ['GET', 'invoices/index.php'],
'v1/invoices/view' => ['GET', 'invoices/view.php'],
'v1/verify' => ['GET', 'invoices/verify_public.php'],
'v1/invoices/file' => ['GET', 'invoices/file.php'],
'v1/invoices/approve' => ['POST', 'invoices/approve.php'],
'v1/invoices/upload' => ['POST', 'invoices/upload.php'],

View File

@@ -3039,29 +3039,9 @@
getQrSrc(inv) {
if (!inv) return '';
if (inv.jofotara?.qr_image_uri) return inv.jofotara.qr_image_uri;
let qrData = inv.qr_code;
// If no QR data in DB but approved, generate a fallback data string
if (!qrData && inv.status === 'approved') {
qrData = `Invoice: ${inv.invoice_number || 'N/A'}\nSupplier: ${inv.supplier_name || 'N/A'}\nTotal: ${inv.grand_total || '0'} JOD\nDate: ${inv.invoice_date || ''}`;
}
if (qrData) {
if (qrData.startsWith('data:')) return qrData;
try {
const qr = new QRious({
value: qrData,
size: 300,
level: 'M'
});
return qr.toDataURL();
} catch (e) {
console.error('QR Gen Error:', e);
return '';
}
}
return '';
const verifyUrl = `https://musadaq.intaleqapp.com/index.php?route=v1/verify&id=${inv.id}`;
const qr = new QRious({ value: verifyUrl, size: 300, level: 'H' });
return qr.toDataURL();
},
async showCompanyStats(companyId) {