RSS Git Download  Clone
Raw Blame History
  [% META title = 'Resources » Dashboard View' -%]

<!-- BEGIN [% template.name %] -->
	[% addcss =	[ 'dashboard.css?v1.4' ] %]

  [% # INCLUDE dumper.tt dump = data %]
  [% # INCLUDE dumper.tt dump = data.incomplete_section_tests %]

	[% # some common data blocks:
		lab_test_data = data.incomplete_section_tests %]
    [% BLOCK series_data;
        total = 0;
        FOREACH test IN section.value;
            total = total + data.sum_this(test.value);
        END;
        id = section.key.replace(' ','-').lower;
    %]
        {
            name: '[% section.key %]',
            y: [% total %],
            drilldown: '[% id %]'
        },
  [% END %]

  [% BLOCK drilldown_series_data;
    # '+' chars for html source readability
    # omit trailing comma on data block for IE8-compatibility
  %]
    ['[% test.key %]',[% data.sum_this(test.value) %]][% ',' UNLESS loop.last +%]
  [% END %]

  <script src="/js/highcharts.js"></script>
  <script src="/js/jquery.timeago.js"></script>
	
  <script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery("abbr.timeago").timeago();
    });
  </script>

  <form action="[% c.query.self_url %]">
    <div style="margin-top: -10px; text-align: right">Last updated:
      <abbr class="timeago" title="[% USE date; date.format %]">
		    <!--[if IE]>[% date.format %]<![endif]-->
			</abbr>
      <input type='submit' value='Refresh' />
    </div>
  </form>

  <h3 style="margin-top: -5px" class="header">Request status:</h3>

	[% BLOCK urgent %]
    <!--<i class="fa fa-taxi"></i> -->Urgent
    <span class="label label-[% data.urgent ? 'my-red' : 'inverse' %]">
			[% data.urgent || 0 %]</span>
	[% END; BLOCK unscreened %]
    <!--<i class="fa fa-th-list"></i> -->Unscreened
    <span class="label label-[% data.unscreened ? 'my-green' : 'inverse' %]">
			[% data.unscreened || 0 %]</span>
	[% END; BLOCK unreported %]
    <!--<i class="fa fa-plug"></i> -->Screened
		<!-- &gt;[% c.cfg('settings').unreported_duration %]d -->
    <span class="label label-[% data.unreported ? 'my-orange' : 'inverse' %]">
			[% data.unreported || 0 %]</span>
	[% END; BLOCK unreported_tests_complete %]
    <!--<i class="fa fa-chain"></i> -->Tests complete
    <span class="label label-[% data.unreported_tests_complete ? 'my-pink' : 'inverse' %]">
		[% data.unreported_tests_complete || 0 %]</span>
	[% END; BLOCK unauthorised %]
    <!--<i class="fa fa-tags"></i> -->Unauthorised
    <span class="label label-[% data.unauthorised ? 'info' : 'inverse' %]">
		[% data.unauthorised || 0 %]</span>
	[% END; BLOCK incomplete %]
    <!--<i class="fa fa-fax"></i> -->Incomplete
    <span class="label label-[% data.incomplete ? 'my-purple' : 'inverse' %]">
			[% ( data.incomplete - data.complete ) || 0 %]</span>
	[% END; BLOCK complete %]
    <!--<i class="fa fa-fax"></i> -->Tests complete
    <span class="label label-[% data.incomplete ? 'my-purple' : 'inverse' %]">
			[% data.complete || 0 %]</span>
	[% END %]

	[% rs_url = app_url _ '/worklist/request_status' %]
	<div class="dashboard">
		<section class="file-marker">
			<div>
				<div class="box-title">Unreported</div>
				<div class="box-contents">
					<ul class="nav nav-pills">
						<li>
						  [% IF data.unscreened;
								USE url(rs_url, status_query = 'unscreened') %]
							<a href="[% url %]">[% INCLUDE unscreened %]</a>
						  [% ELSE %]<div>[% INCLUDE unscreened %]</div>[% END %]
						</li>
						<li>
						  [% IF data.unreported;
								USE url(rs_url, status_query = 'unreported') %]
							<a href="[% url %]">[% INCLUDE unreported %]</a>
						  [% ELSE %]<div>[% INCLUDE unreported %]</div>[% END %]
						</li>
						<li>
						  [% IF data.unreported_tests_complete;
								USE url(rs_url, status_query = 'unreported_tests_complete') %]
							<a href="[% url %]">[% INCLUDE unreported_tests_complete %]</a>
						  [% ELSE %]<div>[% INCLUDE unreported_tests_complete %]</div>[% END %]
						</li>
					</ul>
				</div>
			</div>
		</section>

  [% IF has_authorisation # only if authorisation stage in use %]
		<section class="file-marker">
			<div>
				<div class="box-title">Reported</div>
				<div class="box-contents">
					<ul class="nav nav-pills">
						<li>
						  [% IF data.unauthorised;
								USE url(rs_url, status_query = 'unauthorised') %]
							<a href="[% url %]">[% INCLUDE unauthorised %]</a>
						  [% ELSE %]<div>[% INCLUDE unauthorised %]</div>[% END %]
						</li>
					</ul>
				</div>
			</div>
		</section>
  [% END %]

		<section class="file-marker">
			<div>
				<div class="box-title">
          [% has_authorisation ? 'Authorised' : 'Reported' %]
        </div>
				<div class="box-contents">
					<ul class="nav nav-pills">
						<li>
						  [% IF data.incomplete - data.complete;
								USE url(rs_url, status_query = 'incomplete') %]
							<a href="[% url %];filter=with_incomplete_tests">
								[% INCLUDE incomplete %]</a>
						  [% ELSE %]<div>[% INCLUDE incomplete %]</div>[% END %]
						</li>
						<li>
						  [% IF data.complete;
								USE url(rs_url, status_query = 'incomplete') %]
							<a href="[% url %];filter=no_incomplete_tests">
								[% INCLUDE complete %]</a>
						  [% ELSE %]<div>[% INCLUDE complete %]</div>[% END %]
						</li>
					</ul>
				</div>
			</div>
		</section>
	</div>

	<div class="indent" id="nav-header">
	  <p>Total unreported screened requests:
	    [% width = 0 # start at zero with min width 25px: %]
			<span class="badge" style="width: [% width %]px; min-width: 25px">
				[% ( data.unscreend || 0 ) + ( data.unreported || 0 )
				+ data.unreported_tests_complete || 0 %]
			</span>	  
	  </p>

	[% BLOCK not_required_1 %]<!--
	<ul>
	  <li>&gt; [% c.cfg('settings').unreported_duration %] days old
		  [%
				width = data.unreported * 2;
				class = data.unreported ? 'badge badge-my-orange' : 'badge';
		  %]
		  <span class="[% class %]" style="width: [% width %]px;
			min-width: 25px; position: absolute; left: 240px">
			[% data.unreported || 0 %]</span>
		</li>
		<li>tests complete
		  [%
				width = data.unreported_tests_complete * 2;
				class = data.unreported_tests_complete ? 'badge badge-my-pink' : 'badge';
		  %]
		  <span class="[% class %]" style="width: [% width %]px;
				min-width: 25px; position: absolute; left: 240px">
			[% data.unreported_tests_complete || 0 %]</span>
		</li>
	</ul>-->
	[% END; # INCLUDE not_required_1 %]
	
	  <p>Total reported incomplete requests:
	    [% width = 0 # start at zero with min width 25px: %]
		<span class="badge" style="width: [% width %]px; min-width: 25px">
		  [% ( data.unauthorised || 0 ) + ( data.incomplete || 0 ) %]</span>
	  </p>

	[% BLOCK not_required_2 %]<!--
	<ul>
	  <li>unauthorised
		  [%
				width = data.unauthorised * 2;
				class = data.unauthorised ? 'badge badge-info' : 'badge';
		  %]
		  <span class="[% class %]" style="width: [% width %]px; min-width: 25px;
				position: absolute; left: 240px">[% data.unauthorised || 0 %]</span>
		</li>
		<li>authorised &nbsp;&nbsp;&nbsp;
		  [%
				width = data.incomplete * 2;
				class = data.incomplete ? 'badge badge-my-purple' : 'badge';
		  %]
		  <span class="[% class %]" style="width: [% width %]px; min-width: 25px;
				position: absolute; left: 240px">[% data.incomplete || 0 %]</span>
		</li>
	</ul>-->
	[% END; # INCLUDE not_required_2 %]

	  <p>Incomplete urgent requests:
			<span class="badge [% 'badge-my-red' IF data.urgent %]"
				style="width: 25px">[% data.urgent || 0 %]
			</span>
		[% IF data.urgent;		
			USE url(app_url _ '/worklist/request_status', status_query = 'urgent');
		%]
			<a href="[% url %]"><i class="fa fa-list-ol fa-lg"></i></a>[% END %]		
	  </p>
	</div>
	
  [% IF data.local_dashboard; # only set in controller if local_dashboard.yml exists
		centre = c.cfg('settings').item('_centre') || argv; # argv from index.html ssi exec cmd
		# tt_dir = c.cfg('path_to_app_root') _ '/templates/resources/dashboard/local';
		# TRY; USE File("${tt_dir}/.${centre}"); # don't need this if testing for data.local_dashboard
		# CATCH File; skip_local_dashboard = 1; END; # skip_local_dashboard = 'true' if no file
		PROCESS "resources/dashboard/local/.${centre}"; # UNLESS skip_local_dashboard;
		END;
  %]

	<h3 class="header">Incomplete lab-tests:</h3>

  <p class="title indent">Lab sections - incomplete tests:
	  [% div_name = 'incomplete'; INCLUDE site/snippets/toggleview.tt %]
	</p>

	<!-- drilldown chart needs initial display = itemshow or get miniture chart size -->
  <div id="[% div_name %]" class="indent itemshow">
	  [% INCLUDE resources/dashboard/drilldown.tt %]
	</div>

	[% BLOCK not_required_3 # same data as 'Lab sections - incomplete tests' display after drilldown %]
		<p class="title indent">Lab sections - totals for lab-tests:
		  [% div_name = 'test-totals'; INCLUDE site/snippets/toggleview.tt %]
		</p>
		<div id="[% div_name %]" class="indent itemhidden">
		  [% INCLUDE resources/dashboard/test_totals.tt %]
		</div>
	[% END; # INCLUDE not_required_3 %]

  <p class="title indent">Lab sections - lab-test status:
    [% div_name = 'tests-status'; INCLUDE site/snippets/toggleview.tt %]
  </p>

  <div id="[% div_name %]" class="indent itemhidden">
		[% INCLUDE resources/dashboard/test_status.tt %]
	</div>
<!-- END [% template.name %] -->