[% META title="Sample storage &raquo; Delete vial" %]

<!-- BEGIN [% template.name %] -->
    [% # INCLUDE dumper.tt dump = vial.as_tree %]
    [% # INCLUDE dumper.tt dump = dfv_errs %]

    [% IF vial.vial_location %]
        <p class="warning">
            WARNING: vial has been allocated to plate [% vial.vial_location %].
            Vacant locations can be filled only by deleting and rescanning plate.
        </p>
    [% END %]

    [% IF dfv_errs %]
        <p class="error">Error: validation failed</p>
    [% END %]

	<form method="post" action="[% c.query.self_url %]" name="vial_delete"
        id="vial_delete" />
        [% IF vial.vial_location %]
            <input type="hidden" name="reason_required" value="1" />
            <p class="info">
                Reason for deletion: <input type="text" name="reason"
                    value="[% c.query.param('reason') %]" />
                [% dfv_errs.error_reason # not using check_rm() here or get infinate loop %]
            </p>
        [% END %]
        <p class="info">Scan vial barcode to confirm deletion:
            <input type="text" name="vialId" value="[% c.query.param('vialId') %]" />
            [% dfv_errs.error_vialId %]
            <input type='submit' value='Delete' name='.submit' class='button' />
        </p>
    </form>

    <p>[% site.html.back_button %]</p>
	[% PROCESS site/field_focus.tt form_name = 'vial_delete',
        field_name = 'vialId' %]
<!-- END [% template.name %] -->
