<!-- BEGIN [% component.name %] -->
	<p class="small">

    [% # PROCESS dumper.tt dump = formatted_test_data %]
    [% # PROCESS dumper.tt dump = outstanding_tests %]

	[% IF formatted_test_data.size %]
        <p><span class="title">Lab Tests</span>
		 [% div_name = 'lab_results'; INCLUDE site/snippets/toggleview.tt %]
		 [% IF outstanding_tests.size; %]
		   [ <span class="red">has investigations pending</span> ]
		  [% END %]
        </p>

      <div id="[% div_name %]" class="itemhidden">
        <div class="indent">
        [% FOREACH lab_section IN formatted_test_data # lab_section = HoH %]
            <p class="section_header">[% lab_section.key | html %]:</p>
            [% FOREACH test IN lab_section.value; # PROCESS dumper.tt dump = test %]
                [% import(test) # access hashref keys directly: %]
                <p class="thin">
                    <span class="test_name">[% test_name | html %]:</span>
					[% IF test.test_status == 'complete' %]
						<span class="test_value">[% user_name | upper %]</span>
					[% ELSE %]
						<span class="grey">[pending]</span>
					[% END %]
                </p>
            [% END %]
 		[% END %]
        </div>
    </div>
	  
	[% ELSE %]
        <p class="title">Lab Tests [ 0 ]</p>
	[% END %]
<!-- END [% component.name %] -->
