示例#1
0
文件: _form.php 项目: jorry2008/turen
    <div class="col-md-1"></div>
    <div class="col-md-12 col-lg-6">
        <?php 
$form = ActiveForm::begin();
?>
        <?php 
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>
        <?php 
echo $form->field($model, 'password')->passwordInput();
?>
        <?php 
echo $form->field($model, 'nickname')->textInput(['maxlength' => true]);
?>
        <?php 
echo $form->field($model, 'customer_group_id')->label(Yii::t('customer', 'Customer Group'))->dropDownList(ArrayHelper::map(CustomerGroup::find()->all(), 'id', 'name'));
?>
        <?php 
echo $form->field($model, 'gender')->dropDownList([Customer::CUSTOMER_MALE => Yii::t('common', 'Male'), Customer::CUSTOMER_FEMALE => Yii::t('common', 'Female')]);
?>
        
        <?php 
echo $form->field($model, 'birthday', ['enableClientValidation' => false])->textInput(['maxlength' => true]);
?>
    
        <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>
        <?php 
echo $form->field($model, 'telephone')->textInput(['maxlength' => true]);
?>
示例#2
0
文件: index.php 项目: xidiao/turen
                <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
                        
                <!-- 
                    <p>
                        <?php 
echo Html::a(Yii::t('customer', 'Create Customer'), ['create'], ['class' => 'btn btn-success']);
?>
                    </p>
                 -->
            
                <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'options' => ['class' => 'grid-view box-body table-responsive no-padding'], 'tableOptions' => ['class' => 'table table-hover table-striped table-bordered'], 'headerRowOptions' => [], 'footerRowOptions' => [], 'showHeader' => true, 'showFooter' => false, 'layout' => "{summary}\n{errors}\n{items}\n{pager}", 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'username', ['attribute' => 'gender', 'filter' => [Customer::CUSTOMER_MALE => Yii::t('common', 'Male'), Customer::CUSTOMER_FEMALE => Yii::t('common', 'Female')], 'value' => function ($model) {
    return $model->status ? Yii::t('common', 'Male') : Yii::t('common', 'Female');
}], 'birthday:date', 'email:email', ['attribute' => 'point', 'filter' => false], ['attribute' => 'customerGroup.name', 'filter' => ArrayHelper::map(CustomerGroup::find()->all(), 'id', 'name')], ['attribute' => 'status', 'filter' => [Customer::CUSTOMER_ON => Yii::t('common', 'On'), Customer::CUSTOMER_OFF => Yii::t('common', 'Off')], 'value' => function ($model) {
    return $model->status ? Yii::t('common', 'On') : Yii::t('common', 'Off');
}], 'last_login_at:datetime', ['class' => 'yii\\grid\\ActionColumn', 'header' => Yii::t('common', 'Opration'), 'template' => '{view} {update} {delete} {address} {new_address}', 'buttons' => ['address' => function ($url, $model, $key) {
    $url = ['/customer/customer-address/index', 'CustomerAddressSearch[customer_id]' => $model->id];
    //用户id取用户地址
    $options = ['title' => Yii::t('customer', 'View Address'), 'aria-label' => Yii::t('customer', 'View Address'), 'data-pjax' => '0', 'target' => '_blank'];
    return Html::a('<span class="ion-map"></span>', $url, $options);
}, 'new_address' => function ($url, $model, $key) {
    $url = ['/customer/customer-address/create', 'customer_id' => $model->id];
    //用户id取用户地址
    $options = ['title' => Yii::t('customer', 'Add New Address'), 'aria-label' => Yii::t('customer', 'Add New Address'), 'data-pjax' => '0', 'target' => '_blank'];
    return Html::a('<span class="ion-ios-plus"></span>', $url, $options);
}]]]]);
?>
                                
                </div>
 /**
  * Lists all CustomerGroup models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => CustomerGroup::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }