Update: 2026-05-16 01:36:22

This commit is contained in:
Hamza-Ayed
2026-05-16 01:36:22 +03:00
parent 24a9f064a1
commit aceb7d324f
8 changed files with 145 additions and 43 deletions

View File

@@ -1951,6 +1951,22 @@
</p>
</div>
<!-- Cycle Toggle -->
<div style="display:flex; justify-content:center; margin-bottom:36px;">
<div style="background:var(--bg-secondary); padding:5px; border-radius:12px; display:flex; gap:5px; border:1px solid var(--border);">
<button @click="billingCycle = 'monthly'"
:class="billingCycle === 'monthly' ? 'btn-navy' : 'btn-ghost'"
style="font-size:13px; padding:8px 20px; border-radius:8px; transition:all 0.2s;">
دفع شهري
</button>
<button @click="billingCycle = 'annual'"
:class="billingCycle === 'annual' ? 'btn-navy' : 'btn-ghost'"
style="font-size:13px; padding:8px 20px; border-radius:8px; transition:all 0.2s;">
دفع سنوي (توفير )
</button>
</div>
</div>
<div style="display:grid; grid-template-columns:repeat(auto-fit, minmax(290px, 1fr)); gap:24px;">
<template x-for="p in plans" :key="p.id">
<div class="plan-card" :class="subscription?.plan_id === p.id ? 'active-plan' : ''">
@@ -1969,9 +1985,9 @@
style="text-align:center; padding:18px 0; border-top:1px solid var(--border); border-bottom:1px solid var(--border);">
<span class="num-font"
style="font-size:46px; font-weight:800; color:var(--green-mid);"
x-text="p.price_jod"></span>
x-text="billingCycle === 'monthly' ? (p.price_monthly_jod || p.price_jod) : (p.price_annual_jod || (p.price_jod * 10))"></span>
<span style="font-size:15px; color:var(--text-3); font-weight:500;"> دينار /
سنة</span>
<span x-text="billingCycle === 'monthly' ? 'شهر' : 'سنة'"></span></span>
</div>
<ul
@@ -2927,7 +2943,9 @@
isUploadingBatch: false, batchProgress: { total: 0, current: 0 },
showAddTenantModal: false, showEditTenantModal: false, showTenantStatsModal: false,
acknowledgedWarnings: false, isEditingInvoice: false,
isBusy: false, globalError: '',
isBusy: false,
billingCycle: 'annual', // 'monthly' or 'annual'
globalError: '',
newUser: { name: '', email: '', password: '', role: 'accountant', tenant_id: '' },
newCompany: { name: '', tax_identification_number: '', commercial_registration_number: '', address: '', tenant_id: '' },
@@ -3399,7 +3417,10 @@
const res = await fetch('/index.php?route=v1/payments/create', {
method: 'POST',
headers: { 'Authorization': 'Bearer ' + this.token(), 'Content-Type': 'application/json' },
body: JSON.stringify({ plan_id: plan.id })
body: JSON.stringify({
plan_id: plan.id,
billing_cycle: this.billingCycle
})
});
const json = await res.json();
this.isBusy = false;