[% META title="Sample storage" %] [% # PROCESS dumper.tt dump = specimen_map %] [% # PROCESS dumper.tt dump = storage %] [% # PROCESS dumper.tt dump = c.stash.errs %] [% # PROCESS dumper.tt dump = menu_options %] [% # 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; sample_codes = specimen_map.item(data.id).sample_code; %]

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

Current stock

Number of vials in store: [% available.size %]

[% IF storage.size %] [% FOREACH item IN storage; # PROCESS dumper.tt dump = item.as_tree class = item.signed_out ? 'grey' : 'normal'; %] [% END %]
Specimen Vial ID Sample Source Volume Concn Method In Out
[% loop.count %] [% item.specimen.sample_code %] [% item.vialId %] [% item.sample %] [% item.source || site.html.grey_null %] [% IF item.volume; item.volume; 'µL'; ELSE; site.html.grey_null; END %] [% IF item.concentration; item.concentration; 'ng/µL'; ELSE; site.html.grey_null; END %] [% item.method || site.html.grey_null %] [% item.created_at.strftime('%d.%b.%Y') %] [% item.signed_out.strftime('%d.%b.%Y') %] [edit]
[% END %]

Input new vial [% div_name = 'input'; INCLUDE site/snippets/toggleview.tt %]

Scan multiple vials consecutively (no spaces):

[% display = c.query.param('sample').match('[rd]na') ? 'visible' : 'none' %]
Vial ID(s): [% IF error_vialId; error_vialId; ELSIF NOT c.query.param('vialId') %] « place cursor here to scan barcode [% END %]
Specimen: [% FOREACH s IN sample_codes; # PROCESS dumper.tt dump = s %]
[% END %]
[% error_specimen %]
Sample: [% error_sample %]
Source: [% error_source %]
Volume: [% error_volume %]
Concentration: [% error_concentration %]
Extraction
method:
[% error_method %]
[% site.html.submit %] [% site.html.reset %]
[% IF available.size %]

Output vial

[% IF error; # PROCESS dumper.tt dump = error %]

ERROR: [% error %]

[% END %]
Available vials to sign out: [% available.join(', ') %]

VialId: [% IF error_vialId; error_vialId; ELSE %] « place cursor here to scan barcode [% END %]

[% site.html.submit %]

[% END %]