<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%
     java.util.List places = (java.util.List)request.getSession().getAttribute("places");
     java.util.List users = (java.util.List)request.getSession().getAttribute("users");

     java.lang.String contentUserList = "";
     java.lang.String contentPlaceList = "";     

     for (java.util.Iterator itor = places.iterator(); itor.hasNext();)
     {
        com.ferienclub.custadmin.beans.Place p = (com.ferienclub.custadmin.beans.Place)itor.next();
        java.lang.String placeId = p.getPlaceId();
        java.lang.String placeName = p.getName();
	contentPlaceList += "<option value=\"" + placeId + "\">" + placeName + "</option>\n";        
     }

     for (java.util.Iterator itor = users.iterator(); itor.hasNext();)
     {
        com.ferienclub.custadmin.beans.User u = (com.ferienclub.custadmin.beans.User)itor.next();
        java.lang.String userId = u.getUserId();
        java.lang.String userName = u.getFirstName() + " " + u.getName();
	contentUserList += "<option value=\"" + userId + "\">" + userName + "</option>\n";
     }     
%>

<html>
  <head>
   <title>Club Administration V0.1 -- Create Appointment</title>
    <script type="text/javascript">
    </script>
  </head>
<body>
 <center>
 <h1>Create Appointment</h1><br><br>
 <html:errors/></p>
 <html:form action="CreateAppointment?mode=save">
   <table border="0">
     <tr><td>Subject:</td><td><html:text property="subject" size="30" maxlength="50"/></td></tr>
     <tr><td>Category:</td><td><html:text property="category" size="30" maxlength="50"/></td></tr>
     <tr><td>Date:</td><td><html:text property="date" size="30" maxlength="50"/></td></tr>
     <tr><td>Duration:</td><td><html:text property="duration" size="30" maxlength="50"/></td></tr>
     <tr><td>User:</td><td><html:select property="userId" size="10"><%= contentUserList %></html:select></td></tr>
     <tr><td>Place:</td><td><html:select property="placeId" size="10"><%= contentPlaceList %></html:select></td></tr>
   </table>
 </html:form>
 
 <html:form action="AppointmentsAdm.do">
 </html:form>

 <input type="button" value="Save" onClick="document.forms[0].submit()"/> 
 <input type="button" value="Cancel" onClick="document.forms[1].submit()"/> 
 <html:link href="/ClubAdministration">Back to Start</html:link>
 </center>
</body>
</html>
