Merge pull request #1 from apuc/balance2

Balance2
This commit is contained in:
kavalar 2019-06-25 12:39:22 +03:00 committed by GitHub
commit fe56d217c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
320 changed files with 1011 additions and 28 deletions

0
.bowerrc Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
.htaccess Normal file → Executable file
View File

0
LICENSE.md Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
Vagrantfile vendored Normal file → Executable file
View File

0
backend/assets/AppAsset.php Normal file → Executable file
View File

0
backend/codeception.yml Normal file → Executable file
View File

0
backend/config/.gitignore vendored Normal file → Executable file
View File

0
backend/config/bootstrap.php Normal file → Executable file
View File

3
backend/config/main.php Normal file → Executable file
View File

@ -29,6 +29,9 @@ return [
'hh' => [ 'hh' => [
'class' => 'backend\modules\hh\Hh', 'class' => 'backend\modules\hh\Hh',
], ],
'balance' => [
'class' => 'backend\modules\balance\Balance',
],
], ],
'components' => [ 'components' => [
'request' => [ 'request' => [

0
backend/config/params.php Normal file → Executable file
View File

0
backend/config/test.php Normal file → Executable file
View File

0
backend/controllers/SiteController.php Normal file → Executable file
View File

0
backend/models/.gitkeep Normal file → Executable file
View File

View File

@ -0,0 +1,24 @@
<?php
namespace backend\modules\balance;
/**
* card module definition class
*/
class Balance extends \yii\base\Module
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'backend\modules\balance\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace backend\modules\balance\controllers;
use backend\modules\balance\models\Balance;
use backend\modules\balance\models\BalanceSearch;
use common\classes\Debug;
use common\models\FieldsValue;
use common\models\FieldsValueNew;
use Yii;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\db\Query;
class BalanceController extends Controller
{
public function actionIndex()
{
$searchModel = new BalanceSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index',[
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
public function actionView($id)
{
$dataProviderF = new ActiveDataProvider([
'query' => FieldsValueNew::find()
->where(['item_id' => $id, 'item_type' => FieldsValueNew::TYPE_BALANCE])
->orderBy('order'),
'pagination' => [
'pageSize' => 200,
],
]);
return $this->render('view',[
'model' => $this->findModel($id),
'dataProviderF' => $dataProviderF
]);
}
public function actionCreate()
{
$model = new Balance();
if ($model->load(Yii::$app->request->post())) {
$model->dt_add = strtotime($model->dt_add);
$model->save();
// Debug::dd($model);
Yii::$app->session->addFlash('success', 'Баланса добавлен');
return $this->redirect(['index']);
}
return $this->render('create', [
'model' => $model,
]);
}
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post())) {
$model->dt_add = strtotime($model->dt_add);
$model->save();
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update',[
'model' => $model,
]);
}
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
protected function findModel($id)
{
if (($model = Balance::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace backend\modules\balance\models;
use common\models\FieldsValue;
use common\models\FieldsValueNew;
use common\models\ProjectUser;
use yii\helpers\ArrayHelper;
class Balance extends \common\models\Balance
{
public $fields;
public function init()
{
parent::init();
$fieldValue = FieldsValueNew::find()
->where(
[
//'balance_id' => \Yii::$app->request->get('id'),
'item_id' => \Yii::$app->request->get('id'),
'item_type' => FieldsValueNew::TYPE_BALANCE,
])
->all();
$array = [];
if (!empty($fieldValue)) {
foreach ($fieldValue as $item) {
array_push($array, ['field_id' => $item->field_id, 'value' => $item->value, 'order' => $item->order]);
}
$this->fields = $array;
} else {
$this->fields = [
[
'field_id' => null,
'value' => null,
'order' => null,
],
];
}
// $user = ArrayHelper::getColumn(ProjectUser::find()->where(['project_id' => \Yii::$app->request->get('id')])->all(),
// 'card_id');
//
// if (!empty($user)) {
// $this->user = $user;
//
// }
}
}

View File

@ -0,0 +1,89 @@
<?php
namespace backend\modules\balance\models;
use common\classes\Debug;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\balance\models\Balance;
/**
* BalanceSearch represents the model behind the search form of `backend\modules\balance\models\Balance`.
*/
class BalanceSearch extends Balance
{
public $summ_from;
public $summ_to;
public $dt_from;
public $dt_to;
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'type', 'summ', 'summ_from', 'summ_to'], 'integer'],
[['dt_from', 'dt_to', 'dt_add'], '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 = Balance::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,
'type' => $this->type,
//'summ' => $this->summ,
'dt_add' => $this->dt_add,
]);
//Debug::dd($this);
if($this->dt_from && $this->dt_to){
$query->where(['between', 'dt_add', strtotime($this->$this->dt_from), strtotime($this->$this->dt_to)]);
}
if($this->dt_from){
$query->where(['>', 'dt_add', strtotime($this->$this->dt_from)]);
}
$summ_from = $this->summ_from ?: 0;
$summ_to = $this->summ_to ?: 9999999999;
$query->andFilterWhere(['between', 'summ', $summ_from, $summ_to]);
return $dataProvider;
}
}

View File

@ -0,0 +1,80 @@
<?php
use backend\modules\settings\models\AdditionalFields;
use unclead\multipleinput\MultipleInput;
use yii\helpers\Html;
use yii\jui\DatePicker;
use yii\web\View;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\company\models\Balance */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="balance-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'type')
->dropDownList(\common\models\Balance::getTypeList())?>
<?= $form->field($model, 'summ')->textInput(['maxlength' => 9]) ?>
<?php
echo '<label> Выберите дату</label>';
echo '<br>';
echo DatePicker::widget([
'model' => $model,
'attribute' => 'dt_add',
'language' => 'ru',
'dateFormat' => 'dd-MM-yyyy',
]);
?>
<div class="row">
<div class="col-xs-12">
<?= $form->field($model, 'fields')->widget(MultipleInput::class, [
'columns' => [
[
'name' => 'field_id',
'type' => 'dropDownList',
'title' => 'Поле',
'defaultValue' => null,
'items' => \yii\helpers\ArrayHelper::map(AdditionalFields::find()
->joinWith('useFields')
->where(['`use_field`.`use`' => \common\models\UseField::USE_BALANCE])
->all(),
'id', 'name'),
'options' => ['prompt' => 'Выберите']
],
[
'name' => 'value',
'title' => 'Значение',
'enableError' => true,
'options' => [
'class' => 'input-priority'
]
],
[
'name' => 'order',
'title' => 'Приоритет',
'enableError' => true,
'options' => [
'class' => 'input-priority'
]
]
]
])->label('Дополнительно');
?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,33 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\balance\models\BalanceSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="balance-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'type') ?>
<?= $form->field($model, 'summ') ?>
<?= $form->field($model, 'dt_add') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\company\models\Balance */
$this->title = 'Добавить баланс';
$this->params['breadcrumbs'][] = ['label' => 'Список балансов', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="balance-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,56 @@
<?php
use kartik\select2\Select2;
use yii\data\ActiveDataProvider;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\web\View;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\company\models\BalanceSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Список балансов';
$this->params['breadcrumps'][] = $this->title;
?>
<div class="balance-index">
<p>
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'type',
'value' => function ($model) {
return \common\models\Balance::getTypeName($model->type);
},
'filter' => kartik\select2\Select2::widget([
'model' => $searchModel,
'attribute' => 'type',
'data' => \common\models\Balance::getTypeList(),
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]),
],
[
'attribute' => 'summ',
'filter' => \backend\widgets\SummRangeWidget::widget([
'model' => $searchModel,
]),
],
[
'attribute' => 'dt_add',
'value' => 'dt_add',
'filter' => \yii\jui\DatePicker::widget(['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']),
'format' => 'html',
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
use yii\web\View;
/* @var $this yii\web\View */
/* @var $model backend\modules\balance\models\Balance */
$this->title = 'Редактировать баланс №' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Список балансов', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Редактировать';
?>
<div class="balance-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,57 @@
<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $dataProviderF \yii\data\ActiveDataProvider
/* @var $model backend\modules\balance\models\Balance */
$this->title = 'Баланс №' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Список балансов', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="balance-view">
<p>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
//'id',
[
'attribute' => 'type',
'value' => function($model){
return \common\models\Balance::getTypeName($model->type);
}
],
'summ',
'dt_add',
],
]) ?>
<h2>Дополнительные сведения</h2>
<?= GridView::widget([
'dataProvider' => $dataProviderF,
'layout' => "{items}",
'columns' => [
'field.name:text:Поле',
[
'attribute' => 'value',
'label' => 'Значение'
],
],
]); ?>
</div>

