mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add state user transaction table and php files from branch new_protocol
This commit is contained in:
parent
9668242c8a
commit
37186f1ef2
9
skeema/gradido_community/state_user_transactions.sql
Normal file
9
skeema/gradido_community/state_user_transactions.sql
Normal file
@ -0,0 +1,9 @@
|
||||
CREATE TABLE `state_user_transactions` (
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`state_user_id` int UNSIGNED NOT NULL,
|
||||
`transaction_id` int UNSIGNED NOT NULL,
|
||||
`transaction_type_id` int UNSIGNED NOT NULL,
|
||||
`balance` bigint(20) DEFAULT 0,
|
||||
`balance_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
290
src/Controller/StateUserTransactionsController.php
Normal file
290
src/Controller/StateUserTransactionsController.php
Normal file
@ -0,0 +1,290 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use Cake\ORM\TableRegistry;
|
||||
|
||||
/**
|
||||
* StateUserTransactions Controller
|
||||
*
|
||||
* @property \App\Model\Table\StateUserTransactionsTable $StateUserTransactions
|
||||
*
|
||||
* @method \App\Model\Entity\StateUserTransaction[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class StateUserTransactionsController extends AppController
|
||||
{
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
//$this->Auth->allow(['add', 'edit']);
|
||||
$this->Auth->allow(['ajaxListTransactions']);
|
||||
//$this->loadComponent('JsonRequestClient');
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->paginate = [
|
||||
'contain' => ['StateUsers', 'Transactions', 'TransactionTypes'],
|
||||
];
|
||||
$stateUserTransactions = $this->paginate($this->StateUserTransactions);
|
||||
|
||||
$this->set(compact('stateUserTransactions'));
|
||||
}
|
||||
|
||||
public function sortTransactions($a, $b)
|
||||
{
|
||||
if ($a['date'] == $b['date']) {
|
||||
return 0;
|
||||
}
|
||||
return ($a['date'] > $b['date']) ? -1 : 1;
|
||||
}
|
||||
|
||||
|
||||
public function ajaxListTransactions($page = 1, $count = 20)
|
||||
{
|
||||
$startTime = microtime(true);
|
||||
$session = $this->getRequest()->getSession();
|
||||
$user = $session->read('StateUser');
|
||||
if(!$user) {
|
||||
return $this->returnJson(['state' => 'error', 'msg' => 'user not found', 'details' => 'exist a valid session cookie?']);
|
||||
}
|
||||
|
||||
$paged_state_user_transactions = $this->StateUserTransactions
|
||||
->find('all')
|
||||
->where(['state_user_id' => $user['id'], 'transaction_type_id IN' => [1,2]])
|
||||
->limit($count)
|
||||
->page($page)
|
||||
->order(['transaction_id'])
|
||||
;
|
||||
$all_user_transactions_count = $this->StateUserTransactions
|
||||
->find('all')
|
||||
->where(['state_user_id' => $user['id'], 'transaction_type_id IN' => [1,2]])
|
||||
->count()
|
||||
;
|
||||
$creationTransaction_ids = [];
|
||||
$transferTransaction_ids = [];
|
||||
$allTransaction_ids = [];
|
||||
foreach($paged_state_user_transactions as $state_user_transaction) {
|
||||
$allTransaction_ids[] = $state_user_transaction->transaction_id;
|
||||
switch($state_user_transaction->transaction_type_id) {
|
||||
case 1: $creationTransaction_ids[] = $state_user_transaction->transaction_id; break;
|
||||
case 2: $transferTransaction_ids[] = $state_user_transaction->transaction_id; break;
|
||||
}
|
||||
}
|
||||
$transactionsTable = TableRegistry::getTableLocator()->get('Transactions');
|
||||
$transactionCreationsTable = TableRegistry::getTableLocator()->get('TransactionCreations');
|
||||
$transactionSendCoinsTable = TableRegistry::getTableLocator()->get('TransactionSendCoins');
|
||||
$stateUsersTable = TableRegistry::getTableLocator()->get('StateUsers');
|
||||
if(count($allTransaction_ids) > 0) {
|
||||
$transactionEntries = $transactionsTable->find('all')->where(['id IN' => $allTransaction_ids])->order(['id'])->toArray();
|
||||
}
|
||||
if(count($creationTransaction_ids) > 0) {
|
||||
$transactionCreations = $transactionCreationsTable->find('all')->where(['transaction_id IN' => $creationTransaction_ids]);
|
||||
}
|
||||
if(count($transferTransaction_ids)) {
|
||||
$transactionTransfers = $transactionSendCoinsTable->find('all')->where(['transaction_id IN' => $transferTransaction_ids]);
|
||||
}
|
||||
//var_dump($transactions->all());
|
||||
|
||||
$transactions = [];
|
||||
// creations
|
||||
if(isset($transactionCreations)) {
|
||||
foreach ($transactionCreations as $creation) {
|
||||
//var_dump($creation);
|
||||
$transaction_entries_index = array_search($creation->transaction_id, $allTransaction_ids);
|
||||
if(FALSE === $transaction_entries_index) {
|
||||
return $this->returnJson(['state' => 'error', 'msg' => 'code error', 'details' => 'creation, transaction_entries_index is FALSE, shouldn\'t occure']);
|
||||
}
|
||||
$transaction = $transactionEntries[$transaction_entries_index];
|
||||
array_push($transactions, [
|
||||
'name' => 'Gradido Akademie',
|
||||
'type' => 'creation',
|
||||
'transaction_id' => $creation->transaction_id,
|
||||
'date' => $transaction->received,
|
||||
'balance' => $creation->amount,
|
||||
'memo' => $transaction->memo
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// involved users
|
||||
if(isset($transactionTransfers)) {
|
||||
$involvedUserIds = [];
|
||||
|
||||
foreach ($transactionTransfers as $transfer) {
|
||||
//var_dump($sendCoins);
|
||||
if ($transfer->state_user_id != $user['id']) {
|
||||
array_push($involvedUserIds, intval($transfer->state_user_id));
|
||||
} elseif ($transfer->receiver_user_id != $user['id']) {
|
||||
array_push($involvedUserIds, intval($transfer->receiver_user_id));
|
||||
}
|
||||
}
|
||||
|
||||
// exchange key with values and drop duplicates
|
||||
$involvedUser_temp = array_flip($involvedUserIds);
|
||||
// exchange back
|
||||
$involvedUserIds = array_flip($involvedUser_temp);
|
||||
|
||||
$involvedUser = $stateUsersTable->find('all', [
|
||||
'contain' => false,
|
||||
'where' => ['id IN' => $involvedUserIds],
|
||||
'fields' => ['id', 'first_name', 'last_name', 'email']
|
||||
]);
|
||||
//var_dump($involvedUser->toArray());
|
||||
$involvedUserIndices = [];
|
||||
foreach ($involvedUser as $involvedUser) {
|
||||
$involvedUserIndices[$involvedUser->id] = $involvedUser;
|
||||
}
|
||||
|
||||
// transfers - send coins
|
||||
foreach($transactionTransfers as $transfer)
|
||||
{
|
||||
$transaction_entries_index = array_search($transfer->transaction_id, $allTransaction_ids);
|
||||
if(FALSE === $transaction_entries_index) {
|
||||
|
||||
return $this->returnJson([
|
||||
'state' => 'error',
|
||||
'msg' => 'code error',
|
||||
'details' => 'transfer, transaction_entries_index is FALSE, shouldn\'t occure',
|
||||
'data' => ['haystack' => $allTransaction_ids, 'needle' => $transfer->transaction_id]
|
||||
]);
|
||||
}
|
||||
$transaction = $transactionEntries[$transaction_entries_index];
|
||||
$type = '';
|
||||
$otherUser = null;
|
||||
$other_user_public = '';
|
||||
|
||||
if ($transfer->state_user_id == $user['id']) {
|
||||
$type = 'send';
|
||||
|
||||
if(isset($involvedUserIndices[$transfer->receiver_user_id])) {
|
||||
$otherUser = $involvedUserIndices[$transfer->receiver_user_id];
|
||||
}
|
||||
$other_user_public = bin2hex(stream_get_contents($transfer->receiver_public_key));
|
||||
} else if ($transfer->receiver_user_id == $user['id']) {
|
||||
$type = 'receive';
|
||||
if(isset($involvedUserIndices[$transfer->state_user_id])) {
|
||||
$otherUser = $involvedUserIndices[$transfer->state_user_id];
|
||||
}
|
||||
if($transfer->sender_public_key) {
|
||||
$other_user_public = bin2hex(stream_get_contents($transfer->sender_public_key));
|
||||
}
|
||||
}
|
||||
if(null == $otherUser) {
|
||||
$otherUser = $stateUsersTable->newEntity();
|
||||
}
|
||||
array_push($transactions, [
|
||||
'name' => $otherUser->first_name . ' ' . $otherUser->last_name,
|
||||
'email' => $otherUser->email,
|
||||
'type' => $type,
|
||||
'transaction_id' => $transfer->transaction_id,
|
||||
'date' => $transaction->received,
|
||||
'balance' => $transfer->amount,
|
||||
'memo' => $transaction->memo,
|
||||
'pubkey' => $other_user_public
|
||||
]);
|
||||
//*/
|
||||
|
||||
}
|
||||
}
|
||||
uasort($transactions, array($this, 'sortTransactions'));
|
||||
|
||||
return $this->returnJson([
|
||||
'state' => 'success',
|
||||
'transactions' => $transactions,
|
||||
'transactionExecutingCount' => $session->read('Transaction.executing'),
|
||||
'count' => $all_user_transactions_count,
|
||||
'timeUsed' => microtime(true) - $startTime
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id State User Transaction id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$stateUserTransaction = $this->StateUserTransactions->get($id, [
|
||||
'contain' => ['StateUsers', 'Transactions', 'TransactionTypes'],
|
||||
]);
|
||||
|
||||
$this->set('stateUserTransaction', $stateUserTransaction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$stateUserTransaction = $this->StateUserTransactions->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$stateUserTransaction = $this->StateUserTransactions->patchEntity($stateUserTransaction, $this->request->getData());
|
||||
if ($this->StateUserTransactions->save($stateUserTransaction)) {
|
||||
$this->Flash->success(__('The state user transaction has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The state user transaction could not be saved. Please, try again.'));
|
||||
}
|
||||
$stateUsers = $this->StateUserTransactions->StateUsers->find('list', ['limit' => 200]);
|
||||
$transactions = $this->StateUserTransactions->Transactions->find('list', ['limit' => 200]);
|
||||
$transactionTypes = $this->StateUserTransactions->TransactionTypes->find('list', ['limit' => 200]);
|
||||
$this->set(compact('stateUserTransaction', 'stateUsers', 'transactions', 'transactionTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id State User Transaction id.
|
||||
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function edit($id = null)
|
||||
{
|
||||
$stateUserTransaction = $this->StateUserTransactions->get($id, [
|
||||
'contain' => [],
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$stateUserTransaction = $this->StateUserTransactions->patchEntity($stateUserTransaction, $this->request->getData());
|
||||
if ($this->StateUserTransactions->save($stateUserTransaction)) {
|
||||
$this->Flash->success(__('The state user transaction has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The state user transaction could not be saved. Please, try again.'));
|
||||
}
|
||||
$stateUsers = $this->StateUserTransactions->StateUsers->find('list', ['limit' => 200]);
|
||||
$transactions = $this->StateUserTransactions->Transactions->find('list', ['limit' => 200]);
|
||||
$transactionTypes = $this->StateUserTransactions->TransactionTypes->find('list', ['limit' => 200]);
|
||||
$this->set(compact('stateUserTransaction', 'stateUsers', 'transactions', 'transactionTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id State User Transaction id.
|
||||
* @return \Cake\Http\Response|null Redirects to index.
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function delete($id = null)
|
||||
{
|
||||
$this->request->allowMethod(['post', 'delete']);
|
||||
$stateUserTransaction = $this->StateUserTransactions->get($id);
|
||||
if ($this->StateUserTransactions->delete($stateUserTransaction)) {
|
||||
$this->Flash->success(__('The state user transaction has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The state user transaction could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
37
src/Model/Entity/StateUserTransaction.php
Normal file
37
src/Model/Entity/StateUserTransaction.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace App\Model\Entity;
|
||||
|
||||
use Cake\ORM\Entity;
|
||||
|
||||
/**
|
||||
* StateUserTransaction Entity
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $state_user_id
|
||||
* @property int $transaction_id
|
||||
* @property int $transaction_type_id
|
||||
*
|
||||
* @property \App\Model\Entity\StateUser $state_user
|
||||
* @property \App\Model\Entity\Transaction $transaction
|
||||
* @property \App\Model\Entity\TransactionType $transaction_type
|
||||
*/
|
||||
class StateUserTransaction extends Entity
|
||||
{
|
||||
/**
|
||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||
*
|
||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_accessible = [
|
||||
'state_user_id' => true,
|
||||
'transaction_id' => true,
|
||||
'transaction_type_id' => true,
|
||||
'state_user' => true,
|
||||
'transaction' => true,
|
||||
'transaction_type' => true,
|
||||
];
|
||||
}
|
||||
85
src/Model/Table/StateUserTransactionsTable.php
Normal file
85
src/Model/Table/StateUserTransactionsTable.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
namespace App\Model\Table;
|
||||
|
||||
use Cake\ORM\Query;
|
||||
use Cake\ORM\RulesChecker;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\Validation\Validator;
|
||||
|
||||
/**
|
||||
* StateUserTransactions Model
|
||||
*
|
||||
* @property \App\Model\Table\StateUsersTable&\Cake\ORM\Association\BelongsTo $StateUsers
|
||||
* @property \App\Model\Table\TransactionsTable&\Cake\ORM\Association\BelongsTo $Transactions
|
||||
* @property \App\Model\Table\TransactionTypesTable&\Cake\ORM\Association\BelongsTo $TransactionTypes
|
||||
*
|
||||
* @method \App\Model\Entity\StateUserTransaction get($primaryKey, $options = [])
|
||||
* @method \App\Model\Entity\StateUserTransaction newEntity($data = null, array $options = [])
|
||||
* @method \App\Model\Entity\StateUserTransaction[] newEntities(array $data, array $options = [])
|
||||
* @method \App\Model\Entity\StateUserTransaction|false save(\Cake\Datasource\EntityInterface $entity, $options = [])
|
||||
* @method \App\Model\Entity\StateUserTransaction saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
|
||||
* @method \App\Model\Entity\StateUserTransaction patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
|
||||
* @method \App\Model\Entity\StateUserTransaction[] patchEntities($entities, array $data, array $options = [])
|
||||
* @method \App\Model\Entity\StateUserTransaction findOrCreate($search, callable $callback = null, $options = [])
|
||||
*/
|
||||
class StateUserTransactionsTable extends Table
|
||||
{
|
||||
/**
|
||||
* Initialize method
|
||||
*
|
||||
* @param array $config The configuration for the Table.
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(array $config)
|
||||
{
|
||||
parent::initialize($config);
|
||||
|
||||
$this->setTable('state_user_transactions');
|
||||
$this->setDisplayField('id');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->belongsTo('StateUsers', [
|
||||
'foreignKey' => 'state_user_id',
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
$this->belongsTo('Transactions', [
|
||||
'foreignKey' => 'transaction_id',
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
$this->belongsTo('TransactionTypes', [
|
||||
'foreignKey' => 'transaction_type_id',
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default validation rules.
|
||||
*
|
||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||
* @return \Cake\Validation\Validator
|
||||
*/
|
||||
public function validationDefault(Validator $validator)
|
||||
{
|
||||
$validator
|
||||
->nonNegativeInteger('id')
|
||||
->allowEmptyString('id', null, 'create');
|
||||
|
||||
return $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rules checker object that will be used for validating
|
||||
* application integrity.
|
||||
*
|
||||
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
||||
* @return \Cake\ORM\RulesChecker
|
||||
*/
|
||||
public function buildRules(RulesChecker $rules)
|
||||
{
|
||||
$rules->add($rules->existsIn(['state_user_id'], 'StateUsers'));
|
||||
$rules->add($rules->existsIn(['transaction_id'], 'Transactions'));
|
||||
$rules->add($rules->existsIn(['transaction_type_id'], 'TransactionTypes'));
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
31
src/Template/StateUserTransactions/add.ctp
Normal file
31
src/Template/StateUserTransactions/add.ctp
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\StateUserTransaction $stateUserTransaction
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('List State User Transactions'), ['action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('List State Users'), ['controller' => 'StateUsers', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New State User'), ['controller' => 'StateUsers', 'action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Transactions'), ['controller' => 'Transactions', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Transaction'), ['controller' => 'Transactions', 'action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Transaction Types'), ['controller' => 'TransactionTypes', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Transaction Type'), ['controller' => 'TransactionTypes', 'action' => 'add']) ?></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="stateUserTransactions form large-9 medium-8 columns content">
|
||||
<?= $this->Form->create($stateUserTransaction) ?>
|
||||
<fieldset>
|
||||
<legend><?= __('Add State User Transaction') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('state_user_id', ['options' => $stateUsers]);
|
||||
echo $this->Form->control('transaction_id', ['options' => $transactions]);
|
||||
echo $this->Form->control('transaction_type_id', ['options' => $transactionTypes]);
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
<?= $this->Form->end() ?>
|
||||
</div>
|
||||
37
src/Template/StateUserTransactions/edit.ctp
Normal file
37
src/Template/StateUserTransactions/edit.ctp
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\StateUserTransaction $stateUserTransaction
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Form->postLink(
|
||||
__('Delete'),
|
||||
['action' => 'delete', $stateUserTransaction->id],
|
||||
['confirm' => __('Are you sure you want to delete # {0}?', $stateUserTransaction->id)]
|
||||
)
|
||||
?></li>
|
||||
<li><?= $this->Html->link(__('List State User Transactions'), ['action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('List State Users'), ['controller' => 'StateUsers', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New State User'), ['controller' => 'StateUsers', 'action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Transactions'), ['controller' => 'Transactions', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Transaction'), ['controller' => 'Transactions', 'action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Transaction Types'), ['controller' => 'TransactionTypes', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Transaction Type'), ['controller' => 'TransactionTypes', 'action' => 'add']) ?></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="stateUserTransactions form large-9 medium-8 columns content">
|
||||
<?= $this->Form->create($stateUserTransaction) ?>
|
||||
<fieldset>
|
||||
<legend><?= __('Edit State User Transaction') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('state_user_id', ['options' => $stateUsers]);
|
||||
echo $this->Form->control('transaction_id', ['options' => $transactions]);
|
||||
echo $this->Form->control('transaction_type_id', ['options' => $transactionTypes]);
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
<?= $this->Form->end() ?>
|
||||
</div>
|
||||
57
src/Template/StateUserTransactions/index.ctp
Normal file
57
src/Template/StateUserTransactions/index.ctp
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\StateUserTransaction[]|\Cake\Collection\CollectionInterface $stateUserTransactions
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('New State User Transaction'), ['action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List State Users'), ['controller' => 'StateUsers', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New State User'), ['controller' => 'StateUsers', 'action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Transactions'), ['controller' => 'Transactions', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Transaction'), ['controller' => 'Transactions', 'action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Transaction Types'), ['controller' => 'TransactionTypes', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Transaction Type'), ['controller' => 'TransactionTypes', 'action' => 'add']) ?></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="stateUserTransactions index large-9 medium-8 columns content">
|
||||
<h3><?= __('State User Transactions') ?></h3>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('state_user_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('transaction_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('transaction_type_id') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($stateUserTransactions as $stateUserTransaction): ?>
|
||||
<tr>
|
||||
<td><?= $this->Number->format($stateUserTransaction->id) ?></td>
|
||||
<td><?= $stateUserTransaction->has('state_user') ? $this->Html->link($stateUserTransaction->state_user->email, ['controller' => 'StateUsers', 'action' => 'view', $stateUserTransaction->state_user->id]) : '' ?></td>
|
||||
<td><?= $stateUserTransaction->has('transaction') ? $this->Html->link($stateUserTransaction->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $stateUserTransaction->transaction->id]) : '' ?></td>
|
||||
<td><?= $stateUserTransaction->has('transaction_type') ? $this->Html->link($stateUserTransaction->transaction_type->name, ['controller' => 'TransactionTypes', 'action' => 'view', $stateUserTransaction->transaction_type->id]) : '' ?></td>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['action' => 'view', $stateUserTransaction->id]) ?>
|
||||
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $stateUserTransaction->id]) ?>
|
||||
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $stateUserTransaction->id], ['confirm' => __('Are you sure you want to delete # {0}?', $stateUserTransaction->id)]) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="paginator">
|
||||
<ul class="pagination">
|
||||
<?= $this->Paginator->first('<< ' . __('first')) ?>
|
||||
<?= $this->Paginator->prev('< ' . __('previous')) ?>
|
||||
<?= $this->Paginator->numbers() ?>
|
||||
<?= $this->Paginator->next(__('next') . ' >') ?>
|
||||
<?= $this->Paginator->last(__('last') . ' >>') ?>
|
||||
</ul>
|
||||
<p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
42
src/Template/StateUserTransactions/view.ctp
Normal file
42
src/Template/StateUserTransactions/view.ctp
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\StateUserTransaction $stateUserTransaction
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('Edit State User Transaction'), ['action' => 'edit', $stateUserTransaction->id]) ?> </li>
|
||||
<li><?= $this->Form->postLink(__('Delete State User Transaction'), ['action' => 'delete', $stateUserTransaction->id], ['confirm' => __('Are you sure you want to delete # {0}?', $stateUserTransaction->id)]) ?> </li>
|
||||
<li><?= $this->Html->link(__('List State User Transactions'), ['action' => 'index']) ?> </li>
|
||||
<li><?= $this->Html->link(__('New State User Transaction'), ['action' => 'add']) ?> </li>
|
||||
<li><?= $this->Html->link(__('List State Users'), ['controller' => 'StateUsers', 'action' => 'index']) ?> </li>
|
||||
<li><?= $this->Html->link(__('New State User'), ['controller' => 'StateUsers', 'action' => 'add']) ?> </li>
|
||||
<li><?= $this->Html->link(__('List Transactions'), ['controller' => 'Transactions', 'action' => 'index']) ?> </li>
|
||||
<li><?= $this->Html->link(__('New Transaction'), ['controller' => 'Transactions', 'action' => 'add']) ?> </li>
|
||||
<li><?= $this->Html->link(__('List Transaction Types'), ['controller' => 'TransactionTypes', 'action' => 'index']) ?> </li>
|
||||
<li><?= $this->Html->link(__('New Transaction Type'), ['controller' => 'TransactionTypes', 'action' => 'add']) ?> </li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="stateUserTransactions view large-9 medium-8 columns content">
|
||||
<h3><?= h($stateUserTransaction->id) ?></h3>
|
||||
<table class="vertical-table">
|
||||
<tr>
|
||||
<th scope="row"><?= __('State User') ?></th>
|
||||
<td><?= $stateUserTransaction->has('state_user') ? $this->Html->link($stateUserTransaction->state_user->email, ['controller' => 'StateUsers', 'action' => 'view', $stateUserTransaction->state_user->id]) : '' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Transaction') ?></th>
|
||||
<td><?= $stateUserTransaction->has('transaction') ? $this->Html->link($stateUserTransaction->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $stateUserTransaction->transaction->id]) : '' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Transaction Type') ?></th>
|
||||
<td><?= $stateUserTransaction->has('transaction_type') ? $this->Html->link($stateUserTransaction->transaction_type->name, ['controller' => 'TransactionTypes', 'action' => 'view', $stateUserTransaction->transaction_type->id]) : '' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Id') ?></th>
|
||||
<td><?= $this->Number->format($stateUserTransaction->id) ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user