<&| /Widgets/TitleBox, title => $Title &>

<table width="100%">
<tr class="subject"><td class="label"><&|/l&>Subject</&>:</td>
<td class="value"><i>(<&|/l&>uses subjects from tickets</&>)</i></td></tr>

<tr><td class="label"><&|/l&>Update Type</&>:</td>
<td class="value">
<select name="UpdateType">
% if( $AllowComment ) {
  <option value="private" <% $CommentDefault %>><&|/l&>Comments (Not sent to requestors)</&></option>
% }
% if( $AllowResponse ) {
  <option value="response" <% $ResponseDefault %>><&|/l&>Response to requestors</&></option>
% }
</select>
</td></tr>

% if ( $TicketObj ) {
<tr><td class="label"><&|/l&>Resolution</&>:</td>
<td class="value">
<& /RTIR/Elements/EditRTIRField,
    TicketObj => $TicketObj,
    QueueObj  => $TicketObj->QueueObj,
    Name      => 'Resolution',
    Default   => (
        $TicketObj->FirstCustomFieldValue('Resolution') ||
        RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Resolution'}{$Status}
    ),
    Rows      => 1,
&></td></tr>
% }

<tr class="owner"><td class="label"><&|/l&>Owner</&>:</td>
<td class="value">
<& /Elements/SelectOwner,
    Name    => "Owner",
    Default => $Owner || $session{'CurrentUser'}->Id || undef,
&>
<&|/l&>Worked</&>:
<& /Elements/EditTimeValue,
    Name => 'UpdateTimeWorked',
    Default => $ARGS{'UpdateTimeWorked'} || '',
&>
</td></tr>

<& /RTIR/Elements/UpdateData, %ARGS, Ticket => $TicketObj, QueueObj => $queue &>

</table>

</&>
<%INIT>

$AllowResponse = 1 unless $AllowComment && $AllowResponse;

my ($CommentDefault, $ResponseDefault) = ('', '');
if ( $Action eq 'Comment' || $UpdateType eq 'private' ) {
    $CommentDefault = "selected";
} else {
    $ResponseDefault = "selected";
}

my $queue;
$queue = $TicketObj->QueueObj if $TicketObj;
unless ( $queue ) {
    $queue = RT::Queue->new( $session{'CurrentUser'} );
    $queue->Load('Incidents');
}

</%INIT>
<%ARGS>
$Title         => loc('Reply to selected tickets'),

$Action        => 'Respond',
$UpdateType    => 'response',

$AllowComment  => 1,
$AllowResponse => 1,

$Owner         => undef,

$TicketObj     => undef,
$Status        => '',
</%ARGS>
