commit
27bca791d5
@ -46,7 +46,10 @@ return [
|
|||||||
],
|
],
|
||||||
'gridview' => [
|
'gridview' => [
|
||||||
'class' => 'kartik\grid\Module',
|
'class' => 'kartik\grid\Module',
|
||||||
]
|
],
|
||||||
|
'reports' => [
|
||||||
|
'class' => 'backend\modules\reports\Reports',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'components' => [
|
'components' => [
|
||||||
'request' => [
|
'request' => [
|
||||||
|
24
backend/modules/reports/Reports.php
Normal file
24
backend/modules/reports/Reports.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\modules\reports;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reports module definition class
|
||||||
|
*/
|
||||||
|
class Reports extends \yii\base\Module
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public $controllerNamespace = 'backend\modules\reports\controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
// custom initialization code goes here
|
||||||
|
}
|
||||||
|
}
|
20
backend/modules/reports/controllers/DefaultController.php
Normal file
20
backend/modules/reports/controllers/DefaultController.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\modules\reports\controllers;
|
||||||
|
|
||||||
|
use yii\web\Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default controller for the `reports` module
|
||||||
|
*/
|
||||||
|
class DefaultController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Renders the index view for the module
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
return $this->render('index');
|
||||||
|
}
|
||||||
|
}
|
140
backend/modules/reports/controllers/ReportsController.php
Normal file
140
backend/modules/reports/controllers/ReportsController.php
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\modules\reports\controllers;
|
||||||
|
|
||||||
|
use backend\modules\card\models\UserCardSearch;
|
||||||
|
use Yii;
|
||||||
|
use common\models\Reports;
|
||||||
|
use backend\modules\reports\models\ReportsSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportsController implements the CRUD actions for Reports model.
|
||||||
|
*/
|
||||||
|
class ReportsController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['POST'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Reports models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new ReportsSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function actionGroup()
|
||||||
|
{
|
||||||
|
$searchModel = new UserCardSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
$dataProvider->query->innerJoin('reports', 'user_card.id = reports.user_card_id');
|
||||||
|
|
||||||
|
return $this->render('group', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Reports model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Reports model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new Reports();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Reports model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Reports model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
$this->findModel($id)->delete();
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the Reports model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return Reports the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = Reports::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
75
backend/modules/reports/models/ReportsSearch.php
Normal file
75
backend/modules/reports/models/ReportsSearch.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\modules\reports\models;
|
||||||
|
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Reports;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportsSearch represents the model behind the search form of `common\models\Reports`.
|
||||||
|
*/
|
||||||
|
class ReportsSearch extends Reports
|
||||||
|
{
|
||||||
|
public $fio;
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id', 'created_at', 'user_card_id'], 'integer'],
|
||||||
|
[['today', 'difficulties', 'tomorrow', 'fio'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Reports::find()
|
||||||
|
->leftJoin('user_card', 'reports.user_card_id = user_card.id');
|
||||||
|
|
||||||
|
// add conditions that should always apply here
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
// grid filtering conditions
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'user_card_id' => $this->user_card_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'today', $this->today])
|
||||||
|
->andFilterWhere(['like', 'difficulties', $this->difficulties])
|
||||||
|
->andFilterWhere(['like', 'tomorrow', $this->tomorrow])
|
||||||
|
->andFilterWhere(['like', 'user_card.fio', $this->fio]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
12
backend/modules/reports/views/default/index.php
Normal file
12
backend/modules/reports/views/default/index.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<div class="reports-default-index">
|
||||||
|
<h1><?= $this->context->action->uniqueId ?></h1>
|
||||||
|
<p>
|
||||||
|
This is the view content for action "<?= $this->context->action->id ?>".
|
||||||
|
The action belongs to the controller "<?= get_class($this->context) ?>"
|
||||||
|
in the "<?= $this->context->module->id ?>" module.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You may customize this page by editing the following file:<br>
|
||||||
|
<code><?= __FILE__ ?></code>
|
||||||
|
</p>
|
||||||
|
</div>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
echo GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
['class' => 'yii\grid\SerialColumn'],
|
||||||
|
|
||||||
|
'created_at',
|
||||||
|
'today',
|
||||||
|
'difficulties',
|
||||||
|
'tomorrow',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn'],
|
||||||
|
]
|
||||||
|
]);
|
43
backend/modules/reports/views/reports/_form.php
Normal file
43
backend/modules/reports/views/reports/_form.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="reports-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'created_at')->input(
|
||||||
|
'date',
|
||||||
|
[
|
||||||
|
'placeholder' => 'Zadejte svůj Datum narození',
|
||||||
|
'language' => 'en',
|
||||||
|
"data-format" => "DD MMMM YYYY",
|
||||||
|
'class' => 'form-control report-date'
|
||||||
|
|
||||||
|
]
|
||||||
|
) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'today')->textarea(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'difficulties')->textarea(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'tomorrow')->textarea(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'user_card_id')->dropDownList(
|
||||||
|
\yii\helpers\ArrayHelper::map(common\models\UserCard::find()->all(), 'id', 'fio'),
|
||||||
|
['prompt' => '...']
|
||||||
|
) ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
37
backend/modules/reports/views/reports/_search.php
Normal file
37
backend/modules/reports/views/reports/_search.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\modules\reports\models\ReportsSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="reports-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'created_at') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'today') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'difficulties') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'tomorrow') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'user_card_id') ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::resetButton('Сброс', ['class' => 'btn btn-default']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
18
backend/modules/reports/views/reports/create.php
Normal file
18
backend/modules/reports/views/reports/create.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
|
||||||
|
$this->title = 'Добавить отчет';
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="reports-create">
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
52
backend/modules/reports/views/reports/group.php
Normal file
52
backend/modules/reports/views/reports/group.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use backend\modules\reports\models\ReportsSearch;
|
||||||
|
use kartik\grid\GridView;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = 'Доступы';
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="accesses-index">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
<?= Html::a('Общий вид', ['index'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'filterModel' => $searchModel,
|
||||||
|
'pjax' => true,
|
||||||
|
'striped' => true,
|
||||||
|
'hover' => true,
|
||||||
|
'toggleDataContainer' => ['class' => 'btn-group mr-2'],
|
||||||
|
'columns' => [
|
||||||
|
['class' => 'yii\grid\SerialColumn'],
|
||||||
|
[
|
||||||
|
'class' => 'kartik\grid\ExpandRowColumn',
|
||||||
|
'width' => '50px',
|
||||||
|
'value' => function ($model, $key, $index, $column) {
|
||||||
|
return GridView::ROW_COLLAPSED;
|
||||||
|
},
|
||||||
|
'detail' => function ($model, $key, $index, $column) {
|
||||||
|
$searchReports = new ReportsSearch();
|
||||||
|
$providerReports = $searchReports->search(Yii::$app->request->queryParams);
|
||||||
|
$providerReports->query->andWhere(['user_card.id_user' => $model->id_user]);
|
||||||
|
|
||||||
|
return Yii::$app->controller->renderPartial('_expand-row-details', ['dataProvider' => $providerReports]);
|
||||||
|
},
|
||||||
|
'headerOptions' => ['class' => 'kartik-sheet-style'],
|
||||||
|
'expandOneOnly' => true
|
||||||
|
],
|
||||||
|
'fio',
|
||||||
|
'email'
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
42
backend/modules/reports/views/reports/index.php
Normal file
42
backend/modules/reports/views/reports/index.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\modules\reports\models\ReportsSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = 'Отчеты';
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="reports-index">
|
||||||
|
|
||||||
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
<?= Html::a('Сгрупированный по пользователям вид', ['group'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'filterModel' => $searchModel,
|
||||||
|
'columns' => [
|
||||||
|
['class' => 'yii\grid\SerialColumn'],
|
||||||
|
|
||||||
|
'created_at',
|
||||||
|
'today',
|
||||||
|
'difficulties',
|
||||||
|
'tomorrow',
|
||||||
|
[
|
||||||
|
'format' => 'raw',
|
||||||
|
'attribute' => 'ФИО',
|
||||||
|
'filter' => Html::activeTextInput($searchModel, 'fio', ['class' => 'form-control']),
|
||||||
|
'value' => function ($data) { return \common\models\Reports::getFio($data); },
|
||||||
|
],
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn'],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
</div>
|
19
backend/modules/reports/views/reports/update.php
Normal file
19
backend/modules/reports/views/reports/update.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
|
||||||
|
$this->title = 'Редактировать отчет';
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = 'Редактировать';
|
||||||
|
?>
|
||||||
|
<div class="reports-update">
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
44
backend/modules/reports/views/reports/view.php
Normal file
44
backend/modules/reports/views/reports/view.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
|
||||||
|
$this->title = 'Отчет';
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
\yii\web\YiiAsset::register($this);
|
||||||
|
?>
|
||||||
|
<div class="reports-view">
|
||||||
|
<p>
|
||||||
|
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => 'Вы уверенны, что хотите удалить этот элемент?',
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
// 'id',
|
||||||
|
'created_at',
|
||||||
|
'today',
|
||||||
|
'difficulties',
|
||||||
|
'tomorrow',
|
||||||
|
// 'user_card_id',
|
||||||
|
[
|
||||||
|
'format' => 'raw',
|
||||||
|
'attribute' => 'ФИО',
|
||||||
|
'value' => function ($data) { return \common\models\Reports::getFio($data); },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
@ -48,6 +48,7 @@
|
|||||||
['label' => 'Доступы', 'icon' => 'key', 'url' => ['/accesses/accesses'], 'active' => \Yii::$app->controller->id == 'accesses'],
|
['label' => 'Доступы', 'icon' => 'key', 'url' => ['/accesses/accesses'], 'active' => \Yii::$app->controller->id == 'accesses'],
|
||||||
['label' => 'Заметки', 'icon' => 'sticky-note', 'url' => ['/notes/notes'], 'active' => \Yii::$app->controller->id == 'notes'],
|
['label' => 'Заметки', 'icon' => 'sticky-note', 'url' => ['/notes/notes'], 'active' => \Yii::$app->controller->id == 'notes'],
|
||||||
['label' => 'Календарь ДР', 'icon' => 'calendar', 'url' => ['/calendar/calendar'], 'active' => \Yii::$app->controller->id == 'calendar'],
|
['label' => 'Календарь ДР', 'icon' => 'calendar', 'url' => ['/calendar/calendar'], 'active' => \Yii::$app->controller->id == 'calendar'],
|
||||||
|
['label' => 'Отчеты', 'icon' => 'list-alt', 'url' => ['/reports/reports'], 'active' => \Yii::$app->controller->id == 'reports'],
|
||||||
|
|
||||||
/*['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii']],
|
/*['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii']],
|
||||||
['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug']],
|
['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug']],
|
||||||
|
@ -35,4 +35,8 @@
|
|||||||
|
|
||||||
.field-usercard-fields-0-value .itemImg {
|
.field-usercard-fields-0-value .itemImg {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-date {
|
||||||
|
width: 155px;
|
||||||
}
|
}
|
72
common/models/Reports.php
Normal file
72
common/models/Reports.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "reports".
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $today
|
||||||
|
* @property string $difficulties
|
||||||
|
* @property string $tomorrow
|
||||||
|
* @property int $user_card_id
|
||||||
|
* @property int $status
|
||||||
|
*
|
||||||
|
* @property UserCard $userCard
|
||||||
|
*/
|
||||||
|
class Reports extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'reports';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['user_card_id', 'status'], 'integer'],
|
||||||
|
[['user_card_id', 'created_at', 'today'], 'required'],
|
||||||
|
[['today', 'difficulties', 'tomorrow', 'created_at'], 'string', 'max' => 255],
|
||||||
|
[['user_card_id'], 'exist', 'skipOnError' => true, 'targetClass' => UserCard::className(), 'targetAttribute' => ['user_card_id' => 'id']],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => 'ID',
|
||||||
|
'created_at' => 'Дата заполнения отчета',
|
||||||
|
'today' => 'Что было сделано сегодня?',
|
||||||
|
'difficulties' => 'Какие сложности возникли?',
|
||||||
|
'tomorrow' => 'Что планируется сделать завтра?',
|
||||||
|
'user_card_id' => 'Пользователь',
|
||||||
|
'status' => 'Статус'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \yii\db\ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getUserCard()
|
||||||
|
{
|
||||||
|
return $this->hasOne(UserCard::className(), ['id' => 'user_card_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFio($data)
|
||||||
|
{
|
||||||
|
$user_card = UserCard::findOne(['id' => $data->user_card_id]);
|
||||||
|
return $user_card->fio;
|
||||||
|
}
|
||||||
|
}
|
51
console/migrations/m200204_125649_create_reports_table.php
Normal file
51
console/migrations/m200204_125649_create_reports_table.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the creation of table `{{%reports}}`.
|
||||||
|
*/
|
||||||
|
class m200204_125649_create_reports_table extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
$this->createTable('{{%reports}}', [
|
||||||
|
'id' => $this->primaryKey(),
|
||||||
|
'created_at' => $this->date()->notNull(),
|
||||||
|
'today' => $this->string()->notNull(),
|
||||||
|
'difficulties' => $this->string(),
|
||||||
|
'tomorrow' => $this->string(),
|
||||||
|
'status' => $this->integer()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->addColumn('{{%reports}}', 'user_card_id', $this->integer()->notNull());
|
||||||
|
|
||||||
|
// creates index for column `user_card_id`
|
||||||
|
$this->createIndex(
|
||||||
|
'{{%idx-reports-user_card_id}}',
|
||||||
|
'{{%reports}}',
|
||||||
|
'user_card_id'
|
||||||
|
);
|
||||||
|
|
||||||
|
// add foreign key for table `{{%user_card}}`
|
||||||
|
$this->addForeignKey(
|
||||||
|
'{{%fk-reports-user_card_id}}',
|
||||||
|
'{{%reports}}',
|
||||||
|
'user_card_id',
|
||||||
|
'{{%user_card}}',
|
||||||
|
'id',
|
||||||
|
'CASCADE'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
$this->dropTable('{{%reports}}');
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,9 @@ return [
|
|||||||
'card' => [
|
'card' => [
|
||||||
'class' => 'frontend\modules\card\Card',
|
'class' => 'frontend\modules\card\Card',
|
||||||
],
|
],
|
||||||
|
'reports' => [
|
||||||
|
'class' => 'frontend\modules\reports\Reports',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'components' => [
|
'components' => [
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
namespace frontend\modules\access\models;
|
namespace frontend\modules\access\models;
|
||||||
|
|
||||||
|
|
||||||
use common\classes\Debug;
|
|
||||||
use common\models\UserCardAccesses;
|
use common\models\UserCardAccesses;
|
||||||
use frontend\modules\card\models\UserCard;
|
use frontend\modules\card\models\UserCard;
|
||||||
use Yii;
|
use Yii;
|
||||||
|
24
frontend/modules/reports/Reports.php
Normal file
24
frontend/modules/reports/Reports.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\modules\reports;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reports module definition class
|
||||||
|
*/
|
||||||
|
class Reports extends \yii\base\Module
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public $controllerNamespace = 'frontend\modules\reports\controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
// custom initialization code goes here
|
||||||
|
}
|
||||||
|
}
|
20
frontend/modules/reports/controllers/DefaultController.php
Normal file
20
frontend/modules/reports/controllers/DefaultController.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\modules\reports\controllers;
|
||||||
|
|
||||||
|
use yii\web\Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default controller for the `reports` module
|
||||||
|
*/
|
||||||
|
class DefaultController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Renders the index view for the module
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
return $this->render('index');
|
||||||
|
}
|
||||||
|
}
|
134
frontend/modules/reports/controllers/ReportsController.php
Normal file
134
frontend/modules/reports/controllers/ReportsController.php
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\modules\reports\controllers;
|
||||||
|
|
||||||
|
use common\classes\Debug;
|
||||||
|
use common\models\Accesses;
|
||||||
|
use Yii;
|
||||||
|
use common\models\Reports;
|
||||||
|
use frontend\modules\reports\models\ReportsSearch;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportsController implements the CRUD actions for Reports model.
|
||||||
|
*/
|
||||||
|
class ReportsController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['POST'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Reports models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new ReportsSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
$dataProvider->query
|
||||||
|
->where(['user_card.id_user' => Yii::$app->user->identity->id])
|
||||||
|
->innerJoin('user_card', 'reports.user_card_id = user_card.id');
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Reports model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Reports model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new \frontend\modules\reports\models\Reports();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post())) {
|
||||||
|
$model->save();
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Reports model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Reports model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
$this->findModel($id)->delete();
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the Reports model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return Reports the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = Reports::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
32
frontend/modules/reports/models/Reports.php
Normal file
32
frontend/modules/reports/models/Reports.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace frontend\modules\reports\models;
|
||||||
|
|
||||||
|
use common\classes\Debug;
|
||||||
|
use common\models\UserCard;
|
||||||
|
use Yii;
|
||||||
|
|
||||||
|
class Reports extends \common\models\Reports
|
||||||
|
{
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function beforeSave($insert)
|
||||||
|
// {
|
||||||
|
// $user_card = UserCard::findOne(['id_user' => Yii::$app->user->identity->id]);
|
||||||
|
// $this->user_card_id = $user_card->id;
|
||||||
|
// return parent::beforeSave($insert);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function beforeValidate()
|
||||||
|
{
|
||||||
|
if (empty($this->user_card_id)) {
|
||||||
|
$user_card = UserCard::findOne(['id_user' => Yii::$app->user->identity->id]);
|
||||||
|
$this->user_card_id = $user_card->id;
|
||||||
|
}
|
||||||
|
return parent::beforeValidate();
|
||||||
|
}
|
||||||
|
}
|
73
frontend/modules/reports/models/ReportsSearch.php
Normal file
73
frontend/modules/reports/models/ReportsSearch.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\modules\reports\models;
|
||||||
|
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Reports;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportsSearch represents the model behind the search form of `common\models\Reports`.
|
||||||
|
*/
|
||||||
|
class ReportsSearch extends Reports
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id', 'created_at', 'user_card_id', 'status'], 'integer'],
|
||||||
|
[['today', 'difficulties', 'tomorrow'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Reports::find();
|
||||||
|
|
||||||
|
// add conditions that should always apply here
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
// grid filtering conditions
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'user_card_id' => $this->user_card_id,
|
||||||
|
'status' => $this->status,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'today', $this->today])
|
||||||
|
->andFilterWhere(['like', 'difficulties', $this->difficulties])
|
||||||
|
->andFilterWhere(['like', 'tomorrow', $this->tomorrow]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
12
frontend/modules/reports/views/default/index.php
Normal file
12
frontend/modules/reports/views/default/index.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<div class="reports-default-index">
|
||||||
|
<h1><?= $this->context->action->uniqueId ?></h1>
|
||||||
|
<p>
|
||||||
|
This is the view content for action "<?= $this->context->action->id ?>".
|
||||||
|
The action belongs to the controller "<?= get_class($this->context) ?>"
|
||||||
|
in the "<?= $this->context->module->id ?>" module.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You may customize this page by editing the following file:<br>
|
||||||
|
<code><?= __FILE__ ?></code>
|
||||||
|
</p>
|
||||||
|
</div>
|
38
frontend/modules/reports/views/reports/_form.php
Normal file
38
frontend/modules/reports/views/reports/_form.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="reports-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'created_at')->input(
|
||||||
|
'date',
|
||||||
|
[
|
||||||
|
'placeholder' => 'Zadejte svůj Datum narození',
|
||||||
|
'language' => 'en',
|
||||||
|
"data-format" => "DD MMMM YYYY",
|
||||||
|
'class' => 'form-control report-date'
|
||||||
|
|
||||||
|
]
|
||||||
|
) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'today')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'difficulties')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'tomorrow')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
39
frontend/modules/reports/views/reports/_search.php
Normal file
39
frontend/modules/reports/views/reports/_search.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model frontend\modules\reports\models\ReportsSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="reports-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'created_at') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'today') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'difficulties') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'tomorrow') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'user_card_id') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'status') ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::resetButton('Сброс', ['class' => 'btn btn-default']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
18
frontend/modules/reports/views/reports/create.php
Normal file
18
frontend/modules/reports/views/reports/create.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
|
||||||
|
$this->title = 'Добавить отчет';
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => 'Reports', 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="reports-create">
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
38
frontend/modules/reports/views/reports/index.php
Normal file
38
frontend/modules/reports/views/reports/index.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel frontend\modules\reports\models\ReportsSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = 'Отчеты';
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="reports-index">
|
||||||
|
|
||||||
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'filterModel' => $searchModel,
|
||||||
|
'columns' => [
|
||||||
|
['class' => 'yii\grid\SerialColumn'],
|
||||||
|
|
||||||
|
// 'id',
|
||||||
|
'created_at',
|
||||||
|
'today',
|
||||||
|
'difficulties',
|
||||||
|
'tomorrow',
|
||||||
|
// 'user_card_id',
|
||||||
|
//'status',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn'],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
</div>
|
19
frontend/modules/reports/views/reports/update.php
Normal file
19
frontend/modules/reports/views/reports/update.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
|
||||||
|
$this->title = 'Редактировать отчет';
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = 'Редактировать';
|
||||||
|
?>
|
||||||
|
<div class="reports-update">
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
41
frontend/modules/reports/views/reports/view.php
Normal file
41
frontend/modules/reports/views/reports/view.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Reports */
|
||||||
|
|
||||||
|
$this->title = $model->id;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
\yii\web\YiiAsset::register($this);
|
||||||
|
?>
|
||||||
|
<div class="reports-view">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => 'Вы уверенны, что хотите удалить этот отчет?',
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
// 'id',
|
||||||
|
'created_at',
|
||||||
|
'today',
|
||||||
|
'difficulties',
|
||||||
|
'tomorrow',
|
||||||
|
// 'user_card_id',
|
||||||
|
// 'status',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
@ -45,6 +45,7 @@ AppAsset::register($this);
|
|||||||
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
|
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
|
||||||
} else {
|
} else {
|
||||||
$menuItems[] = ['label' => 'Доступы', 'url' => ['/access/access/index']];
|
$menuItems[] = ['label' => 'Доступы', 'url' => ['/access/access/index']];
|
||||||
|
$menuItems[] = ['label' => 'Отчеты', 'url' => ['/reports/reports/index']];
|
||||||
$menuItems[] = '<li>'
|
$menuItems[] = '<li>'
|
||||||
. Html::beginForm(['/site/logout'], 'post')
|
. Html::beginForm(['/site/logout'], 'post')
|
||||||
. Html::submitButton(
|
. Html::submitButton(
|
||||||
|
@ -121,4 +121,8 @@ a.desc:after {
|
|||||||
|
|
||||||
.custom-input {
|
.custom-input {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-date {
|
||||||
|
width: 155px;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user