<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jspf/taglibs.jsp"%>

<shell:title text="${l.l('Склады')}"/>

<c:set var="selectorUiid" value="${u:uiid()}"/>

<div id="storeQueueShow">

	<table style="width: 100%;"><tr>
		<td nowrap="nowrap">
			<c:choose>
				<c:when test="${not empty frd.queueList}">
					<c:set var="valuesHtml">
						<c:forEach var="q" items="${frd.queueList}">
							<li value="${q.id}">${q.title}</li>
						</c:forEach>
					</c:set>

					<ui:combo-single id="${selectorUiid}"
						prefixText="${l.l('Очередь')}:"
						widthTextValue="15em"
						onSelect="storeQueueLoadFilter(this.value)"
						valuesHtml="${valuesHtml}"/>

					<script>
						$(function () {
							storeQueueLoadFilter($('#${selectorUiid}').find('.selected').attr('value'));
						})
					</script>
				</c:when>
				<c:otherwise>
					${l.l('Нет доступных очередей')}
				</c:otherwise>
			</c:choose>
		</td>
		<td style="width: 100%;"></td>
	</tr></table>

	<div id="storeQueueFilter">
		<%-- filter panel loaded here by AJAX --%>
	</div>

	<div id="storeQueueData">
		<%-- store data loaded here by AJAX --%>
	</div>
</div>

<script>
	function storeQueueLoadFilter(queueId) {
		if (!queueId) return;
		$$.ajax.load('${form.requestURI}?method=queueFilter&queueId=' + queueId, $('#storeQueueFilter'));
		$('#storeQueueData').empty();
	}
</script>
