Skip to content

Commit 6b5719b

Browse files
2 parents 4293b71 + cbfab7d commit 6b5719b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+788
-285
lines changed

packages/Webkul/Admin/src/Config/acl.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
], [
5050
'key' => 'mail.delete',
5151
'name' => 'admin::app.acl.delete',
52-
'route' => ['admin.mail.delete', 'admin.mail.mass-delete'],
52+
'route' => ['admin.mail.delete', 'admin.mail.mass_delete'],
5353
'sort' => 4,
5454
], [
5555
'key' => 'activities',
@@ -69,7 +69,7 @@
6969
], [
7070
'key' => 'activities.delete',
7171
'name' => 'admin::app.acl.delete',
72-
'route' => ['admin.activities.delete', 'admin.activities.mass-delete'],
72+
'route' => ['admin.activities.delete', 'admin.activities.mass_delete'],
7373
'sort' => 3,
7474
], [
7575
'key' => 'contacts',
@@ -94,7 +94,7 @@
9494
], [
9595
'key' => 'contacts.persons.delete',
9696
'name' => 'admin::app.acl.delete',
97-
'route' => ['admin.contacts.persons.delete', 'admin.contacts.persons.mass-delete'],
97+
'route' => ['admin.contacts.persons.delete', 'admin.contacts.persons.mass_delete'],
9898
'sort' => 4,
9999
], [
100100
'key' => 'contacts.organizations',
@@ -114,7 +114,7 @@
114114
], [
115115
'key' => 'contacts.organizations.delete',
116116
'name' => 'admin::app.acl.delete',
117-
'route' => ['admin.contacts.organizations.delete', 'admin.contacts.organizations.mass-delete'],
117+
'route' => ['admin.contacts.organizations.delete', 'admin.contacts.organizations.mass_delete'],
118118
'sort' => 3,
119119
], [
120120
'key' => 'products',
@@ -134,7 +134,7 @@
134134
], [
135135
'key' => 'products.delete',
136136
'name' => 'admin::app.acl.delete',
137-
'route' => ['admin.products.delete', 'admin.products.mass-delete'],
137+
'route' => ['admin.products.delete', 'admin.products.mass_delete'],
138138
'sort' => 3,
139139
], [
140140
'key' => 'settings',
@@ -159,7 +159,7 @@
159159
], [
160160
'key' => 'settings.users.delete',
161161
'name' => 'admin::app.acl.delete',
162-
'route' => ['admin.settings.users.delete', 'admin.settings.users.mass-delete'],
162+
'route' => ['admin.settings.users.delete', 'admin.settings.users.mass_delete'],
163163
'sort' => 3,
164164
], [
165165
'key' => 'settings.roles',

packages/Webkul/Admin/src/DataGrids/Activity/ActivityDataGrid.php

Lines changed: 55 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,6 @@ public function __construct()
8282
],
8383
];
8484

85-
// users list to filter table data
86-
$userRepository = app('\Webkul\User\Repositories\UserRepository');
87-
88-
$users = $userRepository->all();
89-
90-
foreach ($users as $user) {
91-
array_push($this->users, [
92-
'value' => $user['id'],
93-
'label' => $user['name'],
94-
]);
95-
}
96-
9785
// persons list to filter table data
9886
$personRepository = app('\Webkul\Contact\Repositories\PersonRepository');
9987

