<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <h:head>
    <h:title>New Place</h:title>
    <model>
      <instance>
        <data id="clinic" version="1">
          <clinic>
            <name/>
            <external_id/>
            <parent/>
            <contact/>
          </clinic>
          <meta>
            <instanceID/>
          </meta>
          <new_person>
            <name/>
            <phone/>
          </new_person>
        </data>
      </instance>

      <bind nodeset="/data/clinic/name" required="true()" type="string"/>
      <bind nodeset="/data/clinic/external_id" type="string"/>
      <bind nodeset="/data/clinic/parent" type="db:district_hospital"/>
      <bind nodeset="/data/clinic/contact" type="db:person" required="true()"/>

      <bind nodeset="/data/new_person" type="string" relevant="/data/clinic/contact = 'NEW'"/>
      <bind nodeset="/data/new_person/name" type="string" required="true()"/>
      <bind nodeset="/data/new_person/phone" type="phone" required="true()"/>
    </model>
  </h:head>
  <h:body class="pages">

    <group appearance="field-list" ref="/data/clinic">
      <input ref="/data/clinic/name">
        <label>{{'clinic.name' | translate}}</label>
      </input>
      <input ref="/data/clinic/external_id">
        <label>{{'clinic.external_id' | translate}}</label>
      </input>
      <input ref="/data/clinic/parent" appearance="db-object">
        <label>{{'clinic.parent' | translate}}</label>
      </input>
      <input ref="/data/clinic/contact" appearance="db-object">
        <label>{{'clinic.contact' | translate}}</label>
      </input>
    </group>

    <group appearance="field-list" ref="/data/new_person">
      <label>{{'person.new' || translate}}</label>
      <input ref="/data/new_person/name">
        <label>{{'person.name' | translate}}</label>
      </input>
      <input ref="/data/new_person/phone" type="phone">
        <label>{{'person.phone' | translate}}</label>
      </input>
    </group>

  </h:body>
</h:html>
