<!-- BEGIN worklist/snippets/data_entry.tt -->

<script type='text/javascript'>//<![CDATA[ 
  $(window).load(function(){
	$(document).ready(function() {
		$('#status-options').change(function(){
			var opt = $(this).val(),
			div = $('#' + opt);
	
			$('.confirm').hide();
				div.show();		   
		});
	});
  });//]]>  
</script>

<div class="indent">
      <table class="borderless">        
        <tr>
          <td>User:</td>
          <td>
            <select name="user_id">
            [% FOREACH user IN user_list %]
            <option value="[% user.id %]"
                [% 'selected' IF user.username == c.authen.username %]>
              [% user.username | upper %]
            </option>
            [% END %]
            </select>
            [% error_user_id %]
          </td>
          <td>
            [% IF error_user_id; error_user_id; ELSE %]
              <span class="info">&#171; change this if required</span>
            [% END %]
          </td>
        </tr>

        [% UNLESS skip_status %]
        <tr>
          <td>Status:</td>
          <td>
            <select name="status_option_id" id="status-options">
              <option value=""></option>
            [% FOREACH entry IN status_options;
				# shouldn't be able to re-enter same status as selected:
				NEXT IF entry.id == c.query.param('status_option_id');
                NEXT IF entry.description.match('delete'); # goes last with separator between
			%]
              <option value="[% entry.id %]"
                  [% # 'selected' IF entry.id == c.query.param('status_option_id') ?? %]>
                [% entry.description %]
              </option>
            [% END %]
                <option disabled=1>----</option>
            [% FOREACH entry IN status_options;
                NEXT UNLESS entry.description.match('delete'); %]
                <option value="[% entry.id %]" class="red">DELETE</option>
            [% END %]
            </select>
          </td>
          <td>
			[% IF error_status_option_id; error_status_option_id; END %]
            [% FOREACH entry IN status_options;
                NEXT UNLESS entry.description.match('delete');
				display = error_confirm_delete ? 'show' : 'none';
			%]
			  <div id="[% entry.id %]" class="confirm" style="display:[% display %]">
				  <span class="warning">confirm delete record(s):</span>
				  <input type="checkbox" name="confirm_delete" value="1" />
				  [% error_confirm_delete %]
			  </div>	
            [% END %]		  
		  </td>
        </tr>
        [% END %]
      </table>
    </div>
<!-- END worklist/snippets/data_entry.tt -->