@@ -142,37 +130,37 @@ public function prepareQueryBuilder()
142130
public function addColumns()
143131
{
144132
$this->addColumn([
145-
'index' => 'user',
146-
'label' => trans('admin::app.datagrid.assigned_to'),
147-
'type' => 'hidden',
148-
'sortable' => true,
149-
'filterable_type' => 'dropdown',
150-
'filterable_options' => $this->users,
133+
'index' => 'user',
134+
'label' => trans('admin::app.datagrid.assigned_to'),
135+
'type' => 'hidden',
136+
'sortable' => true,
137+
'filterable_type' => 'dropdown',
138+
'filterable_options' => app('\Webkul\User\Repositories\UserRepository')->get(['id as value', 'name as label'])->toArray(),
151139
]);
152140

153141
$this->addColumn([
154-
'index' => 'lead',
155-
'label' => trans('admin::app.datagrid.lead'),
156-
'type' => 'string',
157-
'closure' => function ($row) {
142+
'index' => 'lead',
143+
'label' => trans('admin::app.datagrid.lead'),
144+
'type' => 'string',
145+
'closure' => function ($row) {
158146
$route = urldecode(route('admin.leads.index', ['view_type' => 'table', 'id[eq]' => $row->lead_id]));
159147

160148
return "<a href='" . $route . "'>" . $row->lead_title . "</a>";
161149
},
162150
]);
163151

164152
$this->addColumn([
165-
'index' => 'comment',
166-
'label' => trans('admin::app.datagrid.comment'),
167-
'type' => 'string',
168-
'searchable' => true,
153+
'index' => 'comment',
154+
'label' => trans('admin::app.datagrid.comment'),
155+
'type' => 'string',
156+
'searchable' => true,
169157
]);
170158

171159
$this->addColumn([
172-
'index' => 'type',
173-
'head_style' => 'width: 70px',
174-
'label' => trans('admin::app.datagrid.type'),
175-
'type' => 'boolean',
160+
'index' => 'type',
161+
'head_style' => 'width: 70px',
162+
'label' => trans('admin::app.datagrid.type'),
163+
'type' => 'boolean',
176164
]);
177165

178166
$this->addColumn([
@@ -181,21 +169,21 @@ public function addColumns()
181169
'label' => trans('admin::app.datagrid.is_done'),
182170
'type' => 'boolean',
183171
'filterable_type' => 'dropdown',
184-
'filterable_options' => [[
185-
'value' => 0,
186-
'label' => __("admin::app.common.no"),
187-
], [
188-
'value' => 1,
189-
'label' => __("admin::app.common.yes"),
190-
]],
172+
'filterable_options' => [
173+
[
174+
'value' => 0,
175+
'label' => __("admin::app.common.no"),
176+
], [
177+
'value' => 1,
178+
'label' => __("admin::app.common.yes"),
179+
]
180+
],
191181
'closure' => function ($row) {
192182
if ($row->is_done) {
193183
return '<span class="badge badge-round badge-success"></span>' . __("admin::app.common.yes");
194184
} else {
195185
return '<span class="badge badge-round badge-danger"></span>' . __("admin::app.common.no");
196186
}
197-
198-
// return "<span class='checkbox'><input type='checkbox'" . ($row->is_done ? "checked=checked" : "") . "disabled='disabled'><label for='checkbox' class='checkbox-view'></label></span>";
199187
},
200188
]);
201189

@@ -213,51 +201,51 @@ public function addColumns()
213201
]);
214202

