Example #1
0
use common\models\Group;
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\BrokerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Agents');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box">
    <div class="box-body table-responsive">
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $index, $widget, $grid) {
    if ($model->edit != '' || $model->user->group_id == Group::GROUP_DEFAULT) {
        return ['class' => 'danger'];
    } else {
        return [];
    }
}, 'columns' => [['attribute' => 'user_id', 'headerOptions' => ['width' => '50']], ['class' => SetColumn::className(), 'attribute' => 'type_id', 'filter' => Broker::getTypeList(), 'name' => 'typeName'], ['class' => SetColumn::className(), 'attribute' => 'user.group_id', 'filter' => Group::getList(), 'name' => 'user.group.groupName'], 'name', 'company', 'phone', 'email:email', 'address', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
    </div>
    <div class="box-footer">
        <?php 
echo Html::a(Yii::t('app', 'Add agent'), ['create', 'type_id' => 1], ['class' => 'btn btn-success']);
?>
        <?php 
echo Html::a(Yii::t('app', 'Add company'), ['create', 'type_id' => 2], ['class' => 'btn btn-success']);
?>
    </div>
</div>
Example #2
0
        <?php 
$form = ActiveForm::begin(['id' => 'form-signup']);
?>

            <div class="row">
                <div class="col-md-4">
                    <?php 
echo $form->field($model, 'username');
?>

                    <?php 
echo $form->field($model, 'password')->passwordInput();
?>

                    <?php 
echo $form->field($model, 'type_id')->dropDownList(Broker::getTypeList())->label(Yii::t('app', 'Who are you?'));
?>

                    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true])->label($model->type_id == 1 ? Yii::t('app', 'Enter your full name') : Yii::t('app', 'Enter company name'));
?>

                    <?php 
echo $form->field($model, 'company')->textInput(['maxlength' => true]);
?>

                    <?php 
echo $form->field($model, 'phone')->textInput(['maxlength' => true]);
?>

                    <?php 
Example #3
0
?>
                </div>
            </div>
        </div>
        <div class="col-md-8">
            <div class="box">
                <div class="box-header with-border">
                    <?php 
echo Yii::t('app', 'Information broker');
?>
                </div>
                <div class="box-body">
                    <div class="row">
                        <div class="col-md-6">
                            <?php 
echo $form->field($model, 'type_id')->dropDownList(Broker::getTypeList());
?>

                            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true])->label($model->type_id == 1 ? Yii::t('app', 'Full name') : Yii::t('app', 'Name'));
?>

                            <?php 
if ($model->type_id == 1) {
    echo $form->field($model, 'company')->textInput(['maxlength' => true]);
}
?>

                            <?php 
echo $form->field($model, 'phone')->textInput(['maxlength' => true]);
?>