FEATURE: differentiate total and total for period on admin table report

This commit is contained in:
Joffrey JAFFEUX
2018-06-21 22:46:53 +02:00
committed by GitHub
parent c2ddad696f
commit fed86225c8
4 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,9 @@
import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
@computed("model.sortedData")
totalForPeriod(data) {
const values = data.map(d => d.y);
return values.reduce((sum, v) => sum + v);
}
});

View File

@@ -14,10 +14,19 @@
</tr>
{{/each}}
<tr class="total-for-period">
<td class="x-value">
{{i18n 'admin.dashboard.reports.total_for_period'}}
</td>
<td>
{{totalForPeriod}}
</td>
</tr>
{{#if model.total}}
<tr class="total-for-period">
<tr class="total">
<td class="x-value">
{{i18n 'admin.dashboard.reports.total_for_period'}}
{{i18n 'admin.dashboard.reports.total'}}
</td>
<td>
{{model.total}}

View File

@@ -178,7 +178,8 @@ $mobile-breakpoint: 700px;
}
}
tr.total-for-period {
tr.total-for-period,
tr.total {
td {
font-weight: 700;
}