215203
$this->addColumn([
216-
'index' => 'assigned_to',
217-
'label' => trans('admin::app.datagrid.assigned_to'),
218-
'type' => 'string',
219-
'closure' => function ($row) {
204+
'index' => 'assigned_to',
205+
'label' => trans('admin::app.datagrid.assigned_to'),
206+
'type' => 'string',
207+
'closure' => function ($row) {
220208
$route = urldecode(route('admin.settings.users.index', ['id[eq]' => $row->assignee_id]));
221209

222210
return "<a href='" . $route . "'>" . $row->assigned_to . "</a>";
223211
},
224212
]);
225213

226214
$this->addColumn([
227-
'index' => 'schedule_from',
228-
'head_style' => 'width: 100px',
229-
'label' => trans('admin::app.datagrid.schedule_from'),
230-
'title' => true,
231-
'type' => 'string',
232-
'sortable' => true,
233-
'filterable_type' => 'date_range',
234-
'closure' => function ($row) {
215+
'index' => 'schedule_from',
216+
'head_style' => 'width: 100px',
217+
'label' => trans('admin::app.datagrid.schedule_from'),
218+
'title' => true,
219+
'type' => 'string',
220+
'sortable' => true,
221+
'filterable_type' => 'date_range',
222+
'closure' => function ($row) {
235223
return core()->formatDate($row->schedule_from);
236224
},
237225
]);
238226

239227
$this->addColumn([
240-
'index' => 'schedule_to',
241-
'head_style' => 'width: 100px',
242-
'label' => trans('admin::app.datagrid.schedule_to'),
243-
'title' => true,
244-
'type' => 'string',
245-
'sortable' => true,
246-
'filterable_type' => 'date_range',
247-
'closure' => function ($row) {
228+
'index' => 'schedule_to',
229+
'head_style' => 'width: 100px',
230+
'label' => trans('admin::app.datagrid.schedule_to'),
231+
'title' => true,
232+
'type' => 'string',
233+
'sortable' => true,
234+
'filterable_type' => 'date_range',
235+
'closure' => function ($row) {
248236
return core()->formatDate($row->schedule_to);
249237
},
250238
]);
251239

252240
$this->addColumn([
253-
'index' => 'created_at',
254-
'head_style' => 'width: 100px',
255-
'label' => trans('admin::app.datagrid.created_at'),
256-
'title' => true,
257-
'type' => 'string',
258-
'sortable' => true,
259-
'filterable_type' => 'date_range',
260-
'closure' => function ($row) {
241+
'index' => 'created_at',
242+
'head_style' => 'width: 100px',
243+
'label' => trans('admin::app.datagrid.created_at'),
244+
'title' => true,
245+
'type' => 'string',
246+
'sortable' => true,
247+
'filterable_type' => 'date_range',
248+
'closure' => function ($row) {
261249
return core()->formatDate($row->created_at);
262250
},
263251
]);

packages/Webkul/Admin/src/DataGrids/Contact/OrganizationDataGrid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function prepareMassActions()
108108
$this->addMassAction([
109109
'type' => 'delete',
110110
'label' => trans('ui::app.datagrid.delete'),
111-
'action' => route('admin.contacts.organizations.mass-delete'),
111+
'action' => route('admin.contacts.organizations.mass_delete'),
112112
'method' => 'PUT',
113113
]);
114114
}

packages/Webkul/Admin/src/DataGrids/Contact/PersonDataGrid.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Illuminate\Support\Facades\DB;
66
use Illuminate\Support\Arr;
77
use Webkul\UI\DataGrid\DataGrid;
8-
use Webkul\Contact\Repositories\OrganizationRepository;
98

109
class PersonDataGrid extends DataGrid
1110
{
@@ -16,20 +15,6 @@ class PersonDataGrid extends DataGrid
1615
"route" => "admin.contacts.persons.edit",
1716
];
1817

19-
public function __construct(OrganizationRepository $organizationRepository)
20-
{
21-
$organizations = $organizationRepository->all();
22-
23-
foreach ($organizations as $organization) {
24-
array_push($this->organizations, [
25-
'value' => $organization['id'],
26-
'label' => $organization['name'],
27-
]);
28-
}
29-
30-
parent::__construct();
31-
}
32-
3318
public function prepareQueryBuilder()
3419
{
3520
$queryBuilder = DB::table('persons')
@@ -107,7 +92,7 @@ public function addColumns()
10792
'searchable' => true,
10893
'sortable' => true,
10994
'filterable_type' => 'dropdown',
110-
'filterable_options' => $this->organizations,
95+
'filterable_options' => app('\Webkul\Contact\Repositories\OrganizationRepository')->get(['id as value', 'name as label'])->toArray(),
11196
]);
11297
}
11398

@@ -134,7 +119,7 @@ public function prepareMassActions()
134119
$this->addMassAction([
135120
'type' => 'delete',
136121
'label' => trans('ui::app.datagrid.delete'),
137-
'action' => route('admin.contacts.persons.mass-delete'),
122+
'action' => route('admin.contacts.persons.mass_delete'),
138123
'method' => 'PUT',
139124
]);
140125
}

0 commit comments

Comments
 (0)