<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/spring" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<table class="infotable" border="1" cellpadding="5">
    <tr>
        <th class="main_header"><spring:message code="informations.proces"/></th>
        <th class="main_header"><spring:message code="informations.processtate"/></th>
        <th class="main_header"><spring:message code="informations.processtartdate"/></th>
        <th class="main_header"><spring:message code="informations.procesenddate"/></th>
        <th class="main_header"><spring:message code="informations.procesinfo"/></th>
    </tr>
    <c:forEach items="${procesList}" var="proces" varStatus="lineInfo">
        <tr>
            <td>
                <c:choose>
                    <c:when test='${proces.procesType == "NMAIL.EMAILSENDING"}'>
                        <spring:message code="proces.emailsending"/>
                    </c:when>
                </c:choose>
            </td>
            <td>
                <c:choose>
                    <c:when test='${proces.endProces != null}'>
                        <spring:message code="proces.ready"/>
                    </c:when>
                    <c:otherwise>
                        <div>
                            <c:choose>
                                <c:when test='${proces.procesType == "NMAIL.EMAILSENDING"}'>
                                    <img src="img/percentImage.png" 
                                            style="background-image: url(img/percentImage_back4.png); 
                                                   background-position: ${-1*(120 -(120*(proces.sentEmail+proces.failedEmail)/proces.emailCount))}px 50%;  
                                                   padding:0; margin: 0; width: 120px"/>
                                </c:when>
                            </c:choose>
                        </div>
                    </c:otherwise>
                </c:choose>
            </td>
            <td>
                <fmt:formatDate value="${proces.startProces}" type="both" dateStyle="short" timeStyle="short"/>
            </td>
            <td>
                <c:choose>
                    <c:when test="${proces.endProces != null}">
                        <fmt:formatDate value="${proces.endProces}" type="both" dateStyle="short" timeStyle="short"/>
                    </c:when>
                    <c:otherwise>
                        <c:out value="-"/>
                    </c:otherwise>
                </c:choose>
            </td>
            <td>
                <c:choose>
                    <c:when test='${proces.procesType == "NMAIL.EMAILSENDING"}'>
                        <spring:message code="proces.successful"/>&nbsp;<c:out value="${proces.sentEmail+proces.failedEmail}"/>
                    </c:when>
                </c:choose>
            </td>
        </tr>
    </c:forEach>
</table>
