mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
list transactions
This commit is contained in:
parent
c215f30d02
commit
bbdb9a2ed6
@ -63,11 +63,69 @@ class StateBalancesController extends AppController
|
||||
->where(['OR' => ['state_user_id' => $user['id'], 'receiver_user_id' => $user['id']]])
|
||||
->contain(['Transactions']);
|
||||
|
||||
$transactions = [];
|
||||
foreach($creationTransactions as $creation) {
|
||||
|
||||
$involvedUserIds = [];
|
||||
foreach($transferTransactions as $sendCoins) {
|
||||
if($sendCoins->state_user_id != $user['id']) {
|
||||
array_push($involvedUserIds, intval($sendCoins->state_user_id));
|
||||
} else if($sendCoins->receiver_user_id != $user['id']) {
|
||||
array_push($involvedUserIds, intval($sendCoins->receiver_user_id));
|
||||
}
|
||||
}
|
||||
// exchange key with values and drop duplicates
|
||||
$involvedUser_temp = array_flip($involvedUserIds);
|
||||
// exchange back
|
||||
$involvedUserIds = array_flip($involvedUser_temp);
|
||||
$userTable = TableRegistry::getTableLocator()->get('StateUsers');
|
||||
$involvedUser = $userTable->find('all', [
|
||||
'contain' => false,
|
||||
'where' => ['id IN' => $involvedUserIds],
|
||||
'fields' => ['id', 'first_name', 'last_name', 'email']
|
||||
]);
|
||||
$involvedUserIndices = [];
|
||||
foreach($involvedUser as $involvedUser) {
|
||||
$involvedUserIndices[$involvedUser->id] = $involvedUser;
|
||||
}
|
||||
|
||||
// sender or receiver when user has sended money
|
||||
// group name if creation
|
||||
// type: gesendet / empfangen / geschöpft
|
||||
// transaktion nr / id
|
||||
// date
|
||||
// balance
|
||||
|
||||
$transactions = [];
|
||||
foreach($creationTransactions as $creation) {
|
||||
//var_dump($creation);
|
||||
array_push($transactions, [
|
||||
'name' => 'Gradido Akademie',
|
||||
'type' => 'creation',
|
||||
'transaction_id' => $creation->transaction_id,
|
||||
'date' => $creation->transaction->received,
|
||||
'balance' => $creation->amount
|
||||
]);
|
||||
}
|
||||
|
||||
foreach($transferTransactions as $sendCoins) {
|
||||
$type = '';
|
||||
$otherUser = null;
|
||||
if($sendCoins->state_user_id == $user['id']) {
|
||||
$type = 'send';
|
||||
$otherUser = $involvedUserIndices[$sendCoins->receiver_user_id];
|
||||
} else if($sendCoins->receiver_user_id == $user['id']) {
|
||||
$type = 'receive';
|
||||
$otherUser = $involvedUserIndices[$sendCoins->state_user_id];
|
||||
}
|
||||
array_push($transactions, [
|
||||
'name' => $otherUser->first_name . ' ' . $otherUser->last_name,
|
||||
'email' => $otherUser->email,
|
||||
'type' => $type,
|
||||
'transaction_id' => $sendCoins->transaction_id,
|
||||
'date' => $sendCoins->transaction->received,
|
||||
'balance' => $sendCoins->amount
|
||||
]);
|
||||
}
|
||||
$this->set('transactions', $transactions);
|
||||
$this->set('balance', $session->read('StateUser.balance'));
|
||||
$this->set('timeUsed', microtime(true) - $startTime);
|
||||
}
|
||||
|
||||
|
||||
@ -55,6 +55,11 @@ if(!isset($balance)) {
|
||||
<nav class="grd-left-bar expanded" data-topbar role="navigation">
|
||||
<div class="grd-left-bar-section">
|
||||
<ul class="grd-no-style">
|
||||
<?php if($errorCount > 0) : ?>
|
||||
<li>
|
||||
<?= $this->Html->Link(__('Fehler '). "($errorCount)", ['controller' => 'StateErrors', 'action' => 'showForUser'], ['class' => 'grd-nav-bn grd-nav-bn-discard']) ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if(isset($balance)) : ?>
|
||||
<li><?= $this->Html->link($this->element('printGradido', ['number' => $balance]),
|
||||
['controller' => 'StateBalances', 'action' => 'overview'], ['class' => 'grd-nav-bn grd-nav-without-border', 'escape' => false])
|
||||
@ -63,11 +68,6 @@ if(!isset($balance)) {
|
||||
<?php endif; ?>
|
||||
<li><?= $this->Html->link(__('Startseite'), ['controller' => 'Dashboard'], ['class' => 'grd-nav-bn'])?>
|
||||
<!--<li><?= $this->Html->link(__('Kontostand'), ['controller' => 'StateBalances', 'action' => 'overview'], ['class' => 'grd-nav-bn']) ?>-->
|
||||
<?php if($errorCount > 0) : ?>
|
||||
<li>
|
||||
<?= $this->Html->Link(__('Fehler '). "($errorCount)", ['controller' => 'StateErrors', 'action' => 'showForUser'], ['class' => 'grd-nav-bn grd-nav-bn-discard']) ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if(intval($transactionPendings) > 0) : ?>
|
||||
<li>
|
||||
<a href="<?= Router::url('./', true) ?>account/checkTransactions" class="grd-nav-bn">
|
||||
|
||||
@ -6,88 +6,69 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
$this->assign('title', __('Kontoübersicht'));
|
||||
//var_dump($transactions);
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-10 equel-grid">
|
||||
<div class="grid">
|
||||
<div class="grid-body py-3">
|
||||
<p class="card-title ml-n1">Überweisungen</p>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr class="solid-header">
|
||||
<th colspan="2" class="pl-4">Absender</th>
|
||||
<th>Transaktions Nr.</th>
|
||||
<th>Datum</th>
|
||||
<th>Betrag</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="pr-0 pl-4">
|
||||
<?= $this->Html->image('50x50.png', ['class' => 'profile-img img-sm', 'alt' => 'profile image']) ?>
|
||||
</td>
|
||||
<td class="pl-md-0">
|
||||
<small class="text-black font-weight-medium d-block">Barbara Curtis</small>
|
||||
<span>
|
||||
<span class="status-indicator rounded-indicator small bg-primary"></span>Account Deactivated </span>
|
||||
</td>
|
||||
<td>
|
||||
<small>8523537435</small>
|
||||
</td>
|
||||
<td> Just Now </td>
|
||||
<td>120</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pr-0 pl-4">
|
||||
<?= $this->Html->image('50x50.png', ['class' => 'profile-img img-sm', 'alt' => 'profile image']) ?>
|
||||
</td>
|
||||
<td class="pl-md-0">
|
||||
<small class="text-black font-weight-medium d-block">Charlie Hawkins</small>
|
||||
<span>
|
||||
<span class="status-indicator rounded-indicator small bg-success"></span>Email Verified </span>
|
||||
</td>
|
||||
<td>
|
||||
<small>9537537436</small>
|
||||
</td>
|
||||
<td> Mar 04, 2018 11:37am </td>
|
||||
<td>-120</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pr-0 pl-4">
|
||||
<?= $this->Html->image('50x50.png', ['class' => 'profile-img img-sm', 'alt' => 'profile image']) ?>
|
||||
</td>
|
||||
<td class="pl-md-0">
|
||||
<small class="text-black font-weight-medium d-block">Nina Bates</small>
|
||||
<span>
|
||||
<span class="status-indicator rounded-indicator small bg-warning"></span>Payment On Hold </span>
|
||||
</td>
|
||||
<td>
|
||||
<small>7533567437</small>
|
||||
</td>
|
||||
<td> Mar 13, 2018 9:41am </td>
|
||||
<td>10</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pr-0 pl-4">
|
||||
<?= $this->Html->image('50x50.png', ['class' => 'profile-img img-sm', 'alt' => 'profile image']) ?>
|
||||
</td>
|
||||
<td class="pl-md-0">
|
||||
<small class="text-black font-weight-medium d-block">Hester Richards</small>
|
||||
<span>
|
||||
<span class="status-indicator rounded-indicator small bg-success"></span>Email Verified </span>
|
||||
</td>
|
||||
<td>
|
||||
<small>5673467743</small>
|
||||
</td>
|
||||
<td> Feb 21, 2018 8:34am </td>
|
||||
<td>500</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a class="border-top px-3 py-2 d-block text-gray" href="#"><small class="font-weight-medium"><i class="mdi mdi-chevron-down mr-2"></i>View All Order History</small></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8 equel-grid">
|
||||
<div class="grid">
|
||||
<div class="grid-body py-3">
|
||||
<h3><?= __('Aktueller Kontostand: ') ?></h3>
|
||||
<h2><?= $this->element('printGradido', ['number' => $balance]) ?></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-10 equel-grid">
|
||||
<div class="grid">
|
||||
<div class="grid-body py-3">
|
||||
<p class="card-title ml-n1">Überweisungen</p>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr class="solid-header">
|
||||
<th colspan="2" class="pl-4"><?= __('Absender') . ' / ' . ('Empfänger') ?></th>
|
||||
<th><?= __('Transaktions Nr.') ?></th>
|
||||
<th><?= __('Datum') ?></th>
|
||||
<th><?= __('Betrag') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($transactions as $transaction): ?>
|
||||
<tr>
|
||||
<td class="pr-0 pl-4">
|
||||
<?= $this->Html->image('50x50.png', ['class' => 'profile-img img-sm', 'alt' => 'profile image']) ?>
|
||||
</td>
|
||||
<td class="pl-md-0">
|
||||
<?php if(isset($transaction['email']) && $transaction['email'] != ''): ?>
|
||||
<a href="mailto:<?= $transaction['email'] ?>" title="<?= $transaction['email'] ?>">
|
||||
<small class="text-black font-weight-medium d-block"><?= $transaction['name'] ?></small>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<small class="text-black font-weight-medium d-block"><?= $transaction['name'] ?></small>
|
||||
<?php endif; ?>
|
||||
<span>
|
||||
<?php if($transaction['type'] == 'creation') : ?>
|
||||
<i class="mdi mdi-creation grd-orange-color"></i> <?= __('Geschöpft')?>
|
||||
<?php elseif($transaction['type'] == 'send') : ?>
|
||||
<i class="mdi mdi-arrow-right-bold"></i> <?= __('Gesendet') ?>
|
||||
<?php elseif($transaction['type'] == 'receive') : ?>
|
||||
<i class="mdi mdi-arrow-left-bold"></i> <?= __('Empfangen') ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<small><?= $transaction['transaction_id'] ?></small>
|
||||
</td>
|
||||
<td> <?= $transaction['date']->nice() ?> </td>
|
||||
<td><?= $this->element('printGradido', ['number' => $transaction['balance']]) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--<a class="border-top px-3 py-2 d-block text-gray" href="#"><small class="font-weight-medium"><i class="mdi mdi-chevron-down mr-2"></i>View All Order History</small></a>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user