From 623df3f9fa0b3ec210c28e2fa4def883b6d11f6e Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sun, 3 May 2026 02:22:39 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20=D9=85=D9=8F=D8=B5=D8=A7=D8=AF?= =?UTF-8?q?=D9=8E=D9=82:=20=D8=AA=D8=AD=D8=AF=D9=8A=D8=AB=20=D8=A8=D8=B1?= =?UTF-8?q?=D9=85=D8=AC=D9=8A=20=D8=AC=D8=AF=D9=8A=D8=AF=202026-05-03=2002?= =?UTF-8?q?:22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/shell.php | 131 +++++++++++++++++++++++++++++++---------------- 1 file changed, 87 insertions(+), 44 deletions(-) diff --git a/public/shell.php b/public/shell.php index df7a246..64c646f 100644 --- a/public/shell.php +++ b/public/shell.php @@ -56,6 +56,10 @@ الفواتير المرفوعة + + + المستخدمين +
+
+
+ +

قريباً...

+

جاري برمجة واجهات ربط المحاسبين بالشركات وتحديد الصلاحيات الخاصة بهم.

+
+ `; + } catch(err) { + contentDiv.innerHTML = `
خطأ في جلب المستخدمين
`; + } } // ── Login View ─────────────────────────────────────────── @@ -284,16 +312,16 @@ html += `

${company.name}

-

الرقم الضريبي: ${company.tax_number}

+

الرقم الضريبي: ${company.tax_identification_number || company.tax_number || 'غير متوفر'}

بوابة JoFotara - ${company.jofotara_client_id + ${company.jofotara_client_id_encrypted ? 'مربوط ✓' : 'غير مربوط ⚠'}
- +
`; @@ -450,50 +478,65 @@ }; } - function showUploadInvoiceModal() { - const modals = document.getElementById('modals'); - modals.innerHTML = ` -
-
-

رفع فاتورة للتدقيق

-
- -
-

اختر ملف الفاتورة (JSON/XML/PDF)

- -
-
- - -
-
+ async function showUploadInvoiceModal() { + try { + // Fetch companies to populate the select dropdown + const res = await API.get('/companies'); + const companies = res.data; + + let optionsHtml = ''; + companies.forEach(c => { + optionsHtml += \`\`; + }); + + const modals = document.getElementById('modals'); + modals.innerHTML = \` +
+
+

رفع فاتورة للتدقيق

+
+ +
+

اختر ملف الفاتورة (JSON/XML/PDF)

+ +
+
+ + +
+
+
-
- `; + \`; - document.getElementById('upload-invoice-form').onsubmit = async (e) => { - e.preventDefault(); - try { - 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; + document.getElementById('upload-invoice-form').onsubmit = async (e) => { + e.preventDefault(); + try { + 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.upload('/invoices/upload', formData); - document.getElementById('invoice-modal').remove(); - renderInvoices(); - } catch(err) { - alert(err.error?.message_ar || 'صيغة البيانات غير صحيحة أو حدث خطأ ضريبي.'); - e.target.querySelector('button[type="submit"]').textContent = 'تحقق ورفع'; - e.target.querySelector('button[type="submit"]').disabled = false; - } - }; + await API.upload('/invoices/upload', formData); + document.getElementById('invoice-modal').remove(); + renderInvoices(); + } catch(err) { + alert(err.error?.message_ar || 'صيغة البيانات غير صحيحة أو حدث خطأ ضريبي.'); + e.target.querySelector('button[type="submit"]').textContent = 'تحقق ورفع'; + e.target.querySelector('button[type="submit"]').disabled = false; + } + }; + } catch(err) { + alert('خطأ في جلب بيانات الشركات المربوطة بك.'); + } } // ── Init Engine ──────────────────────────────────────────