<%--
/**
 * 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="/price/init.jsp" %>

<span class="<%= Validator.isNotNull(namespace) ? namespace + "price price" : "price" %><%= compact ? " compact" : StringPool.BLANK %>" id="<%= Validator.isNotNull(namespace) ? namespace + "price" : "" %>">
	<liferay-util:include page="/price/default.jsp" servletContext="<%= application %>" />

	<c:choose>
		<c:when test="<%= compact %>">
			<c:choose>
				<c:when test="<%= Validator.isNull(priceModel.getDiscount()) %>">
					<c:if test="<%= Validator.isNotNull(priceModel.getPromoPrice()) %>">
						<liferay-util:include page="/price/promo.jsp" servletContext="<%= application %>" />
					</c:if>
				</c:when>
				<c:otherwise>
					<c:if test="<%= Validator.isNotNull(priceModel.getFinalPrice()) %>">
						<liferay-util:include page="/price/discount.jsp" servletContext="<%= application %>" />
					</c:if>
				</c:otherwise>
			</c:choose>
		</c:when>
		<c:otherwise>
			<c:if test="<%= Validator.isNotNull(priceModel.getPromoPrice()) %>">
				<liferay-util:include page="/price/promo.jsp" servletContext="<%= application %>" />
			</c:if>

			<c:if test="<%= Validator.isNotNull(priceModel.getFinalPrice()) %>">
				<liferay-util:include page="/price/discount.jsp" servletContext="<%= application %>" />
			</c:if>
		</c:otherwise>
	</c:choose>
</span>

<c:if test="<%= Validator.isNotNull(namespace) %>">
	<aui:script require="commerce-frontend-js/components/price/entry as Price">
		const componentId = '<%= namespace + "price" %>';

		const initialProps = {
			displayDiscountLevels: <%= displayDiscountLevels %>,
			namespace: '<%= namespace %>',
			netPrice: <%= netPrice %>,
			price: <%= jsonSerializer.serializeDeep(priceModel) %>,
			standalone: true,
		};

		Price.default(componentId, componentId, initialProps);
	</aui:script>
</c:if>