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 ──────────────────────────────────────────