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

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

<p:check action="/admin/plugin/inventory/storeQueue:queueGet">
	<c:url var="addUrl" value="${form.requestURI}">
		<c:param name="method" value="queueGet"/>
		<c:param name="returnUrl" value="${form.requestUrl}"/>
	</c:url>
	<ui:button type="add" onclick="$$.ajax.loadContent('${addUrl}', this)"/>
</p:check>

<table id="${uiid}" class="data mt1 hl">
	<tr>
		<td width="30">&#160;</td>
		<td width="40">ID</td>
		<td width="100%">${l.l('Наименование')}</td>
		<td>${l.l('Конфигурация')}</td>
	</tr>
	<c:forEach var="item" items="${frd.queueList}">
		<c:url var="editUrl" value="${form.requestURI}">
			<c:param name="method" value="queueGet"/>
			<c:param name="id" value="${item.id}"/>
			<c:param name="returnUrl" value="${form.requestUrl}"/>
		</c:url>
		<c:url var="deleteUrl" value="${form.requestURI}">
			<c:param name="method" value="queueDelete"/>
			<c:param name="id" value="${item.id}"/>
		</c:url>
		<c:url var="configUrl" value="${form.requestURI}">
			<c:param name="method" value="config"/>
			<c:param name="id" value="${item.id}"/>
			<c:param name="returnUrl" value="${form.requestUrl}"/>
		</c:url>
		<tr>
			<td nowrap="nowrap">
				<ui:button type="edit" styleClass="btn-small" onclick="$$.ajax.loadContent('${editUrl}', this)"/>
				<ui:button type="del" styleClass="btn-small" onclick="
					if ($$.confirm.del()) $$.ajax.post('${deleteUrl}', {control: this}).done((r) => {
						if (r.data.error) { alert(r.data.error); } else { $$.ajax.loadContent('${form.requestUrl}', this); }
					}); return false;"/>
			</td>
			<td>${item.id}</td>
			<td>${item.title}</td>
			<td>
				<a href="#" onclick="$$.ajax.loadContent('${configUrl}', this); return false;">[${l.l('Конфигурация')}]</a>
			</td>
		</tr>
	</c:forEach>
</table>

<shell:title text="${l.l('Очереди складов')}"/>
