Add budget graph

This commit is contained in:
Frederic Guillot
2015-03-22 18:44:45 -04:00
parent 373537efe2
commit 72de621d77
29 changed files with 725 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
<?= $this->js('assets/js/vendor/d3.v3.4.8.min.js') ?>
<?= $this->js('assets/js/vendor/dimple.v2.1.0.min.js') ?>
<?= $this->js('assets/js/vendor/dimple.v2.1.2.min.js') ?>
<section id="main">
<div class="page-header">

View File

@@ -47,6 +47,10 @@
<i class="fa fa-line-chart fa-fw"></i>
<?= $this->a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?>
</li>
<li>
<i class="fa fa-pie-chart fa-fw"></i>
<?= $this->a(t('Budget'), 'budget', 'index', array('project_id' => $project['id'])) ?>
</li>
<li>
<i class="fa fa-cog fa-fw"></i>
<?= $this->a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?>

View File

@@ -1,3 +1,6 @@
<?= $this->js('assets/js/vendor/d3.v3.4.8.min.js') ?>
<?= $this->js('assets/js/vendor/dimple.v2.1.2.min.js') ?>
<div class="page-header">
<h2><?= t('Budget') ?></h2>
<ul>
@@ -6,4 +9,27 @@
</ul>
</div>
<p><?= t('Current budget: ') ?><strong><?= n($total) ?></strong></p>
<?php if (! empty($daily_budget)): ?>
<div id="budget-chart">
<div id="chart"
data-serie='<?= json_encode($daily_budget) ?>'
data-labels='<?= json_encode(array('in' => t('Budget line'), 'out' => t('Expenses'), 'left' => t('Remaining'), 'value' => t('Amount'), 'date' => t('Date'), 'type' => t('Type'))) ?>'></div>
</div>
<hr/>
<table class="table-fixed table-stripped">
<tr>
<th><?= t('Date') ?></td>
<th><?= t('Budget line') ?></td>
<th><?= t('Expenses') ?></td>
<th><?= t('Remaining') ?></td>
</tr>
<?php foreach ($daily_budget as $line): ?>
<tr>
<td><?= $this->e($line['date']) ?></td>
<td><?= n($line['in']) ?></td>
<td><?= n($line['out']) ?></td>
<td><?= n($line['left']) ?></td>
</tr>
<?php endforeach ?>
</table>
<?php endif ?>