Skip to content

Commit a9e2ec1

Browse files
misc. filters added
1 parent 6b5719b commit a9e2ec1

File tree

8 files changed

+40
-45
lines changed

8 files changed

+40
-45
lines changed

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

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

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

@@ -120,7 +108,7 @@ public function prepareQueryBuilder()
120108

121109
$this->addFilter('id', 'lead_activities.id');
122110
$this->addFilter('assigned_to', 'users.name');
123-
$this->addFilter('contact_person', 'persons.id');
111+
$this->addFilter('contact_person', 'persons.name');
124112
$this->addFilter('user', 'lead_activities.user_id');
125113
$this->addFilter('created_at', 'lead_activities.created_at');
126114

@@ -191,8 +179,7 @@ public function addColumns()
191179
'index' => 'contact_person',
192180
'label' => trans('admin::app.datagrid.contact_person'),
193181
'type' => 'string',
194-
'filterable_type' => 'dropdown',
195-
'filterable_options' => $this->persons,
182+
'filterable_type' => 'add',
196183
'closure' => function ($row) {
197184
$route = urldecode(route('admin.contacts.persons.index', ['id[eq]' => $row->contact_person_id]));
198185

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ public function addColumns()
5252
]);
5353

5454
$this->addColumn([
55-
'index' => 'emails',
56-
'label' => trans('admin::app.datagrid.emails'),
57-
'type' => 'string',
58-
'searchable' => true,
59-
'sortable' => false,
60-
'closure' => function ($row) {
55+
'index' => 'emails',
56+
'label' => trans('admin::app.datagrid.emails'),
57+
'type' => 'string',
58+
'searchable' => true,
59+
'sortable' => false,
60+
'filterable_type' => 'add',
61+
'closure' => function ($row) {
6162
$emails = json_decode($row->emails, true);
6263

6364
if ($emails) {
@@ -69,12 +70,13 @@ public function addColumns()
6970
]);
7071

7172
$this->addColumn([
72-
'index' => 'contact_numbers',
73-
'label' => trans('admin::app.datagrid.contact_numbers'),
74-
'type' => 'string',
75-
'searchable' => true,
76-
'sortable' => false,
77-
'closure' => function ($row) {
73+
'index' => 'contact_numbers',
74+
'label' => trans('admin::app.datagrid.contact_numbers'),
75+
'type' => 'string',
76+
'searchable' => true,
77+
'sortable' => false,
78+
'filterable_type' => 'add',
79+
'closure' => function ($row) {
7880
$contactNumbers = json_decode($row->contact_numbers, true);
7981

8082
if ($contactNumbers) {

packages/Webkul/Admin/src/DataGrids/Lead/LeadDataGrid.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@ public function addColumns()
107107
]);
108108

109109
$this->addColumn([
110-
'index' => 'lead_value',
111-
'label' => trans('admin::app.datagrid.lead_value'),
112-
'type' => 'string',
113-
'searchable' => true,
114-
'sortable' => true,
115-
'closure' => function ($row) {
110+
'index' => 'lead_value',
111+
'label' => trans('admin::app.datagrid.lead_value'),
112+
'type' => 'string',
113+
'searchable' => true,
114+
'sortable' => true,
115+
'filterable_type' => 'add',
116+
'closure' => function ($row) {
116117
return round($row->lead_value, 2);
117118
},
118119
]);

packages/Webkul/Admin/src/DataGrids/Product/ProductDataGrid.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ public function addColumns()
4747
]);
4848

4949
$this->addColumn([
50-
'index' => 'price',
51-
'label' => trans('admin::app.datagrid.price'),
52-
'type' => 'string',
53-
'searchable' => true,
54-
'sortable' => true,
55-
'closure' => function ($row) {
50+
'index' => 'price',
51+
'label' => trans('admin::app.datagrid.price'),
52+
'type' => 'string',
53+
'searchable' => true,
54+
'sortable' => true,
55+
'filterable_type' => 'add',
56+
'closure' => function ($row) {
5657
return round($row->price, 2);
5758
},
5859
]);

packages/Webkul/UI/publishable/assets/css/ui.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/Webkul/UI/publishable/assets/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"/js/ui.js": "/js/ui.js?id=925202de58f991c86c6c",
3-
"/css/ui.css": "/css/ui.css?id=e257645d1bdbfb58f53b",
3+
"/css/ui.css": "/css/ui.css?id=b82e866167fb8ee7c926",
44
"/images/add-icon.svg": "/images/add-icon.svg?id=9135b4e0e1c239c36981",
55
"/images/align-justify-icon.svg": "/images/align-justify-icon.svg?id=ee8d48e636b80417a884",
66
"/images/arrow-down-icon.svg": "/images/arrow-down-icon.svg?id=7b5c03f96be72c9a0bef",

packages/Webkul/UI/src/DataGrid/Traits/DatagridCollection.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ private function filterCollection($collection, $info, $columnName, $type = "filt
7171
foreach ($info as $condition => $filter_value) {
7272
switch ($condition) {
7373
case 'in':
74-
$collection->whereIn(
75-
$columnName,
76-
explode(',', $filter_value)
77-
);
74+
foreach (explode(',', $filter_value) as $value) {
75+
$collection->orWhere(
76+
$columnName,
77+
'like',
78+
"%$value%"
79+
);
80+
}
7881
break;
7982

8083
case 'bw':

packages/Webkul/UI/src/Resources/assets/sass/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ h5 {
405405
border-right: 0px;
406406
color: $dark-color;
407407
cursor: not-allowed;
408+
text-transform: capitalize;
408409
font-weight: $font-weight-medium;
409410
border-bottom: 1px solid rgba(193,194,195,.5);
410411

0 commit comments

Comments
 (0)