<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
	"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
    <title></title>
    <style type="text/css">
        <!--/* <![CDATA[ */
            table { border-collapse: collapse; margin-left: 1em; }
            thead tr { background-color: ActiveCaption; color: CaptionText; }
            th, td { vertical-align: top; font-size: 8pt; padding: 3px;
                font-family: "Tahoma", Arial, Helvetica, sans-serif; }
            td { border: 1px solid #c0c0c0; } /* silver */
            thead .col2 { width: 200px; }
			.bold { font-weight: bold; color: #f00; }
            h3 { border-bottom: dotted 1px #000 }
        /* ]]> */-->
    </style>
</head>
[% USE Dumper; USE date = DateTime(today = 1) %]
<body>
    <h3>Requests awaiting final diagnosis/review [[% requests.size %]]</h3>
    <table>
        <thead>
            <tr>
                <td></td>
                <th>hmds ref</th>
                <th>status</th>
				<th>reporter</th>
				<th>authoriser</th>
                <th>authorised</th>
				<th><div>outstanding</div><div>tests</div></th>
            </tr>
        </thead>
        [% FOREACH ref IN requests; # '<pre>'; Dumper.dump(ref); '</pre>'
			class = incomplete.item(ref.id) ? 'normal' : 'bold';
			delta = ref.auth_date.delta_days(date).delta_days;
		%]
            <tr class="[% class %]">
                <td>[% loop.count %]</td>
                <td>[% ref.hmds_ref %]</td>
                <td>[% ref.diagnosis %]</td>
				<td>[% ref.reporter %]</td>
				<td>[% ref.authoriser %]</td>
                <td>[% ref.auth_date.strftime('%d.%b.%Y') %] [[% delta %]]</td>
				<td align="center">[% incomplete.item(ref.id) ? 'yes' : 'no' %]</td>
            </tr>
        [% END %]
    </table>
</body>
</html>
