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
201fc0a9
Commit
201fc0a9
authored
May 21, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dtjdyrjkdyrk
cfgmfghmhdjkd
parent
dbd4146a
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
521 additions
and
259 deletions
+521
-259
RegistrationWizardController.php
...ortsActivity/Controllers/RegistrationWizardController.php
+20
-7
Routes.php
app/Modules/SportsActivity/Routes.php
+1
-0
RegistrationWizardService.php
...les/SportsActivity/Services/RegistrationWizardService.php
+75
-12
print_form.php
app/Modules/SportsActivity/Views/registration/print_form.php
+124
-67
wizard.php
app/Modules/SportsActivity/Views/registration/wizard.php
+267
-173
bootstrap.php
app/Modules/SportsActivity/bootstrap.php
+12
-0
Phase_80_003_add_form_payment_columns.php
...base/migrations/Phase_80_003_add_form_payment_columns.php
+15
-0
Phase_80_004_add_subscription_months_column.php
...igrations/Phase_80_004_add_subscription_months_column.php
+7
-0
No files found.
app/Modules/SportsActivity/Controllers/RegistrationWizardController.php
View file @
201fc0a9
...
@@ -115,7 +115,7 @@ class RegistrationWizardController extends Controller
...
@@ -115,7 +115,7 @@ class RegistrationWizardController extends Controller
$registration
=
$db
->
selectOne
(
$registration
=
$db
->
selectOne
(
"SELECT r.*, p.full_name_ar, p.full_name_en, p.national_id as player_nid,
"SELECT r.*, p.full_name_ar, p.full_name_en, p.national_id as player_nid,
p.date_of_birth, p.gender, p.phone, p.photo_path, p.player_type as p_type,
p.date_of_birth, p.gender, p.phone, p.photo_path, p.player_type as p_type,
p.guardian_name, p.guardian_phone
p.guardian_name, p.guardian_phone
, p.guardian_national_id, p.guardian_relationship
FROM sa_registrations r
FROM sa_registrations r
INNER JOIN sa_players p ON p.id = r.player_id
INNER JOIN sa_players p ON p.id = r.player_id
WHERE r.id = ?"
,
WHERE r.id = ?"
,
...
@@ -176,6 +176,13 @@ class RegistrationWizardController extends Controller
...
@@ -176,6 +176,13 @@ class RegistrationWizardController extends Controller
return
$this
->
json
(
$result
);
return
$this
->
json
(
$result
);
}
}
public
function
submitFormPayment
(
Request
$request
,
string
$id
)
:
Response
{
$registrationId
=
(
int
)
$id
;
$result
=
RegistrationWizardService
::
submitFormPayment
(
$registrationId
);
return
$this
->
json
(
$result
);
}
public
function
selectActivity
(
Request
$request
,
string
$id
)
:
Response
public
function
selectActivity
(
Request
$request
,
string
$id
)
:
Response
{
{
$registrationId
=
(
int
)
$id
;
$registrationId
=
(
int
)
$id
;
...
@@ -356,23 +363,29 @@ class RegistrationWizardController extends Controller
...
@@ -356,23 +363,29 @@ class RegistrationWizardController extends Controller
private
function
determineStep
(
array
$registration
)
:
int
private
function
determineStep
(
array
$registration
)
:
int
{
{
if
(
$registration
[
'status'
]
===
'completed'
)
{
// Step 1: Pay form fee (استمارة اشتراك)
return
5
;
// Step 2: Photo capture
}
// Step 3: Select activity/group
if
(
$registration
[
'payment_status'
]
===
'paid'
)
{
// Step 4: Pay subscription
// Step 5: Complete (print/card)
if
(
$registration
[
'status'
]
===
'completed'
||
$registration
[
'payment_status'
]
===
'paid'
)
{
return
5
;
return
5
;
}
}
if
(
$registration
[
'status'
]
===
'pending_payment'
)
{
if
(
$registration
[
'status'
]
===
'pending_payment'
)
{
return
4
;
return
4
;
}
}
if
(
!
empty
(
$registration
[
'group_id'
]))
{
if
(
!
empty
(
$registration
[
'group_id'
]))
{
return
3
;
return
4
;
}
}
if
((
int
)
$registration
[
'photo_captured'
]
===
1
)
{
if
((
int
)
$registration
[
'photo_captured'
]
===
1
)
{
return
3
;
return
3
;
}
}
$formPaid
=
(
$registration
[
'form_payment_status'
]
??
'unpaid'
)
===
'paid'
;
if
(
$formPaid
)
{
return
2
;
return
2
;
}
}
return
1
;
}
private
function
base64ToTempFile
(
string
$base64
)
:
?
array
private
function
base64ToTempFile
(
string
$base64
)
:
?
array
{
{
...
...
app/Modules/SportsActivity/Routes.php
View file @
201fc0a9
...
@@ -193,6 +193,7 @@ return [
...
@@ -193,6 +193,7 @@ return [
[
'GET'
,
'/sa/registration'
,
'SportsActivity\Controllers\RegistrationWizardController@index'
,
[
'auth'
],
'sa.registration.manage'
],
[
'GET'
,
'/sa/registration'
,
'SportsActivity\Controllers\RegistrationWizardController@index'
,
[
'auth'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/lookup'
,
'SportsActivity\Controllers\RegistrationWizardController@lookupPlayer'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/lookup'
,
'SportsActivity\Controllers\RegistrationWizardController@lookupPlayer'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'GET'
,
'/sa/registration/{id:\d+}'
,
'SportsActivity\Controllers\RegistrationWizardController@wizardStep'
,
[
'auth'
],
'sa.registration.manage'
],
[
'GET'
,
'/sa/registration/{id:\d+}'
,
'SportsActivity\Controllers\RegistrationWizardController@wizardStep'
,
[
'auth'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/{id:\d+}/pay-form'
,
'SportsActivity\Controllers\RegistrationWizardController@submitFormPayment'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/{id:\d+}/photo'
,
'SportsActivity\Controllers\RegistrationWizardController@uploadPhoto'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/{id:\d+}/photo'
,
'SportsActivity\Controllers\RegistrationWizardController@uploadPhoto'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/{id:\d+}/activity'
,
'SportsActivity\Controllers\RegistrationWizardController@selectActivity'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/{id:\d+}/activity'
,
'SportsActivity\Controllers\RegistrationWizardController@selectActivity'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/{id:\d+}/pay'
,
'SportsActivity\Controllers\RegistrationWizardController@submitPayment'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
[
'POST'
,
'/sa/registration/{id:\d+}/pay'
,
'SportsActivity\Controllers\RegistrationWizardController@submitPayment'
,
[
'auth'
,
'csrf'
],
'sa.registration.manage'
],
...
...
app/Modules/SportsActivity/Services/RegistrationWizardService.php
View file @
201fc0a9
...
@@ -250,6 +250,7 @@ final class RegistrationWizardService
...
@@ -250,6 +250,7 @@ final class RegistrationWizardService
$db
->
update
(
'sa_registrations'
,
[
$db
->
update
(
'sa_registrations'
,
[
'group_id'
=>
$groupId
,
'group_id'
=>
$groupId
,
'subscription_amount'
=>
$subscriptionAfterDiscount
,
'subscription_amount'
=>
$subscriptionAfterDiscount
,
'subscription_months'
=>
$months
,
'total_fees'
=>
$totalFees
,
'total_fees'
=>
$totalFees
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'id = ?'
,
[
$registrationId
]);
],
'id = ?'
,
[
$registrationId
]);
...
@@ -289,6 +290,60 @@ final class RegistrationWizardService
...
@@ -289,6 +290,60 @@ final class RegistrationWizardService
];
];
}
}
public
static
function
submitFormPayment
(
int
$registrationId
)
:
array
{
$db
=
App
::
getInstance
()
->
db
();
$registration
=
$db
->
selectOne
(
"SELECT r.*, p.full_name_ar, p.member_id
FROM sa_registrations r
INNER JOIN sa_players p ON p.id = r.player_id
WHERE r.id = ? AND r.status = 'in_progress'"
,
[
$registrationId
]
);
if
(
!
$registration
)
{
return
[
'success'
=>
false
,
'error'
=>
'التسجيل غير موجود أو مكتمل'
];
}
if
(
$registration
[
'form_payment_status'
]
===
'paid'
)
{
return
[
'success'
=>
true
,
'already_paid'
=>
true
];
}
$formFee
=
(
float
)
$registration
[
'registration_fee'
];
if
(
$formFee
<=
0
)
{
return
[
'success'
=>
false
,
'error'
=>
'رسوم الاستمارة غير محددة'
];
}
$memberId
=
(
int
)
(
$registration
[
'member_id'
]
??
0
);
$description
=
'استمارة اشتراك نشاط رياضي — '
.
(
$registration
[
'full_name_ar'
]
??
''
);
$result
=
PaymentRequestService
::
createRequest
([
'member_id'
=>
$memberId
,
'payment_type'
=>
'sa_form_fee'
,
'amount'
=>
(
string
)
$formFee
,
'description_ar'
=>
$description
,
'related_entity_type'
=>
'sa_registration_form'
,
'related_entity_id'
=>
$registrationId
,
]);
if
(
!
$result
[
'success'
])
{
return
$result
;
}
$db
->
update
(
'sa_registrations'
,
[
'form_payment_request_id'
=>
(
int
)
$result
[
'request_id'
],
'form_payment_status'
=>
'pending'
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'id = ?'
,
[
$registrationId
]);
return
[
'success'
=>
true
,
'request_id'
=>
$result
[
'request_id'
],
'request_number'
=>
$result
[
'request_number'
],
'amount'
=>
$formFee
,
];
}
public
static
function
submitToPaymentQueue
(
int
$registrationId
)
:
array
public
static
function
submitToPaymentQueue
(
int
$registrationId
)
:
array
{
{
$db
=
App
::
getInstance
()
->
db
();
$db
=
App
::
getInstance
()
->
db
();
...
@@ -311,18 +366,22 @@ final class RegistrationWizardService
...
@@ -311,18 +366,22 @@ final class RegistrationWizardService
return
[
'success'
=>
false
,
'error'
=>
'يجب اختيار النشاط أولاً'
];
return
[
'success'
=>
false
,
'error'
=>
'يجب اختيار النشاط أولاً'
];
}
}
$totalFees
=
(
float
)
$registration
[
'total_fees'
];
$subscriptionAmount
=
(
float
)
(
$registration
[
'subscription_amount'
]
??
0
);
if
(
$totalFees
<=
0
)
{
$cardFee
=
(
float
)
$registration
[
'card_fee'
];
$formFee
=
(
float
)
$registration
[
'form_fee'
];
$totalSubscription
=
$subscriptionAmount
+
$cardFee
+
$formFee
;
if
(
$totalSubscription
<=
0
)
{
return
[
'success'
=>
false
,
'error'
=>
'إجمالي الرسوم غير صالح'
];
return
[
'success'
=>
false
,
'error'
=>
'إجمالي الرسوم غير صالح'
];
}
}
$memberId
=
(
int
)
(
$registration
[
'member_id'
]
??
0
);
$memberId
=
(
int
)
(
$registration
[
'member_id'
]
??
0
);
$description
=
'
تسجيل
نشاط رياضي — '
.
(
$registration
[
'full_name_ar'
]
??
''
);
$description
=
'
اشتراك
نشاط رياضي — '
.
(
$registration
[
'full_name_ar'
]
??
''
);
$result
=
PaymentRequestService
::
createRequest
([
$result
=
PaymentRequestService
::
createRequest
([
'member_id'
=>
$memberId
,
'member_id'
=>
$memberId
,
'payment_type'
=>
'sports_
registra
tion'
,
'payment_type'
=>
'sports_
subscrip
tion'
,
'amount'
=>
(
string
)
$total
Fees
,
'amount'
=>
(
string
)
$total
Subscription
,
'description_ar'
=>
$description
,
'description_ar'
=>
$description
,
'related_entity_type'
=>
'sa_registrations'
,
'related_entity_type'
=>
'sa_registrations'
,
'related_entity_id'
=>
$registrationId
,
'related_entity_id'
=>
$registrationId
,
...
@@ -343,7 +402,7 @@ final class RegistrationWizardService
...
@@ -343,7 +402,7 @@ final class RegistrationWizardService
'success'
=>
true
,
'success'
=>
true
,
'request_id'
=>
$result
[
'request_id'
],
'request_id'
=>
$result
[
'request_id'
],
'request_number'
=>
$result
[
'request_number'
],
'request_number'
=>
$result
[
'request_number'
],
'amount'
=>
$total
Fees
,
'amount'
=>
$total
Subscription
,
];
];
}
}
...
@@ -375,6 +434,10 @@ final class RegistrationWizardService
...
@@ -375,6 +434,10 @@ final class RegistrationWizardService
$cardNumber
=
self
::
generateCardNumber
();
$cardNumber
=
self
::
generateCardNumber
();
$qrData
=
QRCodeGenerator
::
encode
(
'SA:'
.
$cardNumber
);
$qrData
=
QRCodeGenerator
::
encode
(
'SA:'
.
$cardNumber
);
$months
=
max
(
1
,
(
int
)
(
$registration
[
'subscription_months'
]
??
1
));
$validFrom
=
date
(
'Y-m-d'
);
$validUntil
=
date
(
'Y-m-d'
,
strtotime
(
"+
{
$months
}
months -1 day"
));
$cardId
=
$db
->
insert
(
'sa_player_cards'
,
[
$cardId
=
$db
->
insert
(
'sa_player_cards'
,
[
'card_number'
=>
$cardNumber
,
'card_number'
=>
$cardNumber
,
'player_id'
=>
(
int
)
$registration
[
'player_id'
],
'player_id'
=>
(
int
)
$registration
[
'player_id'
],
...
@@ -382,8 +445,8 @@ final class RegistrationWizardService
...
@@ -382,8 +445,8 @@ final class RegistrationWizardService
'card_type'
=>
'standard'
,
'card_type'
=>
'standard'
,
'status'
=>
'active'
,
'status'
=>
'active'
,
'qr_code_data'
=>
$qrData
,
'qr_code_data'
=>
$qrData
,
'valid_from'
=>
date
(
'Y-m-d'
)
,
'valid_from'
=>
$validFrom
,
'valid_until'
=>
nul
l
,
'valid_until'
=>
$validUnti
l
,
'photo_path'
=>
$registration
[
'photo_path'
],
'photo_path'
=>
$registration
[
'photo_path'
],
'issued_by'
=>
$employee
?
(
int
)
$employee
->
id
:
null
,
'issued_by'
=>
$employee
?
(
int
)
$employee
->
id
:
null
,
'branch_id'
=>
$branch
?
(
int
)
$branch
[
'id'
]
:
null
,
'branch_id'
=>
$branch
?
(
int
)
$branch
[
'id'
]
:
null
,
...
...
app/Modules/SportsActivity/Views/registration/print_form.php
View file @
201fc0a9
This diff is collapsed.
Click to expand it.
app/Modules/SportsActivity/Views/registration/wizard.php
View file @
201fc0a9
This diff is collapsed.
Click to expand it.
app/Modules/SportsActivity/bootstrap.php
View file @
201fc0a9
...
@@ -99,6 +99,18 @@ PermissionRegistry::register('sports_activity', [
...
@@ -99,6 +99,18 @@ PermissionRegistry::register('sports_activity', [
EventBus
::
listen
(
'payment_request.completed'
,
function
(
array
$data
)
:
void
{
EventBus
::
listen
(
'payment_request.completed'
,
function
(
array
$data
)
:
void
{
$entityType
=
$data
[
'related_entity_type'
]
??
''
;
$entityType
=
$data
[
'related_entity_type'
]
??
''
;
try
{
try
{
if
(
$entityType
===
'sa_registration_form'
)
{
$registrationId
=
(
int
)
(
$data
[
'related_entity_id'
]
??
0
);
if
(
$registrationId
>
0
)
{
$db
=
App
::
getInstance
()
->
db
();
$db
->
update
(
'sa_registrations'
,
[
'form_payment_status'
=>
'paid'
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'id = ?'
,
[
$registrationId
]);
}
return
;
}
if
(
$entityType
===
'sa_registrations'
)
{
if
(
$entityType
===
'sa_registrations'
)
{
$registrationId
=
(
int
)
(
$data
[
'related_entity_id'
]
??
0
);
$registrationId
=
(
int
)
(
$data
[
'related_entity_id'
]
??
0
);
$paymentId
=
(
int
)
(
$data
[
'payment_id'
]
??
0
);
$paymentId
=
(
int
)
(
$data
[
'payment_id'
]
??
0
);
...
...
database/migrations/Phase_80_003_add_form_payment_columns.php
0 → 100644
View file @
201fc0a9
<?php
declare
(
strict_types
=
1
);
return
[
'up'
=>
"
ALTER TABLE `sa_registrations`
ADD COLUMN `form_payment_status` VARCHAR(20) NOT NULL DEFAULT 'unpaid' COMMENT 'unpaid, pending, paid' AFTER `payment_status`,
ADD COLUMN `form_payment_request_id` BIGINT UNSIGNED NULL AFTER `payment_request_id`;
"
,
'down'
=>
"
ALTER TABLE `sa_registrations`
DROP COLUMN `form_payment_status`,
DROP COLUMN `form_payment_request_id`;
"
];
database/migrations/Phase_80_004_add_subscription_months_column.php
0 → 100644
View file @
201fc0a9
<?php
declare
(
strict_types
=
1
);
return
[
'up'
=>
"ALTER TABLE `sa_registrations` ADD COLUMN `subscription_months` INT UNSIGNED NOT NULL DEFAULT 1 AFTER `subscription_amount`;"
,
'down'
=>
"ALTER TABLE `sa_registrations` DROP COLUMN `subscription_months`;"
];
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