RSS Git Download  Clone
Raw Blame History
    [% META title="Sample storage" %]
<!-- BEGIN [% template.name %] -->
    [% # PROCESS dumper.tt dump = specimen_map %]
    [% # PROCESS dumper.tt dump = specimens %]
    
  [% # define some data structures:
        # c.debug('##############'); # to reveal any db calls from templates
    data = request_data;
    patient = request_data.patient_case.patient; # not as_tree - preserve datetime objects;
    specimens = specimen_map.item(data.id).sample_code;
  %]

    <h2>
        Sample storage on [% patient.last_name | upper %],
        [% format_firstname(patient) || patient.first_name | ucfirst %]
        [ [% PROCESS site/lab_number.tt %] ]
    </h2>

    <h3 class="header">Current stock</h3>
    
    <p class="info indent">Number of vials in store: [% storage.size || 0 %]</p>
    
    [% IF storage.size %]
        <table class="indent">
            <tr>
                <td class="borderless"></td>
                <th>Specimen</th>
                <th>Vial ID</th>
                <th>In</th>
                <th>Out</th>
                <td class="borderless"></td>
            </tr>
        [% FOREACH item IN storage %]
            <tr>
                <td>[% loop.count %]</td>
                <td>[% item.specimen.sample_code %]</td>
                <td>[% item.vialId %]</td>
                <td>[% item.created_at.strftime('%d.%b.%Y') %]</td>
                <td>[% item.signed_out.strftime('%d.%b.%Y') %]</td>
                <td><a href="">[edit]</a></td>
            </tr>
        [% END %]
        </table>
    [% END %]
    
    <h3 class="header">Input new vial</h3>
    
    <form action="[% app_url %]/storage/input/[% data.id %]" method="post">
        <table class="indent">
            <tr>
                <td>
                [% FOREACH s IN specimens %]
                  <div>
                    <label><input type="radio" name="specimen" value="[% s %]"
                      [% IF specimens.size == 1; 'checked=1'; END %]  />
                        [% s %]</label>
                  </div>
                [% END %]
                </td>
                <td><input type="text" name="vialId" /></td>
                <td class="borderless">
                    <span class="error">&#171; place cursor here to scan</span>
                    [% site.html.submit %] [% site.html.reset %]
                </td>
            </tr>
        </table>
    </form>

    [% IF storage.size %]    
    <h3 class="header">Output vials</h3>
    <form action="[% app_url %]/storage/output/[% data.id %]" method="post">
        
    </form>
    [% END %]

<!-- END [% template.name %] -->