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 Slim\App;
class Statistieken {
class Statistieken
{
public function __construct(App $app)
{
$app->get('/statistieken/{rekeningnummer}', function ($request, $response, $args) {
$verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']);
return $this->renderer->render($response, "statistieken.phtml", [
"header" => Header::getHeaderData(),
"rekeningnr" => $args['rekeningnummer'],
"statistieken" => [
"x-as" => $verloop['x-as'],
"y-as" => $verloop['y-as']
]
]);
try {
$verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']);
return $this->renderer->render($response, "statistieken.phtml", [
"header" => Header::getHeaderData(),
"rekeningnr" => $args['rekeningnummer'],
"statistieken" => [
"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());
}
}

View File

@ -1,6 +1,18 @@
<?php include '__header.phtml'; ?>
<a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr ?>" role="button">Terug</a>
<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>
Chart.defaults.global.legend.display = false;//Geen legenda
var grafiek = document.getElementById("grafiek");
@ -47,5 +59,8 @@
}]
}
});
<?php
} ?>
</script>
<?php include '__footer.phtml'; ?>