<%--
/**
 * 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" %>

<%
COREntryDisplayContext corEntryDisplayContext = (COREntryDisplayContext)request.getAttribute(WebKeys.PORTLET_DISPLAY_CONTEXT);
%>

<div class="row">
	<div class="col">
		<commerce-ui:panel
			bodyClasses="flex-fill"
			title='<%= LanguageUtil.get(request, "configuration") %>'
		>
			<div class="row">
				<div class="col">
					<aui:input label="minimum-order-amount" name='<%= "type--settings--" + COREntryConstants.TYPE_MINIMUM_ORDER_AMOUNT_FIELD_AMOUNT + "--" %>' required="<%= true %>" type="text" value="<%= corEntryDisplayContext.getMinimumAmount() %>">
						<aui:validator name="number" />
					</aui:input>
				</div>

				<div class="col-auto">
					<aui:select label="currency" name='<%= "type--settings--" + COREntryConstants.TYPE_MINIMUM_ORDER_AMOUNT_FIELD_CURRENCY_CODE + "--" %>' required="<%= true %>" title="currency">

						<%
						for (CommerceCurrency commerceCurrency : corEntryDisplayContext.getCommerceCurrencies()) {
							String commerceCurrencyCode = commerceCurrency.getCode();
						%>

							<aui:option label="<%= commerceCurrency.getName(locale) %>" selected="<%= commerceCurrencyCode.equals(corEntryDisplayContext.getCommerceCurrencyCode()) %>" value="<%= commerceCurrencyCode %>" />

						<%
						}
						%>

					</aui:select>
				</div>

				<div class="col-auto">
					<aui:select label="apply-to" name='<%= "type--settings--" + COREntryConstants.TYPE_MINIMUM_ORDER_AMOUNT_FIELD_APPLY_TO + "--" %>' required="<%= true %>" title="apply-to">

						<%
						String applyTo = corEntryDisplayContext.getApplyTo();
						%>

						<aui:option label="total" selected="<%= Validator.isNull(applyTo) || applyTo.equals(COREntryConstants.TYPE_MINIMUM_ORDER_AMOUNT_FIELD_APPLY_TO_ORDER_TOTAL) %>" value="<%= COREntryConstants.TYPE_MINIMUM_ORDER_AMOUNT_FIELD_APPLY_TO_ORDER_TOTAL %>" />
						<aui:option label="subtotal" selected="<%= applyTo.equals(COREntryConstants.TYPE_MINIMUM_ORDER_AMOUNT_FIELD_APPLY_TO_ORDER_SUBTOTAL) %>" value="<%= COREntryConstants.TYPE_MINIMUM_ORDER_AMOUNT_FIELD_APPLY_TO_ORDER_SUBTOTAL %>" />
					</aui:select>
				</div>
			</div>
		</commerce-ui:panel>
	</div>
</div>