add discount to product sell js

This commit is contained in:
2015-10-21 07:46:15 +02:00
parent f2e30779f0
commit 4e04425403
9 changed files with 63 additions and 10 deletions

View File

@@ -65,7 +65,7 @@ class DiscountController extends Controller
$model->status = Discount::STATUS_ACTIVE;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_warehouse]);
return $this->redirect(['view', 'id' => $model->id_discount]);
} else {
return $this->render('create', [
'model' => $model,
@@ -84,7 +84,7 @@ class DiscountController extends Controller
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_warehouse]);
return $this->redirect(['view', 'id' => $model->id_discount]);
} else {
return $this->render('update', [
'model' => $model,

View File

@@ -18,7 +18,7 @@ class DiscountSearch extends Discount
public function rules()
{
return [
[['id_warehouse', 'status', 'type', 'value'], 'integer'],
[['id_discount', 'status', 'type', 'value'], 'integer'],
[['name', 'created_at', 'updated_at'], 'safe'],
];
}
@@ -56,7 +56,7 @@ class DiscountSearch extends Discount
}
$query->andFilterWhere([
'id_warehouse' => $this->id_warehouse,
'id_discount' => $this->id_discount,
'status' => $this->status,
'type' => $this->type,
'value' => $this->value,

View File

@@ -9,7 +9,7 @@ $this->title = Yii::t('common/discount', 'Update {modelClass}: ', [
'modelClass' => 'Discount',
]) . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/discount', 'Discounts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_warehouse]];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_discount]];
$this->params['breadcrumbs'][] = Yii::t('common/discount', 'Update');
?>
<div class="discount-update">

View File

@@ -15,9 +15,9 @@ $this->params['breadcrumbs'][] = $this->title;
<h1><?= Html::encode($this->title) ?></h1>
<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_discount], ['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_discount], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('common/discount', 'Are you sure you want to delete this item?'),