# --
# AdminCustomerUser.dtl - provides HTML form for AdminCustomerUser
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id: AdminCustomerUser.dtl,v 1.41 2013/01/11 12:35:18 mn 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.
# --

<!-- dtl:block:Overview -->
<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
    <h1>$Text{"Customer Management"}</h1>
    <div class="SidebarColumn">
<!-- dtl:block:ActionList -->
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Actions"}</h2>
            </div>
            <div class="Content">
                <ul class="ActionList">
<!-- dtl:block:ActionOverview -->
                    <li>
                        <a href="$Env{"Baselink"}Action=$Env{"Action"};Nav=$LQData{"Nav"}" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
                    </li>
<!-- dtl:block:ActionOverview -->
<!-- dtl:block:ActionSearch -->
                    <li>
                        <form class="SearchBox" action="$Env{"CGIHandle"}" method="post">
                            <input type="hidden" name="Action" value="$Env{"Action"}"/>
                            <input type="hidden" name="Subaction" value="Search"/>
                            <input type="hidden" name="Nav" value="$QData{"Nav"}"/>
                            <input type="text" name="Search" value="$QData{"Search"}" id="Search" title="$Text{"Search"}"/>
                            <button type="submit" value="$Text{"Search"}">$Text{"Search"}</button>
                        </form>
                        <p class="FieldExplanation">
                            $Text{"Wildcards like '*' are allowed."}
                        </p>
                    </li>
<!-- dtl:block:ActionSearch -->
<!-- dtl:block:ActionAdd -->
                    <li>
                        <form action="$Env{"CGIHandle"}" method="post">
                            <input type="hidden" name="Action" value="$Env{"Action"}"/>
                            <input type="hidden" name="Subaction" value="Add"/>
                            <input type="hidden" name="Nav" value="$QData{"Nav"}"/>

                            <button class="CallForAction Plus" type="submit"><span>$Text{"Add customer"}</span></button>
                            <br/>
                            <label class="InvisibleText" for="Source">$Text{"Select"}</label>
                            $Data{"SourceOption"}
                        </form>
                    </li>
<!-- dtl:block:ActionAdd -->
                </ul>

            </div>
        </div>
<!-- dtl:block:ActionList -->

        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Hint"}</h2>
            </div>
            <div class="Content">
                <p>
                    $Text{"Customer will be needed to have a customer history and to login via customer panel."}
                </p>
            </div>
        </div>
    </div>
    <div class="ContentColumn">
        <div class="WidgetSimple">
<!-- dtl:block:OverviewHeader -->
            <div class="Header">
                <h2>$Text{"List"}</h2>
            </div>
<!-- dtl:block:OverviewHeader -->
<!-- dtl:block:NoSearchTerms -->
            <div class="Content">
                <p>$Text{"Please enter a search term to look for customers."}</p>
            </div>
<!-- dtl:block:NoSearchTerms -->
<!-- dtl:block:OverviewResult -->
            <div class="Content ">
                <table class="DataTable" id="CustomerTable">
                    <thead>
                        <tr>
                            <th>$Text{"Username"}</th>
                            <th>$Text{"Name"}</th>
                            <th>$Text{"Email"}</th>
                            <th>$Text{"CustomerID"}</th>
                            <th>$Text{"Last Login"}</th>
<!-- dtl:block:OverviewResultSwitchToCustomer -->
                            <th>$Text{"Login as"}</th>
<!-- dtl:block:OverviewResultSwitchToCustomer -->
                            <th>$Text{"Validity"}</th>
                        </tr>
                    </thead>
                    <tbody>
<!-- dtl:block:NoDataFoundMsg -->
                        <tr>
                            <td colspan="$QData{"ColSpan"}">
                                $Text{"No data found."}
                            </td>
                        </tr>
<!-- dtl:block:NoDataFoundMsg -->

<!-- dtl:block:OverviewResultRow -->
                        <tr>
<!-- dtl:block:OverviewResultRowLink -->
                            <td><a class="AsBlock" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Change;ID=$LQData{"UserLogin"};Search=$LQData{"Search"};Nav=$LQData{"Nav"}">$QData{"UserLogin"}</a></td>
<!-- dtl:block:OverviewResultRowLink -->
<!-- dtl:block:OverviewResultRowLinkNone -->
                            <td><a class="AsBlock" href="#">$QData{"UserLogin"}</a></td>
