Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.0/asset search filter #382

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Move /Elements/SearchFilter to /Search/Elements/FilterTickets
Then it's clear that it's bound to /Search/. Also add "Tickets" suffix
as we are going to support more types.
sunnavy committed Dec 21, 2023
commit d7cddf59d6c07b86f86c9a1056434399bedff739
2 changes: 1 addition & 1 deletion share/html/Elements/CollectionAsTable/Header
Original file line number Diff line number Diff line change
@@ -242,7 +242,7 @@ foreach my $col ( @Format ) {
$m->out(
qq{&nbsp;<a href="javascript:void(0)" class="btn btn-primary button search-filter" data-toggle="tooltip" data-placement="bottom" data-original-title="$tooltip">$icon</a>}
);
$m->out( $m->scomp( '/Elements/SearchFilter', Attribute => $field, FilterData => \%filter_data, %ARGS ) );
$m->out( $m->scomp( '/Search/Elements/FilterTickets', Attribute => $field, FilterData => \%filter_data, %ARGS ) );
}
}
$m->out('</th>');
304 changes: 5 additions & 299 deletions share/html/Elements/SearchFilter
Original file line number Diff line number Diff line change
@@ -45,305 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<div class="modal search-results-filter">
<div class="modal-dialog <% $Attribute eq 'Owner' ? '' : 'modal-dialog-scrollable' %> <% $modal_class %>" role="document">
<form name="search-results-filter">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><&|/l&>Filter Results</&></h5>
<a href="javascript:void(0)" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</a>
</div>
<div class="modal-body">
% if ( $Attribute eq 'Subject' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Subject</&>:
</div>
<div class="value col-9">
<input class="form-control" name="Subject" value="<% $filter->{Subject} // '' %>" />
</div>
</div>
% } elsif ( $Attribute eq 'Status' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Status</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $status ( sort { lc $a cmp lc $b } keys %$status ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="Status-<% $status %>" name="Status" class="custom-control-input" value="<% $status %>" <% $filter->{Status}{$status} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="Status-<% $status %>"><% $status %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute eq 'Queue' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Queue</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $queue ( sort { lc $a->Name cmp lc $b->Name } @$queues ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="Queue-<% $queue->Id %>" name="Queue" class="custom-control-input" value="<% $queue->Id %>" <% $filter->{Queue}{$queue->Id} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="Queue-<% $queue->Id %>"><% $queue->Name %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute eq 'Owner' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Owner</&>:
</div>
<div class="value col-9">
<& /Elements/SelectOwner, Name => 'Owner', Default => $filter->{Owner}, Size => 6 &>
</div>
</div>
% } elsif ( $Attribute eq 'SLA' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>SLA</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $sla ( sort( keys %{RT->Config->Get('ServiceAgreements')->{'Levels'}} ), 'NULL' ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input checkbox" id="SLA_<% $sla %>" name="SLA" value="<% $sla %>" <% $filter->{SLA}{$sla} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="SLA_<% $sla %>"><% $sla eq 'NULL' ? loc('(no value)') : $sla %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute =~ /^(?:Creator|LastUpdatedBy)$/) {
<div class="form-row">
<div class="label col-3">
<% loc(join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-9">
<input class="form-control" data-autocomplete="Users" name="<% $Attribute %>" value="<% $filter->{$Attribute} %>" data-autocomplete-return="Name" />
</div>
</div>
% } elsif ( $Attribute eq 'Type' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Type</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $type ( qw/approval reminder ticket/ ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="Type-<% $type %>" name="Type" class="custom-control-input" value="<% $type %>" <% $filter->{Type}{$type} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="Type-<% $type %>"><% $type %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute =~ /(?:Initial|Final)?Priority/ ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectPriority, Name => "${Attribute}EqualTo", Default => $filter->{$Attribute}{'='}, Queues => { map { $_->Id => 1 } @$queues }, ValueAsString => 1, ShowEmptyOption => 1 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectPriority, Name => "${Attribute}GreaterThan", Default => $filter->{$Attribute}{'>'}, Queues => { map { $_->Id => 1 } @$queues }, ValueAsString => 1, ShowEmptyOption => 1 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectPriority, Name => "${Attribute}LessThan", Default => $filter->{$Attribute}{'<'}, Queues => { map { $_->Id => 1 } @$queues }, ValueAsString => 1, ShowEmptyOption => 1 &>
</div>
</div>
% } elsif ( $Attribute eq 'id' ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', $Attribute) %>:
</div>
<div class="value col-6">
<input type="text" class="form-control" name="<% $Attribute %>EqualTo" size="5" value="<% $filter->{$Attribute}{'='} %>" />
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', $Attribute) %>:
</div>
<div class="value col-6">
<input type="text" class="form-control" name="<% $Attribute %>GreaterThan" size="5" value="<% $filter->{$Attribute}{'>'} %>" />
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', $Attribute) %>:
</div>
<div class="value col-6">
<input type="text" class="form-control" name="<% $Attribute %>LessThan" size="5" value="<% $filter->{$Attribute}{'<'} %>" />
</div>
</div>
% } elsif ( $Attribute =~ /^(?:Told|Starts|Started|Due|Resolved|Created|LastUpdated)/ ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectDate, Name => "${Attribute}EqualTo", Default => $filter->{$Attribute}{'='} || '', ShowTime => 0 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectDate, Name => "${Attribute}GreaterThan", Default => $filter->{$Attribute}{'>'} || '', ShowTime => 0 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectDate, Name => "${Attribute}LessThan", Default => $filter->{$Attribute}{'<'} || '', ShowTime => 0 &>
</div>
</div>
% } elsif ( $Attribute =~ /^Time/ ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<div class="d-inline-block">
<input type="text" class="form-control" name="<% $Attribute %>EqualTo" size="5" value="<% $filter->{$Attribute}{'='} %>" />
</div>
<&|/l&>Minutes</&>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<div class="d-inline-block">
<input type="text" class="form-control" name="<% $Attribute %>GreaterThan" size="5" value="<% $filter->{$Attribute}{'>'} %>" />
</div>
<&|/l&>Minutes</&>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<div class="d-inline-block">
<input type="text" class="form-control" name="<% $Attribute %>LessThan" size="5" value="<% $filter->{$Attribute}{'<'} %>" />
</div>
<&|/l&>Minutes</&>
</div>
</div>
% } elsif ( $Attribute =~ /^(Requestor|Cc|AdminCc)s?$/) {
% my $name = $1;
<div class="form-row">
<div class="label col-4">
<% loc($name) %>:
</div>
<div class="value col-8">
<input class="form-control" data-autocomplete="Users" name="<% $name %>" value="<% $filter->{$name} %>" />
</div>
</div>
% } elsif ( $Attribute =~ /^CustomRole\.\{(.+)\}$/) {
% my $name = $1;
<div class="form-row">
<div class="label col-4">
<% loc($name) %>:
</div>
<div class="value col-8">
<input class="form-control" data-autocomplete="Users" name="<% $Attribute %>" value="<% $filter->{$Attribute} %>" />
</div>
</div>
% } elsif ( $Attribute =~ /^CustomField\.\{(.+)\}$/) {
% my $name = $1;
% my $cf = RT::CustomField->new($session{CurrentUser});
% $cf->Load($name);
<div class="form-row">
<div class="label col-4">
<% loc($name) %>:
</div>
<div class="value col-8">
% if ( $cf->Type eq 'Select' ) {
% my $cfvs = $cf->Values;
<ul class="list-group list-group-compact">
% while ( my $cfv = $cfvs->Next ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input checkbox" id="<% $name . '_' . $cfv->Name %>" name="<% $Attribute %>" value="<% $cfv->Name %>" <% $filter->{$Attribute}{$cfv->Name} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="<% $name . '_' . $cfv->Name %>"><% $cfv->Name %></label>
</div>
</li>
% }
</ul>
% } else {
<input type="text" class="form-control" name="<% $Attribute %>" size="5" value="<% $filter->{$Attribute} %>" />
% }
</div>
</div>
% }
<& /Search/Elements/FilterTickets, %ARGS &>

</div>
<div class="modal-footer">
<div class="form-row justify-content-end">
<div class="col-auto">
<input type="button" class="button btn btn-primary" data-dismiss="modal" name="Apply" value="<% loc('Cancel') %>" />
</div>
<div class="col-auto">
<input type="button" class="button btn btn-primary" onclick="filterSearchResults()" name="Apply" value="<% loc('Apply') %>" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<%INIT>
return unless $ARGS{Query};

my $status = $FilterData{status};
my $queues = $FilterData{queues};
my $filter = $FilterData{filter};

my $modal_class;
if ( $Attribute =~ /^(?:Time|(?:Initial|Final)Priority|LastUpdated)/ ) {
$modal_class = 'modal-md';
}
else {
$modal_class = 'modal-sm';
}
RT->Deprecated(
Instead => '/Search/Elements/FilterTickets',
Remove => '5.2',
);
</%INIT>

<%ARGS>
$Attribute => ''
%FilterData => ()
</%ARGS>
349 changes: 349 additions & 0 deletions share/html/Search/Elements/FilterTickets
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
%# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2023 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%#
%# LICENSE:
%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
%#
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%# General Public License for more details.
%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
%#
%#
%# CONTRIBUTION SUBMISSION POLICY:
%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
%# you are the copyright holder for those contributions and you grant
%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<div class="modal search-results-filter">
<div class="modal-dialog <% $Attribute eq 'Owner' ? '' : 'modal-dialog-scrollable' %> <% $modal_class %>" role="document">
<form name="search-results-filter">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><&|/l&>Filter Results</&></h5>
<a href="javascript:void(0)" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</a>
</div>
<div class="modal-body">
% if ( $Attribute eq 'Subject' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Subject</&>:
</div>
<div class="value col-9">
<input class="form-control" name="Subject" value="<% $filter->{Subject} // '' %>" />
</div>
</div>
% } elsif ( $Attribute eq 'Status' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Status</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $status ( sort { lc $a cmp lc $b } keys %$status ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="Status-<% $status %>" name="Status" class="custom-control-input" value="<% $status %>" <% $filter->{Status}{$status} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="Status-<% $status %>"><% $status %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute eq 'Queue' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Queue</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $queue ( sort { lc $a->Name cmp lc $b->Name } @$queues ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="Queue-<% $queue->Id %>" name="Queue" class="custom-control-input" value="<% $queue->Id %>" <% $filter->{Queue}{$queue->Id} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="Queue-<% $queue->Id %>"><% $queue->Name %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute eq 'Owner' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Owner</&>:
</div>
<div class="value col-9">
<& /Elements/SelectOwner, Name => 'Owner', Default => $filter->{Owner}, Size => 6 &>
</div>
</div>
% } elsif ( $Attribute eq 'SLA' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>SLA</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $sla ( sort( keys %{RT->Config->Get('ServiceAgreements')->{'Levels'}} ), 'NULL' ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input checkbox" id="SLA_<% $sla %>" name="SLA" value="<% $sla %>" <% $filter->{SLA}{$sla} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="SLA_<% $sla %>"><% $sla eq 'NULL' ? loc('(no value)') : $sla %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute =~ /^(?:Creator|LastUpdatedBy)$/) {
<div class="form-row">
<div class="label col-3">
<% loc(join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-9">
<input class="form-control" data-autocomplete="Users" name="<% $Attribute %>" value="<% $filter->{$Attribute} %>" data-autocomplete-return="Name" />
</div>
</div>
% } elsif ( $Attribute eq 'Type' ) {
<div class="form-row">
<div class="label col-3">
<&|/l&>Type</&>:
</div>
<div class="value col-9">
<ul class="list-group list-group-compact">
% for my $type ( qw/approval reminder ticket/ ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="Type-<% $type %>" name="Type" class="custom-control-input" value="<% $type %>" <% $filter->{Type}{$type} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="Type-<% $type %>"><% $type %></label>
</div>
</li>
% }
</ul>
</div>
</div>
% } elsif ( $Attribute =~ /(?:Initial|Final)?Priority/ ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectPriority, Name => "${Attribute}EqualTo", Default => $filter->{$Attribute}{'='}, Queues => { map { $_->Id => 1 } @$queues }, ValueAsString => 1, ShowEmptyOption => 1 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectPriority, Name => "${Attribute}GreaterThan", Default => $filter->{$Attribute}{'>'}, Queues => { map { $_->Id => 1 } @$queues }, ValueAsString => 1, ShowEmptyOption => 1 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectPriority, Name => "${Attribute}LessThan", Default => $filter->{$Attribute}{'<'}, Queues => { map { $_->Id => 1 } @$queues }, ValueAsString => 1, ShowEmptyOption => 1 &>
</div>
</div>
% } elsif ( $Attribute eq 'id' ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', $Attribute) %>:
</div>
<div class="value col-6">
<input type="text" class="form-control" name="<% $Attribute %>EqualTo" size="5" value="<% $filter->{$Attribute}{'='} %>" />
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', $Attribute) %>:
</div>
<div class="value col-6">
<input type="text" class="form-control" name="<% $Attribute %>GreaterThan" size="5" value="<% $filter->{$Attribute}{'>'} %>" />
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', $Attribute) %>:
</div>
<div class="value col-6">
<input type="text" class="form-control" name="<% $Attribute %>LessThan" size="5" value="<% $filter->{$Attribute}{'<'} %>" />
</div>
</div>
% } elsif ( $Attribute =~ /^(?:Told|Starts|Started|Due|Resolved|Created|LastUpdated)/ ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectDate, Name => "${Attribute}EqualTo", Default => $filter->{$Attribute}{'='} || '', ShowTime => 0 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectDate, Name => "${Attribute}GreaterThan", Default => $filter->{$Attribute}{'>'} || '', ShowTime => 0 &>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<& /Elements/SelectDate, Name => "${Attribute}LessThan", Default => $filter->{$Attribute}{'<'} || '', ShowTime => 0 &>
</div>
</div>
% } elsif ( $Attribute =~ /^Time/ ) {
<div class="form-row">
<div class="label col-6">
<% loc('[_1] equal to', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<div class="d-inline-block">
<input type="text" class="form-control" name="<% $Attribute %>EqualTo" size="5" value="<% $filter->{$Attribute}{'='} %>" />
</div>
<&|/l&>Minutes</&>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] greater than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<div class="d-inline-block">
<input type="text" class="form-control" name="<% $Attribute %>GreaterThan" size="5" value="<% $filter->{$Attribute}{'>'} %>" />
</div>
<&|/l&>Minutes</&>
</div>
</div>
<div class="form-row">
<div class="label col-6">
<% loc('[_1] less than', join ' ', split /(?=[A-Z])/, $Attribute) %>:
</div>
<div class="value col-6">
<div class="d-inline-block">
<input type="text" class="form-control" name="<% $Attribute %>LessThan" size="5" value="<% $filter->{$Attribute}{'<'} %>" />
</div>
<&|/l&>Minutes</&>
</div>
</div>
% } elsif ( $Attribute =~ /^(Requestor|Cc|AdminCc)s?$/) {
% my $name = $1;
<div class="form-row">
<div class="label col-4">
<% loc($name) %>:
</div>
<div class="value col-8">
<input class="form-control" data-autocomplete="Users" name="<% $name %>" value="<% $filter->{$name} %>" />
</div>
</div>
% } elsif ( $Attribute =~ /^CustomRole\.\{(.+)\}$/) {
% my $name = $1;
<div class="form-row">
<div class="label col-4">
<% loc($name) %>:
</div>
<div class="value col-8">
<input class="form-control" data-autocomplete="Users" name="<% $Attribute %>" value="<% $filter->{$Attribute} %>" />
</div>
</div>
% } elsif ( $Attribute =~ /^CustomField\.\{(.+)\}$/) {
% my $name = $1;
% my $cf = RT::CustomField->new($session{CurrentUser});
% $cf->Load($name);
<div class="form-row">
<div class="label col-4">
<% loc($name) %>:
</div>
<div class="value col-8">
% if ( $cf->Type eq 'Select' ) {
% my $cfvs = $cf->Values;
<ul class="list-group list-group-compact">
% while ( my $cfv = $cfvs->Next ) {
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input checkbox" id="<% $name . '_' . $cfv->Name %>" name="<% $Attribute %>" value="<% $cfv->Name %>" <% $filter->{$Attribute}{$cfv->Name} ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="<% $name . '_' . $cfv->Name %>"><% $cfv->Name %></label>
</div>
</li>
% }
</ul>
% } else {
<input type="text" class="form-control" name="<% $Attribute %>" size="5" value="<% $filter->{$Attribute} %>" />
% }
</div>
</div>
% }

</div>
<div class="modal-footer">
<div class="form-row justify-content-end">
<div class="col-auto">
<input type="button" class="button btn btn-primary" data-dismiss="modal" name="Apply" value="<% loc('Cancel') %>" />
</div>
<div class="col-auto">
<input type="button" class="button btn btn-primary" onclick="filterSearchResults()" name="Apply" value="<% loc('Apply') %>" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<%INIT>
return unless $ARGS{Query};

my $status = $FilterData{status};
my $queues = $FilterData{queues};
my $filter = $FilterData{filter};

my $modal_class;
if ( $Attribute =~ /^(?:Time|(?:Initial|Final)Priority|LastUpdated)/ ) {
$modal_class = 'modal-md';
}
else {
$modal_class = 'modal-sm';
}
</%INIT>

<%ARGS>
$Attribute => ''
%FilterData => ()
</%ARGS>