#from kojiweb import util

#include "includes/header.chtml"

  #if $target
  <h4>Edit target $target.name</h4>
  #else
  <h4>Create build target</h4>
  #end if

  <form action="#if $target then 'buildtargetedit' else 'buildtargetcreate'#">
    $util.authToken($self, form=True)
    #if $target
    <input type="hidden" name="targetID" value="$target.id"/>
    #end if
    <table>
      <tr>
        <th>Name</th>
      <td>
        <input type="text" name="name" size="50" value="#if $target then $target.name else ''#"/>
      </td>
    </tr>
    #if $target
    <tr>
      <th>ID</th><td>$target.id</td>
    </tr>
    #end if
    <tr>
      <th>Build Tag</th>
      <td>
        <select name="buildTag">
          <option value="">select tag</option>
          #for $tag in $tags
          <option value="$tag.id"#if $target and $target.build_tag == $tag.id then ' selected="selected"' else ''#>$tag.name</option>
          #end for
        </select>
      </td>
    </tr>
    <tr>
      <th>Destination Tag</th>
      <td>
        <select name="destTag">
          <option value="">select tag</option>
          #for $tag in $tags
          <option value="$tag.id"#if $target and $target.dest_tag == $tag.id then ' selected="selected"' else ''#>$tag.name</option>
          #end for
        </select>
      </td>
    </tr>
    <tr>
      <td>
        #if $target
        <button type="submit" name="save" value="Save">Save</button>
        #else
        <button type="submit" name="add" value="Add">Add</button>
        #end if
      </td>
      <td><button type="submit" name="cancel" value="Cancel">Cancel</button></td>
    </tr>
    </table>
    </form>

#include "includes/footer.chtml"
