add collection

This commit is contained in:
Roland Schneider 2015-11-03 09:50:54 +01:00
parent b6b5193120
commit 33bf52df60
22 changed files with 1073 additions and 0 deletions

View File

@ -53,6 +53,7 @@ class AdminMenuStructure{
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ]; $items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ];
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ]; $items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$today,'CollectionSearch[end]' => $tomorrow ] ];
if ( count($items) > 0 ){ if ( count($items) > 0 ){
$userMainMenu = ['label' => 'Beállítások', 'url' => null, $userMainMenu = ['label' => 'Beállítások', 'url' => null,

View File

@ -0,0 +1,110 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Collection;
use backend\models\CollectionSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* CollectionController implements the CRUD actions for Collection model.
*/
class CollectionController extends \backend\controllers\BackendController
{
/**
* Lists all Collection models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new CollectionSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Collection model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Collection model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Collection();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_collection]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Collection model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_collection]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Collection model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Collection model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Collection the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Collection::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,73 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Collection;
/**
* CollectionSearch represents the model behind the search form about `common\models\Collection`.
*/
class CollectionSearch extends Collection
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_collection', 'id_user', 'created_by', 'id_account', 'money', 'type'], 'integer'],
[['start', 'end', 'created_at', 'updated_at'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Collection::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere([
'id_collection' => $this->id_collection,
'id_user' => $this->id_user,
'created_by' => $this->created_by,
'id_account' => $this->id_account,
'money' => $this->money,
'start' => $this->start,
'end' => $this->end,
'type' => $this->type,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
return $dataProvider;
}
}

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="collection-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'created_by')->textInput() ?>
<?= $form->field($model, 'id_account')->textInput() ?>
<?= $form->field($model, 'money')->textInput() ?>
<?= $form->field($model, 'start')->textInput() ?>
<?= $form->field($model, 'end')->textInput() ?>
<?= $form->field($model, 'type')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend/collection', 'Create') : Yii::t('backend/collection', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,45 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\CollectionSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="collection-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_collection') ?>
<?= $form->field($model, 'id_user') ?>
<?= $form->field($model, 'created_by') ?>
<?= $form->field($model, 'id_account') ?>
<?= $form->field($model, 'money') ?>
<?php // echo $form->field($model, 'start') ?>
<?php // echo $form->field($model, 'end') ?>
<?php // echo $form->field($model, 'type') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('backend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('backend/collection', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
$this->title = Yii::t('backend/collection', 'Create Collection');
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/collection', 'Collections'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,42 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\CollectionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('backend/collection', 'Collections');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('backend/collection', 'Create Collection'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id_collection',
'id_user',
'created_by',
'id_account',
'money',
// 'start',
// 'end',
// 'type',
// 'created_at',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
$this->title = Yii::t('backend/collection', 'Update {modelClass}: ', [
'modelClass' => 'Collection',
]) . ' ' . $model->id_collection;
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/collection', 'Collections'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_collection, 'url' => ['view', 'id' => $model->id_collection]];
$this->params['breadcrumbs'][] = Yii::t('backend/collection', 'Update');
?>
<div class="collection-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,44 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
$this->title = $model->id_collection;
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/collection', 'Collections'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('backend/collection', 'Update'), ['update', 'id' => $model->id_collection], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('backend/collection', 'Delete'), ['delete', 'id' => $model->id_collection], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('backend/collection', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_collection',
'id_user',
'created_by',
'id_account',
'money',
'start',
'end',
'type',
'created_at',
'updated_at',
],
]) ?>
</div>

View File

@ -0,0 +1,104 @@
<?php
namespace common\models;
use Yii;
use common\components\AccountAwareBehavior;
use common\components\UserAwareBehavior;
use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "collection".
*
* @property integer $id_collection
* @property integer $id_user
* @property integer $created_by
* @property integer $id_account
* @property integer $money
* @property string $start
* @property string $end
* @property integer $type
* @property string $created_at
* @property string $updated_at
*/
class Collection extends \common\models\BaseFitnessActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'collection';
}
/**
* @inheritdoc
*/
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
],
[
'class' => UserAwareBehavior::className(),
],
[
'class' => AccountAwareBehavior::className(),
],
], parent::behaviors());
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_user', 'created_by', 'id_account', 'money', 'type'], 'integer'],
[['money', 'type', 'created_at', 'updated_at'], 'required'],
[['start', 'end', 'created_at', 'updated_at'], 'safe']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_collection' => Yii::t('common/collection', 'Id Collection'),
'id_user' => Yii::t('common/collection', 'Id User'),
'created_by' => Yii::t('common/collection', 'Created By'),
'id_account' => Yii::t('common/collection', 'Id Account'),
'money' => Yii::t('common/collection', 'Money'),
'start' => Yii::t('common/collection', 'Start'),
'end' => Yii::t('common/collection', 'End'),
'type' => Yii::t('common/collection', 'Type'),
'created_at' => Yii::t('common/collection', 'Created At'),
'updated_at' => Yii::t('common/collection', 'Updated At'),
];
}
/**
* @param \common\models\User $user the user
* */
public static function readLast($user){
$result = null;
$query = Collection::find();
if ( isset($user)){
$query->andWhere($user->id);
}
$query->orderBy(['end' => SORT_DESC]);
$query->limit(1);
$result = $query->one();
return $result;
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace common\models;
use Yii;
use common\components\AccountAwareBehavior;
use common\components\UserAwareBehavior;
use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "collection".
*
* @property integer $id_collection
* @property integer $id_user
* @property integer $created_by
* @property integer $id_account
* @property integer $money
* @property string $start
* @property string $end
* @property integer $type
* @property string $created_at
* @property string $updated_at
*/
class CollectionCreate extends \common\models\Collection
{
public $lastCollection;
}

View File

@ -451,6 +451,82 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
return $status; return $status;
} }
/**
* @param string $mode The mode to load
* Available modes
* <ul>
* <li>
* <h2>created_at</h2>
* <p>Load all transfer which were created </p>
* </li>
* <li>
* <h2>paid_at</h2>
* <p>Load all transfer which were paid </p>
* </li>
* <li>
* <h2>created_at_paid</h2>
* <p>Load all transfer which were created and paid </p>
* </li>
* <li>
* <h2>created_at_not_paid</h2>
* <p>Load all transfer which were created but not paid </p>
* </li>
* <li>
* <h2>paid_at_not_created_at</h2>
* <p>Load all transfer which were not created but paid . Works correctly only,
* when start and end date given
* </p>
* </li>
* </ul>
*
* */
public static function mkTotalQuery($mode,$start,$end,$idUser,$types,$idAccount){
$query = new Query();
$query->addSelect( [
new Expression( 'transfer.id_account as account'),
new Expression( ' COALESCE(sum( ( case when direction = '.Transfer::DIRECTION_OUT.' then -1 else 1 end )* transfer.money ),0) as money' )
]);
$query->from('transfer');
$query->andFilterWhere([
'id_account' => $idAccount,
]);
$query->andFilterWhere(['id_user' => $idUser]);
$query->andFilterWhere(['in' ,'type', $types]);
if ( $mode == 'created_at'){
$query->andFilterWhere([ '>=', 'transfer.created_at' , $start] );
$query->andFilterWhere([ '<' , 'transfer.created_at' , $end ] );
}else if ( $mode == 'paid_at'){
$query->andFilterWhere([ '>=', 'transfer.paid_at' , $start ] );
$query->andFilterWhere([ '<' , 'transfer.paid_at' , $end ] );
}else if ( $mode == 'created_at_not_paid'){
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_NOT_PAID ] );
$query->andFilterWhere([ '>=', 'transfer.created_at' , $start ] );
$query->andFilterWhere([ '<' , 'transfer.created_at' , $end ] );
}else if ( $mode == 'created_at_paid'){
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_PAID ] );
$query->andFilterWhere([ '>=', 'transfer.created_at' , $start ] );
$query->andFilterWhere([ '<' , 'transfer.created_at' , $end ] );
}else if ( $mode == 'paid_at_not_created_at'){
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_PAID ] );
$query->andFilterWhere([ '>=', 'transfer.paid_at' , $start ] );
$query->andFilterWhere([ '<' , 'transfer.paid_at' , $end ] );
$query->andFilterWhere( ['or', [ '<', 'transfer.created_at' , $start ] ,[ '>=' , 'transfer.created_at' , $end ] ] );
}
$query->groupBy('transfer.id_account');
return $query;
}
} }

