From c2161035209e8ed22afb91533c9066d573cf3cbf Mon Sep 17 00:00:00 2001 From: Christine Slotty Date: Tue, 21 Jul 2020 17:14:40 +0200 Subject: [PATCH] User Search in create-multi --- src/Controller/AppController.php | 2 +- .../TransactionCreationsController.php | 483 +++++++++--------- src/Form/TransferForm.php | 10 +- src/Locale/de_DE/default.po | 2 +- src/Locale/default.pot | 2 +- src/Template/Dashboard/index.ctp | 2 +- .../TransactionCreations/create_multi.ctp | 173 +++---- webroot/css/grd_styles.css | 9 +- websrc/src/less/08-navi.less | 1 + websrc/src/less/30-form.less | 9 +- 10 files changed, 350 insertions(+), 343 deletions(-) diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index ae5926523..95f02e00e 100644 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -201,7 +201,7 @@ class AppController extends Controller if ($stateUser->first_name != $json['user']['first_name'] || $stateUser->last_name != $json['user']['last_name'] || //$stateUser->username != $json['user']['username'] || - // -> throws erro + // -> throws error $stateUser->email != $json['user']['email']) { $stateUser->first_name = $json['user']['first_name']; $stateUser->last_name = $json['user']['last_name']; diff --git a/src/Controller/TransactionCreationsController.php b/src/Controller/TransactionCreationsController.php index 5aae585d1..44cb0928b 100644 --- a/src/Controller/TransactionCreationsController.php +++ b/src/Controller/TransactionCreationsController.php @@ -53,9 +53,9 @@ class TransactionCreationsController extends AppController ]; $transactionCreations = $this->paginate($this->TransactionCreations); $identHashes = []; - foreach($transactionCreations as $creation) { - $identHash = TransactionCreation::DRMakeStringHash($creation->state_user->email); - $identHashes[$creation->state_user->id] = $identHash; + foreach ($transactionCreations as $creation) { + $identHash = TransactionCreation::DRMakeStringHash($creation->state_user->email); + $identHashes[$creation->state_user->id] = $identHash; } $this->set(compact('transactionCreations', 'identHashes')); @@ -83,14 +83,12 @@ class TransactionCreationsController extends AppController $this->viewBuilder()->setLayout('frontend'); $session = $this->getRequest()->getSession(); $user = $session->read('StateUser'); -// var_dump($user); - if(!$user) { - //return $this->redirect(Router::url('/', true) . 'account/', 303); - $result = $this->requestLogin(); - if($result !== true) { - return $result; - } - $user = $session->read('StateUser'); + if (!$user) { + $result = $this->requestLogin(); + if ($result !== true) { + return $result; + } + $user = $session->read('StateUser'); } $creationForm = new CreationForm(); $transactionCreation = $this->TransactionCreations->newEntity(); @@ -100,93 +98,90 @@ class TransactionCreationsController extends AppController $stateUserTable = TableRegistry::getTableLocator()->get('StateUsers'); $stateUsers = $stateUserTable->find('all')->contain(false); $receiverProposal = []; - foreach($stateUsers as $stateUser) { - $name = $stateUser->email; - $keyHex = bin2hex(stream_get_contents($stateUser->public_key)); - if($name === NULL) { - $name = $stateUser->first_name . ' ' . $stateUser->last_name; - } - array_push($receiverProposal, ['name' => $name, 'key' => $keyHex, 'email' => $stateUser->email]); + foreach ($stateUsers as $stateUser) { + $name = $stateUser->email; + $keyHex = bin2hex(stream_get_contents($stateUser->public_key)); + if ($name === null) { + $name = $stateUser->first_name . ' ' . $stateUser->last_name; + } + array_push($receiverProposal, ['name' => $name, 'key' => $keyHex, 'email' => $stateUser->email]); //$stateUser->public_key } $timeUsed = microtime(true) - $startTime; $this->set(compact('transactionCreation', 'timeUsed', 'receiverProposal', 'creationForm')); if ($this->request->is('post')) { - $requestData = $this->request->getData(); - $mode = 'next'; - if(isset($requestData['add'])) {$mode = 'add'; } - if($creationForm->validate($requestData)) { - - $pubKeyHex = ''; - $identHash = ''; - $amountCent = $this->GradidoNumber->parseInputNumberToCentNumber($requestData['amount']); - $receiverIndex = intval($requestData['receiver'])-1; - - if(count($receiverProposal) > $receiverIndex) { - $pubKeyHex = $receiverProposal[$receiverIndex]['key']; - $identHash = TransactionCreation::DRMakeStringHash($receiverProposal[$receiverIndex]['email']); - //echo "identHash: $identHash for " . $receiverProposal[$receiverIndex]['email']; + $requestData = $this->request->getData(); + $mode = 'next'; + if (isset($requestData['add'])) { + $mode = 'add'; } - $builderResult = TransactionCreation::build( + if ($creationForm->validate($requestData)) { + $pubKeyHex = ''; + $identHash = ''; + $amountCent = $this->GradidoNumber->parseInputNumberToCentNumber($requestData['amount']); + $receiverIndex = intval($requestData['receiver'])-1; + + if (count($receiverProposal) > $receiverIndex) { + $pubKeyHex = $receiverProposal[$receiverIndex]['key']; + $identHash = TransactionCreation::DRMakeStringHash($receiverProposal[$receiverIndex]['email']); + } + $builderResult = TransactionCreation::build( $amountCent, $requestData['memo'], $pubKeyHex, $identHash - ); -// echo "builder result state: " . $builderResult['state'] . '
'; - if($builderResult['state'] == 'success') { - - $user_balance = 0; - if(isset($user['balance'])) { - $user_balance = $user['balance']; - } - // $session_id, $base64Message, $user_balance = 0 - $requestResult = $this->JsonRequestClient->sendTransaction( - $session->read('session_id'), - base64_encode($builderResult['transactionBody']->serializeToString()), - $user_balance - ); - if($requestResult['state'] != 'success') { - $this->addAdminError('TransactionCreations', 'create', $requestResult, $user['id']); - if($requestResult['type'] == 'request error') { - $this->Flash->error(__('Error by requesting LoginServer, please try again')); + ); + if ($builderResult['state'] == 'success') { + $user_balance = 0; + if (isset($user['balance'])) { + $user_balance = $user['balance']; + } + // $session_id, $base64Message, $user_balance = 0 + $requestResult = $this->JsonRequestClient->sendTransaction( + $session->read('session_id'), + base64_encode($builderResult['transactionBody']->serializeToString()), + $user_balance + ); + if ($requestResult['state'] != 'success') { + $this->addAdminError('TransactionCreations', 'create', $requestResult, $user['id']); + if ($requestResult['type'] == 'request error') { + $this->Flash->error(__('Error by requesting LoginServer, please try again')); + } else { + $this->Flash->error(__('Error, please wait for the admin to fix it')); + } + } else { + $json = $requestResult['data']; + if ($json['state'] != 'success') { + if ($json['msg'] == 'session not found') { + $session->destroy(); + return $this->redirect($this->loginServerUrl . 'account', 303); + } else { + $this->addAdminError('TransactionCreations', 'create', $json, $user['id']); + $this->Flash->error(__('Login Server Error, please wait for the admin to fix it')); + } + } else { + $pendingTransactionCount = $session->read('Transactions.pending'); + if ($pendingTransactionCount == null) { + $pendingTransactionCount = 1; + } else { + $pendingTransactionCount++; + } + $session->write('Transactions.pending', $pendingTransactionCount); + if ($mode === 'next') { + return $this->redirect($this->loginServerUrl . 'account/checkTransactions', 303); + } else { + $this->Flash->success(__('Transaction submitted for review.')); + } + } + } } else { - $this->Flash->error(__('Error, please wait for the admin to fix it')); + $this->Flash->error(__('Building transaction failed')); } - } else { - $json = $requestResult['data']; - if($json['state'] != 'success') { - if($json['msg'] == 'session not found') { - $session->destroy(); - return $this->redirect($this->loginServerUrl . 'account', 303); - } else { - $this->addAdminError('TransactionCreations', 'create', $json, $user['id']); - $this->Flash->error(__('Login Server Error, please wait for the admin to fix it')); - } - } else { - $pendingTransactionCount = $session->read('Transactions.pending'); - if($pendingTransactionCount == null) { - $pendingTransactionCount = 1; - } else { - $pendingTransactionCount++; - } - $session->write('Transactions.pending', $pendingTransactionCount); - //echo "pending: " . $pendingTransactionCount; - if($mode === 'next') { - return $this->redirect($this->loginServerUrl . 'account/checkTransactions', 303); - } else { - $this->Flash->success(__('Transaction submitted for review.')); - } - } - } + // */ } else { - $this->Flash->error(__('Building transaction failed')); + $this->Flash->error(__('Something was invalid, please try again!')); } -// */ - } else { - $this->Flash->error(__('Something was invalid, please try again!')); - } } } @@ -197,8 +192,8 @@ class TransactionCreationsController extends AppController $session = $this->getRequest()->getSession(); $result = $this->requestLogin(); $limit = 200; - if($result !== true) { - return $result; + if ($result !== true) { + return $result; } $user = $session->read('StateUser'); @@ -206,7 +201,7 @@ class TransactionCreationsController extends AppController $connection = ConnectionManager::get('default'); $transactionActiveMonth = $connection->execute( - 'SELECT id, received FROM transactions ' + 'SELECT id, received FROM transactions ' . 'where received >= date_sub(date_add(curdate(), interval 1 - day(curdate()) day), interval 2 month) ' . 'AND ' . 'received < date_add(date_add(curdate(), interval 1 - day(curdate()) day), interval 2 month) ' @@ -214,8 +209,8 @@ class TransactionCreationsController extends AppController . 'transaction_type_id = 1' )->fetchAll('assoc'); $transactionActiveMonthSortedById = []; - foreach($transactionActiveMonth as $t) { - $transactionActiveMonthSortedById[$t['id']] = $t['received']; + foreach ($transactionActiveMonth as $t) { + $transactionActiveMonthSortedById[$t['id']] = $t['received']; } $firstDayLastMonth = new FrozenDate(); $firstDayLastMonth = $firstDayLastMonth->day(1)->subMonth(1); @@ -231,14 +226,27 @@ class TransactionCreationsController extends AppController ]); $transactionsLastMonthTargetDateSortedByStateUserId = []; - foreach($transactionsLastMonthTargeDate as $transactionCreation) { - $transactionsLastMonthTargetDateSortedByStateUserId[$transactionCreation->state_user_id] = $transactionCreation->sum_amount; + foreach ($transactionsLastMonthTargeDate as $transactionCreation) { + $transactionsLastMonthTargetDateSortedByStateUserId[$transactionCreation->state_user_id] = $transactionCreation->sum_amount; } - $stateUsers = $stateUserTable + $requestData = $this->request->getData(); + if ($this->request->is('post') && + isset($requestData['searchButton']) && + isset($requestData['searchText']) && + !empty($requestData['searchText']) + ) { + $mode = 'search'; + $this->log("search for text: ".$requestData['searchText'], 'debug'); + $stateUsers = $stateUserTable ->find('all') ->select(['id', 'first_name', 'last_name', 'email']) - ->order(['id']) + ->order(['first_name', 'last_name']) + ->where(['OR' => [ + 'LOWER(first_name)' => strtolower($requestData['searchText']), + 'LOWER(last_name)' => strtolower($requestData['searchText']), + 'LOWER(email)' => strtolower($requestData['searchText']) + ]]) ->contain(['TransactionCreations' => [ 'fields' => [ 'TransactionCreations.amount', @@ -246,30 +254,44 @@ class TransactionCreationsController extends AppController 'TransactionCreations.state_user_id' ] ]]); + $this->log("search query: ".$stateUsers, 'debug'); + } else { + $stateUsers = $stateUserTable + ->find('all') + ->select(['id', 'first_name', 'last_name', 'email']) + //->order(['id']) + ->order(['first_name', 'last_name']) + ->contain(['TransactionCreations' => [ + 'fields' => [ + 'TransactionCreations.amount', + 'TransactionCreations.transaction_id', + 'TransactionCreations.state_user_id' + ] + ]]); + } //var_dump($stateUsers->toArray()); - $possibleReceiver = []; + $possibleReceivers = []; $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])) { - $sumAmount2 = $transactionsLastMonthTargetDateSortedByStateUserId[$stateUser->id]; - } - foreach($stateUser->transaction_creations as $transactionCreation) { - //var_dump($transactionCreation); - if(isset($transactionActiveMonthSortedById[$transactionCreation->transaction_id])) { - $sumAmount += $transactionCreation->amount; + foreach ($stateUsers as $i => $stateUser) { + $countUsers++; + if ($i < $page * $limit || $i >= ($page + 1) * $limit) { + continue; + } + $sumAmount = 0; + $sumAmount2 = 0; + if (isset($transactionsLastMonthTargetDateSortedByStateUserId[$stateUser->id])) { + $sumAmount2 = $transactionsLastMonthTargetDateSortedByStateUserId[$stateUser->id]; + } + foreach ($stateUser->transaction_creations as $transactionCreation) { + //var_dump($transactionCreation); + if (isset($transactionActiveMonthSortedById[$transactionCreation->transaction_id])) { + $sumAmount += $transactionCreation->amount; + } } - } - //if($sumAmount < 20000000) { - array_push($possibleReceiver, [ + array_push($possibleReceivers, [ 'name' => $stateUser->first_name . ' ' . $stateUser->last_name, 'id' => $stateUser->id, 'email' => $stateUser->email, @@ -280,14 +302,14 @@ class TransactionCreationsController extends AppController $this->Flash->error(__('Creation above 2.000 GDD for 2 last two month')); }*/ } - usort($possibleReceiver, function($a, $b) { - return (strtolower ($a['name']) <=> strtolower ($b['name'])); - }); - //var_dump($possibleReceiver); + // usort($possibleReceivers, function ($a, $b) { + // return (strtolower($a['name']) <=> strtolower($b['name'])); + // }); + // -> replaced by SQL "order by" above $creationForm = new CreationForm(); $timeUsed = microtime(true) - $startTime; - $this->set(compact('timeUsed', 'stateUsers', 'creationForm', 'possibleReceiver')); + $this->set(compact('timeUsed', 'stateUsers', 'creationForm', 'possibleReceivers')); $this->set('firstDayLastMonth', $firstDayLastMonth); $this->set('activeUser', $user); @@ -298,131 +320,122 @@ class TransactionCreationsController extends AppController $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 - $memo = $requestData['memo']; - $amountCent = $this->GradidoNumber->parseInputNumberToCentNumber($requestData['amount']); - $targetDate = $requestData['target_date']; - $mode = 'next'; - if(isset($requestData['add'])) {$mode = 'add'; } - - if(!isset($requestData['user']) || count($requestData['user']) == 0) { - $this->Flash->error(__('no user choosen')); - } else { - $users = $requestData['user']; - if(isset($requestData['user_pending'])) { - $pendings = $requestData['user_pending']; + if ($this->request->is('post') && (!isset($mode) || !($mode === 'search'))) { + $this->log("real POST", 'debug'); + $mode = 'next'; + if (isset($requestData['add'])) { + $mode = 'add'; + } + $memo = $requestData['memo']; + $amountCent = $this->GradidoNumber->parseInputNumberToCentNumber($requestData['amount']); + //$targetDate = $requestData['target_date']; + if (!isset($requestData['user']) || count($requestData['user']) == 0) { + $this->Flash->error(__('No user selected')); } else { - $pendings = []; - } - //var_dump(array_keys($users)); - $receiverUsers = $stateUserTable - ->find('all') - ->where(['id IN' => array_keys($users)]) - ->select(['public_key', 'email', 'id']) - ->contain(false); - $transactions = []; - //var_dump($receiverUsers); - foreach($receiverUsers as $receiverUser) { - $localAmountCent = $amountCent; - $localTargetDate = $targetDate; - $id = $receiverUser->id; - if($requestData['user_amount'][$id] != '') { - $localAmountCent = $this->GradidoNumber->parseInputNumberToCentNumber($requestData['user_amount'][$id]); - } - if(isset($requestData['user_target_date']) && isset($requestData['user_target_date'][$id])) { - $localTargetDate = $requestData['user_target_date'][$id]; - } - if(isset($pendings[$id])) { - $pendings[$id] += $localAmountCent; - } else { - $pendings[$id] = $localAmountCent; - } - $pubKeyHex = bin2hex(stream_get_contents($receiverUser->public_key)); - $identHash = TransactionCreation::DRMakeStringHash($receiverUser->email); - //var_dump($localTargetDate); - //die('a'); - $localTargetDateFrozen = FrozenDate::now(); - $localTargetDateFrozen = $localTargetDateFrozen - ->year($localTargetDate['year']) - ->month($localTargetDate['month']) - ->day($localTargetDate['day']); - //echo "input: "; var_dump($localTargetDate);echo "
"; - //echo "output: "; var_dump($localTargetDateFrozen); - //die('a'); - $builderResult = TransactionCreation::build( - $localAmountCent, - $memo, - $pubKeyHex, - $identHash, - $localTargetDateFrozen - ); - if($builderResult['state'] == 'success') { - array_push($transactions, base64_encode($builderResult['transactionBody']->serializeToString())); - } - } - /*echo "pendings: "; - var_dump($pendings); - echo "
";*/ - foreach($possibleReceiver as $i => $_possibleReceiver) { - $id = $_possibleReceiver['id']; - if(isset($pendings[$id])) { - $possibleReceiver[$i]['pending'] = $pendings[$id]; - } - } - $this->set('possibleReceiver', $possibleReceiver); - $creationTransactionCount = count($transactions); - if($creationTransactionCount > 0) { - $user_balance = 0; - if(isset($user['balance'])) { - $user_balance = $user['balance']; - } - // $session_id, $base64Message, $user_balance = 0 - $requestResult = $this->JsonRequestClient->sendTransaction( - $session->read('session_id'), - $transactions, - $user_balance - ); - if($requestResult['state'] != 'success') { - $this->addAdminError('TransactionCreations', 'createMulti', $requestResult, $user['id']); - if($requestResult['type'] == 'request error') { - $this->Flash->error(__('Error by requesting LoginServer, please try again')); + $users = $requestData['user']; + if (isset($requestData['user_pending'])) { + $pendings = $requestData['user_pending']; } else { - $this->Flash->error(__('Error, please wait for the admin to fix it')); + $pendings = []; } - } else { - $json = $requestResult['data']; - if($json['state'] != 'success') { - if($json['msg'] == 'session not found') { - $session->destroy(); - return $this->redirect($this->loginServerUrl . 'account', 303); - } else { - $this->addAdminError('TransactionCreations', 'createMulti', $json, $user['id']); - $this->Flash->error(__('Login Server Error, please wait for the admin to fix it')); - } - } else { - $pendingTransactionCount = $session->read('Transactions.pending'); - if($pendingTransactionCount == null) { - $pendingTransactionCount = $creationTransactionCount; - } else { - $pendingTransactionCount += $creationTransactionCount; - } - $session->write('Transactions.pending', $pendingTransactionCount); - //echo "pending: " . $pendingTransactionCount; - if($mode === 'next') { - return $this->redirect($this->loginServerUrl . 'account/checkTransactions', 303); - } else { - $this->Flash->success(__('Transaction submitted for review.')); - } + $receiverUsers = $stateUserTable + ->find('all') + ->where(['id IN' => array_keys($users)]) + ->select(['public_key', 'email', 'id']) + ->contain(false); + $transactions = []; + foreach ($receiverUsers as $receiverUser) { + $localAmountCent = $amountCent; + //$localTargetDate = $targetDate; + $id = $receiverUser->id; + if ($requestData['user_amount'][$id] != '') { + $localAmountCent = $this->GradidoNumber->parseInputNumberToCentNumber($requestData['user_amount'][$id]); + } + if (isset($requestData['user_target_date']) && isset($requestData['user_target_date'][$id])) { + $localTargetDate = $requestData['user_target_date'][$id]; + } + if (isset($pendings[$id])) { + $pendings[$id] += $localAmountCent; + } else { + $pendings[$id] = $localAmountCent; + } + $pubKeyHex = bin2hex(stream_get_contents($receiverUser->public_key)); + $identHash = TransactionCreation::DRMakeStringHash($receiverUser->email); + $localTargetDateFrozen = FrozenDate::now(); + $localTargetDateFrozen = $localTargetDateFrozen + ->year($localTargetDate['year']) + ->month($localTargetDate['month']) + ->day($localTargetDate['day']); + //echo "input: "; var_dump($localTargetDate);echo "
"; + //echo "output: "; var_dump($localTargetDateFrozen); + //die('a'); + $builderResult = TransactionCreation::build( + $localAmountCent, + $memo, + $pubKeyHex, + $identHash, + $localTargetDateFrozen + ); + if ($builderResult['state'] == 'success') { + array_push($transactions, base64_encode($builderResult['transactionBody']->serializeToString())); + } + } + echo "pendings: "; + var_dump($pendings); + echo "
"; + foreach ($possibleReceivers as $i => $possibleReceiver) { + $id = $possibleReceiver['id']; + if (isset($pendings[$id])) { + $possibleReceivers[$i]['pending'] = $pendings[$id]; + } + } + $this->set('possibleReceivers', $possibleReceivers); + $creationTransactionCount = count($transactions); + if ($creationTransactionCount > 0) { + $user_balance = 0; + if (isset($user['balance'])) { + $user_balance = $user['balance']; + } + // $session_id, $base64Message, $user_balance = 0 + $requestResult = $this->JsonRequestClient->sendTransaction( + $session->read('session_id'), + $transactions, + $user_balance + ); + if ($requestResult['state'] != 'success') { + $this->addAdminError('TransactionCreations', 'createMulti', $requestResult, $user['id']); + if ($requestResult['type'] == 'request error') { + $this->Flash->error(__('Error by requesting LoginServer, please try again')); + } else { + $this->Flash->error(__('Error, please wait for the admin to fix it')); + } + } else { + $json = $requestResult['data']; + if ($json['state'] != 'success') { + if ($json['msg'] == 'session not found') { + $session->destroy(); + return $this->redirect($this->loginServerUrl . 'account', 303); + } else { + $this->addAdminError('TransactionCreations', 'createMulti', $json, $user['id']); + $this->Flash->error(__('Login Server Error, please wait for the admin to fix it')); + } + } else { + $pendingTransactionCount = $session->read('Transactions.pending'); + if ($pendingTransactionCount == null) { + $pendingTransactionCount = $creationTransactionCount; + } else { + $pendingTransactionCount += $creationTransactionCount; + } + $session->write('Transactions.pending', $pendingTransactionCount); + if ($mode === 'next') { + return $this->redirect($this->loginServerUrl . 'account/checkTransactions', 303); + } else { + $this->Flash->success(__('Transaction submitted for review.')); + } + } + } } - } } - } } } diff --git a/src/Form/TransferForm.php b/src/Form/TransferForm.php index 7cb978733..5572ddaf9 100644 --- a/src/Form/TransferForm.php +++ b/src/Form/TransferForm.php @@ -1,5 +1,5 @@ -setProvider('custom', 'App\Model\Validation\TransactionValidation'); + $validator->setProvider('custom', 'App\Model\Validation\TransactionValidation'); /* $validator->add('receiver_pubkey_hex', 'length', [ 'rule' => ['length', 64], @@ -54,7 +54,7 @@ class TransferForm extends Form ->allowEmptyString('receiver_pubkey_hex', null, 'create')*/ ->add('amount', 'custom', [ 'rule' => 'amount', - 'provider' => 'custom', + 'provider' => 'custom', 'message' => __('Please give a valid positive number with maximal 2 decimal places') ]); return $validator; @@ -72,4 +72,4 @@ class TransferForm extends Form // Send an email. return true; } -} \ No newline at end of file +} diff --git a/src/Locale/de_DE/default.po b/src/Locale/de_DE/default.po index 4486f2a96..90d3c053d 100644 --- a/src/Locale/de_DE/default.po +++ b/src/Locale/de_DE/default.po @@ -344,7 +344,7 @@ msgid "Building transaction failed" msgstr "" #: Controller/TransactionCreationsController.php:262 -msgid "no user choosen" +msgid "No user selected" msgstr "" #: Controller/TransactionCreationsController.php:373 diff --git a/src/Locale/default.pot b/src/Locale/default.pot index 900fe54a8..af483fad6 100644 --- a/src/Locale/default.pot +++ b/src/Locale/default.pot @@ -347,7 +347,7 @@ msgid "Building transaction failed" msgstr "" #: Controller/TransactionCreationsController.php:267 -msgid "no user choosen" +msgid "No user selected" msgstr "" #: Controller/TransactionCreationsController.php:378 diff --git a/src/Template/Dashboard/index.ctp b/src/Template/Dashboard/index.ctp index bb8b7f9dc..3e93e968a 100644 --- a/src/Template/Dashboard/index.ctp +++ b/src/Template/Dashboard/index.ctp @@ -55,7 +55,7 @@ $this->assign( redeem Html->link( - __('viele schöpfen'), + __('schöpfen'), ['controller' => 'TransactionCreations', 'action' => 'createMulti'], ['class' => 'action-button-link'] );?> diff --git a/src/Template/TransactionCreations/create_multi.ctp b/src/Template/TransactionCreations/create_multi.ctp index 674d29961..d4d130b9c 100644 --- a/src/Template/TransactionCreations/create_multi.ctp +++ b/src/Template/TransactionCreations/create_multi.ctp @@ -15,123 +15,99 @@ foreach($receiverProposal as $i => $receiver) { ]); }*/ $this->assign('title', __('Schöpfungstransaktion')); +$this->loadHelper('Form', [ + 'templates' => 'horizontal_form', +]); use Cake\I18n\FrozenTime; ?> -

Schöpfen

- - -
+
Form->create($creationForm) ?> - 0) : ?> -
- -
- Form->control('memo'); ?> - Form->control('amount', ['required' => false]); ?> + 0) : ?> +
+ +
+
+ Form->control('searchText', ['label' => __('Suche'), 'placeholder' => 'Email/Name']); ?> + Form->button(__('Suchen'), ['name' => 'searchButton', 'class' => 'form-button']) ?> +
+
+ Form->control('memo', ['label' => __('Memo'), 'placeholder' => 'Memo']); ?> + Form->control('amount', ['label' => __('Betrag in GDD'), 'required' => false]); ?> day(1)->subMonth(1); ?> - Form->control('target_date', ['value' => $firstDayLastMonth]); ?> - +
+ Form->control('target_date', ['label' => __('Zieldatum'), 'value' => $firstDayLastMonth]); ?> +
+
--> +
+
+ + +
+
+ 30000000) { //$disable = 'disabled'; } ?> -
- - Form->hidden('user_pending[' . $possibleReceiver['id'] . ']', ['value' => $possibleReceiver['pending']] ) ?> - - Form->checkbox('user[' .$possibleReceiver['id'] . ']', ['value' => $possibleReceiver['id'], 'hiddenField' => false, $disable]); ?> - - - - - - - <> -
-
- Form->text('user_amount[' . $possibleReceiver['id'] . ']', ['placeholder' => __('Für benutzerdefinierten Betrag'), 'class' => 'user_amount', 'type' => 'number', 'step' => '0.01', $disable]); ?> GDD -
-
- Form->date('user_target_date[' . $possibleReceiver['id'] . ']', ['value' => $firstDayLastMonth]) ?> -
+
- - Bereits als Transaktion angelegt: element('printGradido', ['number' => $possibleReceiver['pending']]);?> - -
+ Form->hidden('user_pending[' . $possibleReceiver['id'] . ']', ['value' => $possibleReceiver['pending']] ) ?> + +
+
+ Form->checkbox('user[' .$possibleReceiver['id'] . ']', ['value' => $possibleReceiver['id'], 'hiddenField' => false, $disable]); ?> +
+
+ + + + + + + <> + + +
+
+ Form->text('user_amount[' . $possibleReceiver['id'] . ']', ['placeholder' => __('Für benutzerdefinierten Betrag'), 'class' => 'user_amount', 'type' => 'number', 'step' => '0.01', $disable]); ?> GDD +
+
+ Form->date('user_target_date[' . $possibleReceiver['id'] . ']', ['value' => $firstDayLastMonth]) ?> +
+
+
+ + + Bereits als Transaktion angelegt: element('printGradido', ['number' => $possibleReceiver['pending']]);?> + - + In diesen und den letzten 2 Monaten bereits geschöpft (alte Berechnung): element('printGradido', ['number' => $possibleReceiver['amount']]);?> 0) : ?> - + Im letzten Monat geschöpft (neue Berechnung): element('printGradido', ['number' => $possibleReceiver['amount2']]) ?> - - - -
+
- - - -
- $limit) : - ?>

Benutzer insgesamt

-

Seiten: + + +

+ $limit) : ?> +

Benutzer insgesamt

+

Seiten: 0) echo ', '; if($i != $page) { @@ -141,11 +117,17 @@ use Cake\I18n\FrozenTime; } } ?> -

- Form->button(__('Transaktion(en) abschließen'), ['name' => 'next', 'class' => 'grd-form-bn grd-form-bn-succeed grd_clickable grd-width-200']) ?> - Form->button(__('Weitere Transaktion erstellen'), ['name' => 'add', 'class' => 'grd-form-bn grd_clickable grd-width-200']) ?> +

+ +
+
+
+ Form->button(__('Transaktion(en) abschließen'), ['name' => 'next', 'class' => 'form-button' ]) ?> + Form->button(__('Weitere Transaktion erstellen'), ['name' => 'add', 'class' => 'form-button']) ?> +
Form->end() ?> +
Html->script('basic'); ?> 0) : ?>