<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
  xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
  <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
  <jx:import uri="libraries/common-types/types_template_jx.xml"/>
  <title>Hotel Booking Sample (using Libraries)</title>
  <content>
    <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
      
      <table cellpadding="0" border="0" style="border: 1px solid black;">
        <tr>
          <td><ft:widget-label id="room"/></td>
          <td><ft:widget id="room"/></td>
        </tr>
        <tr>
          <td><ft:widget-label id="nrrooms"/></td>
          <td><ft:widget id="nrrooms"/></td>
        </tr>
        <tr>
          <td colspan="2">
            Reserve room:
            <duration id="booking"/>
          </td>
        </tr>
        <tr>
          <td colspan="2">Please include the people who will be included in this booking: <ft:widget id="personsAddRow"/></td>
        </tr>
        <tr>
          <td colspan="2">
            <table cellspacing="0" style="border-top: 1px solid black;">
              <jx:choose>
                <jx:when test="${widget.getChild('persons').getSize() == 0}">
                  <tr><td align="center"><em>There are no rows present yet!</em></td></tr>
                </jx:when>
                <jx:otherwise>
                  <ft:repeater-widget id="persons">
                    <tr>
                     <td style="border-bottom: 1px solid black;"><person/></td>
                      <td style="border-bottom: 1px solid black;">
                        <fi:group>
                          <fi:styling layout="rows"/>
                          <fi:items>
                            <ft:widget id="child"/>
                          </fi:items>
                        </fi:group>
                      </td>
                      <td style="border-bottom: 1px solid black; border-left: 1px solid black;">
                        <jx:choose>
                          <jx:when test="${repeaterLoop.first}">
                            <img src="resources/forms/img/blank_btn.gif"/>
                          </jx:when>
                          <jx:otherwise>
                            <ft:widget id="moveUp">
                              <fi:styling type="image" src="resources/forms/img/move_up.gif"/>
                            </ft:widget>
                          </jx:otherwise>
                        </jx:choose>
                        <jx:choose>
                          <jx:when test="${repeaterLoop.last}">
                            <img src="resources/forms/img/blank_btn.gif"/>
                          </jx:when>
                          <jx:otherwise>
                            <ft:widget id="moveDown">
                              <fi:styling type="image" src="resources/forms/img/move_down.gif"/>
                            </ft:widget>
                          </jx:otherwise>
                        </jx:choose>
                        <ft:widget id="deleteRow">
                          <fi:styling type="image" src="resources/forms/img/delete.gif"/>
                        </ft:widget>
                      </td>
                    </tr>
                  </ft:repeater-widget>
                </jx:otherwise>
              </jx:choose>
            </table>
          </td>
        </tr>
        <tr>
          <td><ft:widget-label id="extras"/></td>
          <td>
            <ft:widget id="extras">
              <fi:styling list-type="checkbox"/>
            </ft:widget>
          </td>
        </tr>
        <tr>
          <td colspan="2">Your billing address:</td>
        </tr>
        <tr>
          <td colspan="2">
            <address/>
          </td>
        </tr>
        <tr><td colspan="2"><input type="submit"/></td></tr>
      </table>
      
    </ft:form-template>
  </content>
</page>