0
backend/modules/card/Card.php Normal file → Executable file
View File

View File

0
backend/modules/card/models/UserCard.php Normal file → Executable file
View File

0
backend/modules/card/models/UserCardSearch.php Normal file → Executable file
View File

0
backend/modules/card/views/user-card/_form.php Normal file → Executable file
View File

0
backend/modules/card/views/user-card/_search.php Normal file → Executable file
View File

0
backend/modules/card/views/user-card/create.php Normal file → Executable file
View File

0
backend/modules/card/views/user-card/index.php Normal file → Executable file
View File

0
backend/modules/card/views/user-card/update.php Normal file → Executable file
View File

0
backend/modules/card/views/user-card/view.php Normal file → Executable file
View File

0
backend/modules/company/Company.php Normal file → Executable file
View File

View File

0
backend/modules/company/models/Company.php Normal file → Executable file
View File

0
backend/modules/company/models/CompanySearch.php Normal file → Executable file
View File

0
backend/modules/company/views/company/_form.php Normal file → Executable file
View File

0
backend/modules/company/views/company/_search.php Normal file → Executable file
View File

0
backend/modules/company/views/company/create.php Normal file → Executable file
View File

0
backend/modules/company/views/company/index.php Normal file → Executable file
View File

0
backend/modules/company/views/company/update.php Normal file → Executable file
View File