View File

@ -0,0 +1,37 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151102_175009_create__table__collection extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%collection}}', [
'id_collection' => $this->primaryKey(),
'id_user' => $this->integer() ,
'created_by' => $this->integer() ,
'id_account' => $this->integer() ,
'money' => $this->integer()->notNull() ,
'start' => $this->dateTime(),
'end' => $this->dateTime(),
'type' => $this->integer(11)->notNull(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
}
public function down()
{
echo "m151102_175009_create__table__collection cannot be reverted.\n";
return false;
}
}

View File

@ -70,6 +70,7 @@ class FrontendMenuStructure{
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ], ['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
['label' => 'Pénzmozgások', 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ], ['label' => 'Pénzmozgások', 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ],
['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ], ['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ],
['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ]
] ]
]; ];

View File

@ -0,0 +1,132 @@
<?php
namespace frontend\controllers;
use Yii;
use common\models\Collection;
use frontend\models\CollectionSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Account;
use common\models\User;
use common\models\CollectionCreate;
/**
* CollectionController implements the CRUD actions for Collection model.
*/
class CollectionController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Collection models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new CollectionSearch();
$searchModel->accounts = Account::read();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Collection model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Collection model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new CollectionCreate();
$user = User::findOne(Yii::$app->user->id);
$model->lastCollection = Collection::readLast($user);
$model->id_user = $user->id;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_collection]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Collection model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_collection]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Collection model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Collection model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Collection the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Collection::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace frontend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Collection;
/**
* CollectionSearch represents the model behind the search form about `common\models\Collection`.
*/
class CollectionSearch extends Collection
{
public $accounts;
public $timestampStart;
public $timestampEnd;
/**
* @inheritdoc
*/
public function rules()
{
return [
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Collection::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere([
'id_account' => $this->id_account,
]);
$query->andFilterWhere([ '>=', 'collection.end', $this->timestampStart ] );
$query->andFilterWhere([ '<', 'collection.end', $this->timestampEnd ] );
return $dataProvider;
}
}

View File

@ -0,0 +1,31 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="collection-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_account')->textInput() ?>
<?= $form->field($model, 'money')->textInput() ?>
<?= $form->field($model, 'start')->textInput() ?>
<?= $form->field($model, 'end')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('frontend/collection', 'Create') : Yii::t('frontend/collection', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,55 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\DateTimePicker;
use frontend\components\HtmlHelper;
/* @var $this yii\web\View */
/* @var $model frontend\models\CollectionSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$accountOptions = ['' =>Yii::t('frontend/collection','All')]+ HtmlHelper::mkAccountOptions($model->accounts);
?>
<div class="collection-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class='row'>
<div class='col-md-4'>
<?= $form->field($model, 'id_account')->dropDownList( $accountOptions ) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,30 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
$this->title = Yii::t('frontend/collection', 'Create Collection');
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/collection', 'Collections'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-create">
<h1><?= Html::encode($this->title) ?></h1>
<dl class='dl-horizontal'>
<dt>Utolsó zárás</dt>
<dd>asdf</dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
</dl>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\CollectionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('frontend/collection', 'Collections');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('frontend/collection', 'Create Collection'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id_collection',
'id_user',
'id_account',
'money',
'start:datetime',
'end:datetime',
'created_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' => '{view}'
],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
$this->title = Yii::t('frontend/collection', 'Update {modelClass}: ', [
'modelClass' => 'Collection',
]) . ' ' . $model->id_collection;
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/collection', 'Collections'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_collection, 'url' => ['view', 'id' => $model->id_collection]];
$this->params['breadcrumbs'][] = Yii::t('frontend/collection', 'Update');
?>
<div class="collection-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,44 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Collection */
$this->title = $model->id_collection;
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/collection', 'Collections'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('frontend/collection', 'Update'), ['update', 'id' => $model->id_collection], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('frontend/collection', 'Delete'), ['delete', 'id' => $model->id_collection], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('frontend/collection', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_collection',
'id_user',
'created_by',
'id_account',
'money',
'start',
'end',
'type',
'created_at',
'updated_at',
],
]) ?>
</div>