@@ -81,7 +81,7 @@ class DocumentController extends BackendController | |||
if($model->save()) { | |||
Yii::$app->getSession()->setFlash('success', $this->getFlashMessage('create', $model)); | |||
return $this->redirect(['index']); | |||
return $this->redirect(['/'.$model->getControllerUrlPath().'/update', 'id' => $model->id]); | |||
} | |||
else { | |||
Yii::$app->getSession()->setFlash('error', 'Un problème est survenu lors de la création du document.'); |
@@ -171,7 +171,7 @@ use common\models\Producer; | |||
</div> | |||
<div class="panel-body"> | |||
<div id="block-list-products"> | |||
<table class="table table-bordered"> | |||
<table class="table table-bordered" v-if="total > 0"> | |||
<thead> | |||
<tr> | |||
<td>Nom</td> | |||
@@ -205,6 +205,9 @@ use common\models\Producer; | |||
</tr> | |||
</tbody> | |||
</table> | |||
<div v-else class="alert alert-info"> | |||
Aucun produit. | |||
</div> | |||
</div> | |||
</div> | |||
</div> |
@@ -84,10 +84,10 @@ var app = new Vue({ | |||
}}) | |||
.then(function(response) { | |||
if(response.data.return == 'success') { | |||
app.address = response.data.address ; | |||
Vue.set(app.document, 'address', response.data.address); | |||
} | |||
else { | |||
app.address = '' ; | |||
app.document.address = '' ; | |||
} | |||
}) ; | |||
}, |
@@ -141,6 +141,18 @@ class Document extends ActiveRecordCommon | |||
{ | |||
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) | |||
{ |