<!-- BEGIN [% component.name %] -->
    [% # PROCESS dumper.tt dump = outreach %]

	[% user_can_enter_data = # 1;
        c.user_can('edit_outreach_data') # can edit outreach data
            AND patient.nhs_number # MUST have primary identifier (NHS No)
            AND NOT is_locked ? 1 : 0; # not already locked
    %]

    [% BLOCK outreach_submit;
		IF user_can_enter_data %]
			<input type="submit" value="Update" class="[% button_class || 'button' %]" />
            [% IF require_reset; site.html.reset; END %]
        [% END %]
	  [% END %]

    [% BLOCK th_default_val;
        IF lab_data.item(param).default;
            default_value = 100 * lab_data.item(param).default / 100;
            class = default_value ? 'acronym' : 'normal'; # redefine class OK here
            title = default_value ? "default value: ${default_value}" : '';
        %]
          <a href="#" onclick="javascript:set_proposed('#[% param %]',
             '[% default_value %]'); return false">
            <span class="[% class %]" title="[% title %]">
              [% lab_data.item(param).field_label %]
            </span>
          </a>
        [% ELSE; lab_data.item(param).field_label; END %]
    [% END %]

	<script language="javascript" type="text/javascript">
		<!--
		function set_proposed(id, proposed) { $(id).val(proposed) }
		-->
	</script>

    [%  required_fields = { # for use with missing_fields() callback:
            demographics = ['address' 'post_code' 'contact_number' 'gp_id'
                            'practice_id'],
            symptoms = ['pain' 'night_sweats' 'weight_loss' 'adenopathy'],
            service  = ['opinion'],
            eq5d     = ['usual_activity' 'health_index' 'anxiety', 'mobility'
                        'self_care' 'discomfort'],
        };
    %]

    <p class="title"><!-- demographics -->
        [%
            img_name = missing_fields(required_fields.demographics, outreach.demographics)
                ? 'question' : 'tick';
        %]
        <img src="/images/[% img_name %].gif" alt="" />
        Demographics [% div_name = 'demographics'; INCLUDE site/snippets/toggleview.tt %]
    </p>

    <div id="[% div_name %]" class="itemhidden">
        [% INCLUDE outreach/demographics.tt %]
    </div>

    <p class="title"><!-- questionnaire -->
        [%
            questionnaire = outreach.questionnaire; # INCLUDE dumper.tt dump = questionnaire;
            missing_questionnaire_fields
                = missing_fields(required_fields.symptoms, questionnaire.symptoms)
                + missing_fields(required_fields.service, questionnaire.service)
                + missing_fields(required_fields.eq5d, questionnaire.eq5d);
            img_name = missing_questionnaire_fields ? 'question' : 'tick';
        %]
        <img src="/images/[% img_name %].gif" alt="" />
        Questionnaire [% div_name = 'questionnaire'; INCLUDE site/snippets/toggleview.tt %]
    </p>

    <div id="[% div_name %]" class="itemhidden">
        [% INCLUDE outreach/questionnaire.tt %]
    </div>

    <p class="title"><!-- haematology -->
        [% img_name = incomplete_dataset(outreach.haematology) ? 'question' : 'tick' %]
        <img src="/images/[% img_name %].gif" alt="" />
        Haematology [% div_name = 'haematology'; INCLUDE site/snippets/toggleview.tt %]
    </p>

    <div id="[% div_name %]" class="itemhidden">
        [% INCLUDE outreach/haematology.tt %]
    </div>

    <p class="title"><!-- flow cytometry -->
        [% img_name = incomplete_dataset(outreach.flow_cytometry) ? 'question' : 'tick' %]
        <img src="/images/[% img_name %].gif" alt="" />
        Flow cytometry [% div_name = 'flow'; INCLUDE site/snippets/toggleview.tt %]
    </p>

    <div id="[% div_name %]" class="itemhidden">
        [% INCLUDE outreach/flow_cytometry.tt %]
    </div>

    <p class="title"><!-- biochemistry -->
        [% img_name = incomplete_dataset(outreach.biochemistry) ? 'question' : 'tick' %]
        <img src="/images/[% img_name %].gif" alt="" />
        Biochemistry [% div_name = 'biochemistry'; INCLUDE site/snippets/toggleview.tt %]
    </p>

    <div id="[% div_name %]" class="itemhidden">
        [% INCLUDE outreach/biochemistry.tt %]
    </div>

    <p class="title"><!-- immunology -->
        [% img_name = incomplete_dataset(outreach.immunology) ? 'question' : 'tick' %]
        <img src="/images/[% img_name %].gif" alt="" />
        Immunology [% div_name = 'immunology'; INCLUDE site/snippets/toggleview.tt %]
    </p>

    <div id="[% div_name %]" class="itemhidden">
        [% INCLUDE outreach/immunology.tt %]
    </div>
<!-- END [% component.name %] -->
