if($model->save()) { | if($model->save()) { | ||||
Yii::$app->getSession()->setFlash('success', $this->getFlashMessage('create', $model)); | Yii::$app->getSession()->setFlash('success', $this->getFlashMessage('create', $model)); | ||||
return $this->redirect(['index']); | |||||
return $this->redirect(['/'.$model->getControllerUrlPath().'/update', 'id' => $model->id]); | |||||
} | } | ||||
else { | else { | ||||
Yii::$app->getSession()->setFlash('error', 'Un problème est survenu lors de la création du document.'); | Yii::$app->getSession()->setFlash('error', 'Un problème est survenu lors de la création du document.'); |
</div> | </div> | ||||
<div class="panel-body"> | <div class="panel-body"> | ||||
<div id="block-list-products"> | <div id="block-list-products"> | ||||
<table class="table table-bordered"> | |||||
<table class="table table-bordered" v-if="total > 0"> | |||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
<td>Nom</td> | <td>Nom</td> | ||||
</tr> | </tr> | ||||
</tbody> | </tbody> | ||||
</table> | </table> | ||||
<div v-else class="alert alert-info"> | |||||
Aucun produit. | |||||
</div> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> |
}}) | }}) | ||||
.then(function(response) { | .then(function(response) { | ||||
if(response.data.return == 'success') { | if(response.data.return == 'success') { | ||||
app.address = response.data.address ; | |||||
Vue.set(app.document, 'address', response.data.address); | |||||
} | } | ||||
else { | else { | ||||
app.address = '' ; | |||||
app.document.address = '' ; | |||||
} | } | ||||
}) ; | }) ; | ||||
}, | }, |
{ | { | ||||
return str_replace('common\models\\','',get_class($this)) ; | return str_replace('common\models\\','',get_class($this)) ; | ||||
} | } | ||||
public function getControllerUrlPath() | |||||
{ | |||||
$class = $this->getClass() ; | |||||
$path = strtolower($class) ; | |||||
if($path == 'deliverynote') { | |||||
$path = 'delivery_note' ; | |||||
} | |||||
return $path ; | |||||
} | |||||
public function isValidClass($typeDocument) | public function isValidClass($typeDocument) | ||||
{ | { |