add changes procurement

This commit is contained in:
rocho 2015-09-25 18:43:23 +02:00
parent 5c9db98110
commit fe61803670
5 changed files with 42 additions and 28 deletions

View File

@ -41,6 +41,14 @@ class ProcurementController extends Controller
$users = User::read(null); $users = User::read(null);
$searchModel = new ProcurementSearch(); $searchModel = new ProcurementSearch();
$today = time();
$tomorrow = time()+86400;
$searchModel->timestampStart = date("Y-m-d" , $today );
$searchModel->timestampEnd = date("Y-m-d" , $tomorrow );
$searchModel->date_start = Yii::$app->formatter->asDate($today);
$searchModel->date_end = Yii::$app->formatter->asDate($tomorrow);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [ return $this->render('index', [
@ -108,7 +116,7 @@ class ProcurementController extends Controller
} }
return $this->redirect(['view', 'id' => $model->id_procurement]); return $this->redirect(['index' ]);
} else { } else {
return $this->render('create', [ return $this->render('create', [
'model' => $model, 'model' => $model,

View File

@ -26,7 +26,7 @@ class ProcurementSearch extends Procurement
{ {
return [ return [
[[ 'id_warehouse', 'id_user', 'id_product', ], 'integer'], [[ 'id_warehouse', 'id_user', 'id_product', ], 'integer'],
[[ 'date_start', ], 'date' , 'timestampAttribute' => 'timestampStart' ], [[ 'date_start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'date_end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [[ 'date_end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
]; ];
} }
@ -63,6 +63,14 @@ class ProcurementSearch extends Procurement
return $dataProvider; return $dataProvider;
} }
if ( empty($this->date_start) ){
$this->timestampStart = '';
}
if ( empty($this->date_end) ){
$this->timestampEnd = '';
}
$query->andFilterWhere([ $query->andFilterWhere([
'id_warehouse' => $this->id_warehouse, 'id_warehouse' => $this->id_warehouse,
'id_user' => $this->id_user, 'id_user' => $this->id_user,

View File

@ -17,8 +17,6 @@ function mkOptions($options){
$all = ['' => Yii::t('common/product','All' ) ]; $all = ['' => Yii::t('common/product','All' ) ];
// $o[''] = Yii::t('common/product','All' ) ;
$o = $all + $options; $o = $all + $options;
return $o; return $o;

View File

@ -48,13 +48,13 @@ $this->params['breadcrumbs'][] = $this->title;
'template' => '{view} {update} {procurement}', 'template' => '{view} {update} {procurement}',
'buttons' =>[ 'buttons' =>[
'view' => function ($url, $model, $key) { 'view' => function ($url, $model, $key) {
return Html::a( Yii::t('common/product', 'Details' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ; return Html::a( Yii::t('common/product', 'Details' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
}, },
'update' => function ($url, $model, $key) { 'update' => function ($url, $model, $key) {
return Html::a( Yii::t('common/product', 'Update' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ; return Html::a( Yii::t('common/product', 'Update' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
}, },
'procurement' => function ($url, $model, $key) { 'procurement' => function ($url, $model, $key) {
return Html::a( Yii::t('common/product', 'Procurement' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ; return Html::a( Yii::t('common/product', 'Procurement' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
}, },
], ],
'urlCreator' => function ( $action, $model, $key, $index ){ 'urlCreator' => function ( $action, $model, $key, $index ){

42
composer.lock generated
View File

@ -318,16 +318,16 @@
}, },
{ {
"name": "kartik-v/bootstrap-fileinput", "name": "kartik-v/bootstrap-fileinput",
"version": "v4.2.7", "version": "v4.2.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/kartik-v/bootstrap-fileinput.git", "url": "https://github.com/kartik-v/bootstrap-fileinput.git",
"reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78" "reference": "e4906dd5ee852a5333d3ce4d19f69ee855efe844"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/0468bbba9c28c1250aca83eba9b33e32ec135f78", "url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/e4906dd5ee852a5333d3ce4d19f69ee855efe844",
"reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78", "reference": "e4906dd5ee852a5333d3ce4d19f69ee855efe844",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -362,20 +362,20 @@
"progress", "progress",
"upload" "upload"
], ],
"time": "2015-09-13 17:39:44" "time": "2015-08-26 18:42:44"
}, },
{ {
"name": "kartik-v/bootstrap-star-rating", "name": "kartik-v/bootstrap-star-rating",
"version": "v3.5.4", "version": "v3.5.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/kartik-v/bootstrap-star-rating.git", "url": "https://github.com/kartik-v/bootstrap-star-rating.git",
"reference": "987777ee21a599bebbc545c743063fcee9833842" "reference": "bd9c52db6ac71cb270620c1aee601d142ab2cc00"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/kartik-v/bootstrap-star-rating/zipball/987777ee21a599bebbc545c743063fcee9833842", "url": "https://api.github.com/repos/kartik-v/bootstrap-star-rating/zipball/bd9c52db6ac71cb270620c1aee601d142ab2cc00",
"reference": "987777ee21a599bebbc545c743063fcee9833842", "reference": "bd9c52db6ac71cb270620c1aee601d142ab2cc00",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -403,7 +403,7 @@
"jquery", "jquery",
"star" "star"
], ],
"time": "2015-09-21 09:06:33" "time": "2015-06-18 14:42:46"
}, },
{ {
"name": "kartik-v/dependent-dropdown", "name": "kartik-v/dependent-dropdown",
@ -1036,16 +1036,16 @@
}, },
{ {
"name": "kartik-v/yii2-widget-select2", "name": "kartik-v/yii2-widget-select2",
"version": "v2.0.3", "version": "v2.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/kartik-v/yii2-widget-select2.git", "url": "https://github.com/kartik-v/yii2-widget-select2.git",
"reference": "e72880e7e8dfc845c112ed7df275bf1c929be6db" "reference": "585e8797d7982e0c9d09370b98b451a028a59439"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/e72880e7e8dfc845c112ed7df275bf1c929be6db", "url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/585e8797d7982e0c9d09370b98b451a028a59439",
"reference": "e72880e7e8dfc845c112ed7df275bf1c929be6db", "reference": "585e8797d7982e0c9d09370b98b451a028a59439",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1080,7 +1080,7 @@
"widget", "widget",
"yii2" "yii2"
], ],
"time": "2015-09-12 19:56:48" "time": "2015-07-01 15:20:59"
}, },
{ {
"name": "kartik-v/yii2-widget-sidenav", "name": "kartik-v/yii2-widget-sidenav",
@ -1581,21 +1581,21 @@
}, },
{ {
"name": "yiisoft/yii2-bootstrap", "name": "yiisoft/yii2-bootstrap",
"version": "2.0.4", "version": "2.0.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/yiisoft/yii2-bootstrap.git", "url": "https://github.com/yiisoft/yii2-bootstrap.git",
"reference": "1b6b1e61cf91c3cdd517d6a7e71d30bb212e4af0" "reference": "1464f93834b1d5edb1f5625f7ffd6c3723fa4923"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/1b6b1e61cf91c3cdd517d6a7e71d30bb212e4af0", "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/1464f93834b1d5edb1f5625f7ffd6c3723fa4923",
"reference": "1b6b1e61cf91c3cdd517d6a7e71d30bb212e4af0", "reference": "1464f93834b1d5edb1f5625f7ffd6c3723fa4923",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*",
"yiisoft/yii2": ">=2.0.4" "yiisoft/yii2": ">=2.0.6"
}, },
"type": "yii2-extension", "type": "yii2-extension",
"extra": { "extra": {
@ -1627,7 +1627,7 @@
"bootstrap", "bootstrap",
"yii2" "yii2"
], ],
"time": "2015-05-10 22:08:17" "time": "2015-09-23 17:48:24"
}, },
{ {
"name": "yiisoft/yii2-composer", "name": "yiisoft/yii2-composer",