RSS Git Download  Clone
Raw Blame History
  [% # INCLUDE dumper.tt dump = pds %]
  [% # INCLUDE dumper.tt dump = params %]
  [% # INCLUDE dumper.tt dump = errs %]

  <div class="container">
    <div class="row">
        <a name="top">
          <img src="[% request.uri_base %]/images/logo.jpg" title="LCC Logo"
              border="0" align="right" alt="LCC Logo"/>
        </a>
    </div>

    <div class="row">
      <form class="form-horizontal" action="/" method="post">
        <!-- Form Name -->
        <legend>HMDS Request Form</legend>

        <h4><a href="#" id="is_trial">Request IS for clinical trial</a></h4>
        <div id="trial-content" style="display: none;">
            <p class="text-warning indent">
                Please use specific clinical trial request form.
            </p>
        </div>
        
        <h4><a href="#" id="non_trial">Request is NOT for clinical trial</a></h4>
        [% IF errs %]
            <p class="dfv-err">Form validation failed, please correct error(s) below:</p>
        [% ELSIF pds.size; PROCESS pds.tt; END %]

        [% IF params.item('_skip_pds') || is_validated; # latter set in pds.tt if SMSP-0000
            generate_pdf = 1; # flag for submit button control %]
            <input type="hidden" name="generate_pdf" value="1" />
            <div class="row indent">
                <p class="bg-success col-md-6">Form passed validation. Please check
                details are correct and re-submit. Then print the request form
                with barcode and send with your specimen(s) to the laboratory at
                the address provided.</p>
            </div>
        [% END %]

        <div id="non-trial-content" class="indent" [% # auto-open if form submission:
                UNLESS params.size %]style="display: none"[% END %]>
            <fieldset>       
                
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="last_name">Last name</label>  
                  <div class="col-md-4">
                    [% errs.last_name %]
                  <input id="last_name" name="last_name" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.last_name %]">
                  </div>
                </div>
        
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="first_name">Forename(s)</label>  
                  <div class="col-md-4">
                    [% errs.first_name %]
                  <input id="first_name" name="first_name" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.first_name %]">
                  </div>
                </div>
        
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="textinput">Date of Birth</label>  
                  <div class="col-md-4">
                    [% errs.day OR errs.month OR errs.year %]
                    [% INCLUDE dateselect.tt %]
                  </div>
                </div>
        
                <!-- Multiple Radios (inline) -->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="radios">Gender</label>
                  <div class="col-md-2"> 
                    [% errs.gender %]
                    <label class="radio-inline" for="gender-0">
                      <input name="gender" id="gender-0" value="M" type="radio"
                      [% 'checked' IF params.gender.match('M') %]>M
                    </label> 
                    <label class="radio-inline" for="gender-1">
                      <input name="gender" id="gender-1" value="F" type="radio"
                      [% 'checked' IF params.gender.match('F') %]>F
                    </label> 
                    <label class="radio-inline" for="gender-2">
                      <input name="gender" id="gender-2" value="U" type="radio"
                      [% 'checked' IF params.gender.match('U') %]>U
                    </label>
                  </div>
                </div>
        
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="nhs_number">NHS number</label>                    
                  <div class="col-md-4">
                    [% errs.nhs_number %]
                    <div id="nhsno_result" class="dfv-err"></div>
                  <input id="nhs_number" name="nhs_number" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.nhs_number %]">
                  </div>
                </div>
        
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="patient_number">
                    Patient/unit number
                  </label>  
                  <div class="col-md-4">
                    [% errs.patient_number %]
                  <input id="patient_number" name="patient_number" type="text"
                        placeholder="optional field" class="form-control input-md"
                        value="[% params.patient_number %]">
                  </div>
                </div>
        
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="location">
                    Referring hospital
                  </label>  
                  <div class="col-md-4">
                    [% errs.location %]
                    <input id="location" name="location_name" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.location_name %]">
                    <input type="hidden" id="location_id" name="location_id"
                        value="[% params.location_id # in case resubmitted %]" />
                  </div>
                </div>
        
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="referrer">Consultant</label>  
                  <div class="col-md-4">
                    [% errs.referrer %]
                  <input id="referrer" name="referrer" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.referrer %]">
                  </div>
                </div>
        
                <hr />
                
                <!-- Radio input-->
                <div class="form-group">
                    [% errs.doi %]
                  <label class="col-md-4" for="doi">
                    Danger of infection sample?
                  </label>  
                  <label class="radio-inline">
                      <input type="radio" name="doi" id="doi-yes" value="YES"
                        [% 'checked' IF params.doi.match('YES') %]> YES
                  </label>
                  <label class="radio-inline">
                      <input type="radio" name="doi" id="doi-no" value="NO"
                        [% 'checked' IF params.doi.match('NO') %]> NO
                  </label>
                </div>
                <!-- Radio input-->
                <div class="form-group">
                    [% errs.tb %]
                  <label class="col-md-4" for="tb">
                    Microbiological or radiological evidence of TB?
                  </label>  
                  <label class="radio-inline">
                      <input type="radio" name="tb" id="tb-yes" value="YES"
                      [% 'checked' IF params.tb.match('YES') %]> YES
                  </label>
                  <label class="radio-inline">
                      <input type="radio" name="tb" id="tb-no" value="NO"
                        [% 'checked' IF params.tb.match('NO') %]> NO
                  </label>
                </div>
                <!-- Radio input-->
                <div class="form-group">
                    [% errs.previous %]
                  <label class="col-md-4" for="previous">
                    Previously investigated by HMDS?
                  </label>  
                  <label class="radio-inline">
                      <input type="radio" name="previous" id="previous-yes" value="YES"
                        [% 'checked' IF params.previous.match('YES') %]> YES
                  </label>
                  <label class="radio-inline">
                      <input type="radio" name="previous" id="previous-no" value="NO"
                        [% 'checked' IF params.previous.match('NO') %]> NO
                  </label>
                  <label class="radio-inline">
                      <input type="radio" name="previous" id="previous-unknown" value="UNKNOWN"
                        [% 'checked' IF params.previous.match('UNKNOWN') %]> UNKNOWN
                  </label>
                </div>
        
                <hr />

                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="specimen">
                    Specimen type(s)
                  </label>  
                  <div class="col-md-4">
                    [% errs.specimen %]
                  <input id="specimen" name="specimen" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.specimen %]">
                  </div>
                </div>

                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="sample_ref">
                    Sample ref
                  </label>  
                  <div class="col-md-4">
                    [% errs.sample_ref %]
                  <input id="sample_ref" name="sample_ref" placeholder="optional field"
                        class="form-control input-md" type="text"
                        value="[% params.sample_ref %]">
                  </div>
                </div>
                
                <!-- Text input-->
                    <!-- // combined with clinical details:
                <div class="form-group">
                  <label class="col-md-2 control-label" for="diagnosis">
                    Suspected diagnosis
                  </label>  
                  <div class="col-md-4">
                    [% errs.diagnosis %]
                  <input id="diagnosis" name="diagnosis" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.diagnosis %]">
                  </div>
                </div>
                    -->
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-3 control-label" for="report_to">
                    Who should report be returned to?
                  </label>  
                  <div class="col-md-4">
                    [% errs.report_to %]
                  <input id="report_to" name="report_to" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.report_to %]">
                  </div>
                </div>

                <div class="form-group">
                  <label class="col-md-2 control-label" for="clinical_details">
                    Clinical details &amp; suspected diagnosis<br />[required]
                  </label>  
                  <div class="col-md-5">
                    [% errs.clinical_details %]
                    <textarea id="clinical_details" name="clinical_details"
                        class="form-control" rows="3">[% params.clinical_details %]</textarea>
                  </div>
                </div>

                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-3 control-label" for="treatment">
                    Chemo/radiotherapy details?
                  </label>  
                  <div class="col-md-4">
                    [% errs.treatment %]
                  <input id="sample_ref" name="treatment" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.treatment %]">
                  </div>
                </div>

                <hr />
                
                <div class="form-group">
                    <label class="col-md-1 control-label" for="hb">Hb</label>
                    <div class="col-md-1">
                        [% errs.hb %]
                        <input type="text" class="form-control" id="hb"
                            name="hb" placeholder="req'd" value="[% params.hb %]">
                    </div>
                    <label class="col-md-1 control-label" for="wbc">WBC</label>
                    <div class="col-md-1">
                        [% errs.wbc %]
                        <input type="text" class="form-control" id="wbc"
                            name="wbc" placeholder="req'd" value="[% params.wbc %]">
                    </div>
                    <label class="col-md-1 control-label" for="wbc">Plts</label>
                    <div class="col-md-1">
                        [% errs.plt %]
                        <input type="text" class="form-control" id="plt"
                            name="plt" placeholder="req'd" value="[% params.plt %]">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-1 control-label" for="lymphs">Lymphs</label>
                    <div class="col-md-1">
                        [% errs.lymphs %]
                        <input type="text" class="form-control" id="lymphs"
                            name="lymph" value="[% params.lymph %]">
                    </div>
                    <label class="col-md-1 control-label" for="neut">Neut</label>
                    <div class="col-md-1">
                        [% errs.neut %]
                        <input type="text" class="form-control" id="neut"
                            name="neut" value="[% params.neut %]">
                    </div>
                    <label class="col-md-1 control-label" for="other">Other</label>
                    <div class="col-md-1">
                        [% errs.other %]
                        <input type="text" class="form-control" id="other"
                            name="other" value="[% params.other %]">
                    </div>
                </div>

                <hr />
                
                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="taken_by">
                    Specimen taken by
                  </label>  
                  <div class="col-md-4">
                    [% errs.taken_by %]
                  <input id="taken_by" name="taken_by" placeholder="full name required"
                        class="form-control input-md" required="" type="text"
                        value="[% params.taken_by %]">
                  </div>
                </div>

                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="contact">
                    Contact details
                  </label>  
                  <div class="col-md-4">
                    [% errs.contact %]
                  <input id="contact" name="contact" placeholder="required field"
                        class="form-control input-md" required="" type="text"
                        value="[% params.contact %]">
                  </div>
                </div>

                <!-- Text input-->
                <div class="form-group">
                  <label class="col-md-2 control-label" for="datetime">
                    Date &amp; time of sample
                  </label>  
                  <div class="col-md-4">
                    [% errs.datetime %]
                  <input id="datetime" name="datetime" placeholder="dd/mm/yyyy hh:mm"
                        class="form-control input-md" required="" type="text"
                        value="[% params.datetime %]">
                  </div>
                </div>

                
                <!-- Button -->
                <div class="col-sm-offset-5 control-group">
                  <label class="control-label" for="submit"></label>
                  <div class="controls">
                    [% IF generate_pdf; btn_type = 'success'; btn_label = 'Submit';
                        ELSE; btn_type = 'primary'; btn_label = 'Validate'; END %]
                    <button id="submit" name="submit"
                        class="btn btn-[% btn_type %]">[% btn_label %]</button>
                  </div>
                </div>
        
            </fieldset>
        </div>
      </form>
    </div>
  </div>
    
    <script type="text/javascript">
        $('#is_trial').click(function() {
            $('#trial-content').slideToggle('fast', function() {
                // ok
            });
            return false;
        });
        $('#non_trial').click(function() {
            $('#non-trial-content').slideToggle('fast', function() {
                // ok
            });
            return false;
        });
        // nhs number ajax validation:
        $('#nhs_number').blur(function() { // alert("Handler for .blur() called.");
            var formData = { 'nhs_number' : $('input[name=nhs_number]').val() };
            var appMethod = "[% uri_for_nhs_number_validation %]";
            $.ajax({
                url: appMethod,
                data: formData,
                type: 'post',
                dataType: 'json',
                // the response is passed to the function
                success: function( json ) { // alert(json.result);
                    $( "#nhsno_result" ).text(json.result); 
                },
            });
            // this also works as a simple 'get' request:
            // $.get( appMethod, formData )
            // .done( function(data) { $( "#nhsno_result" ).text(data) } );
        });
    </script>