<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%@ include file="/init.jsp" %>

<%
AccountEntryDisplay accountEntryDisplay = (AccountEntryDisplay)request.getAttribute(AccountWebKeys.ACCOUNT_ENTRY_DISPLAY);

String[] types = GetterUtil.getStringValues(request.getAttribute(AccountWebKeys.ACCOUNT_ENTRY_ALLOWED_TYPES), AccountConstants.ACCOUNT_ENTRY_TYPES);
%>

<clay:sheet-section>
	<h3 class="sheet-subtitle">
		<liferay-ui:message key="account-display-data" />
	</h3>

	<liferay-frontend:logo-selector
		currentLogoURL="<%= accountEntryDisplay.getLogoURL() %>"
		defaultLogoURL="<%= accountEntryDisplay.getDefaultLogoURL() %>"
		label='<%= LanguageUtil.get(request, "image") %>'
	/>

	<aui:input bean="<%= accountEntryDisplay %>" label="account-name" model="<%= AccountEntry.class %>" name="name" />

	<c:choose>
		<c:when test="<%= accountEntryDisplay.getAccountEntryId() > 0 %>">
			<aui:input disabled="<%= true %>" label="type" name="type" value="<%= LanguageUtil.get(request, accountEntryDisplay.getType()) %>" />
		</c:when>
		<c:otherwise>
			<aui:select label="type" name="type">

				<%
				for (String type : types) {
				%>

					<aui:option label="<%= LanguageUtil.get(request, type) %>" value="<%= type %>" />

				<%
				}
				%>

			</aui:select>
		</c:otherwise>
	</c:choose>

	<aui:input helpMessage="tax-id-help" label="tax-id" name="taxIdNumber" type="text" value="<%= accountEntryDisplay.getTaxIdNumber() %>">
		<aui:validator name="maxLength"><%= ModelHintsUtil.getMaxLength(AccountEntry.class.getName(), "taxIdNumber") %></aui:validator>
	</aui:input>

	<liferay-ui:error embed="<%= false %>" key="<%= DuplicateAccountEntryExternalReferenceCodeException.class.getName() %>" message="the-given-external-reference-code-belongs-to-another-account" />

	<aui:input bean="<%= accountEntryDisplay %>" label="external-reference-code" model="<%= AccountEntry.class %>" name="externalReferenceCode" />

	<c:if test="<%= accountEntryDisplay.getAccountEntryId() > 0 %>">
		<aui:input cssClass="disabled" label="account-id" name="accountEntryId" readonly="true" type="text" value="<%= String.valueOf(accountEntryDisplay.getAccountEntryId()) %>" />
	</c:if>

	<aui:field-wrapper cssClass="form-group lfr-input-text-container">
		<aui:input name="description" type="textarea" value="<%= accountEntryDisplay.getDescription() %>" />
	</aui:field-wrapper>
</clay:sheet-section>