# --
# AgentTicketMove.dtl - provides HTML form for move mask
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: AgentTicketMove.dtl,v 1.85.2.1 2012/05/25 13:32:30 mg Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

<form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="MoveTicketToQueue" class="Validate PreventMultipleSubmits" id="MoveTicketToQueue">
    <input type="hidden" name="Action"       value="$Env{"Action"}"/>
    <input type="hidden" name="Subaction"    value="MoveTicket"/>
    <input type="hidden" name="FormID"       value="$QData{"FormID"}"/>
    <input type="hidden" name="TicketID"     value="$QData{"TicketID"}"/>
    <input type="hidden" name="TicketUnlock" value="$QData{"TicketUnlock"}"/>
    <input type="hidden" name="OwnerAll" id="OwnerAll" value="$QData{"OwnerAll"}"/>
    <input type="hidden" name="NoSubmit"     value=""/>

    <div class="LayoutPopup ARIARoleMain">
        <div class="Header">
            <h1>$Text{"Move Ticket"}: $QData{"TicketNumber"}</h1>

<!-- dtl:block:TicketBack -->
            <p>
                <a class="CancelClosePopup" href="#">$Text{"Cancel & close window"}</a>
            </p>
<!-- dtl:block:TicketBack -->
<!-- dtl:block:PropertiesLock -->
            <p>
                $Text{"The ticket has been locked"}.
                <a class="UndoClosePopup" href="$Env{"Baselink"}Action=AgentTicketLock;Subaction=Unlock;TicketID=$LQData{"TicketID"};$QEnv{"ChallengeTokenParam"}">
                    $Text{"Undo & close window"}
                </a>
            </p>
<!-- dtl:block:PropertiesLock -->


        </div>
        <div class="Content">

            <div class="Header">
                <h2>$Text{"Options"}</h2>
            </div>

            <div class="Content">
                <fieldset class="TableLike FixedLabel">
                    <label class="Mandatory" for="DestQueueID"><span class="Marker">*</span> $Text{"New Queue"}:</label>
                    <div class="Field">
                        $Data{"MoveQueuesStrg"}
                        <div id="DestQueueIDError" class="TooltipErrorMessage" ><p>$Text{"This field is required."}</p></div>
                        <div id="DestQueueIDServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#DestQueueID').bind('change', function (Event) {
        $('#NoSubmit').val('1');
        Core.AJAX.FormUpdate($('#MoveTicketToQueue'), 'AJAXUpdate', 'DestQueueID', ['NewUserID', 'OldUserID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"}]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>

                    <label for="NewUserID">$Text{"New Owner"}:</label>
                    <div class="Field">
                        <input type="radio" name="UserSelection" value="New" $Data{"UserSelection::New"}/>
                        $Data{"OwnerStrg"}
                        <a href="#" id="OwnerSelectionGetAll" class="GetAllAJAX" title="$Text{"Get all"}">$Text{"Get all"}</a>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#OwnerSelectionGetAll').bind('click', function (Event) {
        $('#OwnerAll').val('1');
        Core.AJAX.FormUpdate($('#MoveTicketToQueue'), 'AJAXUpdate', 'OwnerAll', ['NewUserID'], function() {
            $('#NewUserID').focus();
        });
        return false;
    });

    $('#NewUserID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#MoveTicketToQueue'), 'AJAXUpdate', 'NewUserID', ['DestQueueID', 'OldUserID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"}]);
    });
    $('#NewUserID').bind('click', function () {
        Core.Agent.TicketAction.SelectRadioButton('New','UserSelection');
    });
