доработан виджет, добавлен календарь отчетов всех за месяц
This commit is contained in:
@ -10,17 +10,22 @@ use yii\web\Response;
|
||||
class AjaxController extends \yii\web\Controller
|
||||
{
|
||||
|
||||
public function actionGetReportsForDayByDate($user_id, $date)
|
||||
public function actionGetReportsForDayByDate($date, $user_id = null)
|
||||
{
|
||||
$searchModel = new ReportsSearch();
|
||||
$params = ['ReportsSearch' => ['created_at' => $date], 'user_id' => $user_id];
|
||||
$params = ['ReportsSearch' => ['created_at' => $date]];
|
||||
$view = '_gridViewAllUsers';
|
||||
if ($user_id){
|
||||
$params['user_id'] = $user_id;
|
||||
$view = '_gridViewOneUser';
|
||||
}
|
||||
$dataProvider = $searchModel->search($params);
|
||||
return $this->render('_gridView', [
|
||||
'dataProvider' => $dataProvider
|
||||
return $this->render($view, [
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionGetReportsForMonthByIdYearMonth($user_id, $year, $month)
|
||||
public function actionGetReportsForMonthByIdYearMonth($year, $month, $user_id=null)
|
||||
{
|
||||
$searchModel = new ReportsSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
@ -58,7 +58,23 @@ class ReportsController extends Controller
|
||||
]),'user_card_id', 'fio');
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
return $this->render('index');
|
||||
}
|
||||
|
||||
public function actionList()
|
||||
{
|
||||
$searchModel = new ReportsSearch();
|
||||
$user_id__fio = ArrayHelper::map(ArrayHelper::toArray($searchModel->search([])->getModels(), [
|
||||
'common\models\Reports' => [
|
||||
'user_card_id',
|
||||
'fio' => function ($report) {
|
||||
return Reports::getFio($report);
|
||||
}
|
||||
],
|
||||
]),'user_card_id', 'fio');
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('list', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'user_id__fio' => $user_id__fio,
|
||||
@ -94,7 +110,7 @@ class ReportsController extends Controller
|
||||
if (!$dataProvider->getCount()){
|
||||
return $this->render('non-exist_user_id', ['id' => $user_id]);
|
||||
}
|
||||
return $this->render('calendar', [
|
||||
return $this->render('calendarOneUser', [
|
||||
'reports' => $reports_array,
|
||||
'fio' => Reports::getFio($searchModel),
|
||||
'USER_ID' => $user_id
|
||||
|
Reference in New Issue
Block a user