add collections to backend
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
namespace frontend\components;
|
||||
|
||||
use yii\base\Widget;
|
||||
|
||||
class AccountStatisticWidget extends Widget{
|
||||
|
||||
public $totals;
|
||||
|
||||
|
||||
public $viewFile = '//common/_account_statistic';
|
||||
|
||||
public function init(){
|
||||
parent::init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function run(){
|
||||
echo $this->render($this->viewFile,[ 'model' => $this ]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,6 +44,7 @@ class CollectionController extends Controller
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->accountMap = Account::toAccaountMap($searchModel->accounts);
|
||||
|
||||
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
$searchModel->searchTotal();
|
||||
|
||||
@@ -62,7 +63,7 @@ class CollectionController extends Controller
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
$accounts = Account::read();
|
||||
$accounts = Account::read();
|
||||
$accountMap = Account::toAccaountMap($accounts);
|
||||
|
||||
$totals = Transfer::mkTotals($model->start, $model->end, $model->id_user, null, $model->id_account, $accounts, $accountMap);
|
||||
|
||||
@@ -14,6 +14,7 @@ class CollectionSearch extends Collection
|
||||
{
|
||||
public $accounts;
|
||||
public $accountMap;
|
||||
public $users;
|
||||
|
||||
public $timestampStart;
|
||||
public $timestampEnd;
|
||||
|
||||
@@ -68,13 +68,16 @@ class TransferSearch extends Transfer
|
||||
'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->where('0=1');
|
||||
}
|
||||
$query->andWhere(['id_user' => Yii::$app->user->id ] );
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_account' => $this->id_account,
|
||||
@@ -98,11 +101,6 @@ class TransferSearch extends Transfer
|
||||
'money' => 0
|
||||
];
|
||||
|
||||
// if ( $this->hasErrors() ){
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$accounts = Account::find()->orderBy("name asc")->all();
|
||||
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
||||
@@ -110,11 +108,6 @@ class TransferSearch extends Transfer
|
||||
|
||||
$this->totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
||||
|
||||
// $this->totalsCreatedAt = $totals['created_at'];
|
||||
// $this->totalsPaidAt = $totals['paid_at'];
|
||||
// $this->totalsCreatedAtPaid = $totals['created_at_paid'];
|
||||
// $this->totalsCreatedAtNotPaid = $totals['created_at_not_paid'];
|
||||
// $this->totalsPaidAtNotCreatedAt = $totals['paid_at_not_created_at'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use kartik\widgets\DateTimePicker;
|
||||
use frontend\components\HtmlHelper;
|
||||
use kartik\widgets\DateTimePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model frontend\models\CollectionSearch */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use frontend\components\TransferTotalWidget;
|
||||
use frontend\components\AccountStatisticWidget;
|
||||
use common\components\AccountStatisticWidget;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
use frontend\components\AccountStatisticWidget;
|
||||
use common\components\AccountStatisticWidget;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Collection */
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
use common\components\AccountTotalWidget;
|
||||
?>
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['created_at'],
|
||||
'panelHeading' => 'Kiadva',
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['created_at_paid'],
|
||||
'panelHeading' => 'Kiadva/fizetve',
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['created_at_not_paid'],
|
||||
'panelHeading' => 'Kiadva/nem fizetve (Hitel)',
|
||||
'panelType' => 'panel-danger'
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['paid_at_not_created_at'],
|
||||
'panelHeading' => 'Adósság (Hitel)/Fizetve' ,
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['paid_at'],
|
||||
'panelHeading' => 'Fizetve' ,
|
||||
'panelType' => 'panel-success'
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use frontend\components\TransferTotalWidget;
|
||||
use frontend\components\AccountStatisticWidget;
|
||||
use common\components\AccountStatisticWidget;
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ use kartik\widgets\DateTimePicker;
|
||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php //echo $form->field($model, 'type')->dropDownList( ['' =>'Mind']+ Transfer::types()) ?>
|
||||
<?php echo $form->field($model, 'types')->checkboxList( Transfer::types()) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user