<!-- BEGIN [% template.name %] -->
    [% # FOREACH i IN incomplete_requests; PROCESS dumper.tt dump = i.as_tree; END %]

    [% IF incomplete_requests # not 'size' in case no matches %]
        <p>[% site.html.back_button %]</p>
        <p class="bold">Selected test(s):</p>
        <ul>[% FOREACH t IN test_names %]<li>[% t %]</li>[% END %]</ul>

        [% IF incomplete_requests.size;
            width = 70; # make display cols same size %]
            <table class="indent">
                <tr>
                    <td class="borderless"></td>
                    <th>LabNo</th>
                    <th>Test Name</th>
                    <th style="width: [% width %]px">New</th>
                    <th style="width: [% width %]px">PCR</th>
                    <th style="width: [% width %]px">Primary</th>
                    <th style="width: [% width %]px">Complete</th>
                </tr>
                [%
                    status_map = {
                        PCR              => 2,
                        'primary report' => 3,
                        complete         => 4,
                    };

                    FOREACH entry IN incomplete_requests;
                        data = entry.request;
                        status = status_map.item(entry.status.description) || 1;
                %]
                    <tr>
                        <td>[% loop.count %]</td>
                        <td>[% INCLUDE site/snippets/lab_number.tt want_url = 1 %]</td>
                        <td>[% entry.lab_test.field_label %]</td>
                        <td class="pcr_status"></td>
                        <td [% IF status > 1 %]class="pcr_status"[% END %]>
                        </td>
                        <td [% IF status > 2 %]class="pcr_status"[% END %]>
                        </td>
                        <td [% IF status > 3 %]class="pcr_status"[% END %]>
                        </td>
                    </tr>
                [% END %]
            </table>
        [% ELSE %]
            <p class="info">No incomplete requests</p>
        [% END %]
    [% ELSE %]
    <form method="get" action="">
        <input type="hidden" name="function_name"
            value="[% c.query.param('function_name') %]" />
	  <p class="bold">Select one or more tests:</p>
		<div id="multi">
		  <div class="indent">
			<select multiple size="[% IF lab_tests.size > 8; 8; END %]"
				name="lab_test_id">
			[% FOREACH test IN lab_tests;
                NEXT IF test.test_name.match('extraction|store'); # skip these
                NEXT UNLESS test.is_active.match('yes');
            %]
			  <option value="[% test.id %]">[% test.field_label | html %]</option>
			[% END %]
			</select>
		  </div>
		</div>
		<p>[% site.html.submit %]</p>
    </form>
    [% END %]
<!-- END [% template.name %] -->