RSS Git Download  Clone
Raw Blame History
[% # INCLUDE dumper.tt dump = data.packs;
    USE today = DateTime(today = 1); # INCLUDE dumper.tt dump = today;
%]

    <div class="panel panel-info">
      <div class="panel-heading">
        <h4 class="panel-title">Your current status</h4>
      </div>
      <div class="panel-body">
        [% current = data.packs.first; # INCLUDE dumper.tt dump = current %]
        [% IF current.request_status.match('complete') %]
            [% IF current.pack_due >= today %]
              <span class="text-success">
                Next assessment is due on [% current.pack_due.strftime('%d.%b.%Y') %]
              </span>
            [% ELSIF current.pack_sent < today;
              delta_pack_sent = current.pack_sent.delta_days(today).delta_days;
                # INCLUDE dumper.tt dump = delta_pack_sent; %]
              <span class="text-danger">
                A pack was sent on [% current.pack_sent.strftime('%d.%b.%Y') %]
                [[% delta_pack_sent %] days ago] but has not been received.
                [% IF delta_pack_sent > 2 %]Please call us to discuss.[% END %]
              </span>
            [% ELSE %]** current request status complete but pack_due not &ge; today
                and pack_sent not %lt; today **
            [% END %]
        [% ELSIF current.request_status.match('new') %]
          <span class="text-success">
            A pack was received on [% current.registered.strftime('%d.%b.%Y') %] and
            laboratory tests have been initiated.
          </span>
        [% ELSIF current.request_status.match('screened') %]
          <span class="text-success">
            A pack was received on [% current.registered.strftime('%d.%b.%Y') %] and
            initial results indicate that no urgent action is required. It may take
            three weeks to obtain all the laboratory test results but we will contact
            your GP if there are any issues.
          </span>
        [% ELSE %]** current request status is not complete **
        [% END %]
      </div>
    </div>

    <div class="indent">
        <button class="btn btn-primary" type="button" data-toggle="collapse"
            data-target="#recentpacks" aria-expanded="false"
            aria-controls="recentpacks">view your [% data.packs.size %] most
            recent pack[% 's' IF data.packs.size > 1 %]
        </button>
    </div>

    <div class="collapse" id="recentpacks">
      <div class="indent well">
        <table class="table table-striped table-condensed indent packs">
            <tr>
                <th>Pack</th>
                <th>Received</th>
                <th>Lab number</th>
                <th>Action</th>
                <th>Pack sent</th>
            </tr>
            [% FOREACH entry IN data.packs.reverse; # because data collected in reverse order
                NEXT IF entry.option.match('dead'); # oops
            %]
                <tr class="[% loop.last ? 'text-success bold' : 'normal' %]">
                    <td>#[% loop.count %]</td>
                    <td>[% entry.registered.strftime('%d.%b.%Y') %]</td>
                    <td>[% entry.request_number %]/[% use String(entry.year - 2000);
                      String.format('%02d') %]</td>
                    <td>
                        [%
                            IF entry.option.match('month'); 'next pack ';
                              UNLESS entry.label.match('immediate'); 'in '; END;
                            END;
                            entry.outcome;
                        %]
                    </td>
                    <td>
                        [% # INCLUDE dumper.tt name = loop.count dump = entry.pack_due >= date;
                            IF entry.option.match('clinic_return'); '[not required]';
                            ELSIF entry.pack_due AND entry.pack_due >= today;
                              '[ due '; entry.pack_due.strftime('%d.%b.%Y'); ' ]';
                            ELSIF entry.pack_sent;
                              entry.pack_sent.strftime('%d.%b.%Y');
                            END;
                        %]
                    </td>
                </tr>
            [% END %]
        </table>
      </div>
    </div>