Update: 2026-05-09 17:21:01

This commit is contained in:
Hamza-Ayed
2026-05-09 17:21:01 +03:00
parent f75e2719fa
commit c94855ed9c
5 changed files with 198 additions and 84 deletions

View File

@@ -230,6 +230,11 @@ final class QuotaMiddleware
$companiesLimit = (int)$sub['max_companies']; $companiesLimit = (int)$sub['max_companies'];
$usersLimit = (int)($sub['max_users'] ?? 999); $usersLimit = (int)($sub['max_users'] ?? 999);
// Check for pending payment request
$stmt = $db->prepare("SELECT id, plan_id, internal_reference FROM payment_requests WHERE tenant_id = ? AND status = 'pending' LIMIT 1");
$stmt->execute([$tenantId]);
$pendingPayment = $stmt->fetch();
return [ return [
'has_subscription' => true, 'has_subscription' => true,
'plan_id' => $sub['plan_id'] ?? 'free', 'plan_id' => $sub['plan_id'] ?? 'free',
@@ -239,6 +244,11 @@ final class QuotaMiddleware
'status' => $sub['status'], 'status' => $sub['status'],
'ai_features' => (bool)($sub['ai_features'] ?? false), 'ai_features' => (bool)($sub['ai_features'] ?? false),
'jofotara_enabled' => (bool)($sub['jofotara_enabled'] ?? false), 'jofotara_enabled' => (bool)($sub['jofotara_enabled'] ?? false),
'pending_payment' => $pendingPayment ? [
'id' => $pendingPayment['id'],
'plan_id' => $pendingPayment['plan_id'],
'reference' => $pendingPayment['internal_reference']
] : null,
'invoices' => [ 'invoices' => [
'used' => $invoicesUsed, 'used' => $invoicesUsed,

View File

@@ -230,6 +230,11 @@ final class QuotaMiddleware
$companiesLimit = (int)$sub['max_companies']; $companiesLimit = (int)$sub['max_companies'];
$usersLimit = (int)($sub['max_users'] ?? 999); $usersLimit = (int)($sub['max_users'] ?? 999);
// Check for pending payment request
$stmt = $db->prepare("SELECT id, plan_id, internal_reference FROM payment_requests WHERE tenant_id = ? AND status = 'pending' LIMIT 1");
$stmt->execute([$tenantId]);
$pendingPayment = $stmt->fetch();
return [ return [
'has_subscription' => true, 'has_subscription' => true,
'plan_id' => $sub['plan_id'] ?? 'free', 'plan_id' => $sub['plan_id'] ?? 'free',
@@ -239,6 +244,11 @@ final class QuotaMiddleware
'status' => $sub['status'], 'status' => $sub['status'],
'ai_features' => (bool)($sub['ai_features'] ?? false), 'ai_features' => (bool)($sub['ai_features'] ?? false),
'jofotara_enabled' => (bool)($sub['jofotara_enabled'] ?? false), 'jofotara_enabled' => (bool)($sub['jofotara_enabled'] ?? false),
'pending_payment' => $pendingPayment ? [
'id' => $pendingPayment['id'],
'plan_id' => $pendingPayment['plan_id'],
'reference' => $pendingPayment['internal_reference']
] : null,
'invoices' => [ 'invoices' => [
'used' => $invoicesUsed, 'used' => $invoicesUsed,

View File

@@ -0,0 +1,45 @@
<?php
/**
* Delete/Cancel Payment Request (Admin/Accountant)
* POST /api/v1/payments/delete
*/
declare(strict_types=1);
use App\Core\Database;
use App\Middleware\AuthMiddleware;
try {
$decoded = AuthMiddleware::check();
$db = Database::getInstance();
$tenantId = $decoded['tenant_id'];
$data = json_decode(file_get_contents('php://input'), true);
$paymentId = $data['payment_id'] ?? null;
if (!$paymentId) {
json_error('معرف طلب الدفع مطلوب.', 422);
}
// Only allow deleting PENDING requests
$stmt = $db->prepare("SELECT id FROM payment_requests WHERE id = ? AND tenant_id = ? AND status = 'pending'");
$stmt->execute([$paymentId, $tenantId]);
$payment = $stmt->fetch();
if (!$payment) {
json_error('لا يمكن حذف هذا الطلب (قد يكون مقبولاً بالفعل أو غير موجود).', 404);
}
$stmt = $db->prepare("DELETE FROM payment_requests WHERE id = ? AND tenant_id = ?");
$stmt->execute([$paymentId, $tenantId]);
// Log deletion
$logStmt = $db->prepare("INSERT INTO audit_logs (tenant_id, user_id, action, entity_type, entity_id) VALUES (?, ?, 'payment.deleted', 'payment', ?)");
$logStmt->execute([$tenantId, $decoded['user_id'], $paymentId]);
json_success([], 'تم إلغاء طلب الدفع بنجاح.');
} catch (\Throwable $e) {
error_log("Payment Delete Error: " . $e->getMessage());
json_error('حدث خطأ أثناء حذف طلب الدفع.', 500);
}

View File

@@ -77,6 +77,7 @@ $routes = [
'v1/payments/my-requests' => ['GET', 'payments/my_requests.php'], 'v1/payments/my-requests' => ['GET', 'payments/my_requests.php'],
'v1/payments/review' => ['POST', 'payments/review.php'], 'v1/payments/review' => ['POST', 'payments/review.php'],
'v1/payments/stats' => ['GET', 'payments/stats.php'], 'v1/payments/stats' => ['GET', 'payments/stats.php'],
'v1/payments/delete' => ['POST', 'payments/delete.php'],
// Voice Assistant Proxies // Voice Assistant Proxies
'v1/voice/transcribe' => ['POST', 'voice/transcribe.php'], 'v1/voice/transcribe' => ['POST', 'voice/transcribe.php'],

View File

@@ -7,7 +7,7 @@
<title>مُصادَق | لوحة التحكم الذكية</title> <title>مُصادَق | لوحة التحكم الذكية</title>
<link rel="icon" type="image/jpeg" href="assets/img/logo.jpg"> <link rel="icon" type="image/jpeg" href="assets/img/logo.jpg">
<link <link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&family=El+Messiri:wght@500;600;700&display=swap" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=El+Messiri:wght@500;600;700&display=swap"
rel="stylesheet"> rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script> <script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
@@ -63,7 +63,7 @@
} }
body { body {
font-family: 'IBM Plex Sans Arabic', sans-serif; font-family: 'IBM Plex Sans Arabic', 'Outfit', sans-serif;
background: var(--bg); background: var(--bg);
color: var(--text-1); color: var(--text-1);
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
@@ -71,6 +71,10 @@
line-height: 1.6; line-height: 1.6;
} }
.premium-font {
font-family: 'Outfit', sans-serif;
}
h1, h1,
h2, h2,
h3, h3,
@@ -1267,7 +1271,7 @@
<div style="font-size:12px; color:var(--text-3); margin-top:2px;" <div style="font-size:12px; color:var(--text-3); margin-top:2px;"
x-text="c.address"></div> x-text="c.address"></div>
</td> </td>
<td style="font-family:'IBM Plex Mono',monospace; font-size:12px;"> <td style="font-family:'Outfit',sans-serif; font-size:12px;">
<div style="color:var(--text-2);">TIN: <span <div style="color:var(--text-2);">TIN: <span
x-text="c.tax_identification_number"></span></div> x-text="c.tax_identification_number"></span></div>
<div style="color:var(--text-3); margin-top:2px;">CRN: <span <div style="color:var(--text-3); margin-top:2px;">CRN: <span
@@ -1275,7 +1279,7 @@
</td> </td>
<td style="text-align:center; font-weight:700; color:var(--text-2);" <td style="text-align:center; font-weight:700; color:var(--text-2);"
x-text="c.invoices_count || 0"></td> x-text="c.invoices_count || 0"></td>
<td style="text-align:center; font-weight:700; color:var(--teal); font-family:'IBM Plex Mono',monospace; font-size:13px;" <td style="text-align:center; font-weight:700; color:var(--teal); font-family:'Outfit',sans-serif; font-size:13px;"
x-text="parseFloat(c.total_amount || 0).toLocaleString() + ' JOD'"></td> x-text="parseFloat(c.total_amount || 0).toLocaleString() + ' JOD'"></td>
<td> <td>
<template x-if="c.jofotara_client_id_encrypted"> <template x-if="c.jofotara_client_id_encrypted">
@@ -1344,7 +1348,7 @@
<div> <div>
<div style="font-weight:700; color:var(--text-1);" x-text="u.name"> <div style="font-weight:700; color:var(--text-1);" x-text="u.name">
</div> </div>
<div style="font-size:12px; color:var(--text-3); font-family:'IBM Plex Mono',monospace;" <div style="font-size:12px; color:var(--text-3); font-family:'Outfit',sans-serif;"
x-text="u.email"></div> x-text="u.email"></div>
</div> </div>
</div> </div>
@@ -1413,12 +1417,12 @@
x-text="inv.company_name"></div> x-text="inv.company_name"></div>
<div style="font-size:13px; color:var(--text-2); margin-top:2px;" <div style="font-size:13px; color:var(--text-2); margin-top:2px;"
x-text="inv.supplier_name"></div> x-text="inv.supplier_name"></div>
<div style="font-size:11px; color:var(--text-3); font-family:'IBM Plex Mono',monospace;" <div style="font-size:11px; color:var(--text-3); font-family:'Outfit',sans-serif;"
x-text="inv.supplier_tin"></div> x-text="inv.supplier_tin"></div>
</td> </td>
<td style="color:var(--text-2); font-size:13px; font-family:'IBM Plex Mono',monospace;" <td style="color:var(--text-2); font-size:13px; font-family:'Outfit',sans-serif;"
x-text="inv.invoice_date || '—'"></td> x-text="inv.invoice_date || '—'"></td>
<td style="font-weight:700; color:var(--teal); font-family:'IBM Plex Mono',monospace;" <td style="font-weight:700; color:var(--teal); font-family:'Outfit',sans-serif;"
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"
@@ -1471,7 +1475,7 @@
<td> <td>
<div style="font-weight:700; color:var(--navy); font-size:15px;" <div style="font-weight:700; color:var(--navy); font-size:15px;"
x-text="t.name"></div> x-text="t.name"></div>
<div style="font-size:11px; color:var(--text-3); margin-top:3px; font-family:'IBM Plex Mono',monospace;" <div style="font-size:11px; color:var(--text-3); margin-top:3px; font-family:'Outfit',sans-serif;"
x-text="'انضم: ' + t.created_at.split(' ')[0]"></div> x-text="'انضم: ' + t.created_at.split(' ')[0]"></div>
</td> </td>
<td style="text-align:center; font-weight:700; color:var(--text-2);" <td style="text-align:center; font-weight:700; color:var(--text-2);"
@@ -1480,7 +1484,7 @@
x-text="t.invoices_count || 0"></td> x-text="t.invoices_count || 0"></td>
<td> <td>
<div style="font-size:13px; color:var(--text-2);" x-text="t.email"></div> <div style="font-size:13px; color:var(--text-2);" x-text="t.email"></div>
<div style="font-size:12px; color:var(--text-3); font-family:'IBM Plex Mono',monospace;" <div style="font-size:12px; color:var(--text-3); font-family:'Outfit',sans-serif;"
x-text="t.phone || '—'"></div> x-text="t.phone || '—'"></div>
</td> </td>
<td style="text-align:center;"> <td style="text-align:center;">
@@ -1504,80 +1508,124 @@
</div> </div>
</div> </div>
<!-- ── SUBSCRIPTION PAGE ──────────────────────── --> <!-- ── SUBSCRIPTION PAGE ────────────────────────── -->
<div x-show="page === 'subscription'"> <div x-show="page === 'subscription'">
<div class="table-container" style="margin-bottom:24px;"> <div style="display:flex; justify-content:space-between; align-items:end; margin-bottom:24px;">
<div class="table-top-bar"> <div>
<span style="font-size:18px;">💎</span> <h2 style="font-size:28px; font-weight:800; color:var(--navy); letter-spacing:-0.02em;">إدارة الاشتراك</h2>
<h3>اشتراكي الحالي</h3> <p style="color:var(--text-3); font-size:15px;">تفاصيل باقتك الحالية واستهلاك الموارد</p>
<span class="badge badge-teal" x-text="subscription?.plan_name"></span>
</div> </div>
<div style="padding:24px; display:grid; grid-template-columns:repeat(3, 1fr); gap:20px;"> <div style="background:var(--navy); padding:8px 20px; border-radius:12px; color:white; display:flex; align-items:center; gap:10px; box-shadow:var(--shadow);">
<!-- Progress: Invoices --> <span style="font-size:14px; opacity:0.8;">الباقة الحالية:</span>
<div class="stat-card stat-navy"> <span style="font-weight:700; font-size:18px;" x-text="subscription?.plan_name"></span>
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">
<span style="font-size:13px; font-weight:700;">الفواتير الشهرية</span>
<span style="font-size:12px; font-family:'IBM Plex Mono';" x-text="subscription?.invoices?.used + ' / ' + subscription?.invoices?.limit"></span>
</div>
<div style="height:8px; background:rgba(255,255,255,0.2); border-radius:4px; overflow:hidden;">
<div :style="'width:' + (subscription?.invoices?.percent || 0) + '%; height:100%; background:var(--teal);'"></div>
</div>
<div style="font-size:11px; margin-top:8px; opacity:0.8;" x-text="'يتم التصفير في: ' + (subscription?.period_end?.split(' ')[0] || '—')"></div>
</div>
<!-- Progress: Companies -->
<div class="stat-card stat-navy">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">
<span style="font-size:13px; font-weight:700;">الشركات المدارة</span>
<span style="font-size:12px; font-family:'IBM Plex Mono';" x-text="subscription?.companies?.used + ' / ' + subscription?.companies?.limit"></span>
</div>
<div style="height:8px; background:rgba(255,255,255,0.2); border-radius:4px; overflow:hidden;">
<div :style="'width:' + (subscription?.companies?.percent || 0) + '%; height:100%; background:var(--teal);'"></div>
</div>
<div style="font-size:11px; margin-top:8px; opacity:0.8;">إجمالي الشركات المسموح بها</div>
</div>
<!-- Progress: Users -->
<div class="stat-card stat-navy">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">
<span style="font-size:13px; font-weight:700;">فريق العمل</span>
<span style="font-size:12px; font-family:'IBM Plex Mono';" x-text="subscription?.users?.used + ' / ' + subscription?.users?.limit"></span>
</div>
<div style="height:8px; background:rgba(255,255,255,0.2); border-radius:4px; overflow:hidden;">
<div :style="'width:' + (subscription?.users?.percent || 0) + '%; height:100%; background:var(--teal);'"></div>
</div>
<div style="font-size:11px; margin-top:8px; opacity:0.8;">مستخدمين نشطين في النظام</div>
</div>
</div> </div>
</div> </div>
<!-- Pricing Cards --> <!-- Usage Stats Grid -->
<h3 style="font-size:18px; font-weight:700; color:var(--navy); margin:32px 0 20px;">تغيير أو ترقية الباقة</h3> <div style="display:grid; grid-template-columns:repeat(auto-fit, minmax(280px, 1fr)); gap:24px; margin-bottom:40px;">
<div style="display:grid; grid-template-columns:repeat(auto-fit, minmax(250px, 1fr)); gap:20px;"> <!-- Invoices Card -->
<div class="table-container" style="padding:24px; position:relative; overflow:hidden;">
<div style="display:flex; justify-content:space-between; margin-bottom:16px;">
<span style="font-weight:700; color:var(--navy);">الفواتير الشهرية</span>
<span class="premium-font" style="font-weight:700; color:var(--teal);" x-text="subscription?.invoices?.used + ' / ' + subscription?.invoices?.limit"></span>
</div>
<div style="height:10px; background:#f1f5f9; border-radius:10px; overflow:hidden; margin-bottom:12px;">
<div :style="'width:' + (subscription?.invoices?.percent || 0) + '%; height:100%; background:linear-gradient(90deg, var(--teal), var(--teal-mid)); border-radius:10px; transition:width 1s ease;'"></div>
</div>
<div style="display:flex; justify-content:space-between; font-size:12px; color:var(--text-3);">
<span x-text="'يتم التصفير في: ' + (subscription?.period_end?.split(' ')[0] || '—')"></span>
<span class="premium-font" x-text="(subscription?.invoices?.percent || 0) + '%'"></span>
</div>
</div>
<!-- Companies Card -->
<div class="table-container" style="padding:24px;">
<div style="display:flex; justify-content:space-between; margin-bottom:16px;">
<span style="font-weight:700; color:var(--navy);">الشركات المدارة</span>
<span class="premium-font" style="font-weight:700; color:var(--navy);" x-text="subscription?.companies?.used + ' / ' + subscription?.companies?.limit"></span>
</div>
<div style="height:10px; background:#f1f5f9; border-radius:10px; overflow:hidden; margin-bottom:12px;">
<div :style="'width:' + (subscription?.companies?.percent || 0) + '%; height:100%; background:linear-gradient(90deg, var(--navy), var(--navy-mid)); border-radius:10px;'"></div>
</div>
<div style="font-size:12px; color:var(--text-3);" x-text="'إجمالي الشركات المسموح بها'"></div>
</div>
<!-- Team Card -->
<div class="table-container" style="padding:24px;">
<div style="display:flex; justify-content:space-between; margin-bottom:16px;">
<span style="font-weight:700; color:var(--navy);">فريق العمل</span>
<span class="premium-font" style="font-weight:700; color:var(--purple);" x-text="subscription?.users?.used + ' / ' + subscription?.users?.limit"></span>
</div>
<div style="height:10px; background:#f1f5f9; border-radius:10px; overflow:hidden; margin-bottom:12px;">
<div :style="'width:' + (subscription?.users?.percent || 0) + '%; height:100%; background:linear-gradient(90deg, var(--purple), #8b5cf6); border-radius:10px;'"></div>
</div>
<div style="font-size:12px; color:var(--text-3);" x-text="'مستخدمين نشطين في النظام'"></div>
</div>
</div>
<!-- Pending Payment Warning -->
<div x-show="subscription?.pending_payment"
style="background:var(--gold-subtle); border:2px dashed var(--gold); border-radius:20px; padding:30px; margin-bottom:40px; display:flex; justify-content:space-between; align-items:center; animation:pulse 2s infinite;">
<div style="display:flex; gap:20px; align-items:center;">
<div style="background:var(--gold); color:white; width:50px; height:50px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:24px;"></div>
<div>
<h4 style="font-weight:800; color:var(--navy); font-size:18px;">لديك طلب ترقية قيد الانتظار</h4>
<p style="color:var(--text-2); font-size:14px;">بانتظار تأكيد عملية التحويل برقم المرجع: <strong class="premium-font" x-text="subscription?.pending_payment?.reference"></strong></p>
</div>
</div>
<div style="display:flex; gap:12px;">
<button @click="upgradePlan({id: subscription.pending_payment.plan_id})" class="btn-primary" style="background:var(--navy);">متابعة الدفع</button>
<button @click="cancelPayment(subscription.pending_payment.id)" class="btn btn-ghost" style="color:var(--red);">إلغاء الطلب</button>
</div>
</div>
<!-- Pricing Section -->
<div style="text-align:center; margin-bottom:32px;">
<h3 style="font-size:24px; font-weight:800; color:var(--navy); margin-bottom:8px;">تغيير أو ترقية الباقة</h3>
<p style="color:var(--text-3);">اختر الباقة التي تناسب احتياجات مكتبك المحاسبي</p>
</div>
<div style="display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:30px;">
<template x-for="p in plans" :key="p.id"> <template x-for="p in plans" :key="p.id">
<div class="table-container" style="padding:24px; display:flex; flex-direction:column; gap:16px; border:2px solid transparent;" <div class="table-container"
:style="subscription?.plan_id === p.id ? 'border-color:var(--gold);' : ''"> style="padding:40px; display:flex; flex-direction:column; gap:20px; border:2px solid transparent; transition:all 0.3s ease; position:relative;"
<div style="display:flex; justify-content:space-between; align-items:start;"> :style="subscription?.plan_id === p.id ? 'border-color:var(--gold); transform:scale(1.02); box-shadow:var(--shadow-lg);' : 'hover:border-color:var(--border-mid);'">
<div>
<h4 style="font-size:18px; font-weight:700; color:var(--navy);" x-text="p.name_ar"></h4> <div x-show="subscription?.plan_id === p.id"
<div style="font-size:12px; color:var(--text-3);" x-text="p.description_ar"></div> style="position:absolute; top:-12px; left:50%; transform:translateX(-50%); background:var(--gold); color:white; padding:4px 16px; border-radius:20px; font-size:12px; font-weight:700; box-shadow:var(--shadow-sm);">
</div> باقتك الحالية
<span x-show="subscription?.plan_id === p.id" class="badge badge-gold">باقتك الحالية</span>
</div> </div>
<div style="font-size:32px; font-weight:800; color:var(--teal);">
<span x-text="p.price_jod"></span> <div style="text-align:center;">
<span style="font-size:14px; font-weight:400; color:var(--text-3);">دينار / شهر</span> <h4 style="font-size:22px; font-weight:800; color:var(--navy); margin-bottom:8px;" x-text="p.name_ar"></h4>
<p style="font-size:13px; color:var(--text-3); min-height:40px;" x-text="p.description_ar"></p>
</div> </div>
<ul style="list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:10px;">
<div style="text-align:center; padding:20px 0; border-top:1px solid #f1f5f9; border-bottom:1px solid #f1f5f9;">
<span class="premium-font" style="font-size:48px; font-weight:800; color:var(--teal);" x-text="p.price_jod"></span>
<span style="font-size:16px; color:var(--text-3); font-weight:500;"> دينار / شهر</span>
</div>
<ul style="list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:14px; flex:1;">
<template x-for="f in p.features"> <template x-for="f in p.features">
<li style="font-size:13px; color:var(--text-2); display:flex; gap:8px; align-items:center;"> <li style="font-size:14px; color:var(--text-2); display:flex; gap:12px; align-items:center;">
<span style="color:var(--teal);"></span> <div style="width:20px; height:20px; background:var(--teal-subtle); color:var(--teal); border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px;"></div>
<span x-text="f"></span> <span x-text="f"></span>
</li> </li>
</template> </template>
</ul> </ul>
<button x-show="subscription?.plan_id !== p.id" class="btn-primary" style="margin-top:auto;"
@click="upgradePlan(p)"> <button x-show="subscription?.plan_id !== p.id"
@click="upgradePlan(p)"
class="btn-primary"
style="width:100%; height:54px; font-size:16px; font-weight:700; border-radius:14px; background:linear-gradient(135deg, var(--navy), var(--navy-mid)); box-shadow:0 4px 15px rgba(22, 50, 92, 0.2); margin-top:20px;">
ترقية الباقة الآن ترقية الباقة الآن
</button> </button>
<div x-show="subscription?.plan_id === p.id"
style="text-align:center; padding:15px; border-radius:12px; background:var(--gold-subtle); color:var(--gold); font-weight:700; font-size:14px; margin-top:20px;">
أنت مشترك في هذه الباقة
</div>
</div> </div>
</template> </template>
</div> </div>
@@ -1599,7 +1647,7 @@
<div class="modal-head-icon teal">📊</div> <div class="modal-head-icon teal">📊</div>
<div style="flex:1;"> <div style="flex:1;">
<div class="modal-title" x-text="companyStats?.company?.name"></div> <div class="modal-title" x-text="companyStats?.company?.name"></div>
<div class="modal-subtitle" style="font-family:'IBM Plex Mono',monospace;" <div class="modal-subtitle" style="font-family:'Outfit',sans-serif;"
x-text="'TIN: ' + companyStats?.company?.tax_identification_number"></div> x-text="'TIN: ' + companyStats?.company?.tax_identification_number"></div>
</div> </div>
<button @click="showCompanyStatsModal = false" class="modal-close-btn"></button> <button @click="showCompanyStatsModal = false" class="modal-close-btn"></button>
@@ -1643,12 +1691,12 @@
<tbody> <tbody>
<template x-for="m in companyStats?.monthly" :key="m.month"> <template x-for="m in companyStats?.monthly" :key="m.month">
<tr> <tr>
<td style="font-family:'IBM Plex Mono',monospace; color:var(--text-2);" <td style="font-family:'Outfit',sans-serif; color:var(--text-2);"
x-text="m.month"></td> x-text="m.month"></td>
<td x-text="m.total_invoices"></td> <td x-text="m.total_invoices"></td>
<td style="color:var(--amber); font-family:'IBM Plex Mono',monospace;" <td style="color:var(--amber); font-family:'Outfit',sans-serif;"
x-text="parseFloat(m.total_tax || 0).toLocaleString() + ' JOD'"></td> x-text="parseFloat(m.total_tax || 0).toLocaleString() + ' JOD'"></td>
<td style="font-weight:700; color:var(--teal); font-family:'IBM Plex Mono',monospace;" <td style="font-weight:700; color:var(--teal); font-family:'Outfit',sans-serif;"
x-text="parseFloat(m.total_amount || 0).toLocaleString() + ' JOD'"></td> x-text="parseFloat(m.total_amount || 0).toLocaleString() + ' JOD'"></td>
</tr> </tr>
</template> </template>
@@ -1708,12 +1756,12 @@
<tbody> <tbody>
<template x-for="m in tenantStats?.monthly" :key="m.month"> <template x-for="m in tenantStats?.monthly" :key="m.month">
<tr> <tr>
<td style="font-family:'IBM Plex Mono',monospace; color:var(--text-2);" <td style="font-family:'Outfit',sans-serif; color:var(--text-2);"
x-text="m.month"></td> x-text="m.month"></td>
<td x-text="m.total_invoices"></td> <td x-text="m.total_invoices"></td>
<td style="color:var(--amber); font-family:'IBM Plex Mono',monospace;" <td style="color:var(--amber); font-family:'Outfit',sans-serif;"
x-text="parseFloat(m.total_tax || 0).toLocaleString() + ' JOD'"></td> x-text="parseFloat(m.total_tax || 0).toLocaleString() + ' JOD'"></td>
<td style="font-weight:700; color:var(--teal); font-family:'IBM Plex Mono',monospace;" <td style="font-weight:700; color:var(--teal); font-family:'Outfit',sans-serif;"
x-text="parseFloat(m.total_amount || 0).toLocaleString() + ' JOD'"></td> x-text="parseFloat(m.total_amount || 0).toLocaleString() + ' JOD'"></td>
</tr> </tr>
</template> </template>
@@ -2041,14 +2089,14 @@
<div class="invoice-field-card"> <div class="invoice-field-card">
<div class="invoice-field-label">المورد (البائع)</div> <div class="invoice-field-label">المورد (البائع)</div>
<div class="invoice-field-value" x-text="currentInvoice?.supplier_name || 'غير متوفر'"></div> <div class="invoice-field-value" x-text="currentInvoice?.supplier_name || 'غير متوفر'"></div>
<div style="font-size:12px; color:var(--text-3); font-family:'IBM Plex Mono',monospace; margin-top:4px;" <div style="font-size:12px; color:var(--text-3); font-family:'Outfit',sans-serif; margin-top:4px;"
x-text="'TIN: ' + (currentInvoice?.supplier_tin || '—')"></div> x-text="'TIN: ' + (currentInvoice?.supplier_tin || '—')"></div>
</div> </div>
<div class="invoice-field-card"> <div class="invoice-field-card">
<div class="invoice-field-label">رقم الفاتورة والتاريخ</div> <div class="invoice-field-label">رقم الفاتورة والتاريخ</div>
<div class="invoice-field-value" x-text="currentInvoice?.invoice_number || '—'"></div> <div class="invoice-field-value" x-text="currentInvoice?.invoice_number || '—'"></div>
<div style="font-size:13px; color:var(--text-2); font-family:'IBM Plex Mono',monospace; margin-top:3px;" <div style="font-size:13px; color:var(--text-2); font-family:'Outfit',sans-serif; margin-top:3px;"
x-text="currentInvoice?.invoice_date || '—'"></div> x-text="currentInvoice?.invoice_date || '—'"></div>
</div> </div>
@@ -2057,7 +2105,7 @@
<div class="invoice-field-label" style="color:var(--teal);">المجموع الكلي</div> <div class="invoice-field-label" style="color:var(--teal);">المجموع الكلي</div>
<div style="font-size:26px; font-weight:700; color:var(--teal); font-family:'El Messiri',sans-serif;" <div style="font-size:26px; font-weight:700; color:var(--teal); font-family:'El Messiri',sans-serif;"
x-text="parseFloat(currentInvoice?.grand_total || 0).toLocaleString() + ' JOD'"></div> x-text="parseFloat(currentInvoice?.grand_total || 0).toLocaleString() + ' JOD'"></div>
<div style="font-size:12px; color:var(--amber); margin-top:4px; font-family:'IBM Plex Mono',monospace;" <div style="font-size:12px; color:var(--amber); margin-top:4px; font-family:'Outfit',sans-serif;"
x-text="'الضريبة: ' + parseFloat(currentInvoice?.tax_amount || 0).toLocaleString() + ' JOD'"> x-text="'الضريبة: ' + parseFloat(currentInvoice?.tax_amount || 0).toLocaleString() + ' JOD'">
</div> </div>
</div> </div>
@@ -2082,10 +2130,10 @@
<template x-for="item in currentInvoice?.items" :key="item.id"> <template x-for="item in currentInvoice?.items" :key="item.id">
<tr style="border-bottom:1px solid #f0f4f8;"> <tr style="border-bottom:1px solid #f0f4f8;">
<td style="padding:8px 10px; color:var(--text-2);" x-text="item.description"></td> <td style="padding:8px 10px; color:var(--text-2);" x-text="item.description"></td>
<td style="padding:8px 10px; text-align:center; color:var(--text-3); font-family:'IBM Plex Mono',monospace;" x-text="item.quantity"></td> <td style="padding:8px 10px; text-align:center; color:var(--text-3); font-family:'Outfit',sans-serif;" x-text="item.quantity"></td>
<td style="padding:8px 10px; text-align:left; color:var(--teal); font-family:'IBM Plex Mono',monospace;" x-text="item.unit_price"></td> <td style="padding:8px 10px; text-align:left; color:var(--teal); font-family:'Outfit',sans-serif;" x-text="item.unit_price"></td>
<td style="padding:8px 10px; text-align:left; color:var(--amber); font-family:'IBM Plex Mono',monospace;" x-text="(item.tax_rate || 0) + '%'"></td> <td style="padding:8px 10px; text-align:left; color:var(--amber); font-family:'Outfit',sans-serif;" x-text="(item.tax_rate || 0) + '%'"></td>
<td style="padding:8px 10px; text-align:left; font-weight:bold; color:var(--navy); font-family:'IBM Plex Mono',monospace;" x-text="item.line_total"></td> <td style="padding:8px 10px; text-align:left; font-weight:bold; color:var(--navy); font-family:'Outfit',sans-serif;" x-text="item.line_total"></td>
</tr> </tr>
</template> </template>
</tbody> </tbody>
@@ -2333,7 +2381,7 @@
<div style="margin-top:8px;"> <div style="margin-top:8px;">
<p style="margin-bottom:8px; font-size:13px; color:var(--text-2);">يرجى التحويل إلى حساب CliQ التالي:</p> <p style="margin-bottom:8px; font-size:13px; color:var(--text-2);">يرجى التحويل إلى حساب CliQ التالي:</p>
<div style="background:white; padding:10px 20px; border:1px dashed var(--teal); border-radius:8px; font-family:'IBM Plex Mono',monospace; font-size:20px; font-weight:bold; color:var(--navy); display:inline-block; letter-spacing:1px;" x-text="paymentData.cliq_alias"></div> <div style="background:white; padding:10px 20px; border:1px dashed var(--teal); border-radius:8px; font-family:'Outfit',sans-serif; font-size:20px; font-weight:bold; color:var(--navy); display:inline-block; letter-spacing:1px;" x-text="paymentData.cliq_alias"></div>
</div> </div>
</div> </div>