update transfer view, adding missing js

This commit is contained in:
Dario Rekowski on RockPI 2020-02-10 10:18:52 +00:00
parent 8fe36a1c2c
commit d6fed6efee
9 changed files with 24 additions and 12 deletions

View File

@ -43,8 +43,13 @@ class TransactionCreationsController extends AppController
'contain' => ['Transactions', 'StateUsers']
];
$transactionCreations = $this->paginate($this->TransactionCreations);
$identHashes = [];
foreach($transactionCreations as $creation) {
$identHash = TransactionCreation::DRMakeStringHash($creation->state_user->email);
$identHashes[$creation->state_user->id] = $identHash;
}
$this->set(compact('transactionCreations'));
$this->set(compact('transactionCreations', 'identHashes'));
}
/**

View File

@ -15,7 +15,7 @@ class CreationForm extends Form
//->addField('receiver_pubkey_hex', ['type' => 'string'])
->addField('receiver', ['type' => 'select'])
->addField('amount', ['type' => 'decimal', 'precision' => 2])
->addField('memo', ['type' =>'text', 'default' => '', 'rows' => 5, 'maxlength' => 150]);
->addField('memo', ['type' =>'text', 'default' => '', 'rows' => 3, 'maxlength' => 150]);
}
function validationDefault(Validator $validator)

View File

@ -14,7 +14,7 @@ class TransferForm extends Form
return $schema
->addField('email', ['type' => 'string'])
->addField('amount', ['type' => 'decimal', 'precision' => 2])
->addField('memo', ['type' =>'text', 'default' => '', 'rows' => 5, 'maxlength' => 150]);
->addField('memo', ['type' =>'text', 'default' => '', 'rows' => 3, 'maxlength' => 150]);
}
function validationDefault(Validator $validator)

View File

@ -192,7 +192,7 @@ class Transaction extends TransactionBase {
if(is_array($body)) {
return ['state' => 'error', 'msg' => 'error creating body transaction', 'details' => $body];
}
//$protoTransaction->setBodyBytes($body->serializeToString());
$protoTransaction->setBodyBytes($body->serializeToString());
return $protoTransaction;
}

View File

@ -122,7 +122,7 @@ class TransactionCreation extends TransactionBase {
}
}
if($newSum > 10000000) {
$this->addError('TransactionCreation::validate', 'Creation more than 1000 gr per Month not allowed');
$this->addError('TransactionCreation::validate', 'Creation more than 1.000 GDD per Month not allowed');
return false;
}
//die("\n");
@ -204,8 +204,11 @@ class TransactionCreation extends TransactionBase {
$protoCreation->setReceiverAmount($receiverAmount);
//echo "receiver amount: check<br>";
$identHashBytes = stream_get_contents($transactionCreationEntity->ident_hash);
$protoCreation->setIdentHash(intval($identHashBytes));
//$identHashBytes = stream_get_contents($transactionCreationEntity->ident_hash);
// intval
//$protoCreation->setIdentHash(intval($identHashBytes));
$protoCreation->setIdentHash(self::DRMakeStringHash($stateUser->email));
return new TransactionCreation($protoCreation);
}
}

View File

@ -16,13 +16,14 @@
</nav>
<div class="transactionCreations index large-9 medium-8 columns content">
<h3><?= __('Transaction Creations') ?></h3>
<table cellpadding="0" cellspacing="0">
<table cellpadding="0" cellspacing="0" style="table-layout: auto;">
<thead>
<tr>
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
<th scope="col"><?= $this->Paginator->sort('transaction_id') ?></th>
<th scope="col"><?= $this->Paginator->sort('state_user_id') ?></th>
<th scope="col"><?= $this->Paginator->sort('amount') ?></th>
<th scope="col"><?= $this->Paginator->sort('ident_hash ') ?></th>
<th scope="col" class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
@ -31,8 +32,9 @@
<tr>
<td><?= $this->Number->format($transactionCreation->id) ?></td>
<td><?= $transactionCreation->has('transaction') ? $this->Html->link($transactionCreation->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $transactionCreation->transaction->id]) : '' ?></td>
<td><?= $transactionCreation->has('state_user') ? $this->Html->link($transactionCreation->state_user->id, ['controller' => 'StateUsers', 'action' => 'view', $transactionCreation->state_user->id]) : '' ?></td>
<td><?= $this->Number->format($transactionCreation->amount) ?></td>
<td><?= $transactionCreation->has('state_user') ? $this->Html->link($transactionCreation->state_user->getEmailWithName(), ['controller' => 'StateUsers', 'action' => 'view', $transactionCreation->state_user->id]) : '' ?></td>
<td><?= $this->element('printGradido', ['number' => $transactionCreation->amount]) ?></td>
<td><?= stream_get_contents($transactionCreation->ident_hash) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $transactionCreation->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $transactionCreation->id]) ?>

View File

@ -26,9 +26,9 @@ $this->loadHelper('Form', [
<div class="row mb-3">
<div class="col-md-10 mx-auto">
<?= $this->Form->create($transferForm) ?>
<?= $this->Form->control('amount', ['label' => __('Betrag in GDD')]) ?>
<?= $this->Form->control('memo', ['label' => __('Verwendungszweck')]) ?>
<?= $this->Form->control('email', ['label' => __('Empfänger'), 'placeholder' => 'E-Mail']) ?>
<?= $this->Form->control('memo', ['label' => __('Verwendungszweck'), 'rows' => 3]) ?>
<?= $this->Form->control('amount', ['label' => __('Betrag in GDD')]) ?>
<?= $this->Form->button(__('Transaktion abschließen'), ['name' => 'next', 'class' => 'btn btn-sm btn-primary']) ?>
<!--<?= $this->Form->button(__('Weitere Transaktion erstellen'), ['name' => 'add', 'class' => 'btn btn-sm']) ?>-->
<?= $this->Form->end() ?>

1
webroot/js/core.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long