<%@ 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/manufacturer:manufacturerGet">
	<c:url var="addUrl" value="${form.requestURI}">
		<c:param name="method" value="manufacturerGet"/>
		<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('Slug')}</td>
		<td>${l.l('Страна')}</td>
	</tr>
	<c:forEach var="m" items="${frd.manufacturerList}">
		<c:url var="editUrl" value="${form.requestURI}">
			<c:param name="method" value="manufacturerGet"/>
			<c:param name="id" value="${m.id}"/>
			<c:param name="returnUrl" value="${form.requestUrl}"/>
		</c:url>
		<c:url var="deleteUrl" value="${form.requestURI}">
			<c:param name="method" value="manufacturerDelete"/>
			<c:param name="id" value="${m.id}"/>
		</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="$$.ajax.post('${deleteUrl}', {control: this}).done((r) => {
					if (r.data.error) { alert(r.data.error); } else { $$.ajax.loadContent('${form.requestUrl}', this); }
				})"/>
			</td>
			<td>${m.id}</td>
			<td>${m.title}</td>
			<td>${m.slug}</td>
			<td>${m.country}</td>
		</tr>
	</c:forEach>
</table>

<shell:title text="${l.l('Производители')}"/>
