<div>

    % my $modul = $c->render_to_string(inline => $c->l('quo_QUOTA_DESC'));

    <%= $modul %>

    % if (config->{debug} == 1) {
    <pre>
        <%= dumper $c->current_route %>
        <%= dumper $userAccounts %>
    </pre>
    % }

    <h2><%= l 'quo_CURRENT_USAGE_AND_SETTINGS' %></h2>

    <br>

    % my $numUsers = @$userAccounts;


    % if ($numUsers == 0){
        <div>
            <%= l 'ACCOUNT_USER_NONE' %>
        </div>
    % } else {

        % my $limit = l('quo_LIMIT_WITH_GRACE_MB'); $limit =~ s#(graceX)#<br>$1#;
        % my $absolute = l('quo_ABS_LIMIT_MB');     $absolute =~ s#(limitX)#<br>$1#;
        % my $current = l('quo_CURRENT_USAGE');     $current =~ s#(usageX)#<br>$1#;

        <table class="table table-bordered">
            <thead>
                <tr>
                    <th class="col-sm"><%= l 'ACCOUNT' %></th>
                    <th class="col-sm"><%= l 'USER_NAME' %></th>
                    <th class="col-sm"><%= $limit %></th>
                    <th class="col-sm"><%= $absolute %></th>
                    <th class="col-sm"><%= $current %></th>
                    <th class="col-sm align-middle"><%= l 'ACTION' %></th>
                </tr>
            </thead>

            <tbody>

            % foreach my $user (@$userAccounts) {

            % my $uid = getpwnam($user->key);

            % if (config->{debug} == 1) {
                UID <%= l 'quo_COULD_NOT_GET_UID' %> <%= dumper $user->key %><br>
            % }

            <br>
            % unless ($uid) {
            %     warn (l 'quo_COULD_NOT_GET_UID', $user->key);
            %     next;
            % }
            % my $name = $user->prop("FirstName")." ".$user->prop("LastName");
            % my $dev = Quota::getqcarg('/home/e-smith/files');
            % my ($bc, $bs, $bh, $bt, $ic, $is, $ih, $it) = Quota::query($dev, $uid);

                <tr>
                    <td><%= $user->key %></td>
                    <td><%= $name %></td>
                    <td><%= sprintf("%.2f", $bs / 1024 ) %></td>
                    <td><%= sprintf("%.2f", $bh / 1024 ) %></td>
                    <td><%= sprintf("%.2f", $bc / 1024 ) %></td>

                    % my $modify_text = l('MODIFY');  # Localized text
                    % my $csrf_token = "TOKEN";  # CSRF token for security
                    % my $quota_user_name = $user->key;  # quotas_entry name extracted from the data structure
                    % my $actionModify = qq{
                    % <a href="quotad?CsrfDef=$csrf_token&trt=UPD&user=$quota_user_name">
                    %   <button type='button' class="btn btn-primary btn-sm" title='$modify_text' >
                    %       $modify_text
                    %   </button>
                    % </a>
                    %};

                    <td class="align-middle"><%= $c->render_to_string(inline => $actionModify) %></td>
                </tr>
            %    }
            </tbody>
        </table>

    % }

    <%= hidden_field 'trt' => $quo_datas->{trt} %>

</div>
