<&| /Admin/Queues/Elements/SortableBox, prefix => $prefix, is_filter => 1, class_name => 'ExcludedDates' &>
<p><&|/l&>This filter selects eligible owners by datetime custom fields on users, meant for scheduled vacations. If the current date and time falls between the following two custom fields, the user will be excluded from automatic assignment.</&></p>

% if ($user_cfs->Count) {
  <&| /Elements/LabeledValue, Label => loc('Begin Custom Field') &>
    <select id="<% $prefix %>_begin" name="<% $prefix %>_begin" class="selectpicker form-select">
      <option value="">-</option>
%   while (my $cf = $user_cfs->Next) {
      <option <% ($config->{begin}||0) == $cf->Id ? "selected" : "" %> value="<% $cf->Id %>"><% $cf->Name %></option>
%   }
    </select>
  </&>

  <&| /Elements/LabeledValue, Label => loc('End Custom Field') &>
    <select id="<% $prefix %>_end" name="<% $prefix %>_end" class="selectpicker form-select">
      <option value="">-</option>
%   while (my $cf = $user_cfs->Next) {
      <option <% ($config->{end}||0) == $cf->Id ? "selected" : "" %> value="<% $cf->Id %>"><% $cf->Name %></option>
%   }
    </select>
  </&>
% } else {
<p><&|/l&>No user custom fields found.</&></p>
% }
</&>
<%INIT>
my $user_cfs = RT::CustomFields->new($session{CurrentUser});
$user_cfs->LimitToLookupType(RT::User->CustomFieldLookupType);
$user_cfs->ApplySortOrder;
</%INIT>
<%ARGS>
$prefix
$config
$queue
</%ARGS>
