Transactiepagina
This commit is contained in:
parent
1f9f6478e6
commit
7188940141
39
src/Application/Overboeking.php
Normal file
39
src/Application/Overboeking.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Klant;
|
||||||
|
use Inforbank\Application\Helper\Rekeningen;
|
||||||
|
use Inforbank\Application\Helper\IBAN;
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Overboeking
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/overboeking', function ($request, $response, $args) {
|
||||||
|
$klant = Klant::getCurrentUser();
|
||||||
|
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $this->renderer->render($response, 'overboeking.phtml', [
|
||||||
|
'klant' => $klant,
|
||||||
|
'rekeningen' => $rekeningen
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
64
src/Application/Transacties.php
Normal file
64
src/Application/Transacties.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Klant;
|
||||||
|
use Inforbank\Application\Helper\Rekeningen;
|
||||||
|
use Inforbank\Application\Helper\IBAN;
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Transacties
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/rekeningen/{rekeningnummer}', function ($request, $response, $args) {
|
||||||
|
$klant = Klant::getCurrentUser();
|
||||||
|
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||||
|
|
||||||
|
$ibanhelper = new IBAN;
|
||||||
|
$rekening = false;
|
||||||
|
$rekeningnr = $args['rekeningnummer'];
|
||||||
|
|
||||||
|
foreach($rekeningen as $rek){
|
||||||
|
if($rek['nr'] === $rekeningnr){
|
||||||
|
$rekening = $rek;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
$transacties = $db->transacties->where('van', '12345678')->or('naar', $rekeningnr);
|
||||||
|
|
||||||
|
$returnArray = array();
|
||||||
|
|
||||||
|
foreach ($transacties as $transactie) {
|
||||||
|
$returnArray[] = array(
|
||||||
|
"van" => $ibanhelper->getIBAN($transactie['van']),
|
||||||
|
"naar" => $ibanhelper->getIBAN($transactie['naar']),
|
||||||
|
"bedrag" => $transactie['bedrag'],
|
||||||
|
"type" => $transactie['type']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->renderer->render($response, 'transacties.phtml', [
|
||||||
|
'klant' => $klant,
|
||||||
|
'rekening' => $rekening,
|
||||||
|
'transacties' => $returnArray
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -116,6 +116,8 @@ Inforbank\Application::set($app);
|
|||||||
new Inforbank\Application\Login($app);
|
new Inforbank\Application\Login($app);
|
||||||
new Inforbank\Application\Daniel($app);
|
new Inforbank\Application\Daniel($app);
|
||||||
new Inforbank\Application\Main($app);
|
new Inforbank\Application\Main($app);
|
||||||
|
new Inforbank\Application\Transacties($app);
|
||||||
|
new Inforbank\Application\Overboeking($app);
|
||||||
|
|
||||||
// Added API handler
|
// Added API handler
|
||||||
new Inforbank\Application\API\Handler($app);
|
new Inforbank\Application\API\Handler($app);
|
||||||
|
14
templates/overboeking.phtml
Normal file
14
templates/overboeking.phtml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
|
||||||
|
<select>
|
||||||
|
<?php
|
||||||
|
foreach($rekeningen as $rekening){
|
||||||
|
echo "<option>" . $rekening['rekeningnr'] . "</option>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select><br/>
|
||||||
|
<input type="text" placeholder="naar"></input><br/>
|
||||||
|
<input type="number" placeholder="bedrag"></input><br/>
|
||||||
|
<textarea maxlength=40></textarea>
|
||||||
|
|
||||||
|
<?php include '__footer.phtml'; ?>
|
23
templates/transacties.phtml
Normal file
23
templates/transacties.phtml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if(!$rekening){
|
||||||
|
?>
|
||||||
|
Fout: niet jouw eigen rekening.
|
||||||
|
<?php
|
||||||
|
}else{
|
||||||
|
?>
|
||||||
|
|
||||||
|
Saldo: <?php echo $rekening['saldo']?><br/>
|
||||||
|
<?php
|
||||||
|
foreach($transacties as $transactie){
|
||||||
|
echo "<pre>";
|
||||||
|
echo json_encode($transactie);
|
||||||
|
echo "<br/></pre>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php include '__footer.phtml'; ?>
|
Reference in New Issue
Block a user