<!-- dtl:block:OverviewResultRowLinkNone -->
                            <td>$QData{"UserFirstname"} $QData{"UserLastname"}</td>
                            <td>$QData{"UserEmail"}</td>
                            <td>$QData{"UserCustomerID"}</td>
                            <td>$TimeShort{"$QData{"UserLastLoginTimestamp"}"}</td>
<!-- dtl:block:OverviewResultRowSwitchToCustomer -->
                            <td>
                                <a class="AsBlock" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Switch;ID=$LQData{"UserLogin"};$QEnv{"ChallengeTokenParam"}" target="_blank">$Text{"Switch to customer"}</a>
                            </td>
<!-- dtl:block:OverviewResultRowSwitchToCustomer -->
                            <td>$Text{"$Data{"Valid"}"}</td>
                        </tr>
<!-- dtl:block:OverviewResultRow -->

                    </tbody>
                </table>
            </div>
<!-- dtl:block:OverviewResult -->

<!-- dtl:block:OverviewUpdate -->
            <div class="Header">
<!-- dtl:block:HeaderAdd -->
                <h2>$Text{"Add Customer"}</h2>
<!-- dtl:block:HeaderAdd -->
<!-- dtl:block:HeaderEdit -->
                <h2>$Text{"Edit Customer"}</h2>
<!-- dtl:block:HeaderEdit -->
            </div>

            <div class="Content">
                <form action="$Env{"CGIHandle"}" enctype="multipart/form-data" method="post" name="compose" class="Validate PreventMultipleSubmits">
                    <input type="hidden" name="Action" value="$Env{"Action"}"/>
                    <input type="hidden" name="Subaction" value="$QData{"Action"}Action"/>
                    <input type="hidden" name="ID" value="$QData{"ID"}"/>
                    <input type="hidden" name="Source" value="$QData{"Source"}"/>
                    <input type="hidden" name="Nav" value="$QData{"Nav"}"/>
                    <input type="hidden" name="Search" value="$QData{"Search"}"/>
                    <fieldset class="TableLike">
<!-- dtl:block:PreferencesGeneric -->
<!-- dtl:block:PreferencesGenericInputHidden -->
                        <div class="Field">
                            <input type="hidden" name="$QData{"Name"}" value="$QData{"Value"}"/>
                        </div>
<!-- dtl:block:PreferencesGenericInputHidden -->
<!-- dtl:block:PreferencesGenericInput -->
                        <label class="$QData{"RequiredLabelClass"}" for="$QData{"Name"}"><span class="Marker">$QData{"RequiredLabelCharacter"}</span> $Text{"$Data{"Item"}"}:</label>
                        <div class="Field">
                            <input type="text" id="$QData{"Name"}" name="$QData{"Name"}" class="W50pc $QData{"RequiredClass"} $QData{"InvalidField"}" value="$QData{"Value"}" $QData{"ReadOnlyType"}/>
<!-- dtl:block:PreferencesGenericErrorMsg -->
                            <div id="$QData{"Name"}Error" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
<!-- dtl:block:PreferencesGenericErrorMsg -->
<!-- dtl:block:PreferencesUserEmailErrorMsg -->
                            <div id="$QData{"Name"}Error" class="TooltipErrorMessage"><p>$Text{"This field is required and needs to be a valid email address."}</p></div>
<!-- dtl:block:PreferencesUserEmailErrorMsg -->
<!-- dtl:block:PreferencesGenericServerErrorMsg -->
                            <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
<!-- dtl:block:PreferencesGenericServerErrorMsg -->
<!-- dtl:block:PreferencesUserEmailInvalidConfigServerErrorMsg -->
                            <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$Text{"This email address is not allowed due to the system configuration."}</p></div>
<!-- dtl:block:PreferencesUserEmailInvalidConfigServerErrorMsg -->
<!-- dtl:block:PreferencesUserEmailInvalidMXServerErrorMsg -->
                            <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$Text{"This email address failed MX check."}</p></div>
<!-- dtl:block:PreferencesUserEmailInvalidMXServerErrorMsg -->
<!-- dtl:block:PreferencesUserEmailInvalidDNSServerErrorMsg -->
                            <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$Text{"DNS problem, please check your configuration and the error log."}</p></div>
<!-- dtl:block:PreferencesUserEmailInvalidDNSServerErrorMsg -->
<!-- dtl:block:PreferencesUserEmailInvalidSyntaxServerErrorMsg -->
                            <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$Text{"The syntax of this email address is incorrect."}</p></div>
