@@ -82,18 +82,6 @@ public function __construct()
82
82
],
83
83
];
84
84
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
-
97
85
// persons list to filter table data
98
86
$ personRepository = app ('\Webkul\Contact\Repositories\PersonRepository ' );
99
87
@@ -142,37 +130,37 @@ public function prepareQueryBuilder()
142
130
public function addColumns ()
143
131
{
144
132
$ 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 () ,
151
139
]);
152
140
153
141
$ 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 ) {
158
146
$ route = urldecode (route ('admin.leads.index ' , ['view_type ' => 'table ' , 'id[eq] ' => $ row ->lead_id ]));
159
147
160
148
return "<a href=' " . $ route . "'> " . $ row ->lead_title . "</a> " ;
161
149
},
162
150
]);
163
151
164
152
$ 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 ,
169
157
]);
170
158
171
159
$ 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 ' ,
176
164
]);
177
165
178
166
$ this ->addColumn ([
@@ -181,21 +169,21 @@ public function addColumns()
181
169
'label ' => trans ('admin::app.datagrid.is_done ' ),
182
170
'type ' => 'boolean ' ,
183
171
'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
+ ],
191
181
'closure ' => function ($ row ) {
192
182
if ($ row ->is_done ) {
193
183
return '<span class="badge badge-round badge-success"></span> ' . __ ("admin::app.common.yes " );
194
184
} else {
195
185
return '<span class="badge badge-round badge-danger"></span> ' . __ ("admin::app.common.no " );
196
186
}
197
-
198
- // return "<span class='checkbox'><input type='checkbox'" . ($row->is_done ? "checked=checked" : "") . "disabled='disabled'><label for='checkbox' class='checkbox-view'></label></span>";
199
187
},
200
188
]);
201
189
@@ -213,51 +201,51 @@ public function addColumns()
213
201
]);
214
202
215
203
$ 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 ) {
220
208
$ route = urldecode (route ('admin.settings.users.index ' , ['id[eq] ' => $ row ->assignee_id ]));
221
209
222
210
return "<a href=' " . $ route . "'> " . $ row ->assigned_to . "</a> " ;
223
211
},
224
212
]);
225
213
226
214
$ 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 ) {
235
223
return core ()->formatDate ($ row ->schedule_from );
236
224
},
237
225
]);
238
226
239
227
$ 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 ) {
248
236
return core ()->formatDate ($ row ->schedule_to );
249
237
},
250
238
]);
251
239
252
240
$ 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 ) {
261
249
return core ()->formatDate ($ row ->created_at );
262
250
},
263
251
]);
0 commit comments