Commit 17e8255e authored by Administrator's avatar Administrator

Update 9 files via Son of Anton

parent a23798bd
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>حالة وفاة #<?= (int) $case['id'] ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div class="card" style="padding:20px;">
<div class="card" style="padding:20px;margin-bottom:20px;">
<table style="width:100%;max-width:600px;font-size:14px;">
<tr><td style="padding:6px 0;color:#6B7280;width:35%;">العضو</td><td style="padding:6px 0;font-weight:600;"><?= e($case['member_name']) ?> (<?= e($case['membership_number'] ?? '—') ?>)</td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">المتوفى</td><td style="padding:6px 0;"><?= $case['deceased_type'] === 'primary_member' ? 'العضو الرئيسي' : 'الزوج/ة' ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">تاريخ الوفاة</td><td style="padding:6px 0;"><?= e($case['death_date']) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">شهادة الوفاة</td><td style="padding:6px 0;"><?= e($case['death_certificate_number'] ?? '—') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">نفس رقم العضوية</td><td style="padding:6px 0;"><?= $case['same_membership_number'] ? 'نعم' : 'لا' ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الرسوم</td><td style="padding:6px 0;font-weight:700;color:#0D7377;"><?= money($case['fee_amount'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الرسوم (استمارة + اشتراك)</td><td style="padding:6px 0;font-weight:700;font-size:20px;color:#DC2626;"><?= money($case['fee_amount'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الحالة</td><td style="padding:6px 0;font-weight:700;color:<?= $case['status'] === 'completed' ? '#059669' : '#D97706' ?>;"><?= $case['status'] === 'completed' ? 'مكتمل' : 'مسجّل' ?></td></tr>
<?php if ($case['transferred_to_member_id']): ?><tr><td style="padding:6px 0;color:#6B7280;">نُقلت إلى</td><td style="padding:6px 0;"><a href="/members/<?= (int) $case['transferred_to_member_id'] ?>" style="color:#0D7377;font-weight:600;">عضو #<?= (int) $case['transferred_to_member_id'] ?></a></td></tr><?php endif; ?>
</table>
<?php if ($case['status'] !== 'completed'): ?>
<form method="POST" action="/death/<?= (int) $case['id'] ?>/complete" style="margin-top:20px;">
</div>
<?php if ($case['status'] !== 'completed' && bccomp($case['fee_amount'] ?? '0', '0', 2) > 0): ?>
<div class="card" style="padding:20px;margin-bottom:20px;background:#FFF7ED;border:2px solid #F59E0B;">
<h4 style="margin:0 0 15px;color:#D97706;">💰 دفع رسوم نقل العضوية (استمارة + اشتراك سنوي)</h4>
<form method="POST" action="/death/<?= (int) $case['id'] ?>/pay">
<?= csrf_field() ?>
<button type="submit" class="btn btn-primary" onclick="return confirm('⚠ إتمام حالة الوفاة. متأكد؟')">إتمام الإجراء</button>
<input type="hidden" name="amount" value="<?= e($case['fee_amount']) ?>">
<div style="display:flex;gap:10px;align-items:end;">
<div class="form-group"><label class="form-label">المبلغ</label><input type="text" value="<?= money($case['fee_amount']) ?>" class="form-input" style="background:#F3F4F6;font-weight:700;font-size:18px;" readonly></div>
<div class="form-group"><label class="form-label">طريقة الدفع</label><select name="payment_method" class="form-select"><option value="cash">نقدي</option><option value="visa">فيزا</option></select></div>
<button type="submit" class="btn btn-primary" style="padding:10px 25px;" onclick="return confirm('تأكيد الدفع؟')">💰 ادفع</button>
</div>
</form>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($case['status'] !== 'completed'): ?>
<form method="POST" action="/death/<?= (int) $case['id'] ?>/complete">
<?= csrf_field() ?>
<button type="submit" class="btn btn-primary" onclick="return confirm('⚠ إتمام حالة الوفاة. متأكد؟')">✅ إتمام الإجراء</button>
</form>
<?php endif; ?>
<?php $__template->endSection(); ?>
\ No newline at end of file
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>حالة طلاق #<?= (int) $case['id'] ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div class="card" style="padding:20px;">
<div class="card" style="padding:20px;margin-bottom:20px;">
<table style="width:100%;max-width:600px;font-size:14px;">
<tr><td style="padding:6px 0;color:#6B7280;width:35%;">العضو</td><td style="padding:6px 0;"><a href="/members/<?= (int) $case['member_id'] ?>" style="color:#0D7377;font-weight:600;"><?= e($case['member_name']) ?></a></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الزوج/ة</td><td style="padding:6px 0;"><?= e($case['spouse_name']) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">تاريخ الطلاق</td><td style="padding:6px 0;"><?= e($case['divorce_date']) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">نوع الحالة</td><td style="padding:6px 0;font-weight:600;"><?= e(\App\Modules\Divorce\Models\DivorceCase::getCaseTypeLabel($case['divorce_case_type'])) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">النوع</td><td style="padding:6px 0;font-weight:600;"><?= e(\App\Modules\Divorce\Models\DivorceCase::getCaseTypeLabel($case['divorce_case_type'])) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">النسبة</td><td style="padding:6px 0;"><?= e($case['fee_percentage'] ?? '0') ?>%</td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الرسوم</td><td style="padding:6px 0;font-weight:700;color:#0D7377;"><?= money($case['fee_amount'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الرسوم</td><td style="padding:6px 0;font-weight:700;font-size:20px;color:#DC2626;"><?= money($case['fee_amount'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الحالة</td><td style="padding:6px 0;font-weight:700;color:<?= $case['status'] === 'completed' ? '#059669' : '#D97706' ?>;"><?= $case['status'] === 'completed' ? 'مكتمل' : 'مقدّم' ?></td></tr>
<?php if ($case['spouse_new_membership_number']): ?><tr><td style="padding:6px 0;color:#6B7280;">رقم العضوية الجديد</td><td style="padding:6px 0;font-weight:700;color:#0D7377;font-size:18px;"><?= e($case['spouse_new_membership_number']) ?></td></tr><?php endif; ?>
<?php if ($case['spouse_new_membership_number']): ?><tr><td style="padding:6px 0;color:#6B7280;">رقم العضوية الجديد</td><td style="padding:6px 0;font-weight:700;color:#0D7377;font-size:20px;"><?= e($case['spouse_new_membership_number']) ?></td></tr><?php endif; ?>
</table>
<?php if ($case['status'] !== 'completed'): ?>
<form method="POST" action="/divorce/<?= (int) $case['id'] ?>/complete" style="margin-top:20px;">
</div>
<?php if ($case['status'] !== 'completed' && bccomp($case['fee_amount'] ?? '0', '0', 2) > 0): ?>
<div class="card" style="padding:20px;margin-bottom:20px;background:#FFF7ED;border:2px solid #F59E0B;">
<h4 style="margin:0 0 15px;color:#D97706;">💰 دفع رسوم الطلاق</h4>
<form method="POST" action="/divorce/<?= (int) $case['id'] ?>/pay">
<?= csrf_field() ?>
<button type="submit" class="btn btn-primary" onclick="return confirm('⚠ إتمام حالة الطلاق — سيتم إنشاء عضوية جديدة. متأكد؟')">إتمام حالة الطلاق</button>
<input type="hidden" name="amount" value="<?= e($case['fee_amount']) ?>">
<div style="display:flex;gap:10px;align-items:end;">
<div class="form-group"><label class="form-label">المبلغ</label><input type="text" value="<?= money($case['fee_amount']) ?>" class="form-input" style="background:#F3F4F6;font-weight:700;font-size:18px;" readonly></div>
<div class="form-group"><label class="form-label">طريقة الدفع</label><select name="payment_method" class="form-select"><option value="cash">نقدي</option><option value="visa">فيزا</option><option value="bank_transfer">تحويل</option></select></div>
<button type="submit" class="btn btn-primary" style="padding:10px 25px;" onclick="return confirm('تأكيد الدفع؟')">💰 ادفع</button>
</div>
</form>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($case['status'] !== 'completed'): ?>
<form method="POST" action="/divorce/<?= (int) $case['id'] ?>/complete">
<?= csrf_field() ?>
<button type="submit" class="btn btn-primary" onclick="return confirm('⚠ إتمام حالة الطلاق — سيتم إنشاء عضوية جديدة. متأكد؟')">✅ إتمام حالة الطلاق</button>
</form>
<?php endif; ?>
<?php $__template->endSection(); ?>
\ No newline at end of file
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تقديم تظلم<?php $__template->endSection(); ?>
<?php $__template->section('title'); ?>تظلم من غرامة #<?= (int) ($fine['id'] ?? 0) ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div class="card" style="padding:20px;">
<p>صفحة التظلم — يتم التعامل معها عبر النماذج المضمنة في القائمة</p>
<a href="/fines" class="btn btn-outline">← العودة للغرامات</a>
<div class="card" style="padding:20px;margin-bottom:20px;">
<h3 style="color:#0D7377;margin:0 0 15px;">تقديم تظلم</h3>
<div style="margin-bottom:15px;padding:15px;background:#FEF2F2;border:1px solid #FECACA;border-radius:8px;">
<strong>نوع العقوبة:</strong> <?= e(\App\Modules\Fines\Models\Fine::getPenaltyTypeLabel($fine['penalty_type'] ?? '')) ?>
&nbsp;&nbsp; <strong>المبلغ:</strong> <?= money($fine['amount'] ?? '0') ?>
<br><small style="color:#DC2626;">مهلة التظلم: 15 يوم من تاريخ فرض العقوبة</small>
</div>
<form method="POST" action="/fines/<?= (int) $fine['id'] ?>/appeal">
<?= csrf_field() ?>
<div class="form-group" style="margin-bottom:15px;">
<label class="form-label">أسباب التظلم <span style="color:#DC2626;">*</span></label>
<textarea name="appeal_notes" class="form-textarea" rows="5" required placeholder="اكتب أسباب التظلم بالتفصيل..."></textarea>
</div>
<button type="submit" class="btn btn-primary">تقديم التظلم</button>
<a href="/fines" class="btn btn-outline">إلغاء</a>
</form>
</div>
<?php $__template->endSection(); ?>
\ No newline at end of file
......@@ -4,29 +4,34 @@
<div class="card" style="margin-bottom:20px;padding:15px;">
<form method="GET" action="/fines" style="display:flex;gap:10px;flex-wrap:wrap;align-items:end;">
<div><label class="form-label" style="font-size:12px;">بحث</label><input type="text" name="q" value="<?= e($filters['search'] ?? '') ?>" class="form-input" style="min-width:200px;"></div>
<div><label class="form-label" style="font-size:12px;">الحالة</label><select name="status" class="form-select"><option value="">الكل</option><option value="imposed" <?= ($filters['status'] ?? '') === 'imposed' ? 'selected' : '' ?>>مفروضة</option><option value="paid" <?= ($filters['status'] ?? '') === 'paid' ? 'selected' : '' ?>>مدفوعة</option><option value="appealed" <?= ($filters['status'] ?? '') === 'appealed' ? 'selected' : '' ?>>متظلم</option><option value="cancelled" <?= ($filters['status'] ?? '') === 'cancelled' ? 'selected' : '' ?>>ملغاة</option><option value="waived" <?= ($filters['status'] ?? '') === 'waived' ? 'selected' : '' ?>>معفاة</option></select></div>
<div><label class="form-label" style="font-size:12px;">نوع العقوبة</label><select name="penalty_type" class="form-select"><option value="">الكل</option><option value="warning">لفت نظر</option><option value="caution">إنذار</option><option value="fine">غرامة</option><option value="suspension">إيقاف</option><option value="ban">منع دخول</option><option value="termination">إنهاء</option></select></div>
<div><label class="form-label" style="font-size:12px;">الحالة</label><select name="status" class="form-select"><option value="">الكل</option><option value="imposed" <?= ($filters['status'] ?? '') === 'imposed' ? 'selected' : '' ?>>مفروضة</option><option value="paid" <?= ($filters['status'] ?? '') === 'paid' ? 'selected' : '' ?>>مدفوعة</option><option value="appealed" <?= ($filters['status'] ?? '') === 'appealed' ? 'selected' : '' ?>>متظلم</option></select></div>
<button type="submit" class="btn btn-outline">بحث</button>
</form>
</div>
<div class="card"><div class="table-responsive"><table class="data-table"><thead><tr><th>العضو</th><th>نوع العقوبة</th><th>المبلغ</th><th>الفترة</th><th>الحالة</th><th>الإجراءات</th></tr></thead><tbody>
<div class="card"><div class="table-responsive"><table class="data-table"><thead><tr><th>العضو</th><th>نوع العقوبة</th><th>المبلغ</th><th>المدفوع</th><th>الفترة</th><th>الحالة</th><th>الإجراءات</th></tr></thead><tbody>
<?php foreach ($rows as $r): ?>
<tr>
<td><a href="/members/<?= (int) $r['member_id'] ?>" style="color:#0D7377;font-weight:600;"><?= e($r['member_name'] ?? '') ?></a></td>
<td style="font-weight:600;color:<?= in_array($r['penalty_type'], ['suspension','ban','termination']) ? '#DC2626' : '#D97706' ?>;"><?= e(\App\Modules\Fines\Models\Fine::getPenaltyTypeLabel($r['penalty_type'])) ?></td>
<td><?= bccomp($r['amount'] ?? '0', '0', 2) > 0 ? money($r['amount']) : '—' ?></td>
<td style="font-weight:700;"><?= bccomp($r['amount'] ?? '0', '0', 2) > 0 ? money($r['amount']) : '—' ?></td>
<td style="color:#059669;"><?= bccomp($r['paid_amount'] ?? '0', '0', 2) > 0 ? money($r['paid_amount']) : '—' ?></td>
<td style="font-size:12px;"><?= ($r['suspension_from'] && $r['suspension_to']) ? e($r['suspension_from']) . ' → ' . e($r['suspension_to']) : '—' ?></td>
<td><span style="color:<?= match($r['status']) { 'imposed' => '#DC2626', 'paid' => '#059669', 'appealed' => '#D97706', 'cancelled' => '#6B7280', 'waived' => '#0284C7', default => '#6B7280' } ?>;font-weight:600;"><?= match($r['status']) { 'imposed' => 'مفروضة', 'paid' => 'مدفوعة', 'appealed' => 'متظلم', 'appeal_upheld' => 'تأييد', 'appeal_modified' => 'تعديل', 'cancelled' => 'ملغاة', 'waived' => 'معفاة', default => $r['status'] } ?></span></td>
<td><span style="color:<?= match($r['status']) { 'imposed' => '#DC2626', 'paid' => '#059669', 'appealed' => '#D97706', 'cancelled' => '#6B7280', 'waived' => '#0284C7', default => '#6B7280' } ?>;font-weight:600;"><?= match($r['status']) { 'imposed' => 'مفروضة', 'paid' => 'مدفوعة', 'appealed' => 'متظلم', 'appeal_upheld' => 'تأييد', 'cancelled' => 'ملغاة', 'waived' => 'معفاة', default => $r['status'] } ?></span></td>
<td>
<div style="display:flex;gap:5px;flex-wrap:wrap;">
<?php if ($r['status'] === 'imposed' && $r['penalty_type'] === 'fine'): ?>
<form method="POST" action="/fines/<?= (int) $r['id'] ?>/pay" style="display:inline;"><?= csrf_field() ?><input type="hidden" name="payment_method" value="cash"><button type="submit" class="btn btn-sm btn-primary">دفع</button></form>
<?php if (in_array($r['status'], ['imposed', 'appeal_upheld']) && $r['penalty_type'] === 'fine' && bccomp($r['amount'], $r['paid_amount'] ?? '0', 2) > 0): ?>
<form method="POST" action="/fines/<?= (int) $r['id'] ?>/pay" style="display:flex;gap:5px;">
<?= csrf_field() ?>
<input type="hidden" name="payment_method" value="cash">
<button type="submit" class="btn btn-sm btn-primary" onclick="return confirm('دفع غرامة <?= money(bcsub($r['amount'], $r['paid_amount'] ?? '0', 2)) ?>؟')">💰 ادفع <?= money(bcsub($r['amount'], $r['paid_amount'] ?? '0', 2)) ?></button>
</form>
<?php endif; ?>
<?php if (in_array($r['status'], ['imposed']) && !$r['appeal_submitted']): ?>
<form method="POST" action="/fines/<?= (int) $r['id'] ?>/appeal" style="display:inline;"><?= csrf_field() ?><input type="hidden" name="appeal_notes" value="تظلم"><button type="submit" class="btn btn-sm btn-outline">تظلم</button></form>
<?php if ($r['status'] === 'imposed' && !$r['appeal_submitted']): ?>
<a href="/fines/<?= (int) $r['id'] ?>/appeal" class="btn btn-sm btn-outline">تظلم</a>
<?php endif; ?>
<?php if ($r['status'] === 'appealed'): ?>
<form method="POST" action="/fines/<?= (int) $r['id'] ?>/appeal-decide" style="display:flex;gap:3px;"><?= csrf_field() ?>
<form method="POST" action="/fines/<?= (int) $r['id'] ?>/appeal-decide" style="display:flex;gap:3px;">
<?= csrf_field() ?>
<button type="submit" name="appeal_decision" value="upheld" class="btn btn-sm" style="background:#DC2626;color:#fff;border:none;padding:3px 8px;border-radius:4px;cursor:pointer;font-size:11px;">تأييد</button>
<button type="submit" name="appeal_decision" value="cancelled" class="btn btn-sm" style="background:#059669;color:#fff;border:none;padding:3px 8px;border-radius:4px;cursor:pointer;font-size:11px;">إلغاء</button>
</form>
......@@ -35,6 +40,6 @@
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($rows)): ?><tr><td colspan="6" style="text-align:center;padding:40px;color:#6B7280;">لا توجد غرامات</td></tr><?php endif; ?>
<?php if (empty($rows)): ?><tr><td colspan="7" style="text-align:center;padding:40px;color:#6B7280;">لا توجد غرامات</td></tr><?php endif; ?>
</tbody></table></div></div>
<?php $__template->endSection(); ?>
\ No newline at end of file
......@@ -3,11 +3,7 @@ declare(strict_types=1);
return [
['GET', '/installments', 'Installments\Controllers\InstallmentController@index', ['auth'], 'installment.view'],
['GET', '/installments/create/{memberId}', 'Installments\Controllers\InstallmentController@create', ['auth'], 'installment.create_plan'],
['POST', '/installments/store/{memberId}', 'Installments\Controllers\InstallmentController@store', ['auth'], 'installment.create_plan'],
['GET', '/installments/create/{memberId}', 'Installments\Controllers\InstallmentController@create', ['auth'], 'installment.create'],
['GET', '/installments/{id}', 'Installments\Controllers\InstallmentController@show', ['auth'], 'installment.view'],
['POST', '/installments/{id}/pay', 'Installments\Controllers\InstallmentController@recordPayment', ['auth'], 'installment.record_payment'],
['POST', '/installments/{id}/early-payoff', 'Installments\Controllers\InstallmentController@earlyPayoff', ['auth'], 'installment.modify_plan'],
['POST', '/api/installments/calculate', 'Installments\Controllers\InstallmentController@calculate', ['auth'], 'installment.create_plan'],
['GET', '/members/{memberId}/installments', 'Installments\Controllers\InstallmentController@memberPlans', ['auth'], 'installment.view'],
['POST', '/installments/{planId}/pay/{scheduleId}', 'Installments\Controllers\InstallmentController@payInstallment', ['auth'], 'installment.pay'],
];
\ No newline at end of file
This diff is collapsed.
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>طلب تحويل #<?= (int) $transfer['id'] ?><?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?>
<a href="/transfers" class="btn btn-outline">← العودة</a>
<?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;">
<div class="card" style="padding:20px;">
<h4 style="color:#0D7377;margin-bottom:15px;">بيانات الطلب</h4>
<table style="width:100%;font-size:14px;">
<tr><td style="padding:6px 0;color:#6B7280;width:40%;">رقم الطلب</td><td style="padding:6px 0;font-weight:700;">#<?= (int) $transfer['id'] ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">نوع التحويل</td><td style="padding:6px 0;font-weight:600;"><?= e(\App\Modules\Transfers\Models\TransferRequest::getTransferTypeLabel($transfer['transfer_type'])) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">العضو المصدر</td><td style="padding:6px 0;"><a href="/members/<?= (int) $transfer['source_member_id'] ?>" style="color:#0D7377;"><?= e($transfer['source_name']) ?></a> (<?= e($transfer['source_number'] ?? '—') ?>)</td></tr>
<?php if ($transfer['child_name']): ?><tr><td style="padding:6px 0;color:#6B7280;">الابن/الابنة</td><td style="padding:6px 0;"><?= e($transfer['child_name']) ?></td></tr><?php endif; ?>
<?php if ($transfer['spouse_name']): ?><tr><td style="padding:6px 0;color:#6B7280;">الزوج/الزوجة</td><td style="padding:6px 0;"><?= e($transfer['spouse_name']) ?></td></tr><?php endif; ?>
<tr><td style="padding:6px 0;color:#6B7280;">الحالة</td><td style="padding:6px 0;font-weight:700;color:<?= match($transfer['status']) { 'completed' => '#059669', 'rejected' => '#DC2626', default => '#D97706' } ?>;"><?= match($transfer['status']) { 'requested' => 'مقدّم', 'approved' => 'مُعتمد', 'fee_paid' => 'تم السداد', 'completed' => 'مكتمل', 'rejected' => 'مرفوض', default => $transfer['status'] } ?></td></tr>
<?php if ($transfer['target_name']): ?><tr><td style="padding:6px 0;color:#6B7280;">العضو الجديد</td><td style="padding:6px 0;"><a href="/members/<?= (int) $transfer['target_member_id'] ?>" style="color:#0D7377;font-weight:600;"><?= e($transfer['target_name']) ?></a></td></tr><?php endif; ?>
<?php if ($transfer['new_membership_number']): ?><tr><td style="padding:6px 0;color:#6B7280;">رقم العضوية الجديد</td><td style="padding:6px 0;font-weight:700;color:#0D7377;font-size:18px;"><?= e($transfer['new_membership_number']) ?></td></tr><?php endif; ?>
<?php if ($transfer['notes']): ?><tr><td style="padding:6px 0;color:#6B7280;">ملاحظات</td><td style="padding:6px 0;"><?= e($transfer['notes']) ?></td></tr><?php endif; ?>
</table>
</div>
<div class="card" style="padding:20px;">
<h4 style="color:#0D7377;margin-bottom:15px;">تفاصيل الرسوم</h4>
<table style="width:100%;font-size:14px;">
<tr><td style="padding:6px 0;color:#6B7280;">قيمة العضوية الجديدة</td><td style="padding:6px 0;"><?= money($transfer['new_membership_value'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">سنوات منذ الاكتساب</td><td style="padding:6px 0;"><?= (int) ($transfer['years_since_acquisition'] ?? 0) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">نسبة رسوم الفصل</td><td style="padding:6px 0;"><?= e($transfer['fee_percentage'] ?? '0') ?>%</td></tr>
<tr><td style="padding:8px 0;color:#6B7280;border-top:1px solid #E5E7EB;">رسوم الفصل</td><td style="padding:8px 0;border-top:1px solid #E5E7EB;"><?= money($transfer['separation_fee'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">رسوم الاستمارة</td><td style="padding:6px 0;"><?= money($transfer['form_fee'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الاشتراك السنوي</td><td style="padding:6px 0;"><?= money($transfer['annual_subscription_fee'] ?? '0') ?></td></tr>
<tr><td style="padding:10px 0;color:#1A1A2E;font-weight:700;font-size:16px;border-top:2px solid #0D7377;">الإجمالي</td><td style="padding:10px 0;font-weight:700;font-size:18px;color:#0D7377;border-top:2px solid #0D7377;"><?= money($transfer['total_fee'] ?? '0') ?></td></tr>
<div class="card" style="padding:20px;margin-bottom:20px;">
<table style="width:100%;max-width:700px;font-size:14px;">
<tr><td style="padding:8px 0;color:#6B7280;width:35%;">العضو المصدر</td><td style="padding:8px 0;"><a href="/members/<?= (int) $transfer['source_member_id'] ?>" style="color:#0D7377;font-weight:600;"><?= e($transfer['member_name'] ?? '') ?></a></td></tr>
<tr><td style="padding:8px 0;color:#6B7280;">النوع</td><td style="padding:8px 0;font-weight:600;"><?= e($transfer['transfer_type']) ?></td></tr>
<tr><td style="padding:8px 0;color:#6B7280;">رسوم الفصل</td><td style="padding:8px 0;font-weight:700;font-size:20px;color:#0D7377;"><?= money($transfer['separation_fee'] ?? '0') ?></td></tr>
<tr><td style="padding:8px 0;color:#6B7280;">رسوم الاستمارة</td><td style="padding:8px 0;"><?= money($transfer['form_fee'] ?? '0') ?></td></tr>
<tr><td style="padding:8px 0;color:#6B7280;">الإجمالي</td><td style="padding:8px 0;font-weight:700;font-size:22px;color:#DC2626;"><?= money($transfer['total_fee'] ?? '0') ?></td></tr>
<tr><td style="padding:8px 0;color:#6B7280;">الحالة</td><td style="padding:8px 0;font-weight:700;color:<?= match($transfer['status']) { 'completed' => '#059669', 'approved' => '#0284C7', default => '#D97706' } ?>;"><?= e($transfer['status']) ?></td></tr>
<?php if ($transfer['new_membership_number']): ?><tr><td style="padding:8px 0;color:#6B7280;">الرقم الجديد</td><td style="padding:8px 0;font-weight:700;color:#0D7377;font-size:20px;"><?= e($transfer['new_membership_number']) ?></td></tr><?php endif; ?>
</table>
</div>
<?php if ($transfer['status'] === 'requested'): ?>
<div style="margin-top:20px;display:flex;gap:10px;">
<form method="POST" action="/transfers/<?= (int) $transfer['id'] ?>/approve" style="flex:1;">
<?php if (in_array($transfer['status'], ['requested', 'approved']) && bccomp($transfer['total_fee'] ?? '0', '0', 2) > 0): ?>
<div class="card" style="padding:20px;margin-bottom:20px;background:#FFF7ED;border:2px solid #F59E0B;">
<h4 style="margin:0 0 15px;color:#D97706;">💰 دفع رسوم التحويل/الفصل</h4>
<form method="POST" action="/transfers/<?= (int) $transfer['id'] ?>/pay">
<?= csrf_field() ?>
<textarea name="board_decision_notes" class="form-textarea" rows="2" placeholder="ملاحظات المجلس..." style="margin-bottom:10px;"></textarea>
<button type="submit" class="btn btn-primary" style="width:100%;" onclick="return confirm('هل تريد الموافقة على هذا الطلب؟')">✓ موافقة</button>
</form>
<form method="POST" action="/transfers/<?= (int) $transfer['id'] ?>/reject" style="flex:1;">
<?= csrf_field() ?>
<textarea name="reject_reason" class="form-textarea" rows="2" placeholder="سبب الرفض..." style="margin-bottom:10px;"></textarea>
<button type="submit" class="btn" style="width:100%;background:#DC2626;color:#fff;border:none;padding:10px;border-radius:6px;cursor:pointer;" onclick="return confirm('هل تريد رفض هذا الطلب؟')">✗ رفض</button>
</form>
<input type="hidden" name="amount" value="<?= e($transfer['total_fee']) ?>">
<div style="display:flex;gap:10px;align-items:end;">
<div class="form-group"><label class="form-label">المبلغ</label><input type="text" value="<?= money($transfer['total_fee']) ?>" class="form-input" style="background:#F3F4F6;font-weight:700;font-size:18px;" readonly></div>
<div class="form-group"><label class="form-label">طريقة الدفع</label><select name="payment_method" class="form-select"><option value="cash">نقدي</option><option value="visa">فيزا</option><option value="bank_transfer">تحويل</option></select></div>
<button type="submit" class="btn btn-primary" style="padding:10px 25px;" onclick="return confirm('تأكيد دفع <?= money($transfer['total_fee']) ?>؟')">💰 ادفع</button>
</div>
<?php endif; ?>
<?php if ($transfer['status'] === 'approved' || $transfer['status'] === 'fee_paid'): ?>
<div style="margin-top:20px;">
<form method="POST" action="/transfers/<?= (int) $transfer['id'] ?>/complete">
<?= csrf_field() ?>
<button type="submit" class="btn btn-primary" style="width:100%;padding:12px;font-size:16px;" onclick="return confirm('⚠ هذا الإجراء نهائي — سيتم إنشاء عضوية جديدة وأرشفة البيانات القديمة. متأكد؟')">🔄 إتمام التحويل وإنشاء العضوية الجديدة</button>
</form>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if ($transfer['status'] === 'requested'): ?>
<form method="POST" action="/transfers/<?= (int) $transfer['id'] ?>/complete" style="margin-top:15px;">
<?= csrf_field() ?>
<button type="submit" class="btn btn-primary" onclick="return confirm('إتمام التحويل؟')">✅ إتمام التحويل</button>
</form>
<?php endif; ?>
<?php $__template->endSection(); ?>
\ No newline at end of file
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>طلب تنازل #<?= (int) $waiver['id'] ?><?php $__template->endSection(); ?>
<?php $__template->section('title'); ?>تنازل #<?= (int) $waiver['id'] ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div class="card" style="padding:20px;">
<div class="card" style="padding:20px;margin-bottom:20px;">
<table style="width:100%;max-width:600px;font-size:14px;">
<tr><td style="padding:6px 0;color:#6B7280;width:35%;">العضو المتنازل</td><td style="padding:6px 0;font-weight:600;"><?= e($waiver['source_name']) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">رقم العضوية</td><td style="padding:6px 0;font-weight:700;"><?= e($waiver['membership_number']) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">قيمة العضوية وقت التنازل</td><td style="padding:6px 0;"><?= money($waiver['membership_value_at_waiver']) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">النسبة</td><td style="padding:6px 0;"><?= e($waiver['waiver_fee_percentage']) ?>%</td></tr>
<tr><td style="padding:6px 0;color:#6B7280;font-weight:700;">رسوم التنازل</td><td style="padding:6px 0;font-weight:700;color:#0D7377;font-size:18px;"><?= money($waiver['waiver_fee_amount']) ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">عدد التابعين الأصلي</td><td style="padding:6px 0;"><?= (int) $waiver['original_dependent_count'] ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">المستفيد</td><td style="padding:6px 0;"><?= e($waiver['target_name'] ?? 'لم يُحدد بعد') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الحالة</td><td style="padding:6px 0;font-weight:700;color:<?= match($waiver['status']) { 'completed' => '#059669', 'approved' => '#0284C7', default => '#D97706' } ?>;"><?= match($waiver['status']) { 'requested' => 'في انتظار الموافقة', 'approved' => 'مُعتمد', 'completed' => 'مكتمل', 'rejected' => 'مرفوض', default => $waiver['status'] } ?></td></tr>
<?php if ($waiver['board_decision_reference']): ?><tr><td style="padding:6px 0;color:#6B7280;">مرجع قرار المجلس</td><td style="padding:6px 0;"><?= e($waiver['board_decision_reference']) ?></td></tr><?php endif; ?>
<tr><td style="padding:6px 0;color:#6B7280;width:35%;">المتنازل</td><td style="padding:6px 0;"><a href="/members/<?= (int) $waiver['source_member_id'] ?>" style="color:#0D7377;font-weight:600;"><?= e($waiver['member_name'] ?? '') ?></a></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">رقم العضوية</td><td style="padding:6px 0;font-weight:700;"><?= e($waiver['membership_number'] ?? '—') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">قيمة العضوية وقت التنازل</td><td style="padding:6px 0;"><?= money($waiver['membership_value_at_waiver'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">نسبة التنازل</td><td style="padding:6px 0;"><?= e($waiver['waiver_fee_percentage'] ?? '30') ?>%</td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">رسوم التنازل</td><td style="padding:6px 0;font-weight:700;font-size:22px;color:#DC2626;"><?= money($waiver['waiver_fee_amount'] ?? '0') ?></td></tr>
<tr><td style="padding:6px 0;color:#6B7280;">الحالة</td><td style="padding:6px 0;font-weight:700;color:<?= match($waiver['status']) { 'completed' => '#059669', 'approved' => '#0284C7', default => '#D97706' } ?>;"><?= match($waiver['status']) { 'requested' => 'مقدم', 'approved' => 'معتمد — في انتظار الدفع', 'completed' => 'مكتمل', default => $waiver['status'] } ?></td></tr>
<?php if ($waiver['target_member_id']): ?><tr><td style="padding:6px 0;color:#6B7280;">المتنازل إليه</td><td style="padding:6px 0;"><a href="/members/<?= (int) $waiver['target_member_id'] ?>" style="color:#0D7377;font-weight:600;">عضو #<?= (int) $waiver['target_member_id'] ?></a></td></tr><?php endif; ?>
</table>
</div>
<?php if ($waiver['status'] === 'requested'): ?>
<div style="margin-top:20px;display:flex;gap:10px;">
<form method="POST" action="/waivers/<?= (int) $waiver['id'] ?>/approve">
<?php if (in_array($waiver['status'], ['requested', 'approved']) && bccomp($waiver['waiver_fee_amount'] ?? '0', '0', 2) > 0): ?>
<div class="card" style="padding:20px;margin-bottom:20px;background:#FFF7ED;border:2px solid #F59E0B;">
<h4 style="margin:0 0 15px;color:#D97706;">💰 دفع رسوم التنازل (30% من قيمة العضوية)</h4>
<form method="POST" action="/waiver/<?= (int) $waiver['id'] ?>/pay">
<?= csrf_field() ?>
<input type="text" name="board_decision_reference" placeholder="مرجع قرار المجلس" class="form-input" style="margin-bottom:10px;">
<button type="submit" class="btn btn-primary" onclick="return confirm('موافقة على التنازل؟')">✓ موافقة مجلس الأمناء</button>
</form>
<input type="hidden" name="amount" value="<?= e($waiver['waiver_fee_amount']) ?>">
<div style="display:flex;gap:10px;align-items:end;">
<div class="form-group"><label class="form-label">المبلغ</label><input type="text" value="<?= money($waiver['waiver_fee_amount']) ?>" class="form-input" style="background:#F3F4F6;font-weight:700;font-size:18px;" readonly></div>
<div class="form-group"><label class="form-label">طريقة الدفع</label><select name="payment_method" class="form-select"><option value="cash">نقدي</option><option value="visa">فيزا</option><option value="bank_transfer">تحويل</option></select></div>
<button type="submit" class="btn btn-primary" style="padding:10px 25px;" onclick="return confirm('تأكيد دفع <?= money($waiver['waiver_fee_amount']) ?>؟')">💰 ادفع</button>
</div>
<?php endif; ?>
</form>
</div>
<?php endif; ?>
<?php if ($waiver['status'] === 'approved' && !$waiver['target_member_id']): ?>
<div style="margin-top:20px;padding:15px;background:#EFF6FF;border:1px solid #BFDBFE;border-radius:8px;">
<strong>الخطوة التالية:</strong> يجب إنشاء عضوية جديدة للمستفيد أولاً، ثم ربطها بهذا الطلب وإتمام التنازل.
<form method="POST" action="/waivers/<?= (int) $waiver['id'] ?>/complete" style="margin-top:10px;">
<?php if ($waiver['status'] === 'approved'): ?>
<form method="POST" action="/waiver/<?= (int) $waiver['id'] ?>/complete">
<?= csrf_field() ?>
<input type="number" name="target_member_id" placeholder="رقم العضو المستفيد (ID)" class="form-input" style="width:200px;margin-bottom:10px;" required>
<button type="submit" class="btn btn-primary" onclick="return confirm('⚠ إتمام التنازل نهائياً. متأكد؟')">إتمام التنازل</button>
</form>
</div>
<?php endif; ?>
<button type="submit" class="btn btn-primary" onclick="return confirm('⚠ إتمام التنازل — سيتم نقل العضوية. متأكد؟')">✅ إتمام التنازل</button>
</form>
<?php endif; ?>
<?php if ($waiver['status'] === 'requested'): ?>
<div style="margin-top:15px;display:flex;gap:10px;">
<form method="POST" action="/waiver/<?= (int) $waiver['id'] ?>/approve"><?= csrf_field() ?><button type="submit" class="btn btn-primary" onclick="return confirm('اعتماد التنازل؟')">✅ اعتماد مجلس الأمناء</button></form>
<form method="POST" action="/waiver/<?= (int) $waiver['id'] ?>/reject"><?= csrf_field() ?><button type="submit" class="btn btn-outline" style="color:#DC2626;" onclick="return confirm('رفض التنازل؟')">❌ رفض</button></form>
</div>
<?php endif; ?>
<?php $__template->endSection(); ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment