Skip to content

Commit

Permalink
Workflow has been done.
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj-webkul committed Jul 23, 2024
1 parent 5a451a2 commit 3823455
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 1,600 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function prepareColumns(): void
{
$this->addColumn([
'index' => 'id',
'label' => trans('admin::app.datagrid.id'),
'label' => trans('admin::app.settings.workflows.index.datagrid.id'),
'type' => 'string',
'searchable' => true,
'filterable' => true,
Expand All @@ -40,7 +40,7 @@ public function prepareColumns(): void

$this->addColumn([
'index' => 'name',
'label' => trans('admin::app.datagrid.name'),
'label' => trans('admin::app.settings.workflows.index.datagrid.name'),
'type' => 'string',
'searchable' => true,
'filterable' => true,
Expand All @@ -56,15 +56,15 @@ public function prepareActions(): void
$this->addAction([
'index' => 'edit',
'icon' => 'icon-edit',
'title' => trans('ui::app.datagrid.edit'),
'title' => trans('admin::app.settings.workflows.index.datagrid.edit'),
'method' => 'GET',
'url' => fn ($row) => route('admin.settings.workflows.edit', $row->id),
]);

$this->addAction([
'index' => 'delete',
'icon' => 'icon-delete',
'title' => trans('ui::app.datagrid.delete'),
'title' => trans('admin::app.settings.workflows.index.datagrid.delete'),
'method' => 'DELETE',
'url' => fn ($row) => route('admin.settings.workflows.delete', $row->id),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function store(): RedirectResponse

Event::dispatch('settings.workflow.create.after', $workflow);

session()->flash('success', trans('admin::app.settings.workflows.create-success'));
session()->flash('success', trans('admin::app.settings.workflows.index.create-success'));

return redirect()->route('admin.settings.workflows.index');
}
Expand Down Expand Up @@ -84,7 +84,7 @@ public function update(int $id): RedirectResponse

Event::dispatch('settings.workflow.update.after', $workflow);

session()->flash('success', trans('admin::app.settings.workflows.update-success'));
session()->flash('success', trans('admin::app.settings.workflows.index.update-success'));

return redirect()->route('admin.settings.workflows.index');
}
Expand All @@ -99,21 +99,21 @@ public function destroy(int $id): JsonResponse
try {
Event::dispatch('settings.workflow.delete.before', $id);

$this->workflowRepository->delete($id);
$workflow->delete($id);

Event::dispatch('settings.workflow.delete.after', $id);

return response()->json([
'message' => trans('admin::app.settings.workflows.delete-success'),
'message' => trans('admin::app.settings.workflows.index.delete-success'),
], 200);
} catch (\Exception $exception) {
return response()->json([
'message' => trans('admin::app.settings.workflows.delete-failed'),
'message' => trans('admin::app.settings.workflows.index.delete-failed'),
], 400);
}

return response()->json([
'message' => trans('admin::app.settings.workflows.delete-failed'),
'message' => trans('admin::app.settings.workflows.index.delete-failed'),
], 400);
}
}
18 changes: 18 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,22 @@
],

'workflows' => [
'index' => [
'title' => 'Workflows',
'create-btn' => 'Create Workflow',
'create-success' => 'Workflow created successfully.',
'update-success' => 'Workflow updated successfully.',
'delete-success' => 'Workflow deleted successfully.',
'delete-failed' => 'Workflow can not be deleted.',
'datagrid' => [
'delete' => 'Delete',
'description' => 'Description',
'edit' => 'Edit',
'id' => 'ID',
'name' => 'Name',
],
],

'create' => [
'title' => 'Create Workflow',
'event' => 'Event',
Expand All @@ -251,6 +267,7 @@
'add-action' => 'Add Action',
'yes' => 'Yes',
'no' => 'No',
'email' => 'Email',
'is-equal-to' => 'Is equal to',
'is-not-equal-to' => 'Is not equal to',
'equals-or-greater-than' => 'Equals or greater than',
Expand Down Expand Up @@ -285,6 +302,7 @@
'add-action' => 'Add Action',
'yes' => 'Yes',
'no' => 'No',
'email' => 'Email',
'is-equal-to' => 'Is equal to',
'is-not-equal-to' => 'Is not equal to',
'equals-or-greater-than' => 'Equals or greater than',
Expand Down
Loading

0 comments on commit 3823455

Please sign in to comment.