42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
|
|
function resetEntitySearch(cancelButtonJQueryObject) {
|
|||
|
|
try {
|
|||
|
|
const button = cancelButtonJQueryObject;
|
|||
|
|
const inputGroupAppend = button.parent();
|
|||
|
|
const inputGroup = inputGroupAppend.parent();
|
|||
|
|
const modalBody = inputGroup.parent();
|
|||
|
|
const input = inputGroupAppend.siblings("input");
|
|||
|
|
|
|||
|
|
input.val("");
|
|||
|
|
modalBody.children(".list-group").children(".list-group-item").show();
|
|||
|
|
} catch(error) {
|
|||
|
|
window.showErrorPopup(error);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function onEntitySearchInput(searchInput) {
|
|||
|
|
try {
|
|||
|
|
const input = $(searchInput);
|
|||
|
|
const modalBody = input.parent().parent();
|
|||
|
|
|
|||
|
|
var searchText = input.val();
|
|||
|
|
|
|||
|
|
if(searchText === null || searchText === undefined || searchText.length === 0) {
|
|||
|
|
modalBody.find(".list-group").children(".list-group-item").show();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const listGroupItems = modalBody.find(".list-group").children(".list-group-item").show();
|
|||
|
|
|
|||
|
|
listGroupItems.hide();
|
|||
|
|
|
|||
|
|
searchText = searchText.toLowerCase();
|
|||
|
|
|
|||
|
|
$.each(listGroupItems, function (index, item) {
|
|||
|
|
if($(item).text().toLowerCase().includes(searchText)) {
|
|||
|
|
$(item).show();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
} catch(error) {
|
|||
|
|
window.showErrorPopup(error);
|
|||
|
|
}
|
|||
|
|
}
|