🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 02:16

This commit is contained in:
Hamza-Ayed
2026-05-03 02:16:47 +03:00
parent adb262c6b8
commit 355fb45935
4 changed files with 31 additions and 8 deletions

View File

@@ -455,10 +455,13 @@
modals.innerHTML = `
<div class="fixed inset-0 bg-black/60 backdrop-blur-sm z-[100] flex items-center justify-center" id="invoice-modal">
<div class="glass-panel p-8 rounded-3xl w-full max-w-md border border-white/10 shadow-2xl">
<h3 class="text-2xl font-bold mb-6">رفع فاتورة (JSON/XML)</h3>
<form id="upload-invoice-form" class="space-y-4">
<h3 class="text-2xl font-bold mb-6">رفع فاتورة للتدقيق</h3>
<form id="upload-invoice-form" class="space-y-4" enctype="multipart/form-data">
<input type="text" id="inv-comp-id" class="w-full bg-black/20 border border-white/10 rounded-xl px-4 py-3 text-white focus:border-primary outline-none" placeholder="معرف الشركة (Company ID)" required>
<textarea id="inv-payload" rows="6" class="w-full bg-black/20 border border-white/10 rounded-xl px-4 py-3 text-white focus:border-primary outline-none font-mono text-sm" placeholder='{"Invoice": {...}}' required></textarea>
<div class="p-4 border-2 border-dashed border-white/20 rounded-xl bg-black/10 text-center">
<p class="text-sm text-slate-400 mb-2">اختر ملف الفاتورة (JSON/XML/PDF)</p>
<input type="file" id="inv-file" class="text-sm w-full" required>
</div>
<div class="flex gap-3 mt-6">
<button type="button" onclick="document.getElementById('invoice-modal').remove()" class="flex-1 py-3 bg-white/5 hover:bg-white/10 rounded-xl transition">إلغاء</button>
<button type="submit" class="flex-1 py-3 bg-primary hover:bg-primary-dark text-white font-bold rounded-xl shadow-lg transition">تحقق ورفع</button>
@@ -471,14 +474,18 @@
document.getElementById('upload-invoice-form').onsubmit = async (e) => {
e.preventDefault();
try {
const companyId = document.getElementById('inv-comp-id').value; // Keep as string (UUID)
const payload = JSON.parse(document.getElementById('inv-payload').value);
const companyId = document.getElementById('inv-comp-id').value;
const fileInput = document.getElementById('inv-file');
const formData = new FormData();
formData.append('company_id', companyId);
formData.append('invoice', fileInput.files[0]);
const btn = e.target.querySelector('button[type="submit"]');
btn.textContent = 'جاري التحقق...';
btn.disabled = true;
await API.post('/invoices/upload', { company_id: companyId, payload });
await API.upload('/invoices/upload', formData);
document.getElementById('invoice-modal').remove();
renderInvoices();
} catch(err) {