Skip to content

Commit

Permalink
added not in conditions for several filters
Browse files Browse the repository at this point in the history
  • Loading branch information
skie committed Sep 10, 2024
1 parent d6c3d0a commit 3de3267
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 71 deletions.
1 change: 1 addition & 0 deletions src/Filter/LookupFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class LookupFilter extends AbstractFilter
AbstractFilter::COND_EQ => '=',
AbstractFilter::COND_NE => '',
AbstractFilter::COND_IN => 'In',
AbstractFilter::COND_NOT_IN => 'Not In',
AbstractFilter::COND_LIKE => 'Like',
];

Expand Down
2 changes: 1 addition & 1 deletion src/Filter/SelectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SelectFilter extends AbstractFilter
AbstractFilter::COND_EQ => '=',
AbstractFilter::COND_NE => '',
AbstractFilter::COND_IN => 'In',
AbstractFilter::COND_LIKE => 'Like',
AbstractFilter::COND_NOT_IN => 'Not In',
];

/**
Expand Down
1 change: 1 addition & 0 deletions src/Filter/StringFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class StringFilter extends AbstractFilter
AbstractFilter::COND_EQ => '=',
AbstractFilter::COND_NE => '',
AbstractFilter::COND_IN => 'In',
AbstractFilter::COND_NOT_IN => 'Not In',
];

/**
Expand Down
121 changes: 58 additions & 63 deletions templates/element/Search/v_templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,72 +287,67 @@
align-self: flex-start;
}

.search-filter-item.item-alert {
--padding: .5rem 1rem !important;
--margin-bottom: 0rem !important;
}

.multiple-item {
margin-top: 10px;
margin-left: 15px;
}
.fa.fa-times {
margin-right: 5px;
margin-top: 5px;
}
.conditions {
align-items: center;
}
.hidden {
display: none !important;
}

/* lookup widget */
.lookup-wrapper {
position: relative;
display: inline-block; /* This ensures the wrapper only takes up as much space as needed */
}

.lookup-wrapper input {
width: 100%; /* Make the input take up full width of its container */
}
.multiple-item {
margin-top: 10px;
margin-left: 15px;
}
.fa.fa-times {
margin-right: 5px;
margin-top: 5px;
}
.conditions {
align-items: center;
}
.hidden {
display: none !important;
}

.suggestions-list {
position: absolute;
top: 100%;
left: 0;
right: 0;
z-index: 1000;
display: block;
padding: 5px 0;
margin: 2px 0 0;
font-size: 1rem;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0,0,0,.175);
max-height: 200px;
overflow-y: auto;
}
/* lookup widget */
.lookup-wrapper {
position: relative;
display: inline-block;
}

.suggestions-list li {
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
cursor: pointer;
}
.lookup-wrapper input {
width: 100%;
}

.suggestions-list {
position: absolute;
top: 100%;
left: 0;
right: 0;
z-index: 1000;
display: block;
padding: 5px 0;
margin: 2px 0 0;
font-size: 1rem;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0,0,0,.175);
max-height: 200px;
overflow-y: auto;
}

.suggestions-list li {
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
cursor: pointer;
}

.suggestions-list li:hover {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
.suggestions-list li:hover {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}

</style>

Expand Down
18 changes: 11 additions & 7 deletions webroot/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,25 @@ function uuid() {
return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(13, 3)}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;
};

const isMultiple = function (condition) {
return (condition == 'in' || condition == 'notIn');
};

const inputTypeMap = {
'none': function (type, condition) {
if (condition == 'in') {
if (isMultiple(condition)) {
return 'SearchMultiple';
}
return 'SearchNone';
},
'string': function (type, condition) {
if (condition == 'in') {
if (isMultiple(condition)) {
return 'SearchMultiple';
}
return 'SearchInput';
},
'numeric': function (type, condition) {
if (condition == 'in') {
if (isMultiple(condition)) {
return 'SearchMultiple';
} else if (condition == 'between') {
return 'SearchInputNumericRange';
Expand All @@ -37,7 +41,7 @@ const inputTypeMap = {
return 'SearchInput';
},
'date': function (type, condition) {
if (condition == 'in') {
if (isMultiple(condition)) {
return 'SearchMultiple';
}
switch (condition) {
Expand All @@ -53,7 +57,7 @@ const inputTypeMap = {
}
},
'datetime': function (type, condition) {
if (condition == 'in') {
if (isMultiple(condition)) {
return 'SearchMultiple';
}
switch (condition) {
Expand All @@ -69,13 +73,13 @@ const inputTypeMap = {
}
},
'select': function (type, condition) {
if (condition == 'in') {
if (isMultiple(condition)) {
return 'SearchMultiple';
}
return 'SearchSelect';
},
'autocomplete': function (type, condition) {
if (condition == 'in') {
if (isMultiple(condition)) {
return 'SearchMultiple';
} else if (condition == 'like') {
return 'SearchInput';
Expand Down

0 comments on commit 3de3267

Please sign in to comment.