add inventory to frontend

This commit is contained in:
2016-03-24 07:44:00 +01:00
parent e7b16f20ce
commit ed837d6580
27 changed files with 1259 additions and 71 deletions

View File

@@ -8,13 +8,7 @@ use backend\models\InventorySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\InventoryItem;
use yii\data\ActiveDataProvider;
use common\components\Helper;
use common\models\User;
use common\models\Product;
use common\models\InventoryGroup;
use yii\db\Expression;
use yii\db\Query;
use backend\models\InventoryItemSearch;
@@ -50,27 +44,7 @@ class InventoryController extends Controller
]);
}
/**
* Displays a single Inventory model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
$inventory = $this->findModel($id);
$searchModel = new InventoryItemSearch(['inventory' => $inventory]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$query = new Query();
return $this->render('view', [
'model' => $inventory,
'dataProvider' => $dataProvider
]);
}
/**
* Creates a new Inventory model.
* If creation is successful, the browser will be redirected to the 'view' page.
@@ -86,7 +60,7 @@ class InventoryController extends Controller
$model->id_user = \Yii::$app->user->id;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
// return $this->redirect(['view', 'id' => $model->id_inventory]);
return $this->redirect(['view', 'id' => $model->id_inventory]);
} else {
}
return $this->render('create', [
@@ -94,37 +68,7 @@ class InventoryController extends Controller
]);
}
/**
* Updates an existing Inventory model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_inventory]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Inventory model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Inventory model based on its primary key value.