RSS Git Download  Clone
Raw Blame History
[% META title = 'Resources » User Workload' %]

<!-- BEGIN [% template.name %] -->
    [% # PROCESS dumper.tt dump = data %]
    
    [%
        USE Math;
        actions = data.keys;
        cols = ['BMAT' 'BMA' 'PB' 'Tissue' 'Other'];
    %]
    
    <form action="[% app_url%]/audit/user_workload" method="post">
        <h3>
            Workload by user for past [% c.stash.duration %] days
            or enter new: <input type="text" name="duration" size="2" />
            [% site.html.go_btn %]
        </h3>
    </form>
    
    <div class="indent">
        [% FOREACH action IN actions.sort.reverse; # happy co-incidence !!
            users = data.item(action); # PROCESS dumper.tt dump = users;
            total = 0; # total units in each action
            FOREACH user IN users.keys; 
                count = sum(data.item(action).item(user).values); 
                total = total + count;
            END;
        %]
            <h4>[% action | ucfirst %] [[% total %]]</h4>
            <table class="indent tbl_header_darken">
                <tr>
                    <th>UserID</th>
                    [% FOREACH col IN cols %]
                        <th>[% col %]</th>
                    [% END %]
                    <th>Total</th>
                </tr>
                
                [% FOREACH user IN users.keys.sort; 
                    results = data.item(action).item(user);
                    class = c.authen.username == user
                        ? 'bkgd_light_yellow' : 'normal';
                %]
                <tr class="[% class %]">
                    <td class="label">[% user | upper %]</td>
                    [% FOREACH col IN cols %]
                        <td align="center">
                            [% results.item(col) || site.html.grey_null %]
                        </td>
                    [% END %]
                    <td class="bold" align="center">
                        [% n = sum(results.values); # PROCESS dumper.tt dump = results.values %]
                        [% n %] ([% Math.int(100 * n / total) %]%)
                    </td>
                </tr>
                [% END %]
            </table>
        [% END %]
    </div>
    <p>[% site.html.back_button %]</p>
<!-- END [% template.name %] -->