@@ -81,6 +81,17 @@ class BackendController extends CommonController | |||
{ | |||
return $this->redirect(['dashboard/index']); | |||
} | |||
public function redirectAfterSave(string $baseRoute, int $id) | |||
{ | |||
$postParams = \Yii::$app->request->post(); | |||
if(isset($postParams['save-stay'])) { | |||
return $this->redirect([$baseRoute.'/update', 'id' => $id]); | |||
} | |||
else { | |||
return $this->redirect(['index']); | |||
} | |||
} | |||
} | |||
?> |
@@ -102,7 +102,8 @@ class PointSaleController extends BackendController | |||
$this->initPaymentMethodsByCreditFunctioning($pointSale); | |||
$distributionModule->addPointSaleIncomingDistributions($pointSale); | |||
return $this->redirect(['index']); | |||
$this->setFlash('success', 'Point de vente créé.'); | |||
return $this->redirectAfterSave('point-sale', $pointSale->id); | |||
} else { | |||
return $this->render('create', array_merge($this->initForm(), [ | |||
'model' => $pointSale, | |||
@@ -132,8 +133,7 @@ class PointSaleController extends BackendController | |||
$distributionModule->addPointSaleIncomingDistributions($model); | |||
$this->setFlash('success', 'Point de vente modifié.'); | |||
return $this->redirect(['index']); | |||
return $this->redirectAfterSave('point-sale', $model->id); | |||
} else { | |||
return $this->render('update', array_merge($this->initForm($id), [ | |||
'model' => $model, |
@@ -140,7 +140,7 @@ class ProductController extends BackendController | |||
$this->setFlash('success', 'Produit <strong>' . Html::encode($model->name) . '</strong> ajouté'); | |||
return $this->redirect(['index']); | |||
return $this->redirectAfterSave('product', $model->id); | |||
} | |||
} | |||
@@ -188,7 +188,8 @@ class ProductController extends BackendController | |||
$productModule->update($model); | |||
$this->setFlash('success', 'Produit <strong>' . Html::encode($model->name) . '</strong> modifié'); | |||
return $this->redirect(['index']); | |||
return $this->redirectAfterSave('product', $model->id); | |||
} | |||
} | |||
@@ -135,6 +135,7 @@ class UserController extends BackendController | |||
$this->processLinkPointSale($userExist); | |||
$this->processLinkUserGroup($userExist); | |||
$this->setFlash('success', "L'utilisateur que vous souhaitez créer possède déjà un compte sur la plateforme. Il vient d'être lié à votre établissement."); | |||
return $this->redirectAfterSave('user', $userExist->id); | |||
} else { | |||
if ($model->load(\Yii::$app->request->post()) && $model->validate() && YII_ENV != 'demo') { | |||
@@ -159,14 +160,13 @@ class UserController extends BackendController | |||
$this->setFlash('success', 'Utilisateur créé.'); | |||
return $this->refresh(); | |||
return $this->redirectAfterSave('user', $userCreate->id); | |||
} | |||
} | |||
return $this->render('create', array_merge($this->initForm($model), [ | |||
'model' => $model, | |||
])); | |||
} | |||
public function actionView($id) |
@@ -0,0 +1,11 @@ | |||
<?php | |||
use yii\helpers\Html; | |||
?> | |||
<div class="form-group form-actions"> | |||
<?= Html::a('Retour', ['index'], ['class' => 'btn btn-default']) ?> | |||
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary', 'name' => 'save']) ?> | |||
<?= Html::submitButton($model->isNewRecord ? 'Créer et rester' : 'Modifier et rester', ['class' => 'btn btn-primary', 'name' => 'save-stay']) ?> | |||
</div> |
@@ -315,9 +315,9 @@ $featureChecker = FeatureModule::getInstance()->getChecker(); | |||
</div> | |||
<div class="clr"></div> | |||
<div class="form-group form-actions"> | |||
<?= Html::a('Retour', ['point-sale/index'], ['class' => 'btn btn-default']) ?> | |||
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary']) ?> | |||
</div> | |||
<?= $this->render('@backend/views/_include/form_actions.php',[ | |||
'model' => $model, | |||
]); ?> | |||
<?php ActiveForm::end(); ?> | |||
</div> |
@@ -223,10 +223,9 @@ $taxRateModule = $this->getTaxRateModule(); | |||
<?= $form->field($model, 'id_producer')->hiddenInput()->label('') ?> | |||
<div class="form-group form-actions"> | |||
<?= Html::a('Retour', ['product/index'], ['class' => 'btn btn-default']) ?> | |||
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary']) ?> | |||
</div> | |||
<?= $this->render('@backend/views/_include/form_actions.php',[ | |||
'model' => $model, | |||
]); ?> | |||
<?php ActiveForm::end(); ?> | |||
@@ -150,12 +150,9 @@ $distributionModule = DistributionModule::getInstance(); | |||
<?php /* $form->field($model, 'product_price_percent') | |||
->dropDownList( ProductPrice::percentValues(), [])->hint('Pourcentage appliqué aux prix de chaque produit pour cet utilisateur.');*/ ?> | |||
<div class="form-group form-actions"> | |||
<?= Html::a('Retour', ['user/index'], ['class' => 'btn btn-default']) ?> | |||
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary']) ?> | |||
</div> | |||
<?= $this->render('@backend/views/_include/form_actions.php',[ | |||
'model' => $model, | |||
]); ?> | |||
</div> | |||
<div class="col-md-4"> | |||
@@ -213,7 +210,7 @@ $distributionModule = DistributionModule::getInstance(); | |||
<?php if ( | |||
$distributionModule->getExportManager()->isEnabled(ExportManager::SHOPPING_CART_LABELS_PDF) | |||
|| $producerModule->getSolver()->getConfig('option_export_evoliz')): ?> | |||
|| $producerModule->getSolver()->getConfig('option_export_evoliz')): ?> | |||
<div class="panel panel-default"> | |||
<div class="panel-heading"> | |||
<h3 class="panel-title"> |