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
6bfad320
Commit
6bfad320
authored
May 03, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coool
parent
0f1cba7f
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
619 additions
and
220 deletions
+619
-220
WorkflowController.php
app/Modules/Workflow/Controllers/WorkflowController.php
+70
-0
Routes.php
app/Modules/Workflow/Routes.php
+3
-1
diagram.php
app/Modules/Workflow/Views/diagram.php
+105
-69
edit.php
app/Modules/Workflow/Views/edit.php
+169
-0
index.php
app/Modules/Workflow/Views/index.php
+104
-55
instance.php
app/Modules/Workflow/Views/instance.php
+168
-95
No files found.
app/Modules/Workflow/Controllers/WorkflowController.php
View file @
6bfad320
...
...
@@ -131,4 +131,74 @@ class WorkflowController extends Controller
$count
=
count
(
$processed
);
return
$this
->
redirect
(
'/workflows'
)
->
withSuccess
(
"تم معالجة
{
$count
}
انتقال تلقائي"
);
}
public
function
edit
(
Request
$request
,
string
$code
)
:
Response
{
$definition
=
WorkflowDefinition
::
findByCode
(
$code
);
if
(
!
$definition
)
{
return
$this
->
redirect
(
'/workflows'
)
->
withError
(
'تعريف دورة العمل غير موجود'
);
}
return
$this
->
view
(
'Workflow.Views.edit'
,
[
'definition'
=>
$definition
,
]);
}
public
function
update
(
Request
$request
,
string
$code
)
:
Response
{
$db
=
App
::
getInstance
()
->
db
();
$definition
=
WorkflowDefinition
::
findByCode
(
$code
);
if
(
!
$definition
)
{
return
$this
->
redirect
(
'/workflows'
)
->
withError
(
'تعريف دورة العمل غير موجود'
);
}
$nameAr
=
trim
((
string
)
$request
->
post
(
'name_ar'
,
''
));
$nameEn
=
trim
((
string
)
$request
->
post
(
'name_en'
,
''
));
$descriptionAr
=
trim
((
string
)
$request
->
post
(
'description_ar'
,
''
));
if
(
$nameAr
===
''
)
{
return
$this
->
redirect
(
"/workflows/edit/
{
$code
}
"
)
->
withError
(
'الاسم بالعربي مطلوب'
);
}
$defJson
=
$definition
->
getDefinition
();
// Update state labels
$statesInput
=
$request
->
post
(
'states'
,
[]);
if
(
is_array
(
$statesInput
))
{
foreach
(
$statesInput
as
$key
=>
$stateData
)
{
if
(
isset
(
$defJson
[
'states'
][
$key
]))
{
if
(
!
empty
(
$stateData
[
'label_ar'
]))
{
$defJson
[
'states'
][
$key
][
'label_ar'
]
=
trim
(
$stateData
[
'label_ar'
]);
}
if
(
!
empty
(
$stateData
[
'label_en'
]))
{
$defJson
[
'states'
][
$key
][
'label_en'
]
=
trim
(
$stateData
[
'label_en'
]);
}
}
}
}
// Update transition triggers
$transitionsInput
=
$request
->
post
(
'transitions'
,
[]);
if
(
is_array
(
$transitionsInput
))
{
foreach
(
$transitionsInput
as
$idx
=>
$tData
)
{
if
(
isset
(
$defJson
[
'transitions'
][
$idx
])
&&
!
empty
(
$tData
[
'trigger_edit'
]))
{
$defJson
[
'transitions'
][
$idx
][
'trigger'
]
=
$tData
[
'trigger_edit'
];
}
}
}
$newVersion
=
(
int
)
$definition
->
version
+
1
;
$db
->
update
(
'workflow_definitions'
,
[
'name_ar'
=>
$nameAr
,
'name_en'
=>
$nameEn
?:
null
,
'description_ar'
=>
$descriptionAr
?:
null
,
'definition_json'
=>
json_encode
(
$defJson
,
JSON_UNESCAPED_UNICODE
|
JSON_PRETTY_PRINT
),
'version'
=>
$newVersion
,
'updated_at'
=>
date
(
'Y-m-d H:i:s'
),
],
'`id` = ?'
,
[(
int
)
$definition
->
id
]);
return
$this
->
redirect
(
"/workflows/diagram/
{
$code
}
"
)
->
withSuccess
(
'تم تحديث دورة العمل — الإصدار '
.
$newVersion
);
}
}
\ No newline at end of file
app/Modules/Workflow/Routes.php
View file @
6bfad320
...
...
@@ -4,8 +4,10 @@ declare(strict_types=1);
return
[
[
'GET'
,
'/workflows'
,
'Workflow\Controllers\WorkflowController@index'
,
[
'auth'
,
'csrf'
],
'rules.view'
],
[
'GET'
,
'/workflows/diagram/{code}'
,
'Workflow\Controllers\WorkflowController@diagram'
,
[
'auth'
,
'csrf'
],
'rules.view'
],
[
'GET'
,
'/workflows/instances/{code}'
,
'Workflow\Controllers\WorkflowController@instances'
,
[
'auth'
,
'csrf'
],
'rules.view'
],
[
'GET'
,
'/workflows/edit/{code}'
,
'Workflow\Controllers\WorkflowController@edit'
,
[
'auth'
,
'csrf'
],
'rules.edit'
],
[
'POST'
,
'/workflows/edit/{code}'
,
'Workflow\Controllers\WorkflowController@update'
,
[
'auth'
,
'csrf'
],
'rules.edit'
],
[
'GET'
,
'/workflows/instances/{id:\d+}'
,
'Workflow\Controllers\WorkflowController@instance'
,
[
'auth'
,
'csrf'
],
'rules.view'
],
[
'POST'
,
'/workflows/instances/{id:\d+}/transition'
,
'Workflow\Controllers\WorkflowController@transition'
,
[
'auth'
,
'csrf'
],
'rules.edit'
],
[
'GET'
,
'/workflows/instances/{code}'
,
'Workflow\Controllers\WorkflowController@instances'
,
[
'auth'
,
'csrf'
],
'rules.view'
],
[
'POST'
,
'/workflows/process-timeouts'
,
'Workflow\Controllers\WorkflowController@processTimeouts'
,
[
'auth'
,
'csrf'
],
'rules.edit'
],
];
\ No newline at end of file
app/Modules/Workflow/Views/diagram.php
View file @
6bfad320
This diff is collapsed.
Click to expand it.
app/Modules/Workflow/Views/edit.php
0 → 100644
View file @
6bfad320
This diff is collapsed.
Click to expand it.
app/Modules/Workflow/Views/index.php
View file @
6bfad320
This diff is collapsed.
Click to expand it.
app/Modules/Workflow/Views/instance.php
View file @
6bfad320
This diff is collapsed.
Click to expand it.
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