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

<table class="data" style="width:100%">
	<tr>
		<td>#</td>
		<td>MAC</td>
		<td>MAC_TO</td>
		<td>Status</td>
		<td>RX</td>
		<td>TX</td>
		<td>Temp</td>
		<td>Distance</td>
		<td>Договор</td>
		<td>ФИО</td>
	</tr>
	<c:forEach var="onu" items="${frd.onus}">
		<tr>
			<td>${onu.numOnu}</td>
			<td>${onu.mac}</td>
			<td>${onu.macTo}</td>
			<td>
				<c:choose>
					<c:when test="${onu.status == 'up'}"><span class="getolt-status-ok">${onu.status}</span></c:when>
					<c:when test="${onu.status == 'down'}"><span class="getolt-status-error">${onu.status}</span></c:when>
					<c:otherwise>${onu.status}</c:otherwise>
				</c:choose>
			</td>
			<td class="<c:choose><c:when test="${onu.rxSignal != null && onu.rxSignal > -15}">getolt-signal-overexposed</c:when><c:when test="${onu.rxSignal != null && onu.rxSignal >= -25}"></c:when><c:when test="${onu.rxSignal != null && onu.rxSignal >= -27}">getolt-signal-medium</c:when><c:when test="${onu.rxSignal != null}">getolt-signal-poor</c:when></c:choose>">
				<c:if test="${onu.rxSignal != null}">${onu.rxSignal}</c:if>
				<c:if test="${onu.rxSignal == null}">-</c:if>
			</td>
			<td>
				<c:if test="${onu.txSignal != null}">${onu.txSignal}</c:if>
				<c:if test="${onu.txSignal == null}">-</c:if>
			</td>
			<td>
				<c:if test="${onu.temperature != null}">${onu.temperature}</c:if>
				<c:if test="${onu.temperature == null}">-</c:if>
			</td>
			<td>
				<c:if test="${onu.distance != null}">${onu.distance}</c:if>
				<c:if test="${onu.distance == null}">-</c:if>
			</td>
			<td><c:choose>
				<c:when test="${not empty onu.numDogovor && onu.contractId > 0 && not empty frd.operatorToBillingId[onu.operator]}">
					<a href="#" data-billing-id="<c:out value="${frd.operatorToBillingId[onu.operator]}"/>" data-contract-id="${onu.contractId}"
						onclick="$$.bgbilling.contract.open(this.dataset.billingId, parseInt(this.dataset.contractId)); return false;"><c:out value="${onu.numDogovor}"/></a>
				</c:when>
				<c:otherwise><c:out value="${onu.numDogovor}"/></c:otherwise>
			</c:choose></td>
			<td><c:out value="${onu.abonFio}"/></td>
		</tr>
	</c:forEach>
</table>
<c:if test="${empty frd.onus}">
	<div class="mt05">Нет ONU на порту.</div>
</c:if>
