예제 #1
0
    <?php 
$form = ActiveForm::begin(['layout' => 'inline', 'enableAjaxValidation' => false, 'method' => 'get']);
?>
    <?php 
echo $form->field($searchModel, 'Name', ['inputOptions' => ['placeholder' => \Yii::t('app', 'Search by object\'s name')]]);
?>
    <?php 
echo $form->field($searchModel, 'RoomID', ['inputOptions' => ['placeholder' => \Yii::t('app', 'Search object by room\'s name')]])->dropdownList(\common\models\cf\RoomRecord::find()->select(['Name', 'ID'])->indexBy('ID')->column(), ['prompt' => 'Любой зал']);
?>
    <?php 
echo Html::submitButton('<span class="glyphicon glyphicon-search"></span>', ['class' => 'btn btn-default']);
?>
    <?php 
ActiveForm::end();
?>
</div>
<div class="object-record-index">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $key, $index, $grid) {
    return ['class' => $model->Disabled ? 'danger' : ''];
}, 'columns' => [['class' => '\\common\\components\\DisableActionColumn'], 'Name', 'HardID', 'CoinPrice:currency', ['label' => Yii::t('app', 'Object price'), 'value' => function ($model) {
    if (!empty($model->functions)) {
        return $model->CoinPrice * $model->functions[0]->Price;
    }
}], ['class' => \common\components\BooleanFilterColumn::className(), 'attribute' => 'Disabled'], 'room.Name', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update}', 'buttons' => ['view' => function ($url, $model, $key) {
    $options = ['title' => Yii::t('app', 'Object\'s functions'), 'aria-label' => Yii::t('app', 'Object\'s functions'), 'class' => 'btn btn-primary'];
    return Html::a('<span class="glyphicon glyphicon-cog"></span>', \yii\helpers\Url::to(['view', 'id' => $model->ID]), $options);
}]]]]);
?>

</div>
예제 #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>
예제 #3
0
$this->title = Yii::t('app', 'Rooms');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="room-record-index">

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

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

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $key, $index, $grid) {
    return ['class' => !$model->Enabled ? 'danger' : ''];
}, 'columns' => ['ID', 'Name', 'URL:url', ['attribute' => 'Color', 'filter' => false, 'value' => function ($model) {
    return '#' . strtoupper(dechex($model->Color));
}, 'contentOptions' => function ($model, $key, $index, $grid) {
    return ['style' => 'background-color: #' . dechex($model->Color)];
}], ['attribute' => 'Enabled', 'class' => \common\components\BooleanFilterColumn::className()], ['attribute' => 'Available', 'class' => \common\components\BooleanFilterColumn::className()], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
예제 #4
0
            } else {
                if ($model->DateTo < time()) {
                    return 'Истек период действия';
                } else {
                    if ($model->DateFrom > time()) {
                        return 'Акция пока не действует';
                    }
                }
                return 'Не работает<br>(не входит в расписание)';
            }
        }
    }
}], 'Name', 'DateFrom:datetime', 'DateTo:datetime', ['header' => Yii::t('app', 'Description'), 'format' => 'raw', 'value' => function ($model) {
    /** @var \common\models\cf\ActionsRecord $model */
    $discount = $model->getDiscount();
    return $discount !== null ? $model->getDiscount()->getDescription() : '';
}], 'Schedule', ['header' => Yii::t('models', 'Price for hour'), 'format' => 'raw', 'value' => function ($model) {
    /** @var \common\discounts\DiscountAbstract $discount */
    $discount = $model->getDiscount();
    if ($discount->hasProperty('price')) {
        return Yii::$app->formatter->asCurrency($discount->price);
    } else {
        return '<span class="not-set">(не применимо)</span>';
    }
}], ['attribute' => 'WithHighPriority', 'format' => 'raw', 'value' => function ($model) {
    return $model->WithHighPriority ? '<i class="fa fa-2x fa-bolt" aria-hidden="true"></i>' : '<i class="fa fa-2x fa-minus" aria-hidden="true"></i>';
}], ['attribute' => 'Deleted', 'class' => \common\components\BooleanFilterColumn::className(), 'visible' => Yii::$app->user->identity->isAdmin], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
?>

</div>
예제 #5
0
    <h1><?php 
echo Html::a('<span class="glyphicon glyphicon-arrow-left"></span>', ['/objects/index']);
?>
 <?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Object Functions Record'), ['create', 'objectID' => $model->id], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['HardID', 'Name', 'group.Name', 'room.Name', 'CoinPrice', ['label' => Yii::t('app', 'Object price') . ' (' . $model->functions[0]->Name . ')', 'value' => $model->CoinPrice * $model->functions[0]->Price], 'IsTerminal:boolean', 'Disabled:boolean']]);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['ID', 'Name', 'Price', ['header' => Yii::t('app', 'Object price'), 'format' => 'currency', 'value' => function ($model) {
    return $model->object->CoinPrice * $model->Price;
}], ['class' => \common\components\BooleanFilterColumn::className(), 'attribute' => 'Deleted'], 'room.Name', ['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model, $key, $index) {
    return \yii\helpers\Url::to(['/object-functions/' . $action, 'objectID' => $model->ObjectID, 'id' => $model->id]);
}]]]);
?>

</div>
예제 #6
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) {