Skip to content

Commit cbfab7d

Browse files
Merge pull request #112 from jitendra-webkul/master
Link quote to the lead, added view_render events to all blade file, fixed namespacing issue
2 parents 6cd5650 + bda52e8 commit cbfab7d

Some content is hidden

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

52 files changed

+786
-283
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: 51 additions & 63 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,58 +130,58 @@ 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-
'label' => trans('admin::app.datagrid.type'),
174-
'type' => 'boolean',
160+
'index' => 'type',
161+
'label' => trans('admin::app.datagrid.type'),
162+
'type' => 'boolean',
175163
]);
176164

177165
$this->addColumn([
178166
'index' => 'is_done',
179167
'label' => trans('admin::app.datagrid.is_done'),
180168
'type' => 'boolean',
181169
'filterable_type' => 'dropdown',
182-
'filterable_options' => [[
183-
'value' => 0,
184-
'label' => __("admin::app.common.no"),
185-
], [
186-
'value' => 1,
187-
'label' => __("admin::app.common.yes"),
188-
]],
170+
'filterable_options' => [
171+
[
172+
'value' => 0,
173+
'label' => __("admin::app.common.no"),
174+
], [
175+
'value' => 1,
176+
'label' => __("admin::app.common.yes"),
177+
]
178+
],
189179
'closure' => function ($row) {
190180
if ($row->is_done) {
191181
return '<span class="badge badge-round badge-success"></span>' . __("admin::app.common.yes");
192182
} else {
193183
return '<span class="badge badge-round badge-danger"></span>' . __("admin::app.common.no");
194184
}
195-
196-
// return "<span class='checkbox'><input type='checkbox'" . ($row->is_done ? "checked=checked" : "") . "disabled='disabled'><label for='checkbox' class='checkbox-view'></label></span>";
197185
},
198186
]);
199187

@@ -211,48 +199,48 @@ public function addColumns()
211199
]);
212200

213201
$this->addColumn([
214-
'index' => 'assigned_to',
215-
'label' => trans('admin::app.datagrid.assigned_to'),
216-
'type' => 'string',
217-
'closure' => function ($row) {
202+
'index' => 'assigned_to',
203+
'label' => trans('admin::app.datagrid.assigned_to'),
204+
'type' => 'string',
205+
'closure' => function ($row) {
218206
$route = urldecode(route('admin.settings.users.index', ['id[eq]' => $row->assignee_id]));
219207

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

224212
$this->addColumn([
225-
'index' => 'schedule_from',
226-
'label' => trans('admin::app.datagrid.schedule_from'),
227-
'title' => true,
228-
'type' => 'string',
229-
'sortable' => true,
230-
'filterable_type' => 'date_range',
231-
'closure' => function ($row) {
213+
'index' => 'schedule_from',
214+
'label' => trans('admin::app.datagrid.schedule_from'),
215+
'title' => true,
216+
'type' => 'string',
217+
'sortable' => true,
218+
'filterable_type' => 'date_range',
219+
'closure' => function ($row) {
232220
return core()->formatDate($row->schedule_from);
233221
},
234222
]);
235223

236224
$this->addColumn([
237-
'index' => 'schedule_to',
238-
'label' => trans('admin::app.datagrid.schedule_to'),
239-
'title' => true,
240-
'type' => 'string',
241-
'sortable' => true,
242-
'filterable_type' => 'date_range',
243-
'closure' => function ($row) {
225+
'index' => 'schedule_to',
226+
'label' => trans('admin::app.datagrid.schedule_to'),
227+
'title' => true,
228+
'type' => 'string',
229+
'sortable' => true,
230+
'filterable_type' => 'date_range',
231+
'closure' => function ($row) {
244232
return core()->formatDate($row->schedule_to);
245233
},
246234
]);
247235

248236
$this->addColumn([
249-
'index' => 'created_at',
250-
'label' => trans('admin::app.datagrid.created_at'),
251-
'title' => true,
252-
'type' => 'string',
253-
'sortable' => true,
254-
'filterable_type' => 'date_range',
255-
'closure' => function ($row) {
237+
'index' => 'created_at',
238+
'label' => trans('admin::app.datagrid.created_at'),
239+
'title' => true,
240+
'type' => 'string',
241+
'sortable' => true,
242+
'filterable_type' => 'date_range',
243+
'closure' => function ($row) {
256244
return core()->formatDate($row->created_at);
257245
},
258246
]);

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)