Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Clubphp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Clubphp
Commits
0cfaeee3
Commit
0cfaeee3
authored
Apr 11, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed ddivore
parent
e670eba1
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
193 additions
and
14 deletions
+193
-14
DeathController.php
app/Modules/Death/Controllers/DeathController.php
+39
-0
Routes.php
app/Modules/Death/Routes.php
+1
-0
show.php
app/Modules/Death/Views/show.php
+2
-2
DivorceController.php
app/Modules/Divorce/Controllers/DivorceController.php
+39
-0
Routes.php
app/Modules/Divorce/Routes.php
+1
-0
show.php
app/Modules/Divorce/Views/show.php
+2
-2
TransferController.php
app/Modules/Transfers/Controllers/TransferController.php
+39
-0
Routes.php
app/Modules/Transfers/Routes.php
+1
-0
show.php
app/Modules/Transfers/Views/show.php
+3
-3
WaiverController.php
app/Modules/Waiver/Controllers/WaiverController.php
+57
-0
Routes.php
app/Modules/Waiver/Routes.php
+2
-0
show.php
app/Modules/Waiver/Views/show.php
+7
-7
No files found.
app/Modules/Death/Controllers/DeathController.php
View file @
0cfaeee3
...
...
@@ -11,6 +11,7 @@ use App\Core\EventBus;
use
App\Modules\Death\Models\DeathCase
;
use
App\Modules\Archive\Services\ArchiveService
;
use
App\Modules\Rules\Services\RuleEngine
;
use
App\Modules\Payments\Services\PaymentService
;
class
DeathController
extends
Controller
{
...
...
@@ -82,6 +83,44 @@ class DeathController extends Controller
return
$this
->
view
(
'Death.Views.show'
,
[
'case'
=>
$case
]);
}
public
function
pay
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
$case
=
$db
->
selectOne
(
"SELECT * FROM death_cases WHERE id = ?"
,
[(
int
)
$id
]);
if
(
!
$case
)
return
$this
->
redirect
(
'/death'
)
->
withError
(
'الحالة غير موجودة'
);
if
(
$case
[
'status'
]
===
'completed'
||
$case
[
'status'
]
===
'fee_paid'
)
{
return
$this
->
redirect
(
"/death/
{
$id
}
"
)
->
withError
(
'تم دفع الرسوم مسبقاً'
);
}
$amount
=
$case
[
'fee_amount'
]
??
'0.00'
;
if
(
bccomp
((
string
)
$amount
,
'0'
,
2
)
<=
0
)
{
return
$this
->
redirect
(
"/death/
{
$id
}
"
)
->
withError
(
'لا توجد رسوم مطلوبة'
);
}
$result
=
PaymentService
::
processPayment
([
'member_id'
=>
(
int
)
$case
[
'member_id'
],
'amount'
=>
$amount
,
'payment_type'
=>
'death_fee'
,
'payment_method'
=>
$request
->
post
(
'payment_method'
,
'cash'
),
'related_entity_type'
=>
'death_cases'
,
'related_entity_id'
=>
(
int
)
$id
,
'description'
=>
'رسوم وفاة (استمارة + اشتراك) — حالة #'
.
$id
,
]);
if
(
!
$result
[
'success'
])
{
return
$this
->
redirect
(
"/death/
{
$id
}
"
)
->
withError
(
$result
[
'error'
]);
}
$db
->
update
(
'death_cases'
,
[
'status'
=>
'fee_paid'
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'`id` = ?'
,
[(
int
)
$id
]);
EventBus
::
dispatch
(
'death.fee_paid'
,
[
'case_id'
=>
(
int
)
$id
,
'payment_id'
=>
$result
[
'payment_id'
]]);
return
$this
->
redirect
(
"/death/
{
$id
}
"
)
->
withSuccess
(
'تم دفع الرسوم — إيصال: '
.
$result
[
'receipt_number'
]);
}
public
function
complete
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
...
...
app/Modules/Death/Routes.php
View file @
0cfaeee3
...
...
@@ -6,5 +6,6 @@ return [
[
'GET'
,
'/death/create/{memberId}'
,
'Death\Controllers\DeathController@create'
,
[
'auth'
],
'transfer.initiate'
],
[
'POST'
,
'/death/store/{memberId}'
,
'Death\Controllers\DeathController@store'
,
[
'auth'
],
'transfer.initiate'
],
[
'GET'
,
'/death/{id}'
,
'Death\Controllers\DeathController@show'
,
[
'auth'
],
'transfer.view'
],
[
'POST'
,
'/death/{id}/pay'
,
'Death\Controllers\DeathController@pay'
,
[
'auth'
],
'payment.collect'
],
[
'POST'
,
'/death/{id}/complete'
,
'Death\Controllers\DeathController@complete'
,
[
'auth'
],
'transfer.approve'
],
];
\ No newline at end of file
app/Modules/Death/Views/show.php
View file @
0cfaeee3
...
...
@@ -8,12 +8,12 @@
<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;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>
<tr><td
style=
"padding:6px 0;color:#6B7280;"
>
الحالة
</td><td
style=
"padding:6px 0;font-weight:700;color:
<?=
match
(
$case
[
'status'
])
{
'completed'
=>
'#059669'
,
'fee_paid'
=>
'#2563EB'
,
default
=>
'#D97706'
}
?>
;"
>
●
<?=
match
(
$case
[
'status'
])
{
'completed'
=>
'مكتمل'
,
'fee_paid'
=>
'تم الدفع'
,
default
=>
'مسجّل'
}
?>
</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>
</div>
<?php
if
(
$case
[
'status'
]
!==
'completed'
&&
bccomp
(
$case
[
'fee_amount'
]
??
'0'
,
'0'
,
2
)
>
0
)
:
?>
<?php
if
(
!
in_array
(
$case
[
'status'
],
[
'completed'
,
'fee_paid'
])
&&
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"
>
...
...
app/Modules/Divorce/Controllers/DivorceController.php
View file @
0cfaeee3
...
...
@@ -12,6 +12,7 @@ use App\Modules\Divorce\Models\DivorceCase;
use
App\Modules\Divorce\Services\DivorceFeeCalculator
;
use
App\Modules\Archive\Services\ArchiveService
;
use
App\Modules\Members\Services\MemberNumberGenerator
;
use
App\Modules\Payments\Services\PaymentService
;
class
DivorceController
extends
Controller
{
...
...
@@ -84,6 +85,44 @@ class DivorceController extends Controller
return
$this
->
view
(
'Divorce.Views.show'
,
[
'case'
=>
$case
]);
}
public
function
pay
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
$case
=
$db
->
selectOne
(
"SELECT * FROM divorce_cases WHERE id = ?"
,
[(
int
)
$id
]);
if
(
!
$case
)
return
$this
->
redirect
(
'/divorce'
)
->
withError
(
'الحالة غير موجودة'
);
if
(
$case
[
'status'
]
===
'completed'
||
$case
[
'status'
]
===
'fee_paid'
)
{
return
$this
->
redirect
(
"/divorce/
{
$id
}
"
)
->
withError
(
'تم دفع الرسوم مسبقاً'
);
}
$amount
=
$case
[
'fee_amount'
]
??
'0.00'
;
if
(
bccomp
((
string
)
$amount
,
'0'
,
2
)
<=
0
)
{
return
$this
->
redirect
(
"/divorce/
{
$id
}
"
)
->
withError
(
'لا توجد رسوم مطلوبة'
);
}
$result
=
PaymentService
::
processPayment
([
'member_id'
=>
(
int
)
$case
[
'member_id'
],
'amount'
=>
$amount
,
'payment_type'
=>
'divorce_fee'
,
'payment_method'
=>
$request
->
post
(
'payment_method'
,
'cash'
),
'related_entity_type'
=>
'divorce_cases'
,
'related_entity_id'
=>
(
int
)
$id
,
'description'
=>
'رسوم طلاق — حالة #'
.
$id
,
]);
if
(
!
$result
[
'success'
])
{
return
$this
->
redirect
(
"/divorce/
{
$id
}
"
)
->
withError
(
$result
[
'error'
]);
}
$db
->
update
(
'divorce_cases'
,
[
'status'
=>
'fee_paid'
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'`id` = ?'
,
[(
int
)
$id
]);
EventBus
::
dispatch
(
'divorce.fee_paid'
,
[
'case_id'
=>
(
int
)
$id
,
'payment_id'
=>
$result
[
'payment_id'
]]);
return
$this
->
redirect
(
"/divorce/
{
$id
}
"
)
->
withSuccess
(
'تم دفع رسوم الطلاق — إيصال: '
.
$result
[
'receipt_number'
]);
}
public
function
complete
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
...
...
app/Modules/Divorce/Routes.php
View file @
0cfaeee3
...
...
@@ -6,5 +6,6 @@ return [
[
'GET'
,
'/divorce/create/{memberId}'
,
'Divorce\Controllers\DivorceController@create'
,
[
'auth'
],
'transfer.initiate'
],
[
'POST'
,
'/divorce/store/{memberId}'
,
'Divorce\Controllers\DivorceController@store'
,
[
'auth'
],
'transfer.initiate'
],
[
'GET'
,
'/divorce/{id}'
,
'Divorce\Controllers\DivorceController@show'
,
[
'auth'
],
'transfer.view'
],
[
'POST'
,
'/divorce/{id}/pay'
,
'Divorce\Controllers\DivorceController@pay'
,
[
'auth'
],
'payment.collect'
],
[
'POST'
,
'/divorce/{id}/complete'
,
'Divorce\Controllers\DivorceController@complete'
,[
'auth'
],
'transfer.approve'
],
];
\ No newline at end of file
app/Modules/Divorce/Views/show.php
View file @
0cfaeee3
...
...
@@ -9,12 +9,12 @@
<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;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>
<tr><td
style=
"padding:6px 0;color:#6B7280;"
>
الحالة
</td><td
style=
"padding:6px 0;font-weight:700;color:
<?=
match
(
$case
[
'status'
])
{
'completed'
=>
'#059669'
,
'fee_paid'
=>
'#2563EB'
,
default
=>
'#D97706'
}
?>
;"
>
●
<?=
match
(
$case
[
'status'
])
{
'completed'
=>
'مكتمل'
,
'fee_paid'
=>
'تم الدفع'
,
default
=>
'مقدّم'
}
?>
</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:20px;"
>
<?=
e
(
$case
[
'spouse_new_membership_number'
])
?>
</td></tr>
<?php
endif
;
?>
</table>
</div>
<?php
if
(
$case
[
'status'
]
!==
'completed'
&&
bccomp
(
$case
[
'fee_amount'
]
??
'0'
,
'0'
,
2
)
>
0
)
:
?>
<?php
if
(
!
in_array
(
$case
[
'status'
],
[
'completed'
,
'fee_paid'
])
&&
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"
>
...
...
app/Modules/Transfers/Controllers/TransferController.php
View file @
0cfaeee3
...
...
@@ -11,6 +11,7 @@ use App\Core\EventBus;
use
App\Modules\Transfers\Models\TransferRequest
;
use
App\Modules\Transfers\Services\SeparationFeeCalculator
;
use
App\Modules\Transfers\Services\TransferProcessor
;
use
App\Modules\Payments\Services\PaymentService
;
class
TransferController
extends
Controller
{
...
...
@@ -130,6 +131,44 @@ class TransferController extends Controller
return
$this
->
view
(
'Transfers.Views.show'
,
[
'transfer'
=>
$transfer
]);
}
public
function
pay
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
$transfer
=
$db
->
selectOne
(
"SELECT * FROM transfer_requests WHERE id = ?"
,
[(
int
)
$id
]);
if
(
!
$transfer
)
return
$this
->
redirect
(
'/transfers'
)
->
withError
(
'الطلب غير موجود'
);
if
(
in_array
(
$transfer
[
'status'
],
[
'completed'
,
'fee_paid'
,
'rejected'
]))
{
return
$this
->
redirect
(
"/transfers/
{
$id
}
"
)
->
withError
(
'لا يمكن الدفع لهذا الطلب'
);
}
$amount
=
$transfer
[
'total_fee'
]
??
'0.00'
;
if
(
bccomp
((
string
)
$amount
,
'0'
,
2
)
<=
0
)
{
return
$this
->
redirect
(
"/transfers/
{
$id
}
"
)
->
withError
(
'لا توجد رسوم مطلوبة'
);
}
$result
=
PaymentService
::
processPayment
([
'member_id'
=>
(
int
)
$transfer
[
'source_member_id'
],
'amount'
=>
$amount
,
'payment_type'
=>
'separation_fee'
,
'payment_method'
=>
$request
->
post
(
'payment_method'
,
'cash'
),
'related_entity_type'
=>
'transfer_requests'
,
'related_entity_id'
=>
(
int
)
$id
,
'description'
=>
'رسوم تحويل/فصل — طلب #'
.
$id
,
]);
if
(
!
$result
[
'success'
])
{
return
$this
->
redirect
(
"/transfers/
{
$id
}
"
)
->
withError
(
$result
[
'error'
]);
}
$db
->
update
(
'transfer_requests'
,
[
'status'
=>
'fee_paid'
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'`id` = ?'
,
[(
int
)
$id
]);
EventBus
::
dispatch
(
'transfer.fee_paid'
,
[
'transfer_id'
=>
(
int
)
$id
,
'payment_id'
=>
$result
[
'payment_id'
]]);
return
$this
->
redirect
(
"/transfers/
{
$id
}
"
)
->
withSuccess
(
'تم دفع رسوم التحويل — إيصال: '
.
$result
[
'receipt_number'
]);
}
public
function
approve
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
...
...
app/Modules/Transfers/Routes.php
View file @
0cfaeee3
...
...
@@ -6,6 +6,7 @@ return [
[
'GET'
,
'/transfers/create/{memberId}'
,
'Transfers\Controllers\TransferController@create'
,
[
'auth'
],
'transfer.initiate'
],
[
'POST'
,
'/transfers/store/{memberId}'
,
'Transfers\Controllers\TransferController@store'
,
[
'auth'
],
'transfer.initiate'
],
[
'GET'
,
'/transfers/{id}'
,
'Transfers\Controllers\TransferController@show'
,
[
'auth'
],
'transfer.view'
],
[
'POST'
,
'/transfers/{id}/pay'
,
'Transfers\Controllers\TransferController@pay'
,
[
'auth'
],
'payment.collect'
],
[
'POST'
,
'/transfers/{id}/approve'
,
'Transfers\Controllers\TransferController@approve'
,
[
'auth'
],
'transfer.approve'
],
[
'POST'
,
'/transfers/{id}/reject'
,
'Transfers\Controllers\TransferController@reject'
,
[
'auth'
],
'transfer.approve'
],
[
'POST'
,
'/transfers/{id}/complete'
,
'Transfers\Controllers\TransferController@complete'
,[
'auth'
],
'transfer.approve'
],
...
...
app/Modules/Transfers/Views/show.php
View file @
0cfaeee3
...
...
@@ -3,12 +3,12 @@
<?php
$__template
->
section
(
'content'
);
?>
<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;width:35%;"
>
العضو المصدر
</td><td
style=
"padding:8px 0;"
><a
href=
"/members/
<?=
(
int
)
$transfer
[
'source_member_id'
]
?>
"
style=
"color:#0D7377;font-weight:600;"
>
<?=
e
(
$transfer
[
'
source
_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>
<tr><td
style=
"padding:8px 0;color:#6B7280;"
>
الحالة
</td><td
style=
"padding:8px 0;font-weight:700;color:
<?=
match
(
$transfer
[
'status'
])
{
'completed'
=>
'#059669'
,
'
fee_paid'
=>
'#2563EB'
,
'approved'
=>
'#0284C7'
,
'rejected'
=>
'#DC2626'
,
default
=>
'#D97706'
}
?>
;"
>
●
<?=
match
(
$transfer
[
'status'
])
{
'completed'
=>
'مكتمل'
,
'fee_paid'
=>
'تم الدفع'
,
'approved'
=>
'معتمد'
,
'rejected'
=>
'مرفوض'
,
default
=>
'مقدّم'
}
?>
</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>
...
...
@@ -28,7 +28,7 @@
</div>
<?php
endif
;
?>
<?php
if
(
$transfer
[
'status'
]
===
'requested'
)
:
?>
<?php
if
(
in_array
(
$transfer
[
'status'
],
[
'requested'
,
'approved'
,
'fee_paid'
])
)
:
?>
<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>
...
...
app/Modules/Waiver/Controllers/WaiverController.php
View file @
0cfaeee3
...
...
@@ -11,6 +11,7 @@ use App\Core\EventBus;
use
App\Modules\Waiver\Models\WaiverRequest
;
use
App\Modules\Waiver\Services\WaiverProcessor
;
use
App\Modules\Rules\Services\RuleEngine
;
use
App\Modules\Payments\Services\PaymentService
;
class
WaiverController
extends
Controller
{
...
...
@@ -95,6 +96,44 @@ class WaiverController extends Controller
return
$this
->
view
(
'Waiver.Views.show'
,
[
'waiver'
=>
$waiver
]);
}
public
function
pay
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
$waiver
=
$db
->
selectOne
(
"SELECT * FROM waiver_requests WHERE id = ?"
,
[(
int
)
$id
]);
if
(
!
$waiver
)
return
$this
->
redirect
(
'/waivers'
)
->
withError
(
'الطلب غير موجود'
);
if
(
in_array
(
$waiver
[
'status'
],
[
'completed'
,
'fee_paid'
,
'rejected'
]))
{
return
$this
->
redirect
(
"/waivers/
{
$id
}
"
)
->
withError
(
'لا يمكن الدفع لهذا الطلب'
);
}
$amount
=
$waiver
[
'waiver_fee_amount'
]
??
'0.00'
;
if
(
bccomp
((
string
)
$amount
,
'0'
,
2
)
<=
0
)
{
return
$this
->
redirect
(
"/waivers/
{
$id
}
"
)
->
withError
(
'لا توجد رسوم مطلوبة'
);
}
$result
=
PaymentService
::
processPayment
([
'member_id'
=>
(
int
)
$waiver
[
'source_member_id'
],
'amount'
=>
$amount
,
'payment_type'
=>
'waiver_fee'
,
'payment_method'
=>
$request
->
post
(
'payment_method'
,
'cash'
),
'related_entity_type'
=>
'waiver_requests'
,
'related_entity_id'
=>
(
int
)
$id
,
'description'
=>
'رسوم تنازل — طلب #'
.
$id
,
]);
if
(
!
$result
[
'success'
])
{
return
$this
->
redirect
(
"/waivers/
{
$id
}
"
)
->
withError
(
$result
[
'error'
]);
}
$db
->
update
(
'waiver_requests'
,
[
'status'
=>
'fee_paid'
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'`id` = ?'
,
[(
int
)
$id
]);
EventBus
::
dispatch
(
'waiver.fee_paid'
,
[
'waiver_id'
=>
(
int
)
$id
,
'payment_id'
=>
$result
[
'payment_id'
]]);
return
$this
->
redirect
(
"/waivers/
{
$id
}
"
)
->
withSuccess
(
'تم دفع رسوم التنازل — إيصال: '
.
$result
[
'receipt_number'
]);
}
public
function
approve
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
...
...
@@ -115,6 +154,24 @@ class WaiverController extends Controller
return
$this
->
redirect
(
"/waivers/
{
$id
}
"
)
->
withSuccess
(
'تمت الموافقة على طلب التنازل'
);
}
public
function
reject
(
Request
$request
,
string
$id
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
$waiver
=
$db
->
selectOne
(
"SELECT * FROM waiver_requests WHERE id = ? AND status = 'requested'"
,
[(
int
)
$id
]);
if
(
!
$waiver
)
return
$this
->
redirect
(
'/waivers'
)
->
withError
(
'الطلب غير صالح'
);
$employee
=
App
::
getInstance
()
->
currentEmployee
();
$db
->
update
(
'waiver_requests'
,
[
'status'
=>
'rejected'
,
'approved_by'
=>
$employee
?
(
int
)
$employee
->
id
:
null
,
'approved_at'
=>
date
(
'Y-m-d H:i:s'
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'`id` = ?'
,
[(
int
)
$id
]);
return
$this
->
redirect
(
'/waivers'
)
->
withSuccess
(
'تم رفض طلب التنازل'
);
}
public
function
complete
(
Request
$request
,
string
$id
)
:
Response
{
// The target member must be created first (via member creation flow)
...
...
app/Modules/Waiver/Routes.php
View file @
0cfaeee3
...
...
@@ -6,6 +6,8 @@ return [
[
'GET'
,
'/waivers/create/{memberId}'
,
'Waiver\Controllers\WaiverController@create'
,
[
'auth'
],
'waiver.initiate'
],
[
'POST'
,
'/waivers/store/{memberId}'
,
'Waiver\Controllers\WaiverController@store'
,
[
'auth'
],
'waiver.initiate'
],
[
'GET'
,
'/waivers/{id}'
,
'Waiver\Controllers\WaiverController@show'
,
[
'auth'
],
'waiver.view'
],
[
'POST'
,
'/waivers/{id}/pay'
,
'Waiver\Controllers\WaiverController@pay'
,
[
'auth'
],
'payment.collect'
],
[
'POST'
,
'/waivers/{id}/approve'
,
'Waiver\Controllers\WaiverController@approve'
,
[
'auth'
],
'waiver.approve'
],
[
'POST'
,
'/waivers/{id}/reject'
,
'Waiver\Controllers\WaiverController@reject'
,
[
'auth'
],
'waiver.approve'
],
[
'POST'
,
'/waivers/{id}/complete'
,
'Waiver\Controllers\WaiverController@complete'
,[
'auth'
],
'waiver.approve'
],
];
\ No newline at end of file
app/Modules/Waiver/Views/show.php
View file @
0cfaeee3
...
...
@@ -3,12 +3,12 @@
<?php
$__template
->
section
(
'content'
);
?>
<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
)
$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;width:35%;"
>
المتنازل
</td><td
style=
"padding:6px 0;"
><a
href=
"/members/
<?=
(
int
)
$waiver
[
'source_member_id'
]
?>
"
style=
"color:#0D7377;font-weight:600;"
>
<?=
e
(
$waiver
[
'
source
_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>
<tr><td
style=
"padding:6px 0;color:#6B7280;"
>
الحالة
</td><td
style=
"padding:6px 0;font-weight:700;color:
<?=
match
(
$waiver
[
'status'
])
{
'completed'
=>
'#059669'
,
'
fee_paid'
=>
'#2563EB'
,
'approved'
=>
'#0284C7'
,
'rejected'
=>
'#DC2626'
,
default
=>
'#D97706'
}
?>
;"
>
●
<?=
match
(
$waiver
[
'status'
])
{
'requested'
=>
'مقدم'
,
'approved'
=>
'معتمد — في انتظار الدفع'
,
'fee_paid'
=>
'تم الدفع'
,
'completed'
=>
'مكتمل'
,
'rejected'
=>
'مرفوض
'
,
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>
...
...
@@ -16,7 +16,7 @@
<?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"
>
<form
method=
"POST"
action=
"/waiver
s
/
<?=
(
int
)
$waiver
[
'id'
]
?>
/pay"
>
<?=
csrf_field
()
?>
<input
type=
"hidden"
name=
"amount"
value=
"
<?=
e
(
$waiver
[
'waiver_fee_amount'
])
?>
"
>
<div
style=
"display:flex;gap:10px;align-items:end;"
>
...
...
@@ -28,8 +28,8 @@
</div>
<?php
endif
;
?>
<?php
if
(
$waiver
[
'status'
]
===
'approved'
)
:
?>
<form
method=
"POST"
action=
"/waiver/
<?=
(
int
)
$waiver
[
'id'
]
?>
/complete"
>
<?php
if
(
in_array
(
$waiver
[
'status'
],
[
'approved'
,
'fee_paid'
])
)
:
?>
<form
method=
"POST"
action=
"/waiver
s
/
<?=
(
int
)
$waiver
[
'id'
]
?>
/complete"
>
<?=
csrf_field
()
?>
<button
type=
"submit"
class=
"btn btn-primary"
onclick=
"return confirm('⚠ إتمام التنازل — سيتم نقل العضوية. متأكد؟')"
>
✅ إتمام التنازل
</button>
</form>
...
...
@@ -37,8 +37,8 @@
<?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>
<form
method=
"POST"
action=
"/waiver
s
/
<?=
(
int
)
$waiver
[
'id'
]
?>
/approve"
>
<?=
csrf_field
()
?>
<button
type=
"submit"
class=
"btn btn-primary"
onclick=
"return confirm('اعتماد التنازل؟')"
>
✅ اعتماد مجلس الأمناء
</button></form>
<form
method=
"POST"
action=
"/waiver
s
/
<?=
(
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment