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

<c:set var="inst" value="${frd.instance}"/>

<h3 class="mb1">
	${l.l('Лог экспорта')}
	<c:if test="${not empty inst}"> — ${inst.title}</c:if>
</h3>

<c:url var="backUrl" value="/admin/plugin/sync1c/instance.do"/>
<button type="button" class="btn-white mb1"
	onclick="$$.ajax.loadContent('${backUrl}')">&larr; ${l.l('Назад')}</button>

<table class="data hl">
	<tr>
		<td>ID</td>
		<td>${l.l('Инстанция 1С')}</td>
		<td>${l.l('Процесс')}</td>
		<td>${l.l('Запись очереди')}</td>
		<td>${l.l('Начало')}</td>
		<td>${l.l('Завершение')}</td>
		<td>${l.l('Позиций')}</td>
		<td>${l.l('Статус')}</td>
		<td>${l.l('Ошибка')}</td>
	</tr>
	<c:forEach var="entry" items="${frd.logList}">
		<tr class="${entry.status == 'error' ? 'inv-deleted' : ''}">
			<td>${entry.id}</td>
			<td>${entry.instanceTitle}</td>
			<td>${entry.processId}</td>
			<td>${entry.queueId}</td>
			<td class="nowrap">${tu.format(entry.startedAt, 'ymdhms')}</td>
			<td class="nowrap">${tu.format(entry.finishedAt, 'ymdhms')}</td>
			<td>${entry.itemsCount}</td>
			<td>
				<c:choose>
					<c:when test="${entry.status == 'ok'}"><span class="color-green">${l.l('Успешно')}</span></c:when>
					<c:when test="${entry.status == 'error'}"><span class="color-red">${l.l('Ошибка')}</span></c:when>
					<c:otherwise><span class="color-gray">${l.l('Выполняется')}</span></c:otherwise>
				</c:choose>
			</td>
			<td><small>${entry.errorText}</small></td>
		</tr>
	</c:forEach>
	<c:if test="${empty frd.logList}">
		<tr><td colspan="9" class="center">${l.l('Нет данных')}</td></tr>
	</c:if>
</table>

<shell:title text="${l.l('Лог экспорта')}"/>
