Example #1
0
    <p>
        <?php 
$dropdown = [];
foreach (\common\models\cf\ActionsRecord::getClassList() as $className => $text) {
    $shortClassName = array_reverse(explode('\\', $className))[0];
    $dropdown[] = ['label' => Html::tag('strong', $text), 'url' => ['create', 'className' => $shortClassName]];
}
echo \yii\bootstrap\ButtonDropdown::widget(['label' => Yii::t('app', 'Create Actions Record'), 'options' => ['class' => 'btn-success'], 'dropdown' => ['encodeLabels' => false, 'items' => $dropdown]]);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $key, $index, $grid) {
    return ['class' => $model->Disabled || $model->Deleted || !$model->getDiscount()->isDue() ? 'danger' : 'success'];
}, 'columns' => [['class' => \common\components\DisableActionColumn::className(), 'stateAttribute' => 'Disabled'], ['header' => 'Активно', 'format' => 'raw', 'value' => function ($model) {
    /** @var \common\models\cf\ActionsRecord $model */
    if ($model->getDiscount()->isDue()) {
        //                        return ($model->disabled ? 'Активна, но отключена' : 'Работает');
        if ($model->Deleted) {
            return 'Удалена';
        } else {
            return $model->Disabled ? 'Активна, но отключена' : 'Работает';
        }
    } else {
        if ($model->Deleted) {
            return 'Удалена';
        } else {
            if ($model->Disabled) {
                return 'Отключена';
            } else {
Example #2
0
?>
<div class="levels-record-index">

    <h1 class="page-header"><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Level'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $key, $index, $grid) {
    return ['class' => $model->Deleted ? 'danger' : ($model->StartLevel ? 'success' : '')];
}, 'columns' => ['ID', ['attribute' => 'Name', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    return $model->StartLevel ? '<strong>' . $model->Name . '</strong>' : $model->Name;
}], ['attribute' => 'Discount', 'format' => 'percent', 'value' => function ($model, $key, $index) {
    return $model->Discount / 100;
}], ['attribute' => 'PersonsExpression', 'value' => function ($model) {
    return \common\models\cf\LevelsRecord::getExpressionList()[$model->PersonsExpression];
}], 'Charge:currency', 'OneCheckCharge:currency', ['class' => \common\components\BooleanFilterColumn::className(), 'attribute' => 'ReturnPawn'], ['class' => \common\components\BooleanFilterColumn::className(), 'attribute' => 'Deleted'], ['class' => \common\components\DisableActionColumn::className(), 'stateAttribute' => 'Deleted'], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Example #3
0
 */
$this->title = Yii::t('user', 'Manage users');
$this->params['breadcrumbs'][] = $this->title;
$gridColumns = [['attribute' => 'group.Name', 'filter' => \common\models\cf\PersonsGroupRecord::find()->select(['Name'])->indexBy('Name')->column(), 'options' => ['style' => 'width: 1%'], 'group' => true], ['attribute' => 'accountLevelID', 'header' => 'Уровень', 'filter' => \common\models\cf\LevelsRecord::find()->select(['Name'])->indexBy('ID')->column(), 'value' => function ($model) {
    if ($model->account && $model->account->level) {
        return $model->account->level->Name;
    } else {
        return '';
    }
}, 'options' => ['style' => 'width: 1%'], 'group' => true], ['attribute' => 'ID', 'format' => 'raw', 'value' => function ($model) {
    return $model->id . ':' . $model->account->id;
}, 'options' => ['style' => 'width: 1%']], ['attribute' => 'card.HardID', 'header' => '№ карты', 'format' => 'raw', 'value' => function ($model) {
    return $model->card ? $model->card->id . ': ' . $model->card->HardID : 'без карты';
}, 'options' => ['style' => 'width: 1%']], ['attribute' => 'searchName', 'header' => 'Имя', 'format' => 'raw', 'value' => function ($model) {
    return $model->fullName;
}], ['attribute' => 'childrenCount'], ['attribute' => 'IsRegularClient', 'visible' => $searchModel->hasAttribute('IsRegularClient'), 'class' => \common\components\BooleanFilterColumn::className()], 'Phone1', 'account.Money:currency', 'account.Spend:currency', ['attribute' => 'ServiceCard', 'class' => \common\components\BooleanFilterColumn::className()], ['attribute' => 'Deleted', 'class' => \common\components\BooleanFilterColumn::className()], ['attribute' => 'RegisterDate', 'format' => 'dateTime', 'filter' => \kartik\daterange\DateRangePicker::widget(['model' => $searchModel, 'attribute' => 'RegisterDate', 'presetDropdown' => true, 'hideInput' => true, 'pluginOptions' => ['locale' => ['format' => 'DD.MM.YYYY HH:mm']]])], ['header' => Yii::t('user', 'Block status'), 'stateAttribute' => 'Blocked', 'class' => \common\components\DisableActionColumn::className(), 'template' => '{disable}<br>{statistic} {update} {delete} ', 'buttons' => ['statistic' => function ($url, $model, $key) {
    $options = ['class' => 'btn btn-default btn-xs', 'title' => Yii::t('app', 'User\'s statistic'), 'aria-label' => Yii::t('app', 'User\'s statistic')];
    return Html::a('<span class="glyphicon glyphicon-stats"></span>', \yii\helpers\Url::to(['/finances/person', 'id' => $model->ID]), $options);
}, 'delete' => function ($url, $model, $key) {
    $options = ['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('app', 'Are you sure you want to totally delete this user?'), 'data-method' => 'post', 'data-pjax' => '0', 'class' => 'btn btn-default btn-xs btn-danger'];
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
}], 'buttonOptions' => ['class' => 'btn btn-default btn-xs'], 'options' => ['style' => 'width: 145px'], 'contentOptions' => ['style' => 'text-align: center']]];
echo ExportMenu::widget(['dataProvider' => $dataProvider, 'columns' => $gridColumns, 'target' => '_self', 'selectedColumns' => [0, 3, 4, 9], 'disabledColumns' => [1, 2], 'fontAwesome' => true, 'showConfirmAlert' => false, 'dropdownOptions' => ['label' => 'Экспортровать всех', 'class' => 'btn btn-primary'], 'exportConfig' => [ExportMenu::FORMAT_CSV => false, ExportMenu::FORMAT_PDF => false], 'deleteAfterSave' => true]) . "<hr>\n";
?>

<?php 
Pjax::begin();
?>

<?php 
echo KartikGridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'export' => ['target' => \kartik\grid\GridView::TARGET_SELF, 'fontAwesome' => true, 'showConfirmAlert' => false, 'deleteAfterSave' => true], 'rowOptions' => function ($model, $key, $index, $grid) {