Skip to content

Commit

Permalink
Fix stats table for various ali layouts (#4880)
Browse files Browse the repository at this point in the history
fix stats table for different alis
  • Loading branch information
kflemin authored Nov 8, 2024
1 parent adb3caa commit de11e2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 10 additions & 0 deletions seed/static/seed/js/controllers/inventory_reports_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ angular.module('SEED.controller.inventory_reports', []).controller('inventory_re
$scope.filter_groups = filter_groups;
$scope.report_configurations = report_configurations;
$scope.filter_group_id = null;

$scope.has_children = (obj) => {
// check if the access level selected has children levels for stats table
let children = false;
if ('children' in obj && Object.keys(obj.children).length > 0) {
children = true;
}
return children;
};

function path_to_string(path) {
const orderedPath = [];
for (const i in $scope.level_names) {
Expand Down
5 changes: 2 additions & 3 deletions seed/static/seed/partials/inventory_reports.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,13 @@ <h4 class="chartTitle">Statistics</h4>
<th translate width="5%">Max</th>
</tr>
</thead>
<tbody ng-repeat="(key, values) in vals track by $index" ng-init="childIndex = $index">
<tbody ng-repeat="(key, values) in vals track by $index" ng-init="childIndex = $index;">
<tr>
<td style="font-weight: bold">{$ key $}</td>
<td style="font-weight: bold" ng-repeat="item in values['values'] track by $index" ngInit="colIndex = $index">
<span ng-if="key === 'Year Built'"> {$ item $} </span>
<span ng-if="key != 'Year Built'"> {$ item | tolerantNumber:2 $} </span>
<span ng-if="$index === 0">
<!-- && values['children'].length > 0 -->
<span ng-if="$index === 0 && has_children(values)">
<button
id="collapse-{$ parentIndex $}-{$ $index $}"
type="button"
Expand Down

0 comments on commit de11e2a

Please sign in to comment.