<!-- BEGIN [% component.name %] -->
     [%
		request = entry.request;
		patient = request.patient_case.patient;
                test_requested = entry.time;
	  %]

       [% # skip trials if exclude_trials is checked
           IF c.query.param('exclude_trials');
               IF request.request_trial ;
                   # debug
                   # c.query.param('exclude_trials');
                   trial_counter = trial_counter + 1;
                   NEXT ;
               END;
           END;
        %]
      [% # filters for genomics app:
        IF c.query.param('genomics_category_filter');
            param = c.query.param('genomics_category_filter');
            NEXT UNLESS
			  request.request_initial_screen.screen.description.lower.match(param);
        END;
        IF c.query.param('genomics_parentcode_filter');
            param = c.query.param('genomics_parentcode_filter');
            NEXT UNLESS # referral_source doesn't have parent_organisation object:
			  request.patient_case.referral_source.organisation_code.match('^'_ param);
        END;
      %]

	  <tr>
        <td>[% loop.count - trial_counter %]</td>
        <td>
          [% data = request; PROCESS site/lab_number.tt want_url = 1;
            # expects request object 'data' %]
        </td>
        [% IF c.config('settings').have_worklist_external_ref %]
        <td>
            [% request.request_external_ref.external_reference %]
        </td>
        [% END %]
        [% class = request_options_map.item(request.id).urgent ? 'red' : 'normal' %]
        <td class="[% class %]">
          [% patient.last_name   | upper %],
          [% patient.first_name  | ucfirst %]
          [% patient.middle_name | ucfirst %]
        </td>
		<td>[% request.created_at.strftime('%a %d.%b.%Y') %]</td>
        <td>
            [% specimen_map.item(request.id).sample_code.join(', ') %]
            [% INCLUDE site/snippets/doi.tt IF request_options_map.item(request.id).doi %]
        </td>
		<td>
		    [% SET location = request.patient_case.referral_source.display_name %]
            [% PROCESS site/display_name.tt %]
		</td>

        [% IF worklist_cols.item(lab_section.section_name).row_tt;
            tt = worklist_cols.item(lab_section.section_name).row_tt;
            PROCESS $tt # override for default cols %]
        [% ELSE %]
        <td>
          [% IF request.request_initial_screen %]
            [% request.request_initial_screen.screen.description | html %]
          [% ELSE %]
            [% site.html.grey_null %]
          [% END %]
		</td>
        <td>
		  [% prefix = entry.lab_test.test_type.match('panel') ? 'P' : 'T' %]
		  [[% prefix %]] [% entry.lab_test.field_label %]

		  [% IF requesting_user_sections.item( c.param('id') ); # get user who requested it:
				requester = requesting_user(request.id, entry.lab_test.field_label);
				IF requester; '['; requester.user.username | upper; ']'; END;
		  END %]
        </td>
        [% END %]

        <td>
		  [% entry.status.description | upper %]

                  [% IF show_request_lab_test_status_time %]
        </td>
        <td>
		  [% date.format(entry.time , '%d/%m/%Y') %]
                  [% END %]
        </td>

		[% IF is_results_entry %]
		  <td align="right">
			<span>
			  [% PROCESS site/lab_number.tt want_url = 0 %]:
			</span>
			[% field_name = c.stash.individual_tests_only ?
				  'request_lab_test_result_id' : 'request_lab_test_id' %]
			  <input type="checkbox" style="vertical-align: middle"
				  name="[% field_name %]" value="[% entry.id %]" />
		  </td>
		[% ELSE;
            IF section_has_test_details %]
                <td>
                  [% request_section_notes_map.item(request.id) %]
                </td>
            [% END %]
            [% IF has_labels;
              request_ids = c.session.param('lab_section_labels') %]
                <td align="center" class="printHide">
                  <input type="checkbox" name="request_id" value="[% request.id %]"
                   [% 'checked' IF request_ids.grep(request.id).size %] />
                </td>
            [% END %]
		[% END %]
      </tr>
<!-- END [% component.name %] -->
