1
0

Testrapport #5 fix

This commit is contained in:
Christiaan Goossens 2017-04-03 18:17:26 +02:00
parent 16035fee7a
commit a62fdd9491
2 changed files with 33 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,4 +1,15 @@
<?php include '__header.phtml'; ?> <?php include '__header.phtml'; ?>
<?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> <a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr?>" role="button">Terug</a>
<canvas id="myChart" height="100"></canvas> <canvas id="myChart" height="100"></canvas>
<script> <script>
@ -32,5 +43,8 @@
}] }]
} }
}); });
<?php
} ?>
</script> </script>
<?php include '__footer.phtml'; ?> <?php include '__footer.phtml'; ?>