Fix customer backend forms , fix site\index
backend create\update customer forms must display the same as the frontend forms site\index action should be friendly and related to this app
This commit is contained in:
parent
ed1e0b6c2a
commit
b6b5193120
@ -75,7 +75,12 @@ class CardController extends \backend\controllers\BackendController
|
|||||||
$model->status = Card::STATUS_ACTIVE;
|
$model->status = Card::STATUS_ACTIVE;
|
||||||
$model->type = Card::TYPE_RFID;
|
$model->type = Card::TYPE_RFID;
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
return $this->redirect(['view', 'id' => $model->id_card]);
|
\Yii::$app->session->setFlash( 'success','Card created!' );
|
||||||
|
if ( isset($_POST['create_next'])){
|
||||||
|
return $this->redirect(['create' ]);
|
||||||
|
}else{
|
||||||
|
return $this->redirect(['view', 'id' => $model->id_card]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return $this->render('create', [
|
return $this->render('create', [
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
|
|||||||
@ -79,6 +79,8 @@ class CustomerController extends \backend\controllers\BackendController
|
|||||||
throw new NotFoundHttpException('The requested page does not exist.');
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$model->birthdate= isset($model->birthdate ) ? Yii::$app->formatter->asDate($model->birthdate) :'';
|
||||||
|
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
return $this->redirect(['view', 'id' => $model->id_customer]);
|
return $this->redirect(['view', 'id' => $model->id_customer]);
|
||||||
|
|||||||
@ -68,6 +68,15 @@ class CustomerCreate extends \common\models\Customer
|
|||||||
[['email'], 'string', 'max' => 255],
|
[['email'], 'string', 'max' => 255],
|
||||||
[['email'], 'email' ],
|
[['email'], 'email' ],
|
||||||
[['email'], 'unique' ],
|
[['email'], 'unique' ],
|
||||||
|
[['email'], 'required', 'when' => function($model) {
|
||||||
|
return !isset( $model->email ) || empty($model->phone) ;
|
||||||
|
} ,
|
||||||
|
'whenClient' => "function (attribute, value) {
|
||||||
|
return false;
|
||||||
|
}",
|
||||||
|
'message' => Yii::t('customer/backend','E-mail or phone number required!')
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
[['password_plain','password_repeat'], 'string', 'max' => 32],
|
[['password_plain','password_repeat'], 'string', 'max' => 32],
|
||||||
|
|
||||||
@ -80,6 +89,15 @@ class CustomerCreate extends \common\models\Customer
|
|||||||
|
|
||||||
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
||||||
|
|
||||||
|
[['phone'], 'required', 'when' => function($model) {
|
||||||
|
return !isset( $model->email ) || empty( $model->email ) ;
|
||||||
|
} ,
|
||||||
|
'whenClient' => "function (attribute, value) {
|
||||||
|
return false;
|
||||||
|
}",
|
||||||
|
'message' => Yii::t('customer/backend','E-mail or phone number required!')
|
||||||
|
],
|
||||||
|
|
||||||
[['zip'], 'string', 'max' => 8],
|
[['zip'], 'string', 'max' => 8],
|
||||||
|
|
||||||
[['city'], 'string', 'max' => 30]
|
[['city'], 'string', 'max' => 30]
|
||||||
|
|||||||
@ -68,6 +68,16 @@ class CustomerUpdate extends \common\models\Customer
|
|||||||
[['email'], 'email' ],
|
[['email'], 'email' ],
|
||||||
[['email'], 'unique' ],
|
[['email'], 'unique' ],
|
||||||
|
|
||||||
|
[['email'], 'required', 'when' => function($model) {
|
||||||
|
return !isset( $model->email ) || empty($model->phone) ;
|
||||||
|
} ,
|
||||||
|
'whenClient' => "function (attribute, value) {
|
||||||
|
return false;
|
||||||
|
}",
|
||||||
|
'message' => Yii::t('customer/backend','E-mail or phone number required!')
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
[['password_plain','password_repeat'], 'string', 'max' => 32],
|
[['password_plain','password_repeat'], 'string', 'max' => 32],
|
||||||
|
|
||||||
[['sex'], 'integer'],
|
[['sex'], 'integer'],
|
||||||
@ -79,6 +89,15 @@ class CustomerUpdate extends \common\models\Customer
|
|||||||
|
|
||||||
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
||||||
|
|
||||||
|
[['phone'], 'required', 'when' => function($model) {
|
||||||
|
return !isset( $model->email ) || empty( $model->email ) ;
|
||||||
|
} ,
|
||||||
|
'whenClient' => "function (attribute, value) {
|
||||||
|
return false;
|
||||||
|
}",
|
||||||
|
'message' => Yii::t('customer/backend','E-mail or phone number required!')
|
||||||
|
],
|
||||||
|
|
||||||
[['zip'], 'string', 'max' => 8],
|
[['zip'], 'string', 'max' => 8],
|
||||||
|
|
||||||
[['city'], 'string', 'max' => 30]
|
[['city'], 'string', 'max' => 30]
|
||||||
|
|||||||
@ -22,6 +22,7 @@ use common\models\Card;
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/card', 'Create') : Yii::t('common/card', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/card', 'Create') : Yii::t('common/card', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
<?= Html::submitButton( Yii::t('common/card', 'Create/Next') ,['class' => 'btn btn-primary','name'=>'create_next']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|||||||
@ -22,9 +22,6 @@ use kartik\widgets\DatePicker;
|
|||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?php echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
<?php echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-3'>
|
|
||||||
<?= $form->field($model, 'partnerCardNumber')->textInput() ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -39,17 +36,6 @@ use kartik\widgets\DatePicker;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class='row'>
|
|
||||||
<div class='col-md-3'>
|
|
||||||
<?= $form->field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?>
|
|
||||||
</div>
|
|
||||||
<div class='col-md-3'>
|
|
||||||
<?= $form->field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
||||||
|
|||||||
@ -26,9 +26,6 @@ use kartik\widgets\DatePicker;
|
|||||||
<?php echo $model->customerCardNumber ?>
|
<?php echo $model->customerCardNumber ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-3'>
|
|
||||||
<?= $form->field($model, 'partnerCardNumber')->textInput() ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -43,17 +40,6 @@ use kartik\widgets\DatePicker;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class='row'>
|
|
||||||
<div class='col-md-3'>
|
|
||||||
<?= $form->field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?>
|
|
||||||
</div>
|
|
||||||
<div class='col-md-3'>
|
|
||||||
<?= $form->field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
||||||
|
|||||||
@ -7,47 +7,11 @@ $this->title = 'My Yii Application';
|
|||||||
<div class="site-index">
|
<div class="site-index">
|
||||||
|
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<h1>Congratulations!</h1>
|
<h1>Web Admin</h1>
|
||||||
|
|
||||||
<p class="lead">You have successfully created your Yii-powered application.</p>
|
<p class="lead">Üdvözöljük adminisztrációs felületünkön</p>
|
||||||
|
|
||||||
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="body-content">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<h2>Heading</h2>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
||||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
|
||||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
|
||||||
fugiat nulla pariatur.</p>
|
|
||||||
|
|
||||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<h2>Heading</h2>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
||||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
|
||||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
|
||||||
fugiat nulla pariatur.</p>
|
|
||||||
|
|
||||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<h2>Heading</h2>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
||||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
|
||||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
|
||||||
fugiat nulla pariatur.</p>
|
|
||||||
|
|
||||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -71,7 +71,6 @@ class CustomerCreate extends \common\models\Customer
|
|||||||
[['email'], 'required', 'when' => function($model) {
|
[['email'], 'required', 'when' => function($model) {
|
||||||
return !isset( $model->email ) || empty($model->phone) ;
|
return !isset( $model->email ) || empty($model->phone) ;
|
||||||
} ,
|
} ,
|
||||||
// 'enableClientValidation' => false,
|
|
||||||
'whenClient' => "function (attribute, value) {
|
'whenClient' => "function (attribute, value) {
|
||||||
return false;
|
return false;
|
||||||
}",
|
}",
|
||||||
@ -92,7 +91,6 @@ class CustomerCreate extends \common\models\Customer
|
|||||||
[['phone'], 'required', 'when' => function($model) {
|
[['phone'], 'required', 'when' => function($model) {
|
||||||
return !isset( $model->email ) || empty( $model->email ) ;
|
return !isset( $model->email ) || empty( $model->email ) ;
|
||||||
} ,
|
} ,
|
||||||
// 'enableClientValidation' => false,
|
|
||||||
'whenClient' => "function (attribute, value) {
|
'whenClient' => "function (attribute, value) {
|
||||||
return false;
|
return false;
|
||||||
}",
|
}",
|
||||||
|
|||||||
@ -7,47 +7,8 @@ $this->title = 'My Yii Application';
|
|||||||
<div class="site-index">
|
<div class="site-index">
|
||||||
|
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<h1>Congratulations!</h1>
|
<h1>Web Recepció</h1>
|
||||||
|
<p class="lead">Üdvözöljük Web Recepció oldalunkon!</p>
|
||||||
<p class="lead">You have successfully created your Yii-powered application.</p>
|
|
||||||
|
|
||||||
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="body-content">
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<h2>Heading</h2>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
||||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
|
||||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
|
||||||
fugiat nulla pariatur.</p>
|
|
||||||
|
|
||||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<h2>Heading</h2>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
||||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
|
||||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
|
||||||
fugiat nulla pariatur.</p>
|
|
||||||
|
|
||||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<h2>Heading</h2>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
||||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
|
||||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
|
||||||
fugiat nulla pariatur.</p>
|
|
||||||
|
|
||||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user