small fixes

This commit is contained in:
rocho 2015-09-21 09:36:44 +02:00
parent b68c2dd20b
commit 8890727862
7 changed files with 20 additions and 22 deletions

View File

@ -92,18 +92,6 @@ class DiscountController extends Controller
} }
} }
/**
* Deletes an existing Discount 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 Discount model based on its primary key value. * Finds the Discount model based on its primary key value.

View File

@ -62,7 +62,7 @@ class WarehouseController extends Controller
public function actionCreate() public function actionCreate()
{ {
$model = new Warehouse(); $model = new Warehouse();
$model->status = Warehouse::STATUS_ACTIVE;
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_warehouse]); return $this->redirect(['view', 'id' => $model->id_warehouse]);
} else { } else {

View File

@ -21,7 +21,6 @@ $this->params['breadcrumbs'][] = $this->title;
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [ 'columns' => [
'name', 'name',
[ [
@ -36,7 +35,10 @@ $this->params['breadcrumbs'][] = $this->title;
'created_at:datetime', 'created_at:datetime',
'updated_at:datetime', 'updated_at:datetime',
['class' => 'yii\grid\ActionColumn'], [
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'
],
], ],
]); ?> ]); ?>

View File

@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
<p> <p>
<?= Html::a(Yii::t('common/discount', 'Update'), ['update', 'id' => $model->id_warehouse], ['class' => 'btn btn-primary']) ?> <?= Html::a(Yii::t('common/discount', 'Update'), ['update', 'id' => $model->id_warehouse], ['class' => 'btn btn-primary']) ?>
<?= <?php
/* Html::a(Yii::t('common/discount', 'Delete'), ['delete', 'id' => $model->id_warehouse], [ /* Html::a(Yii::t('common/discount', 'Delete'), ['delete', 'id' => $model->id_warehouse], [
'class' => 'btn btn-danger', 'class' => 'btn btn-danger',
'data' => [ 'data' => [
@ -30,10 +30,18 @@ $this->params['breadcrumbs'][] = $this->title;
<?= DetailView::widget([ <?= DetailView::widget([
'model' => $model, 'model' => $model,
'attributes' => [ 'attributes' => [
'id_warehouse',
'name', 'name',
'status', [
'type', 'attribute' => 'status',
'label' => Yii::t('common/discount', "Active"),
'value' => $model->statusHuman
],
[
'attribute' => 'type',
'value' => $model->typeHuman
],
// 'status',
// 'type',
'value', 'value',
'created_at', 'created_at',
'updated_at', 'updated_at',

View File

@ -99,7 +99,7 @@ class Account extends \yii\db\ActiveRecord
$result = null; $result = null;
$s = self::types($this->type); $s = self::types($this->type);
if ( array_key_exists($this->type, $s)){ if ( array_key_exists($this->type, $s)){
$result = $s[$this->status]; $result = $s[$this->type];
} }
return $result; return $result;
} }

View File

@ -98,7 +98,7 @@ class Discount extends \yii\db\ActiveRecord
$result = null; $result = null;
$s = self::types($this->type); $s = self::types($this->type);
if ( array_key_exists($this->type, $s)){ if ( array_key_exists($this->type, $s)){
$result = $s[$this->status]; $result = $s[$this->type];
} }
return $result; return $result;
} }

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "8580bd82955b1fbb80d47024e184056e", "hash": "5fe15fcdcc6c43b39968ffd29104ac62",
"packages": [ "packages": [
{ {
"name": "bower-asset/bootstrap", "name": "bower-asset/bootstrap",