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
0d8cd6aa
Commit
0d8cd6aa
authored
May 23, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed trainer
parent
77d245c2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
29 deletions
+59
-29
CoachController.php
app/Modules/SportsActivity/Controllers/CoachController.php
+22
-19
create.php
app/Modules/SportsActivity/Views/coaches/create.php
+13
-5
edit.php
app/Modules/SportsActivity/Views/coaches/edit.php
+13
-5
show.php
app/Modules/SportsActivity/Views/coaches/show.php
+11
-0
No files found.
app/Modules/SportsActivity/Controllers/CoachController.php
View file @
0d8cd6aa
...
@@ -130,7 +130,11 @@ class CoachController extends Controller
...
@@ -130,7 +130,11 @@ class CoachController extends Controller
if
(
$employmentType
===
''
)
{
if
(
$employmentType
===
''
)
{
$errors
[]
=
'نوع التوظيف مطلوب'
;
$errors
[]
=
'نوع التوظيف مطلوب'
;
}
}
if
(
$paymentModel
===
''
)
{
$coachType
=
trim
((
string
)
$request
->
post
(
'coach_type'
,
'independent'
));
if
(
!
array_key_exists
(
$coachType
,
Coach
::
getCoachTypeOptions
()))
{
$coachType
=
'independent'
;
}
if
(
$coachType
!==
'academy'
&&
$paymentModel
===
''
)
{
$errors
[]
=
'نموذج الدفع مطلوب'
;
$errors
[]
=
'نموذج الدفع مطلوب'
;
}
}
if
(
$code
!==
''
&&
Coach
::
findByCode
(
$code
)
!==
null
)
{
if
(
$code
!==
''
&&
Coach
::
findByCode
(
$code
)
!==
null
)
{
...
@@ -153,10 +157,6 @@ class CoachController extends Controller
...
@@ -153,10 +157,6 @@ class CoachController extends Controller
}
}
}
}
$coachType
=
trim
((
string
)
$request
->
post
(
'coach_type'
,
'independent'
));
if
(
!
array_key_exists
(
$coachType
,
Coach
::
getCoachTypeOptions
()))
{
$coachType
=
'independent'
;
}
$academyId
=
$coachType
===
'academy'
?
((
int
)
$request
->
post
(
'academy_id'
,
0
)
?:
null
)
:
null
;
$academyId
=
$coachType
===
'academy'
?
((
int
)
$request
->
post
(
'academy_id'
,
0
)
?:
null
)
:
null
;
$coach
=
Coach
::
create
([
$coach
=
Coach
::
create
([
...
@@ -171,10 +171,10 @@ class CoachController extends Controller
...
@@ -171,10 +171,10 @@ class CoachController extends Controller
'employment_type'
=>
$employmentType
,
'employment_type'
=>
$employmentType
,
'coach_type'
=>
$coachType
,
'coach_type'
=>
$coachType
,
'academy_id'
=>
$academyId
,
'academy_id'
=>
$academyId
,
'payment_model'
=>
$
paymentModel
,
'payment_model'
=>
$
coachType
===
'academy'
?
null
:
(
$paymentModel
?:
null
)
,
'hourly_rate'
=>
$
hourlyRate
!==
''
?
(
float
)
$hourlyRate
:
null
,
'hourly_rate'
=>
$
coachType
===
'academy'
?
null
:
(
$hourlyRate
!==
''
?
(
float
)
$hourlyRate
:
null
)
,
'session_rate'
=>
$
sessionRate
!==
''
?
(
float
)
$sessionRate
:
null
,
'session_rate'
=>
$
coachType
===
'academy'
?
null
:
(
$sessionRate
!==
''
?
(
float
)
$sessionRate
:
null
)
,
'monthly_rate'
=>
$
monthlyRate
!==
''
?
(
float
)
$monthlyRate
:
null
,
'monthly_rate'
=>
$
coachType
===
'academy'
?
null
:
(
$monthlyRate
!==
''
?
(
float
)
$monthlyRate
:
null
)
,
'max_groups'
=>
$maxGroups
!==
''
?
(
int
)
$maxGroups
:
10
,
'max_groups'
=>
$maxGroups
!==
''
?
(
int
)
$maxGroups
:
10
,
'bio_ar'
=>
$bioAr
?:
null
,
'bio_ar'
=>
$bioAr
?:
null
,
'is_active'
=>
1
,
'is_active'
=>
1
,
...
@@ -192,7 +192,10 @@ class CoachController extends Controller
...
@@ -192,7 +192,10 @@ class CoachController extends Controller
$db
=
App
::
getInstance
()
->
db
();
$db
=
App
::
getInstance
()
->
db
();
$coach
=
$db
->
selectOne
(
$coach
=
$db
->
selectOne
(
"SELECT * FROM sa_coaches WHERE id = ? AND is_archived = 0"
,
"SELECT c.*, a.name_ar as academy_name
FROM sa_coaches c
LEFT JOIN sa_academies a ON a.id = c.academy_id
WHERE c.id = ? AND c.is_archived = 0"
,
[(
int
)
$id
]
[(
int
)
$id
]
);
);
...
@@ -317,7 +320,11 @@ class CoachController extends Controller
...
@@ -317,7 +320,11 @@ class CoachController extends Controller
if
(
$employmentType
===
''
)
{
if
(
$employmentType
===
''
)
{
$errors
[]
=
'نوع التوظيف مطلوب'
;
$errors
[]
=
'نوع التوظيف مطلوب'
;
}
}
if
(
$paymentModel
===
''
)
{
$coachType
=
trim
((
string
)
$request
->
post
(
'coach_type'
,
'independent'
));
if
(
!
array_key_exists
(
$coachType
,
Coach
::
getCoachTypeOptions
()))
{
$coachType
=
'independent'
;
}
if
(
$coachType
!==
'academy'
&&
$paymentModel
===
''
)
{
$errors
[]
=
'نموذج الدفع مطلوب'
;
$errors
[]
=
'نموذج الدفع مطلوب'
;
}
}
if
(
$code
!==
''
&&
$code
!==
$coach
[
'code'
])
{
if
(
$code
!==
''
&&
$code
!==
$coach
[
'code'
])
{
...
@@ -343,10 +350,6 @@ class CoachController extends Controller
...
@@ -343,10 +350,6 @@ class CoachController extends Controller
}
}
}
}
$coachType
=
trim
((
string
)
$request
->
post
(
'coach_type'
,
'independent'
));
if
(
!
array_key_exists
(
$coachType
,
Coach
::
getCoachTypeOptions
()))
{
$coachType
=
'independent'
;
}
$academyId
=
$coachType
===
'academy'
?
((
int
)
$request
->
post
(
'academy_id'
,
0
)
?:
null
)
:
null
;
$academyId
=
$coachType
===
'academy'
?
((
int
)
$request
->
post
(
'academy_id'
,
0
)
?:
null
)
:
null
;
$db
->
update
(
'sa_coaches'
,
[
$db
->
update
(
'sa_coaches'
,
[
...
@@ -361,10 +364,10 @@ class CoachController extends Controller
...
@@ -361,10 +364,10 @@ class CoachController extends Controller
'employment_type'
=>
$employmentType
,
'employment_type'
=>
$employmentType
,
'coach_type'
=>
$coachType
,
'coach_type'
=>
$coachType
,
'academy_id'
=>
$academyId
,
'academy_id'
=>
$academyId
,
'payment_model'
=>
$
paymentModel
,
'payment_model'
=>
$
coachType
===
'academy'
?
null
:
(
$paymentModel
?:
null
)
,
'hourly_rate'
=>
$
hourlyRate
!==
''
?
(
float
)
$hourlyRate
:
null
,
'hourly_rate'
=>
$
coachType
===
'academy'
?
null
:
(
$hourlyRate
!==
''
?
(
float
)
$hourlyRate
:
null
)
,
'session_rate'
=>
$
sessionRate
!==
''
?
(
float
)
$sessionRate
:
null
,
'session_rate'
=>
$
coachType
===
'academy'
?
null
:
(
$sessionRate
!==
''
?
(
float
)
$sessionRate
:
null
)
,
'monthly_rate'
=>
$
monthlyRate
!==
''
?
(
float
)
$monthlyRate
:
null
,
'monthly_rate'
=>
$
coachType
===
'academy'
?
null
:
(
$monthlyRate
!==
''
?
(
float
)
$monthlyRate
:
null
)
,
'max_groups'
=>
$maxGroups
!==
''
?
(
int
)
$maxGroups
:
10
,
'max_groups'
=>
$maxGroups
!==
''
?
(
int
)
$maxGroups
:
10
,
'bio_ar'
=>
$bioAr
?:
null
,
'bio_ar'
=>
$bioAr
?:
null
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
...
...
app/Modules/SportsActivity/Views/coaches/create.php
View file @
0d8cd6aa
...
@@ -89,9 +89,9 @@
...
@@ -89,9 +89,9 @@
<?php
endforeach
;
?>
<?php
endforeach
;
?>
</select>
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
id=
"paymentModelField"
>
<label
class=
"form-label"
>
نموذج الدفع
<span
style=
"color:#DC2626;"
>
*
</span></label>
<label
class=
"form-label"
>
نموذج الدفع
<span
style=
"color:#DC2626;"
>
*
</span></label>
<select
name=
"payment_model"
class=
"form-select"
required
>
<select
name=
"payment_model"
id=
"paymentModelSelect"
class=
"form-select"
required
>
<option
value=
""
>
-- اختر --
</option>
<option
value=
""
>
-- اختر --
</option>
<?php
foreach
(
$paymentModels
as
$key
=>
$label
)
:
?>
<?php
foreach
(
$paymentModels
as
$key
=>
$label
)
:
?>
<option
value=
"
<?=
e
(
$key
)
?>
"
<?=
old
(
'payment_model'
)
===
$key
?
'selected'
:
''
?>
>
<?=
e
(
$label
)
?>
</option>
<option
value=
"
<?=
e
(
$key
)
?>
"
<?=
old
(
'payment_model'
)
===
$key
?
'selected'
:
''
?>
>
<?=
e
(
$label
)
?>
</option>
...
@@ -111,7 +111,7 @@
...
@@ -111,7 +111,7 @@
</select>
</select>
</div>
</div>
</div>
</div>
<div
style=
"display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:20px;margin-top:15px;"
>
<div
id=
"financialFields"
style=
"display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:20px;margin-top:15px;"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"form-label"
>
سعر الساعة (ج.م)
</label>
<label
class=
"form-label"
>
سعر الساعة (ج.م)
</label>
<input
type=
"number"
name=
"hourly_rate"
value=
"
<?=
e
(
old
(
'hourly_rate'
))
?>
"
class=
"form-input"
min=
"0"
step=
"0.01"
placeholder=
"0.00"
style=
"direction:ltr;text-align:left;"
>
<input
type=
"number"
name=
"hourly_rate"
value=
"
<?=
e
(
old
(
'hourly_rate'
))
?>
"
class=
"form-input"
min=
"0"
step=
"0.01"
placeholder=
"0.00"
style=
"direction:ltr;text-align:left;"
>
...
@@ -204,13 +204,21 @@ document.addEventListener('DOMContentLoaded', function() {
...
@@ -204,13 +204,21 @@ document.addEventListener('DOMContentLoaded', function() {
// Coach type toggle
// Coach type toggle
var
coachTypeSelect
=
document
.
getElementById
(
'coachTypeSelect'
);
var
coachTypeSelect
=
document
.
getElementById
(
'coachTypeSelect'
);
var
academyFields
=
document
.
getElementById
(
'academyFields'
);
var
academyFields
=
document
.
getElementById
(
'academyFields'
);
var
financialFields
=
document
.
getElementById
(
'financialFields'
);
var
paymentModelField
=
document
.
getElementById
(
'paymentModelField'
);
var
paymentModelSelect
=
document
.
getElementById
(
'paymentModelSelect'
);
function
toggleAcademyFields
()
{
function
toggleAcademyFields
()
{
academyFields
.
style
.
display
=
coachTypeSelect
.
value
===
'academy'
?
'block'
:
'none'
;
var
isAcademy
=
coachTypeSelect
.
value
===
'academy'
;
academyFields
.
style
.
display
=
isAcademy
?
'block'
:
'none'
;
financialFields
.
style
.
display
=
isAcademy
?
'none'
:
'grid'
;
paymentModelField
.
style
.
display
=
isAcademy
?
'none'
:
''
;
var
acadSelect
=
document
.
getElementById
(
'academySelect'
);
var
acadSelect
=
document
.
getElementById
(
'academySelect'
);
if
(
coachTypeSelect
.
value
===
'academy'
)
{
if
(
isAcademy
)
{
acadSelect
.
setAttribute
(
'required'
,
'required'
);
acadSelect
.
setAttribute
(
'required'
,
'required'
);
paymentModelSelect
.
removeAttribute
(
'required'
);
}
else
{
}
else
{
acadSelect
.
removeAttribute
(
'required'
);
acadSelect
.
removeAttribute
(
'required'
);
paymentModelSelect
.
setAttribute
(
'required'
,
'required'
);
}
}
}
}
coachTypeSelect
.
addEventListener
(
'change'
,
toggleAcademyFields
);
coachTypeSelect
.
addEventListener
(
'change'
,
toggleAcademyFields
);
...
...
app/Modules/SportsActivity/Views/coaches/edit.php
View file @
0d8cd6aa
...
@@ -98,9 +98,9 @@ $val = function(string $field) use ($coach) {
...
@@ -98,9 +98,9 @@ $val = function(string $field) use ($coach) {
<?php
endforeach
;
?>
<?php
endforeach
;
?>
</select>
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
id=
"paymentModelField"
>
<label
class=
"form-label"
>
نموذج الدفع
<span
style=
"color:#DC2626;"
>
*
</span></label>
<label
class=
"form-label"
>
نموذج الدفع
<span
style=
"color:#DC2626;"
>
*
</span></label>
<select
name=
"payment_model"
class=
"form-select"
required
>
<select
name=
"payment_model"
id=
"paymentModelSelect"
class=
"form-select"
required
>
<option
value=
""
>
-- اختر --
</option>
<option
value=
""
>
-- اختر --
</option>
<?php
foreach
(
$paymentModels
as
$key
=>
$label
)
:
?>
<?php
foreach
(
$paymentModels
as
$key
=>
$label
)
:
?>
<option
value=
"
<?=
e
(
$key
)
?>
"
<?=
$val
(
'payment_model'
)
===
$key
?
'selected'
:
''
?>
>
<?=
e
(
$label
)
?>
</option>
<option
value=
"
<?=
e
(
$key
)
?>
"
<?=
$val
(
'payment_model'
)
===
$key
?
'selected'
:
''
?>
>
<?=
e
(
$label
)
?>
</option>
...
@@ -120,7 +120,7 @@ $val = function(string $field) use ($coach) {
...
@@ -120,7 +120,7 @@ $val = function(string $field) use ($coach) {
</select>
</select>
</div>
</div>
</div>
</div>
<div
style=
"display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:20px;margin-top:15px;"
>
<div
id=
"financialFields"
style=
"display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:20px;margin-top:15px;"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"form-label"
>
سعر الساعة (ج.م)
</label>
<label
class=
"form-label"
>
سعر الساعة (ج.م)
</label>
<input
type=
"number"
name=
"hourly_rate"
value=
"
<?=
e
(
$val
(
'hourly_rate'
))
?>
"
class=
"form-input"
min=
"0"
step=
"0.01"
placeholder=
"0.00"
style=
"direction:ltr;text-align:left;"
>
<input
type=
"number"
name=
"hourly_rate"
value=
"
<?=
e
(
$val
(
'hourly_rate'
))
?>
"
class=
"form-input"
min=
"0"
step=
"0.01"
placeholder=
"0.00"
style=
"direction:ltr;text-align:left;"
>
...
@@ -236,13 +236,21 @@ document.addEventListener('DOMContentLoaded', function() {
...
@@ -236,13 +236,21 @@ document.addEventListener('DOMContentLoaded', function() {
// Coach type toggle
// Coach type toggle
var
coachTypeSelect
=
document
.
getElementById
(
'coachTypeSelect'
);
var
coachTypeSelect
=
document
.
getElementById
(
'coachTypeSelect'
);
var
academyFields
=
document
.
getElementById
(
'academyFields'
);
var
academyFields
=
document
.
getElementById
(
'academyFields'
);
var
financialFields
=
document
.
getElementById
(
'financialFields'
);
var
paymentModelField
=
document
.
getElementById
(
'paymentModelField'
);
var
paymentModelSelect
=
document
.
getElementById
(
'paymentModelSelect'
);
function
toggleAcademyFields
()
{
function
toggleAcademyFields
()
{
academyFields
.
style
.
display
=
coachTypeSelect
.
value
===
'academy'
?
'block'
:
'none'
;
var
isAcademy
=
coachTypeSelect
.
value
===
'academy'
;
academyFields
.
style
.
display
=
isAcademy
?
'block'
:
'none'
;
financialFields
.
style
.
display
=
isAcademy
?
'none'
:
'grid'
;
paymentModelField
.
style
.
display
=
isAcademy
?
'none'
:
''
;
var
acadSelect
=
document
.
getElementById
(
'academySelect'
);
var
acadSelect
=
document
.
getElementById
(
'academySelect'
);
if
(
coachTypeSelect
.
value
===
'academy'
)
{
if
(
isAcademy
)
{
acadSelect
.
setAttribute
(
'required'
,
'required'
);
acadSelect
.
setAttribute
(
'required'
,
'required'
);
paymentModelSelect
.
removeAttribute
(
'required'
);
}
else
{
}
else
{
acadSelect
.
removeAttribute
(
'required'
);
acadSelect
.
removeAttribute
(
'required'
);
paymentModelSelect
.
setAttribute
(
'required'
,
'required'
);
}
}
}
}
coachTypeSelect
.
addEventListener
(
'change'
,
toggleAcademyFields
);
coachTypeSelect
.
addEventListener
(
'change'
,
toggleAcademyFields
);
...
...
app/Modules/SportsActivity/Views/coaches/show.php
View file @
0d8cd6aa
...
@@ -88,20 +88,30 @@ $isActive = (int) ($coach['is_active'] ?? 0);
...
@@ -88,20 +88,30 @@ $isActive = (int) ($coach['is_active'] ?? 0);
<h3
style=
"margin:0;color:#059669;font-size:15px;"
>
بيانات التوظيف
</h3>
<h3
style=
"margin:0;color:#059669;font-size:15px;"
>
بيانات التوظيف
</h3>
</div>
</div>
<div
style=
"padding:20px;"
>
<div
style=
"padding:20px;"
>
<?php
$isAcademyCoach
=
(
$coach
[
'coach_type'
]
??
''
)
===
'academy'
;
?>
<div
style=
"display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;"
>
<div
style=
"display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;"
>
<div>
<div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
نوع التوظيف
</div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
نوع التوظيف
</div>
<div
style=
"font-weight:600;"
>
<?=
e
(
$employmentTypes
[
$coach
[
'employment_type'
]
??
''
]
??
'-'
)
?>
</div>
<div
style=
"font-weight:600;"
>
<?=
e
(
$employmentTypes
[
$coach
[
'employment_type'
]
??
''
]
??
'-'
)
?>
</div>
</div>
</div>
<?php
if
(
!
$isAcademyCoach
)
:
?>
<div>
<div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
نموذج الدفع
</div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
نموذج الدفع
</div>
<div
style=
"font-weight:600;"
>
<?=
e
(
$paymentModels
[
$coach
[
'payment_model'
]
??
''
]
??
'-'
)
?>
</div>
<div
style=
"font-weight:600;"
>
<?=
e
(
$paymentModels
[
$coach
[
'payment_model'
]
??
''
]
??
'-'
)
?>
</div>
</div>
</div>
<?php
endif
;
?>
<div>
<div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
أقصى عدد مجموعات
</div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
أقصى عدد مجموعات
</div>
<div
style=
"font-weight:600;"
>
<?=
!
empty
(
$coach
[
'max_groups'
])
?
(
int
)
$coach
[
'max_groups'
]
:
'-'
?>
</div>
<div
style=
"font-weight:600;"
>
<?=
!
empty
(
$coach
[
'max_groups'
])
?
(
int
)
$coach
[
'max_groups'
]
:
'-'
?>
</div>
</div>
</div>
<?php
if
(
$isAcademyCoach
&&
!
empty
(
$coach
[
'academy_name'
]))
:
?>
<div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
الأكاديمية
</div>
<div
style=
"font-weight:600;color:#7C3AED;"
>
<?=
e
(
$coach
[
'academy_name'
])
?>
</div>
</div>
<?php
endif
;
?>
</div>
</div>
<?php
if
(
!
$isAcademyCoach
)
:
?>
<div
style=
"display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;margin-top:20px;"
>
<div
style=
"display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;margin-top:20px;"
>
<div>
<div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
سعر الساعة
</div>
<div
style=
"font-size:12px;color:#6B7280;margin-bottom:4px;"
>
سعر الساعة
</div>
...
@@ -116,6 +126,7 @@ $isActive = (int) ($coach['is_active'] ?? 0);
...
@@ -116,6 +126,7 @@ $isActive = (int) ($coach['is_active'] ?? 0);
<div>
<?=
$coach
[
'monthly_rate'
]
!==
null
&&
$coach
[
'monthly_rate'
]
!==
''
?
number_format
((
float
)
$coach
[
'monthly_rate'
],
2
)
.
' ج.م'
:
'-'
?>
</div>
<div>
<?=
$coach
[
'monthly_rate'
]
!==
null
&&
$coach
[
'monthly_rate'
]
!==
''
?
number_format
((
float
)
$coach
[
'monthly_rate'
],
2
)
.
' ج.م'
:
'-'
?>
</div>
</div>
</div>
</div>
</div>
<?php
endif
;
?>
</div>
</div>
</div>
</div>
...
...
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