//]]></script>
<!--dtl:js_on_document_complete-->

                    </div>
                    <div class="Clear"></div>

                    <label for="OldUserID">$Text{"Previous Owner"}:</label>
                    <div class="Field">
                        <input type="radio" name="UserSelection" value="Old" $Data{"UserSelection::Old"}/>
                        $Data{"OldUserStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#OldUserID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#MoveTicketToQueue'), 'AJAXUpdate', 'OldUserID', ['DestQueueID', 'NewUserID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"}]);
    });

    $('#OldUserID').bind('click', function () {
        Core.Agent.TicketAction.SelectRadioButton('Old','UserSelection');
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>

                    <label for="Subject">$Text{"Subject"}:</label>
                    <div class="Field">
                        <input type="text" id="Subject" name="Subject" value="$QData{"Subject"}" class="Validate_DependingRequiredAND Validate_Depending_Body $Data{"SubjectInvalid"} W75pc"/>
                        <div id="SubjectError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                        <div id="SubjectServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                    </div>
                    <div class="Clear"></div>

<!-- dtl:block:TicketOptions -->
                    <label>$Text{"Options"}:</label>
                    <div class="Field">

<!-- OutputFilterHook_TicketOptionsBegin -->

<!-- dtl:block:SpellCheck -->
                        <a href="#" id="OptionSpellCheck">[ $Text{"Spell check"} ]</a>
<!-- dtl:block:SpellCheck -->

<!-- OutputFilterHook_TicketOptionsEnd -->

                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TicketOptions -->

<!-- OutputFilterHook_NoTicketOptionsFallback -->

                    <label for="Body">$Text{"Text"}:</label>

<!-- dtl:block:RichText -->
$Include{"RichTextEditor"}
<!-- dtl:block:RichText -->

                    <div class="RichTextField">
                        <textarea id="Body" class="RichText Validate_DependingRequiredAND Validate_Depending_Subject $Data{"BodyInvalid"}" name="Body" rows="15" cols="$Config{"Ticket::Frontend::TextAreaNote"}">$QData{"Body"}</textarea>
                        <div id="BodyError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                        <div id="BodyServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                    </div>
                    <div class="Clear"></div>

                    <label>$Text{"Attachment"}:</label>
                    <div class="Field">
                        <ul>
<!-- dtl:block:Attachment -->
                            <li>
                                $QData{"Filename"} ($QData{"Filesize"})
                                <button type="button" id="AttachmentDeleteButton$QData{"FileID"}" name="AttachmentDeleteButton$QData{"FileID"}" value="$Text{"Delete"}" class="SpacingLeft">$Text{"Delete"}</button>
                                <input type="hidden" id="AttachmentDelete$QData{"FileID"}" name="AttachmentDelete$QData{"FileID"}" />
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#AttachmentDeleteButton$QData{"FileID"}').bind('click', function () {
        var $Form = $('#AttachmentDeleteButton$QData{"FileID"}').closest('form');
        $('#AttachmentDelete$QData{"FileID"}').val(1);
        Core.Form.Validate.DisableValidation($Form);
        $Form.trigger('submit');
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                            </li>
<!-- dtl:block:Attachment -->
                            <li>
                                <input id="FileUpload" name="FileUpload" type="file" size="40" />
                                <input type="hidden" id="AttachmentUpload" name="AttachmentUpload" value="0" />
                            </li>
                        </ul>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#FileUpload').bind('change', function () {
        var $Form = $('#FileUpload').closest('form');
        Core.Form.Validate.DisableValidation($Form);
        $Form.find('#AttachmentUpload').val('1').end().submit();
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>

<!-- dtl:block:State -->
                    <label for="NewStateID">$Text{"Next ticket state"}:</label>
                    <div class="Field">
                        $Data{"NextStatesStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#NewStateID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#MoveTicketToQueue'), 'AJAXUpdate', 'NewStateID', ['DestQueueID', 'NewUserID', 'OldUserID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"}]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>

<!-- dtl:block:StatePending -->
                    <label>$Text{"Pending date"}:</label>
                    <div class="Field">
                        $Data{"DateString"}
                        <div id="DayServerError" class="TooltipErrorMessage"><p>$Text{"Date invalid!"}</p></div>
                        <div id="HourServerError" class="TooltipErrorMessage"><p>$Text{"Date invalid!"}</p></div>
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:StatePending -->
<!-- dtl:block:State -->

<!-- dtl:block:Priority -->
                    <label for="NewPriorityID">$Text{"Priority"}:</label>
                    <div class="Field">
                        $Data{"NextPrioritiesStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#NewPriorityID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#MoveTicketToQueue'), 'AJAXUpdate', 'NewStateID', ['DestQueueID', 'NewUserID', 'OldUserID', 'NewStateID', $Data{"DynamicFieldNamesStrg"}]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:Priority -->

<!-- dtl:block:DynamicField -->
                    <div class="Row Row_DynamicField_$QData{"Name"}">
                        $Data{"Label"}
                        <div class="Field">
                            $Data{"Field"}
                        </div>
                        <div class="Clear"></div>
                    </div>
<!-- dtl:block:DynamicField -->

# example of how to use fixed dynamic field blocks for customizations
# Note: Field1 and Field2 are the names of the fields and had to be replaced with the actual
# field names
#<!-- dtl:block:DynamicField_Field1 -->
#                    <div class="Row Row_DynamicField_$QData{"Name"}">
#                        $Data{"Label"}
#                        <div class="Field">
#                            $Data{"Field"}
#                        </div>
#                        <div class="Clear"></div>
#                    </div>
#<!-- dtl:block:DynamicField_Field1 -->
#<!-- dtl:block:DynamicField_Field2 -->
#                    <div class="Row Row_DynamicField_$QData{"Name"}">
#                        $Data{"Label"}
#                        <div class="Field">
#                            $Data{"Field"}
#                        </div>
#                        <div class="Clear"></div>
#                    </div>
#<!-- dtl:block:DynamicField_Field2 -->

<!-- dtl:block:TimeUnitsLabel -->
                    <label for="TimeUnits">$Text{"Time units"}$Text{"$Config{"Ticket::Frontend::TimeUnits"}"}:</label>
<!-- dtl:block:TimeUnitsLabel -->
<!-- dtl:block:TimeUnitsLabelMandatory -->
                    <label class="Mandatory" for="TimeUnits"><span class="Marker">*</span>$Text{"Time units"}$Text{"$Config{"Ticket::Frontend::TimeUnits"}"}:</label>
<!-- dtl:block:TimeUnitsLabelMandatory -->
<!-- dtl:block:TimeUnits -->
                    <div class="Field">
                        <input type="text" name="TimeUnits" id="TimeUnits" value="$QData{"TimeUnits"}" class="Validate_TimeUnits $QData{"TimeUnitsRequired"} $QData{"TimeUnitsInvalid"}"/>
                        <div id="TimeUnitsError" class="TooltipErrorMessage"><p>$Text{"Invalid time!"}</p></div>
                        <div id="TimeUnitsServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TimeUnits -->

                </fieldset>
            </div>
        </div>
        <div class="Footer">
            <button class="Primary" id="submitRichText" accesskey="g" title="$Text{"Submit"} (g)" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
        </div>
    </div>
</form>

#Layers
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    Core.Agent.TicketAction.Init();
//]]></script>
<!--dtl:js_on_document_complete-->
