<!-- BEGIN result/single_tests.tt -->
  [% # PROCESS dumper.tt dump = section_result_lab_tests.item(section) %]
  [% # PROCESS dumper.tt dump = completed_lab_tests %]
  
  <p class="indent"><span class="title">Single tests:</span></p>
  
  [% # get list of tests:
    tests = [ ];
    FOREACH test IN this_section.test; # PROCESS dumper.tt dump = test;
      tests.push(test.key);
      END;
    sorted_tests = natural_sort(tests); # PROCESS dumper.tt dump = sorted_tests;
  %]
  
    <div class="indent">
      <table class="results">
        <tr>
          [% count = 1 %]
          
        [% FOREACH test_name IN sorted_tests;
            test_data = this_section.test.item(test_name);
              # PROCESS dumper.tt dump = test_data; 
            # NEXT IF test_data.result; # already has result on test of same name - moved below
            NEXT UNLESS test_data.is_active.match('yes');
            # get td background 'color' (expects 'test_data'):
            PROCESS result/colour.tt 
        %]
          
          <td align="right" width="170">
            <span style="color: [% clr %]; background: [% bgclr %]; padding: 2px">
            [% IF test_data.status; user = test_data.user; %]
              <span class="acronym" title="[% user.first_name _ ' ' _ user.last_name %]">
                [% test_name | html %]
              </span>
              [% ELSE %]
                [% test_name | html %]
              [% END %]
            </span>         
          </td>
          
          <td>
            [% IF is_locked %]
                <img src="/images/checkbox.png" title="locked" />
            [% ELSE %]
                <input type="checkbox" name="test_id" value="[% test_data.id %]"
                    [% site.html.disabled IF test_data.result %] />
            [% END %]
          </td>
          [% UNLESS loop.last OR # don't start new table unless multiple of 6:
            ( this_section.test.size > 4 AND count % 4 ) %]
            </tr>
          </table>
          <table class="results">
            <tr>
          [% END %]              
          [% count = count + 1 %]               
        [% END %]
        [% '<td></td>' IF count == 1 # or get invalid html %]
        </tr>
      </table>
    </div>
<!-- END result/single_tests.tt -->
