red/green total in tooltip

This commit is contained in:
Gwenhael Le Moine 2018-05-19 10:54:11 +02:00
parent 08861e44bc
commit bbbc714f68
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
3 changed files with 15 additions and 13 deletions

View file

@ -14,7 +14,7 @@ pull-deps:
cd public/vendor; npm install
clean:
-rm public/js/app.min.js public/js/app.js
-rm public/js/app.min.js public/js/app.js credger
clean-all:
-rm -fr lib/ public/vendor/node_modules

View file

@ -94,19 +94,21 @@ app.component('dashboard',
return series.filter((s) => { return s.value != 0; });
};
return `
let total = e.series.reduce((memo, serie) => { return memo + serie.value; }, 0);
return `
<h2>${e.value}</h2>
<table>
<tbody>
${prepare_series(e.series).map((s) => { return format_line(s); }).join("")}
</tbody>
<tfoot>
<tr>
<td> </td>
<td style="text-align: right; text-decoration: underline; font-weight: bold;">Total</td>
<td style="text-align: right; font-weight: bold;">${e.series.reduce((memo, serie) => { return memo + serie.value; }, 0)}</td>
</tr>
</tfoot>
<tbody>
${prepare_series(e.series).map((s) => { return format_line(s); }).join("")}
</tbody>
<tfoot>
<tr style="color: #ececec; background-color: ${total < 0 ? 'green' : 'red'}">
<td> </td>
<td style="text-align: right; text-decoration: underline; font-weight: bold;">Total</td>
<td style="text-align: right; font-weight: bold;">${total}</td>
</tr>
</tfoot>
</table>
`;
}

View file

@ -2,7 +2,7 @@ version: 1.0
shards:
kemal:
github: kemalcr/kemal
commit: 8cb9770ec3c6cf5897e644229dad8d0b5c360941
commit: 50f82f51874babe92cbb808013647a7989d54354
kilt:
github: jeromegn/kilt