diff --git a/backend/modules/card/views/user-card/index.php b/backend/modules/card/views/user-card/index.php index a92b535..6c73bda 100755 --- a/backend/modules/card/views/user-card/index.php +++ b/backend/modules/card/views/user-card/index.php @@ -79,7 +79,7 @@ $this->params['breadcrumbs'][] = $this->title; 'data' => \common\models\UserCard::getNameSkills(), 'options' => ['multiple' => true, 'placeholder' => 'Выбрать параметр', 'class' => 'form-control'], 'pluginOptions' => [ - 'allowClear' => true + 'allowClear' => true, ], ]), ], diff --git a/backend/modules/reports/controllers/ReportsController.php b/backend/modules/reports/controllers/ReportsController.php index 11793d8..1d34af4 100644 --- a/backend/modules/reports/controllers/ReportsController.php +++ b/backend/modules/reports/controllers/ReportsController.php @@ -48,11 +48,19 @@ class ReportsController extends Controller public function actionIndex() { $searchModel = new ReportsSearch(); + $reports = $searchModel->search([])->getModels(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + $user_id__fio = []; + for ($i=0; $iuser_card_id] = \common\models\Reports::getFio($reports[$i]); + } + return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, + 'user_id__fio' => $user_id__fio, + ]); } diff --git a/backend/modules/reports/models/ReportsSearch.php b/backend/modules/reports/models/ReportsSearch.php index 5acbe3c..1c5a158 100644 --- a/backend/modules/reports/models/ReportsSearch.php +++ b/backend/modules/reports/models/ReportsSearch.php @@ -60,9 +60,6 @@ class ReportsSearch extends Reports $this->load($params); - if (isset($params['date']) and preg_match("/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/", $params['date']) and !isset($params['id'])) { - $this->created_at = $params['date']; - } if (isset($params['year'])) { $query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]); } diff --git a/backend/modules/reports/views/reports/index.php b/backend/modules/reports/views/reports/index.php index 8728f83..01575b1 100644 --- a/backend/modules/reports/views/reports/index.php +++ b/backend/modules/reports/views/reports/index.php @@ -1,11 +1,14 @@ title = 'Отчеты'; $this->params['breadcrumbs'][] = $this->title; @@ -16,7 +19,6 @@ function next_day($date, $number) { return date('Y-m-d', strtotime($date) + 3600 * 24 * $number); } - ?>
@@ -25,20 +27,47 @@ function next_day($date, $number) 'btn btn-success']) ?>

- - 'btn btn-primary']) ?> -

+ request->url .'?ReportsSearch[created_at]='; + } else{ + $url = '../..'.Yii::$app->request->url .'&ReportsSearch[created_at]='; + } + + for ($date = TODAY; + $date != WEEK_AGO; + $date = next_day($date, -1)): ?> + + 'btn btn-primary']) ?> +
+ + + + + + '; + } + ?> + + + 'form-control', + 'style' => 'display:', + 'id' => 'date' + + ]) ?> + - 'form-control', - 'style' => 'display:', - 'id' => 'date' - ]) ?> 'btn btn-danger sort_by_date', 'type' => 'submit']) ?> @@ -49,12 +78,7 @@ function next_day($date, $number)
-

-'; -//var_dump($dataProvider); -//echo '';?> $dataProvider, 'filterModel' => $searchModel, @@ -62,7 +86,18 @@ function next_day($date, $number) 'columns' => [ ['class' => 'yii\grid\SerialColumn'], - 'created_at', + [ + 'format' => 'raw', + 'attribute' => 'created_at', + 'filter' => Html::input('date', 'ReportsSearch[created_at]', + null, [ + 'class' => 'form-control', + 'style' => 'display:', + 'id' => 'date' + + ]) , + 'value' => 'created_at', + ], [ 'attribute' => 'today', 'format' => 'raw', @@ -83,10 +118,19 @@ function next_day($date, $number) 'tomorrow', [ 'format' => 'raw', - 'attribute' => 'ФИО', - 'filter' => Html::activeTextInput($searchModel, 'fio', ['class' => 'form-control']), + 'attribute' => 'user_card_id', + 'filter' => kartik\select2\Select2::widget([ + 'model' => $searchModel, + 'attribute' => 'user_card_id', + 'data' => $user_id__fio, + 'options' => ['multiple' => true, 'class' => 'form-control'], + 'pluginOptions' => [ + + 'multiple' => true, + ], + ]), 'value' => function ($data) { - return '' . \common\models\Reports::getFio($data) . ''; + return '' . \common\models\Reports::getFio($data) . ''; }, ], @@ -99,18 +143,9 @@ $this->registerCssFile('../../css/site.css'); - \ No newline at end of file diff --git a/backend/web/js/site.js b/backend/web/js/site.js index 9d1bdf4..6fa1192 100644 --- a/backend/web/js/site.js +++ b/backend/web/js/site.js @@ -1,4 +1,3 @@ -alert(123); $(function(){ $('#options').change(function(){