summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-03-22 18:44:45 -0400
committerFrederic Guillot <fred@kanboard.net>2015-03-22 18:44:45 -0400
commit72de621d77dc1e0fc21a2409d310d6dcdc3eee9e (patch)
treeccfe5d7c21961a60c60938c41dd30c16a6ecfd5d /app/Template
parent373537efe2f893f91f11c04436073bbb2c2732dd (diff)
Add budget graph
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/analytic/layout.php2
-rw-r--r--app/Template/board/filters.php4
-rw-r--r--app/Template/budget/index.php28
3 files changed, 32 insertions, 2 deletions
diff --git a/app/Template/analytic/layout.php b/app/Template/analytic/layout.php
index 8c946699..c6e3a962 100644
--- a/app/Template/analytic/layout.php
+++ b/app/Template/analytic/layout.php
@@ -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">
diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php
index 2dd559b9..47304d7d 100644
--- a/app/Template/board/filters.php
+++ b/app/Template/board/filters.php
@@ -48,6 +48,10 @@
<?= $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'])) ?>
</li>
diff --git a/app/Template/budget/index.php b/app/Template/budget/index.php
index bdeda781..442a6b64 100644
--- a/app/Template/budget/index.php
+++ b/app/Template/budget/index.php
@@ -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 ?>