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,10 +19,12 @@ 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) {
try {
$verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']); $verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']);
return $this->renderer->render($response, "statistieken.phtml", [ return $this->renderer->render($response, "statistieken.phtml", [
"header" => Header::getHeaderData(), "header" => Header::getHeaderData(),
@ -32,6 +34,13 @@ class Statistieken {
"y-as" => $verloop['y-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'; ?>