Skip to content

Commit d6e9251

Browse files
list view now can filter zero, blank or null values
1 parent fd547fb commit d6e9251

File tree

8 files changed

+59
-13
lines changed

8 files changed

+59
-13
lines changed

app/Http/Controllers/ListViewController.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function getRecords($request, $table_schema)
175175
foreach ($filters as $filter) {
176176
if (isset($filter['column_name']) && $filter['column_name'] &&
177177
isset($filter['column_operator']) && $filter['column_operator'] &&
178-
isset($filter['column_value'])) {
178+
array_key_exists('column_value', $filter)) {
179179

180180
$column = $filter['column_name'];
181181
$operator = $filter['column_operator'];
@@ -220,7 +220,15 @@ public function getRecords($request, $table_schema)
220220

221221
$rows = $rows->whereNotBetween($column, $value);
222222
} else {
223-
$rows = $rows->where($column, $operator, $value);
223+
if ($value) {
224+
$rows = $rows->where($column, $operator, $value);
225+
} else {
226+
$rows = $rows->where(function($query) use ($column) {
227+
$query->orWhere($column, '')
228+
->orWhere($column, '0')
229+
->orWhereNull($column);
230+
});
231+
}
224232
}
225233
}
226234
}

public/css/all.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.

public/js/origin/list_view.js

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

public/js/origin/report_view.js

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

public/mix-manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"/css/all.css": "/css/all.css?id=0458c36606c56c263580",
2+
"/css/all.css": "/css/all.css?id=dec100b9197b46c7e5bd",
33
"/js/all.js": "/js/all.js?id=8b36aac06cc95446647b",
44
"/js/origin/activity.js": "/js/origin/activity.js?id=c82ead60de86ce816a82",
55
"/js/origin/backups.js": "/js/origin/backups.js?id=abbdc7d16058211fdfbd",
6-
"/js/origin/list_view.js": "/js/origin/list_view.js?id=1b4568021c0ffc23b2f3",
6+
"/js/origin/list_view.js": "/js/origin/list_view.js?id=74c25044f8440de3b6ff",
77
"/js/origin/form.js": "/js/origin/form.js?id=6e2cc18da3e53df06043",
88
"/css/origin/report_view.css": "/css/origin/report_view.css?id=332ed7235426b440980b",
9-
"/js/origin/report_view.js": "/js/origin/report_view.js?id=14bf192c08757906e994"
9+
"/js/origin/report_view.js": "/js/origin/report_view.js?id=d86bc1b9c989551b08ba"
1010
}

resources/css/origin/origin.css

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
width: 32px;
2727
height: 32px;
2828
background: #e1e5e9;
29-
display: block;
29+
display: inline-block;
3030
border-radius: 50%;
3131
position: relative;
3232
text-align: center;
@@ -42,6 +42,33 @@
4242
color: #676a6c;
4343
}
4444

45+
.default-picture-sm {
46+
width: 32px;
47+
height: 32px;
48+
}
49+
50+
.default-picture-md {
51+
width: 64px;
52+
height: 64px;
53+
}
54+
55+
.default-picture-lg {
56+
width: 96px;
57+
height: 96px;
58+
}
59+
60+
.default-picture-circle {
61+
border-radius: 50% !important;
62+
}
63+
64+
.default-picture-box {
65+
border-radius: 0 !important;
66+
}
67+
68+
.default-picture-rounded {
69+
border-radius: 5px !important;
70+
}
71+
4572
.sidebar-collapse .default-avatar {
4673
width: 30px;
4774
height: 30px;
@@ -888,6 +915,7 @@ a.back-to-top:hover {
888915

889916
/* Fancybox start */
890917
.fancyimg {
918+
border-radius: 5px;
891919
cursor: pointer;
892920
transition: 0.3s;
893921
}

resources/js/origin/list_view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ $(document).ready(function() {
339339
}
340340
else {
341341
list_records += '<td data-field-name="' + column_name + '" class="client-avatar">\
342-
<span class="default-picture">\
342+
<span class="default-picture default-picture-rounded">\
343343
<i class="fa fa-picture-o"></i>\
344344
</span>\
345345
</td>';

resources/js/origin/report_view.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,18 @@ $(document).ready(function() {
133133
column_value = '<a href="' + column_value + '" target="_blank">' + column_value + '</a>';
134134
}
135135

136-
if (['image', 'avatar'].contains(column_name) && column_value) {
137-
img_path = getImage(column_value, 48, 48, 95, 0, 'b');
138-
column_value = '<img src="' + img_path + '" alt="' + grid_data[data["link_field"]] + '">';
136+
if (['image', 'photo', 'picture', 'profile_picture', 'profile_photo', 'logo', 'avatar'].contains(column_name)) {
137+
if (column_value) {
138+
img_path = getImage(column_value, 32, 32, 95, 0, 'b');
139+
column_value = '<div class="text-center"><img src="' + img_path + '" data-big="' + getImage(column_value) + '" class="fancyimg" alt="' + grid_data[data["form_title"]] + '"></div>';
140+
}
141+
else {
142+
column_value = '<div class="text-center">\
143+
<span class="default-picture default-picture-rounded">\
144+
<i class="fa fa-picture-o"></i>\
145+
</span>\
146+
</div>';
147+
}
139148
}
140149
}
141150

@@ -162,6 +171,7 @@ $(document).ready(function() {
162171
$("body").find("#report-table_info").html(report_info);
163172
$("body").find("#report-table_paginate").empty().append(makePagination(data['rows']));
164173
report_table.columns.adjust();
174+
enableFancyBox();
165175
}
166176
});
167177
}

0 commit comments

Comments
 (0)