{ | { | ||||
return $this->redirect(['dashboard/index']); | 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']); | |||||
} | |||||
} | |||||
} | } | ||||
?> | ?> |
$this->initPaymentMethodsByCreditFunctioning($pointSale); | $this->initPaymentMethodsByCreditFunctioning($pointSale); | ||||
$distributionModule->addPointSaleIncomingDistributions($pointSale); | $distributionModule->addPointSaleIncomingDistributions($pointSale); | ||||
return $this->redirect(['index']); | |||||
$this->setFlash('success', 'Point de vente créé.'); | |||||
return $this->redirectAfterSave('point-sale', $pointSale->id); | |||||
} else { | } else { | ||||
return $this->render('create', array_merge($this->initForm(), [ | return $this->render('create', array_merge($this->initForm(), [ | ||||
'model' => $pointSale, | 'model' => $pointSale, | ||||
$distributionModule->addPointSaleIncomingDistributions($model); | $distributionModule->addPointSaleIncomingDistributions($model); | ||||
$this->setFlash('success', 'Point de vente modifié.'); | $this->setFlash('success', 'Point de vente modifié.'); | ||||
return $this->redirect(['index']); | |||||
return $this->redirectAfterSave('point-sale', $model->id); | |||||
} else { | } else { | ||||
return $this->render('update', array_merge($this->initForm($id), [ | return $this->render('update', array_merge($this->initForm($id), [ | ||||
'model' => $model, | 'model' => $model, |
$this->setFlash('success', 'Produit <strong>' . Html::encode($model->name) . '</strong> ajouté'); | $this->setFlash('success', 'Produit <strong>' . Html::encode($model->name) . '</strong> ajouté'); | ||||
return $this->redirect(['index']); | |||||
return $this->redirectAfterSave('product', $model->id); | |||||
} | } | ||||
} | } | ||||
$productModule->update($model); | $productModule->update($model); | ||||
$this->setFlash('success', 'Produit <strong>' . Html::encode($model->name) . '</strong> modifié'); | $this->setFlash('success', 'Produit <strong>' . Html::encode($model->name) . '</strong> modifié'); | ||||
return $this->redirect(['index']); | |||||
return $this->redirectAfterSave('product', $model->id); | |||||
} | } | ||||
} | } | ||||
$this->processLinkPointSale($userExist); | $this->processLinkPointSale($userExist); | ||||
$this->processLinkUserGroup($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."); | $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 { | } else { | ||||
if ($model->load(\Yii::$app->request->post()) && $model->validate() && YII_ENV != 'demo') { | if ($model->load(\Yii::$app->request->post()) && $model->validate() && YII_ENV != 'demo') { | ||||
$this->setFlash('success', 'Utilisateur créé.'); | $this->setFlash('success', 'Utilisateur créé.'); | ||||
return $this->refresh(); | |||||
return $this->redirectAfterSave('user', $userCreate->id); | |||||
} | } | ||||
} | } | ||||
return $this->render('create', array_merge($this->initForm($model), [ | return $this->render('create', array_merge($this->initForm($model), [ | ||||
'model' => $model, | 'model' => $model, | ||||
])); | ])); | ||||
} | } | ||||
public function actionView($id) | public function actionView($id) |
<?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> |
</div> | </div> | ||||
<div class="clr"></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(); ?> | <?php ActiveForm::end(); ?> | ||||
</div> | </div> |
<?= $form->field($model, 'id_producer')->hiddenInput()->label('') ?> | <?= $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(); ?> | <?php ActiveForm::end(); ?> | ||||
<?php /* $form->field($model, 'product_price_percent') | <?php /* $form->field($model, 'product_price_percent') | ||||
->dropDownList( ProductPrice::percentValues(), [])->hint('Pourcentage appliqué aux prix de chaque produit pour cet utilisateur.');*/ ?> | ->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> | ||||
<div class="col-md-4"> | <div class="col-md-4"> | ||||
<?php if ( | <?php if ( | ||||
$distributionModule->getExportManager()->isEnabled(ExportManager::SHOPPING_CART_LABELS_PDF) | $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 panel-default"> | ||||
<div class="panel-heading"> | <div class="panel-heading"> | ||||
<h3 class="panel-title"> | <h3 class="panel-title"> |