{{>header}}
<form action="{{rt}}/items/{{id}}" method="post" data-ajax="false"
    {{#outbox_id}}data-wq-outbox-id="{{outbox_id}}"{{/outbox_id}}>
  {{#id}}
  <input type="hidden" name="_method" value="put">
  {{/id}}
  <input type="hidden" name="csrfmiddlewaretoken" value="{{csrf_token}}">
  <input type="hidden" name="geometry">
  <ul data-role="listview">
    <li>
      <label for="label">Name</label>
      <input name="label" id="label" value="{{label}}">
      <p class="error item-label-errors"></p>
    </li>
    <li>
      <fieldset data-role="controlgroup" data-type="horizontal">
        <legend>Color</legend>
        {{#color_choices}}
        <input type='radio' value='{{name}}' id='color-{{name}}' name='color'
           {{#selected}}checked{{/selected}}>
        <label for='color-{{name}}'>{{label}}</label>
        {{/color_choices}}
      </fieldset>
      <p class="error item-color-errors"></p>
    </li>
    <li>
      <label for="type_id">Type</label>
      <select name="type_id" id="type_id">
        <option value="">Select a type...</option>
      {{#type_list}}
        <option value="{{id}}"{{#selected}} selected{{/selected}}>
          {{#outbox}}*{{/outbox}}
          {{label}}
        </option>
      {{/type_list}}
      </select>
    </li>
    <li>
      <label for="parent_id">Related Item</label>
      <select name="parent_id" id="parent_id">
        <option value="">Select item...</option>
      {{#parent_list}}
        <option value="{{id}}"{{#selected}} selected{{/selected}}>
          {{#outbox}}*{{/outbox}}
          {{label}}
        </option>
      {{/parent_list}}
      </select>
    </li>
    <li>
      <label for="image">Image</label>
      <input type="file" name="image" id="image">
    </li>
    <li data-role="list-divider">Values</li>
    {{#values}}
    <li>
      <label for="values-{{@index}}-name">{{#attribute}}{{label}}{{/attribute}}</label>
      <input attribute="hidden" name="values[{{@index}}][attribute_id]" value="{{attribute_id}}">
      <input name="values[{{@index}}][value]" id="values-{{@index}}-value" value="{{value}}">
    </li>
    {{/values}}
    <li data-role="list-divider">Location</li>
    <li>
      <div id="item-{{id}}{{^id}}new{{/id}}-edit-map" style="height:500px;"></div>
    </li>
    <li>
      <p class="error item-errors"></p>
      <div class="ui-grid-a">
        <div class="ui-block-a">
          <a data-role="button" data-icon="back" data-transition="flip"
             {{#outbox_id}}
             href="{{rt}}/outbox/{{outbox_id}}"
             {{/outbox_id}}
             {{^outbox_id}}
             href="{{rt}}/items/{{id}}"
             {{/outbox_id}}
             data-direction="reverse">
            Back
          </a>
        </div>
        <div class="ui-block-b">
          <button type="submit" data-theme="b" data-icon="check">
            Submit
          </button>
        </div>
        <p class="error item-type_id-errors"></p>
      </div>
    </li>
  </ul>
</form>
{{>context_test}}
{{>footer}}