<!-- dtl:block:PreferencesUserEmailInvalidSyntaxServerErrorMsg -->
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:PreferencesGenericInput -->
<!-- dtl:block:PreferencesGenericPassword -->
                        <label class="$QData{"RequiredLabelClass"}" for="$QData{"Name"}"><span class="Marker">$QData{"RequiredLabelCharacter"}</span> $Text{"$Data{"Item"}"}:</label>
                        <div class="Field">
                            <input type="password" id="$QData{"Name"}" name="$QData{"Name"}" class="W50pc $QData{"RequiredClass"} $QData{"InvalidField"}" value="" maxlength="100" $QData{"ReadOnlyType"}/>
                            <div id="$QData{"Name"}Error" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                            <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:PreferencesGenericPassword -->
<!-- dtl:block:PreferencesGenericOption -->
                        <label class="$QData{"RequiredLabelClass"}" for="$QData{"Name"}"><span class="Marker">$QData{"RequiredLabelCharacter"}</span> $Text{"$Data{"Item"}"}:</label>
                        <div class="Field">
                            $Data{"Option"}
                            <div id="$QData{"Name"}Error" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                            <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:PreferencesGenericOption -->
<!-- dtl:block:PreferencesGeneric -->
<!-- dtl:block:Item -->
<!-- dtl:block:InputKey -->
                        <label for="$QData{"Name"}">$Text{"$Data{"Label"}"}:</label>
                        <div class="Field">
                            <input id="$QData{"Name"}"type="text" name="$QData{"Name"}" class="W50pc" value="$QData{"SelectedID"}"/>
                            <div class="FieldExplanation"> $Text{"$Data{"Key"}"} </div>
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:InputKey -->
<!-- dtl:block:Input -->
                        <label for="$QData{"Name"}">$Text{"$Data{"Label"}"}:</label>
                        <div class="Field">
                            <input id="$QData{"Name"}" type="text" name="$QData{"Name"}" class="W50pc" value="$QData{"SelectedID"}"/>
                            <div class="FieldExplanation">$Text{"$Data{"Desc"}"}$Text{"$Data{"Key"}"}</div>
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:Input -->
<!-- dtl:block:Option -->
                        <label for="$QData{"Name"}">$Text{"$Data{"Label"}"}:</label>
                        <div class="Field">
                            $Data{"Option"}
                            <div class="FieldExplanation">$Text{"$Data{"Desc"}"}$Text{"$Data{"Key"}"}</div>
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:Option -->
<!-- dtl:block:Upload -->
                        <label for="$QData{"Name"}">$Text{"$Data{"Label"}"}:</label>
                        <div class="Field">
                            <input id="$QData{"Name"}" name="$QData{"Name"}" type="file"/>
                            <div class="FieldExplanation">$Text{"$Data{"Desc"}"}$Text{"$Data{"Key"}"}</div>
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:Upload -->
<!-- dtl:block:Password -->
                        <label for="$QData{"Name"}">$Text{"$Data{"Label"}"}:</label>
                        <div class="Field">
                            <input id="$QData{"Name"}" type="password" name="$QData{"Name"}" class="W50pc" value="$QData{"SelectedID"}" autocomplete="off" />
                            <div>$Text{"$Data{"Key"}"}</div>
                        </div>
                        <div class="Clear"></div>
<!-- dtl:block:Password -->
<!-- dtl:block:Item -->
                        <div class="Field SpacingTop">
                            <button class="Primary" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
                            $Text{"or"}
                            <a href="$Env{"Baselink"}Action=$Env{"Action"};Nav=$LQData{"Nav"}">$Text{"Cancel"}</a>
                        </div>
                        <div class="Clear"></div>
                    </fieldset>
                </form>
            </div>
<!-- dtl:block:OverviewUpdate -->
        </div>
    </div>
    <div class="Clear"></div>
</div>
<!-- dtl:block:Overview -->

<!-- dtl:block:BorrowedViewJS -->
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#CustomerTable a').bind('click', function (Event) {
    Core.Agent.TicketAction.UpdateCustomer($(this).text());
});
//]]></script>
<!--dtl:js_on_document_complete-->
<!-- dtl:block:BorrowedViewJS -->

<!-- dtl:block:BorrowedViewSubmitJS -->
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
Core.Agent.TicketAction.UpdateCustomer('$JSText{"$Data{"Customer"}"}');
//]]></script>
<!--dtl:js_on_document_complete-->
<!-- dtl:block:BorrowedViewSubmitJS -->
