Ejemplo n.º 1
0
if ($flash = Yii::$app->session->getFlash("Entry-success")) {
    ?>

        <div class="alert text-success">
            <p><em><?php 
    echo $flash;
    ?>
</em></p>
        </div>

    <?php 
}
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-striped table-hover'], 'emptyText' => '</br><p class="text-danger">' . Yii::t('app', 'No entries found!') . '</p>', 'summary' => '', 'showFooter' => true, 'showOnEmpty' => false, 'footerRowOptions' => ['style' => 'font-weight:bold;'], 'columns' => [['attribute' => 'date', 'enableSorting' => true, 'value' => function ($model) {
    return $model->date != '' ? Yii::$app->formatter->asDate($model->date, 'short') : Yii::$app->formatter->asDate($model->date, 'short');
}, 'contentOptions' => ['style' => 'width: 10%;text-align:left']], ['attribute' => 'category_id', 'format' => 'raw', 'enableSorting' => true, 'value' => function ($model) {
    return $model->description != '' ? '<span style="color:' . $model->category->hexcolor_category . '">' . $model->category->desc_category . '</span>' . ' <em class="text-muted">(' . $model->description . ')</em>' : '<span style="color:' . $model->category->hexcolor_category . '">' . $model->category->desc_category . '</span>';
}, 'contentOptions' => ['style' => 'width: 35%;text-align:left'], 'footer' => 'Total', 'footerOptions' => ['style' => 'text-align:letf']], ['attribute' => 'account.description', 'header' => Yii::t('app', 'Account')], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{pending} {attachment} {view} {update} {delete}', 'buttons' => ['pending' => function ($url, $model) {
    return $model->is_pending != 0 ? Html::a('<span class="glyphicon glyphicon-alert text-danger" ></span>', $url, ['title' => Yii::t('app', 'Pending')]) : '';
}, 'attachment' => function ($url, $model) {
    return $model->attachment != '' ? Html::a('<span class="glyphicon glyphicon-paperclip"></span>', $url, ['title' => Yii::t('app', 'Receipt')]) : '';
}], 'contentOptions' => ['style' => 'width: 25%;text-align:right']], ['label' => '', 'attribute' => 'value', 'format' => 'raw', 'value' => function ($model) {
    return '<strong style="color:' . $model->type->hexcolor_type . '">' . (isset($model->account) ? $model->account->currency->iso_code : Yii::t('app', '$')) . ' ' . $model->value . '</strong>';
}, 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 25%;text-align:right'], 'footer' => Cashbook::pageTotal($dataProvider->models, 'value'), 'footerOptions' => ['style' => 'text-align:right']]]]);
?>

</div>

        </div>
    </div>