0
backend/modules/company/views/company/view.php Normal file → Executable file
View File

0
backend/modules/hh/Hh.php Normal file → Executable file
View File

0
backend/modules/hh/controllers/DefaultController.php Normal file → Executable file
View File

0
backend/modules/hh/controllers/HhController.php Normal file → Executable file
View File

0
backend/modules/hh/controllers/HhJobController.php Normal file → Executable file
View File

0
backend/modules/hh/models/Hh.php Normal file → Executable file
View File

0
backend/modules/hh/models/HhJob.php Normal file → Executable file
View File

0
backend/modules/hh/models/HhJobSearch.php Normal file → Executable file
View File

0
backend/modules/hh/models/HhSearch.php Normal file → Executable file
View File

0
backend/modules/hh/views/default/index.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh-job/_form.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh-job/_search.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh-job/create.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh-job/index.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh-job/update.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh-job/view.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh/_form.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh/_search.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh/create.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh/index.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh/update.php Normal file → Executable file
View File

0
backend/modules/hh/views/hh/view.php Normal file → Executable file
View File

0
backend/modules/project/Project.php Normal file → Executable file
View File

View File

0
backend/modules/project/models/Project.php Normal file → Executable file
View File

0
backend/modules/project/models/ProjectSearch.php Normal file → Executable file
View File

0
backend/modules/project/views/project/_form.php Normal file → Executable file
View File

0
backend/modules/project/views/project/_search.php Normal file → Executable file
View File

0
backend/modules/project/views/project/create.php Normal file → Executable file
View File

0
backend/modules/project/views/project/index.php Normal file → Executable file
View File

0
backend/modules/project/views/project/update.php Normal file → Executable file
View File

0
backend/modules/project/views/project/view.php Normal file → Executable file
View File

0
backend/modules/settings/Settings.php Normal file → Executable file
View File

View File

View File

View File

View File

0
backend/modules/settings/models/AdditionalFields.php Normal file → Executable file
View File

View File

0
backend/modules/settings/models/Position.php Normal file → Executable file
View File

0
backend/modules/settings/models/PositionSearch.php Normal file → Executable file
View File

0
backend/modules/settings/models/Skill.php Normal file → Executable file
View File

0
backend/modules/settings/models/SkillSearch.php Normal file → Executable file
View File

0
backend/modules/settings/models/Status.php Normal file → Executable file
View File

0
backend/modules/settings/models/StatusSearch.php Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

0
backend/modules/settings/views/position/_form.php Normal file → Executable file
View File

0
backend/modules/settings/views/position/_search.php Normal file → Executable file
View File

0
backend/modules/settings/views/position/create.php Normal file → Executable file
View File

0
backend/modules/settings/views/position/index.php Normal file → Executable file
View File

0
backend/modules/settings/views/position/update.php Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More