diff --git a/assets/css/main.css b/assets/css/main.css index 1ad17f8..f532ffc 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -47,7 +47,8 @@ ul.nv { color: grey; margin-top: 50px; } + /** Table Row **/ .clickable { cursor: pointer; -} \ No newline at end of file +} diff --git a/src/Application/Berichten.php b/src/Application/Berichten.php new file mode 100644 index 0000000..53b3a7f --- /dev/null +++ b/src/Application/Berichten.php @@ -0,0 +1,32 @@ +get('/berichten', function ($request, $response, $args) { + return $this->renderer->render($response, 'berichten.phtml', [ + 'header' => Header::getHeaderData(), + 'berichten' => BerichtHelper::getUserBerichten() + ]); + })->add(new Auth\Middleware()); + } +} diff --git a/src/Application/Helper/Berichten.php b/src/Application/Helper/Berichten.php new file mode 100644 index 0000000..f412c31 --- /dev/null +++ b/src/Application/Helper/Berichten.php @@ -0,0 +1,57 @@ +db; + $berichten = $db->berichten->where('klantid', $container->auth->getUserID())->order('datum DESC'); + + $berichtArray = array(); + + foreach ($berichten as $bericht) { + $datum = new \DateTime($bericht['datum']); + $datum = $datum->format('d-m-Y'); + + $berichtArray[] = array( + "afzender" => $bericht['afzender'], + "bericht" => $bericht['bericht'], + "datum" => $datum + ); + } + + return $berichtArray; + } + + public static function newBericht($user, $afzender, $bericht) + { + $container = Application::getContainer(); + $db = $container->db; + + $array = array( + 'klantid' => (int) $user, + 'afzender' => $afzender, + 'bericht' => $bericht, + 'datum' => date('Y-m-d') + ); + + $row = $db->berichten->insert($array); + } +} diff --git a/src/Application/Overboeking.php b/src/Application/Overboeking.php index a7e55d0..a201280 100644 --- a/src/Application/Overboeking.php +++ b/src/Application/Overboeking.php @@ -31,7 +31,7 @@ class Overboeking 'header' => Header::getHeaderData(), 'rekeningen' => $rekeningen ]); - }); + })->add(new Auth\Middleware()); $app->post('/overboeking', function ($request, $response, $args) { $post = $request->getParsedBody(); @@ -86,7 +86,8 @@ class Overboeking ]); //TODO update saldo + //TODO Checken of het saldo van de rekening onder de 20 euro komt, dan doe je een mededeling via de berichthelper. return Redirect::create($request, $response, "/"); - }); + })->add(new Auth\Middleware()); } } diff --git a/src/Application/Transacties.php b/src/Application/Transacties.php index 9b40efc..f178d43 100644 --- a/src/Application/Transacties.php +++ b/src/Application/Transacties.php @@ -63,6 +63,6 @@ class Transacties 'rekening' => $rekening, 'transacties' => $returnArray ]); - }); + })->add(new Auth\Middleware()); } } diff --git a/src/bootstrap.php b/src/bootstrap.php index 771d735..b753261 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -113,14 +113,27 @@ Inforbank\Application::set($app); * */ -new Inforbank\Application\Login($app); -new Inforbank\Application\Daniel($app); + +/** + * Basis + */ + new Inforbank\Application\Main($app); +new Inforbank\Application\Login($app); + +/** + * Pagina's + */ + +new Inforbank\Application\Daniel($app); new Inforbank\Application\Transacties($app); new Inforbank\Application\Overboeking($app); new Inforbank\Application\Rekeningen($app); +new Inforbank\Application\Berichten($app); -// Added API handler +/** + * API + */ new Inforbank\Application\API\Handler($app); /** diff --git a/templates/berichten.phtml b/templates/berichten.phtml new file mode 100644 index 0000000..d551a4b --- /dev/null +++ b/templates/berichten.phtml @@ -0,0 +1,19 @@ + + + + + +
+
+

+ Afzender:
+
+ +
+
+ + +