mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
update create multi, simple paging
This commit is contained in:
parent
1b57d2231b
commit
5b3bcbbae8
@ -182,12 +182,13 @@ class TransactionCreationsController extends AppController
|
||||
}
|
||||
}
|
||||
|
||||
public function createMulti()
|
||||
public function createMulti($page = 0)
|
||||
{
|
||||
$startTime = microtime(true);
|
||||
$this->viewBuilder()->setLayout('frontend');
|
||||
$session = $this->getRequest()->getSession();
|
||||
$result = $this->requestLogin();
|
||||
$limit = 200;
|
||||
if($result !== true) {
|
||||
return $result;
|
||||
}
|
||||
@ -229,6 +230,7 @@ class TransactionCreationsController extends AppController
|
||||
$stateUsers = $stateUserTable
|
||||
->find('all')
|
||||
->select(['id', 'first_name', 'last_name', 'email'])
|
||||
->order(['id'])
|
||||
->contain(['TransactionCreations' => [
|
||||
'fields' => [
|
||||
'TransactionCreations.amount',
|
||||
@ -239,7 +241,12 @@ class TransactionCreationsController extends AppController
|
||||
|
||||
//var_dump($stateUsers->toArray());
|
||||
$possibleReceiver = [];
|
||||
foreach($stateUsers as $stateUser) {
|
||||
$countUsers = 0;
|
||||
foreach($stateUsers as $i => $stateUser) {
|
||||
$countUsers++;
|
||||
if($i < $page * $limit || $i >= ($page + 1) * $limit) {
|
||||
continue;
|
||||
}
|
||||
$sumAmount = 0;
|
||||
$sumAmount2 = 0;
|
||||
if(isset($transactionsLastMonthTargetDateSortedByStateUserId[$stateUser->id])) {
|
||||
@ -279,10 +286,14 @@ class TransactionCreationsController extends AppController
|
||||
$this->set('creationForm', $creationForm);
|
||||
$this->set('transactionExecutingCount', $session->read('Transaction.executing'));
|
||||
$this->set('timeUsed', microtime(true) - $startTime);
|
||||
$this->set('countUsers', $countUsers);
|
||||
$this->set('limit', $limit);
|
||||
$this->set('page', $page);
|
||||
|
||||
if ($this->request->is('post')) {
|
||||
$requestData = $this->request->getData();
|
||||
//var_dump($requestData);
|
||||
//var_dump($this->request->getData('user'));
|
||||
//die("miau");
|
||||
// memo
|
||||
// amount
|
||||
|
||||
@ -34,6 +34,14 @@ use Cake\I18n\FrozenTime;
|
||||
margin-bottom:50px;
|
||||
}
|
||||
|
||||
.grd_margin-bottom_100 {
|
||||
margin-bottom:100px;
|
||||
}
|
||||
|
||||
.grd_margin-bottom_120 {
|
||||
margin-bottom:120px;
|
||||
}
|
||||
|
||||
.grd_smaller {
|
||||
font-size:smaller;
|
||||
color:blue;
|
||||
@ -54,7 +62,7 @@ use Cake\I18n\FrozenTime;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="grd_container_small grd_margin-bottom_50">
|
||||
<div class="grd_container_small grd_margin-bottom_120">
|
||||
|
||||
<button type="button" onclick="checkAll()" >Alle auswählen</button>
|
||||
<button type="button" onclick="uncheckAll()">Alle abwählen</button>
|
||||
@ -121,6 +129,19 @@ use Cake\I18n\FrozenTime;
|
||||
<!--<?= $this->Form->control('receiver_pubkey_hex', []) ?>-->
|
||||
</fieldset>
|
||||
<div class="flowing-bottom">
|
||||
<?php if($countUsers > $limit) :
|
||||
?><p><?= $countUsers ?> Benutzer insgesamt</p>
|
||||
<p>Seiten:
|
||||
<?php for($i = 0; $i < ceil($countUsers/$limit); $i++) {
|
||||
if($i > 0) echo ', ';
|
||||
if($i != $page) {
|
||||
echo $this->Html->link($i, ['action' => 'create_multi', $i]);
|
||||
} else {
|
||||
echo $i;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</p><?php endif ?>
|
||||
<?= $this->Form->button(__('Transaktion(en) abschließen'), ['name' => 'next', 'class' => 'grd-form-bn grd-form-bn-succeed grd_clickable grd-width-200']) ?>
|
||||
<?= $this->Form->button(__('Weitere Transaktion erstellen'), ['name' => 'add', 'class' => 'grd-form-bn grd_clickable grd-width-200']) ?>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user