Update: 2026-05-12 01:40:41
This commit is contained in:
@@ -73,7 +73,7 @@ final class QuotaMiddleware
|
|||||||
$used = (int)$sub['invoices_used_this_month'];
|
$used = (int)$sub['invoices_used_this_month'];
|
||||||
$limit = (int)$sub['max_invoices_per_month'];
|
$limit = (int)$sub['max_invoices_per_month'];
|
||||||
|
|
||||||
if ($used >= $limit && false) { // BYPASS QUOTA FOR TESTING
|
if ($used >= $limit) {
|
||||||
json_error('لقد وصلت للحد الأقصى من الفواتير المسموحة هذا الشهر (' . $limit . ' فاتورة). يرجى ترقية باقتك.', 429, [
|
json_error('لقد وصلت للحد الأقصى من الفواتير المسموحة هذا الشهر (' . $limit . ' فاتورة). يرجى ترقية باقتك.', 429, [
|
||||||
'quota_type' => 'invoices',
|
'quota_type' => 'invoices',
|
||||||
'used' => $used,
|
'used' => $used,
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ final class QuotaMiddleware
|
|||||||
$used = (int)$sub['invoices_used_this_month'];
|
$used = (int)$sub['invoices_used_this_month'];
|
||||||
$limit = (int)$sub['max_invoices_per_month'];
|
$limit = (int)$sub['max_invoices_per_month'];
|
||||||
|
|
||||||
if ($used >= $limit && false) { // BYPASS QUOTA FOR TESTING
|
if ($used >= $limit) {
|
||||||
json_error('لقد وصلت للحد الأقصى من الفواتير المسموحة هذا الشهر (' . $limit . ' فاتورة). يرجى ترقية باقتك.', 429, [
|
json_error('لقد وصلت للحد الأقصى من الفواتير المسموحة هذا الشهر (' . $limit . ' فاتورة). يرجى ترقية باقتك.', 429, [
|
||||||
'quota_type' => 'invoices',
|
'quota_type' => 'invoices',
|
||||||
'used' => $used,
|
'used' => $used,
|
||||||
|
|||||||
@@ -1751,14 +1751,20 @@
|
|||||||
x-text="parseFloat(inv.grand_total).toLocaleString() + ' JOD'"></td>
|
x-text="parseFloat(inv.grand_total).toLocaleString() + ' JOD'"></td>
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
<span class="badge"
|
<span class="badge"
|
||||||
:class="inv.status==='extracted' ? 'badge-blue' : (inv.status==='approved' ? 'badge-teal' : (inv.status==='rejected'||inv.status==='failed'?'badge-red':'badge-gray'))"
|
:class="inv.status==='extracted' ? 'badge-blue' : (inv.status==='approved' ? 'badge-teal' : (inv.status==='submitted' ? 'badge-purple' : (inv.status==='rejected'||inv.status==='failed'?'badge-red':'badge-gray')))"
|
||||||
x-text="inv.status === 'approved' ? '✓ مدققة' : (inv.status === 'extracted' ? 'جاهزة للتدقيق' : (inv.status === 'rejected' ? 'مرفوضة' : inv.status))">
|
x-text="inv.status === 'approved' ? '✓ مدققة' : (inv.status === 'submitted' ? '🚀 مُرسلة للفوترة' : (inv.status === 'extracted' ? 'جاهزة للتدقيق' : (inv.status === 'rejected' ? 'مرفوضة' : inv.status)))">
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
<button @click="viewInvoice(inv.id)" class="btn-table-action btn-ta-navy">
|
<button @click="viewInvoice(inv.id)" class="btn-table-action btn-ta-navy">
|
||||||
👁️ عرض
|
👁️ عرض
|
||||||
</button>
|
</button>
|
||||||
|
<button @click="submitToJoFotara(inv.id)"
|
||||||
|
x-show="inv.status === 'approved'"
|
||||||
|
class="btn-table-action btn-ta-teal"
|
||||||
|
style="margin-right:4px;">
|
||||||
|
📤 جوفوترا
|
||||||
|
</button>
|
||||||
<button @click="deleteInvoice(inv.id)" class="btn-table-action btn-ta-red" style="margin-right:4px;">
|
<button @click="deleteInvoice(inv.id)" class="btn-table-action btn-ta-red" style="margin-right:4px;">
|
||||||
🗑️ حذف
|
🗑️ حذف
|
||||||
</button>
|
</button>
|
||||||
@@ -3230,6 +3236,29 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async submitToJoFotara(id) {
|
||||||
|
if (this.isBusy) return;
|
||||||
|
this.isBusy = true;
|
||||||
|
try {
|
||||||
|
const res = await fetch('/index.php?route=v1/invoices/submit-jofotara', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Authorization': 'Bearer ' + this.token(), 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ invoice_id: id })
|
||||||
|
});
|
||||||
|
const json = await res.json();
|
||||||
|
this.isBusy = false;
|
||||||
|
if (json.success) {
|
||||||
|
alert('تم إرسال الفاتورة لجوفتورة بنجاح!');
|
||||||
|
this.loadAll();
|
||||||
|
} else {
|
||||||
|
this.showError(json.message);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.isBusy = false;
|
||||||
|
this.showError('حدث خطأ أثناء الإرسال لجوفتورة');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async updateInvoice() {
|
async updateInvoice() {
|
||||||
if (!this.currentInvoice || this.isBusy) return;
|
if (!this.currentInvoice || this.isBusy) return;
|
||||||
this.isBusy = true;
|
this.isBusy = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user