1
0

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	templates/statistieken.phtml
This commit is contained in:
JelmerHinssen 2017-04-03 18:24:43 +02:00
commit dfc5b993f6
3 changed files with 34 additions and 10 deletions

View File

@ -19,19 +19,28 @@ use Inforbank\Application\Helper\Header;
use Inforbank\Application\Helper\Statistieken as StatistiekenHelper; use Inforbank\Application\Helper\Statistieken as StatistiekenHelper;
use Slim\App; use Slim\App;
class Statistieken { class Statistieken
{
public function __construct(App $app) public function __construct(App $app)
{ {
$app->get('/statistieken/{rekeningnummer}', function ($request, $response, $args) { $app->get('/statistieken/{rekeningnummer}', function ($request, $response, $args) {
$verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']); try {
return $this->renderer->render($response, "statistieken.phtml", [ $verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']);
"header" => Header::getHeaderData(), return $this->renderer->render($response, "statistieken.phtml", [
"rekeningnr" => $args['rekeningnummer'], "header" => Header::getHeaderData(),
"statistieken" => [ "rekeningnr" => $args['rekeningnummer'],
"x-as" => $verloop['x-as'], "statistieken" => [
"y-as" => $verloop['y-as'] "x-as" => $verloop['x-as'],
] "y-as" => $verloop['y-as']
]); ]
]);
} catch (\Exception $e) {
return $this->renderer->render($response, "statistieken.phtml", [
"header" => Header::getHeaderData(),
"rekeningnr" => $args['rekeningnummer'],
"statistieken" => false
]);
}
})->add(new Middleware()); })->add(new Middleware());
} }
} }

View File

@ -1,6 +1,18 @@
<?php include '__header.phtml'; ?> <?php include '__header.phtml'; ?>
<a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr ?>" role="button">Terug</a> <a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr ?>" role="button">Terug</a>
<canvas id="grafiek" height="100"></canvas> <canvas id="grafiek" height="100"></canvas>
<?php
if (!$statistieken) {
?>
<div class="alert alert-danger" role="alert"><b>Fout!</b> Dit is niet een aan jouw account gekoppelde rekening.</div>
<?php
} else {
?>
<a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr?>" role="button">Terug</a>
<canvas id="myChart" height="100"></canvas>
<script> <script>
Chart.defaults.global.legend.display = false;//Geen legenda Chart.defaults.global.legend.display = false;//Geen legenda
var grafiek = document.getElementById("grafiek"); var grafiek = document.getElementById("grafiek");
@ -47,5 +59,8 @@
}] }]
} }
}); });
<?php
} ?>
</script> </script>
<?php include '__footer.phtml'; ?> <?php include '__footer.phtml'; ?>