  [% META title = 'Resources &raquo; Teaching Cases' -%]
<!-- BEGIN [% template.title %] -->
  
  [% # PROCESS dumper.tt dump = cases %]

	<h2 align="center">Teaching cases</h2>

    <form action="[% app_url%]/resources/teaching_cases" method="post">
        <h3>
            For past [% c.stash.duration %] days or enter new:
            <input type="text" name="duration" size="2" />
            [% site.html.go_btn %]
        </h3>
    </form>

	[% IF cases.size # only empty if new db %]
        [% PROCESS site/page_count.tt %]
		<table>
			<tr>
				<th></th>
				<th>Lab. No.</th>
				<th>Diagnosis</th>
				<th>Auth. Date</th>
				<th>Status</th>
			</tr>

			[% FOREACH data IN cases %]
			<tr>
				<td>
                    [% IF cgi_pager; cgi_pager.first_pos_displayed + loop.count - 1; ELSE; loop.count; END %]
                </td>
                <td>[% INCLUDE site/lab_number.tt want_url = 1 %]</td>
				<td>[% data.diagnosis | html %]</td>
				<td>[% date = data.auth_date.split('-'); date.reverse.join('.') %]</td>
				<td>[% data.status %]</td>
			 </tr>
			[% END %]
		</table>
	[% END %]

    [% PROCESS site/cgi_pager.tt %]
<!-- END [% template.title %] -->
