public function actionList($finance_id) { $finance = Finance::model()->findByPk($finance_id); /** * @var $finance Finance */ if ($finance->account_id != $this->Account->id) { return false; } $models = FinanceCommit::model()->findAllByAttributes(['finance_id' => $finance_id]); $this->render('list', ['models' => $models, 'finance' => $finance]); }
<tbody> <?php foreach ($models as $index => $model) { $activeGoalsCount = count(FinanceGoal::model()->findAllByAttributes(array('finance_id' => $model->id, 'state' => FinanceGoal::StateInProgress))); ?> <tr> <td><?php echo $index + 1; ?> </td> <td> <?php echo FinanceCommit::getTypeName($model->type); ?> </td> <td> <?php echo $model->value; ?> </td> <td><?php echo CDateHelper::getFullDate($model->create_date); ?> </td> </tr> <?php } ?>
?> <a type="button" class="btn btn-link" href="/finance/view?id=<?php echo $model->finance_id; ?> ">Назад</a> <?php echo CHtml::beginForm('', 'post', array('style' => 'width: 560px;margin: 0 auto;')); echo CHtml::errorSummary($model); ?> <div class="form-group"> <label for="exampleInputEmail1">Тип</label> <?php echo CHtml::activeDropDownList($model, 'type', FinanceCommit::getTypes(), array('class' => 'form-control')); ?> </div> <div class="form-group"> <label for="exampleInputEmail1">Сумма</label> <?php echo CHtml::activeNumberField($model, 'value', array('class' => 'form-control')); ?> </div> <div class="form-group"> <label for="exampleInputEmail1">Описание</label> <?php echo CHtml::activeTextArea($model, 'description', array('class' => 'form-control')); ?> </div>