<?xml version="1.0" encoding="UTF-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
	  xmlns:c="http://java.sun.com/jsp/jstl/core"
	  xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
	  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	  version="2.0">

    <jsp:useBean id="podnik" class="cz.frantovo.nekurak.dto.Podnik" scope="request"/>
    <jsp:useBean id="pridatPodnik" class="cz.frantovo.nekurak.web.PridatPodnik" scope="request"/>

    <h1><fmt:message key="pridatPodnik.nadpis"/></h1>

    <c:choose>
	<c:when test="${param.akcePridat == 'pridej'}">
	    <c:catch var="pridatPodnikChyba">
		<jsp:setProperty name="podnik" property="*"/>
		<jsp:setProperty name="pridatPodnik" property="podnik" value="${podnik}"/>
		<c:set var="pridatPodnikOK" value="${pridatPodnik.pridano}"/>
	    </c:catch>
	    <c:choose>
		<c:when test="${pridatPodnikChyba == null}">
		    <p><fmt:message key="pridatPodnik.bylPridan"/></p>
		</c:when>
		<c:otherwise>
		    <p class="chybovaHlaska"><fmt:message key="pridatPodnik.nebylPridan"/></p>
		</c:otherwise>
	    </c:choose>
	</c:when>
	<c:otherwise>
	    <form method="post" action="?akce=pridatPodnik&amp;amp;akcePridat=pridej">
		<fieldset>
		    <label><fmt:message key="dto.podnik.nazev"/>: <input type="text" name="nazev" maxlength="255"/></label><br/>
		    <label><fmt:message key="dto.podnik.popis"/>: <input type="text" name="popis" maxlength="255"/></label><br/>
			<fmt:message key="dto.podnik.url.tip" var="urlTip"/>
		    <label title="${urlTip}"><fmt:message key="dto.podnik.url"/>: <input type="text" name="url" maxlength="255"/></label><br/>
		    <label><fmt:message key="dto.podnik.ulice"/>: <input type="text" name="ulice" maxlength="64"/></label><br/>
			<fmt:message key="dto.podnik.cisloPopisne.tip" var="cisloPopisneTip"/>
		    <label title="${cisloPopisneTip}"><fmt:message key="dto.podnik.cisloPopisne"/>: <input type="text" name="cisloPopisne" maxlength="5"/></label><br/>
		    <label><fmt:message key="dto.podnik.mesto"/>: <input type="text" name="mesto" maxlength="64"/></label><br/>
		    <button value="submit"><fmt:message key="pridatPodnik.tlacitko"/></button>
		</fieldset>
	    </form>
	</c:otherwise>
    </c:choose>




</jsp:root>
