add company-manager role
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use asmoday74\ckeditor5\EditorClassic;
|
||||
use backend\modules\card\models\ResumeTemplate;
|
||||
use common\helpers\StatusHelper;
|
||||
use mihaildev\ckeditor\CKEditor;
|
||||
use mihaildev\elfinder\InputFile;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
@ -27,10 +27,11 @@ use yii\widgets\ActiveForm;
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $form->field($model, 'template_body')->widget(EditorClassic::className(), [
|
||||
'clientOptions' => [
|
||||
'language' => 'ru',
|
||||
]
|
||||
<?= $form->field($model, 'template_body')->widget(CKEditor::className(),[
|
||||
'editorOptions' => [
|
||||
'preset' => 'full',
|
||||
'inline' => false,
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'header_text')->textInput(['maxlength' => true]) ?>
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use yii\widgets\ListView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\card\models\UserCardSearch */
|
||||
@ -84,7 +83,16 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
]),
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {update} {permit} {delete}',
|
||||
'buttons' =>
|
||||
[
|
||||
'permit' => function ($url, $model) {
|
||||
return Html::a('<span class="glyphicon glyphicon-wrench"></span>', Url::to(['/permit/user/view', 'id' => $model->id_user]), [
|
||||
'title' => Yii::t('yii', 'Change user role')
|
||||
]); },
|
||||
]
|
||||
],
|
||||
],
|
||||
]);
|
||||
echo "<h3>Сумма зарплат: " . $searchModel->total . "</h3>";
|
||||
|
145
backend/modules/company/controllers/CompanyManagerController.php
Normal file
145
backend/modules/company/controllers/CompanyManagerController.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\company\controllers;
|
||||
|
||||
use common\classes\Debug;
|
||||
use Yii;
|
||||
use backend\modules\company\models\CompanyManager;
|
||||
use backend\modules\company\models\CompanyManagerSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
|
||||
/**
|
||||
* CompanyManagerController implements the CRUD actions for CompanyManager model.
|
||||
*/
|
||||
class CompanyManagerController extends Controller
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['POST'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all CompanyManager models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new CompanyManagerSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single CompanyManager 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 CompanyManager model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new CompanyManager();
|
||||
|
||||
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 CompanyManager 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 CompanyManager 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 CompanyManager model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return CompanyManager the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = CompanyManager::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing CompanyManager 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 actionDismiss($id)
|
||||
{
|
||||
// Debug::dd('fff');
|
||||
$model = $this->findModel($id);
|
||||
$model->company_id = null;
|
||||
$model->update(false);
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
}
|
10
backend/modules/company/models/CompanyManager.php
Normal file
10
backend/modules/company/models/CompanyManager.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\company\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
class CompanyManager extends \common\models\CompanyManager
|
||||
{
|
||||
|
||||
}
|
67
backend/modules/company/models/CompanyManagerSearch.php
Normal file
67
backend/modules/company/models/CompanyManagerSearch.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\company\models;
|
||||
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use backend\modules\company\models\CompanyManager;
|
||||
|
||||
/**
|
||||
* CompanyManagerSearch represents the model behind the search form of `backend\modules\company\models\CompanyManager`.
|
||||
*/
|
||||
class CompanyManagerSearch extends CompanyManager
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id', 'company_id', 'user_card_id'], 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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 = CompanyManager::find()->where(['not', ['company_id' => null]]);
|
||||
|
||||
// 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,
|
||||
'company_id' => $this->company_id,
|
||||
'user_card_id' => $this->user_card_id,
|
||||
]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
38
backend/modules/company/views/company-manager/_form.php
Normal file
38
backend/modules/company/views/company-manager/_form.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\card\models\UserCard;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\company\models\CompanyManager */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="company-manager-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'company_id')->dropDownList(
|
||||
ArrayHelper::map(\backend\modules\company\models\Company::find()->all(), 'id', 'name'),
|
||||
[
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= $form->field($model, 'user_card_id')->dropDownList(
|
||||
ArrayHelper::map(UserCard::getCardByUserRole('company_manager'), 'id', 'fio'),
|
||||
[
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
)
|
||||
?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
31
backend/modules/company/views/company-manager/_search.php
Normal file
31
backend/modules/company/views/company-manager/_search.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\company\models\CompanyManagerSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="company-manager-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'company_id') ?>
|
||||
|
||||
<?= $form->field($model, 'user_card_id') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
18
backend/modules/company/views/company-manager/create.php
Normal file
18
backend/modules/company/views/company-manager/create.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\company\models\CompanyManager */
|
||||
|
||||
$this->title = 'Добавить нового менеджера компании';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Company Managers', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="company-manager-create">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
64
backend/modules/company/views/company-manager/index.php
Normal file
64
backend/modules/company/views/company-manager/index.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\card\models\UserCard;
|
||||
use backend\modules\company\models\Company;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\company\models\CompanyManagerSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'Менеджеры компании';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="company-manager-index">
|
||||
|
||||
<p>
|
||||
<?= Html::a('Добавить компании менеджера', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
// 'id',
|
||||
[
|
||||
'attribute' => 'company_id',
|
||||
'filter' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
|
||||
'value' => 'company.name',
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_card_id',
|
||||
'filter' => ArrayHelper::map(UserCard::getCardByUserRole('company_manager'), 'id', 'fio'),
|
||||
'value' => 'userCard.fio',
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {update} {delete}',
|
||||
'buttons' =>
|
||||
[
|
||||
// 'delete' => function ($url, $model) {
|
||||
// return Html::a('<span class="glyphicon glyphicon-wrench"></span>', Url::to(['/company/company-manager/dismiss', 'id' => $model->id]), [
|
||||
// 'title' => Yii::t('yii', 'Уволить менеджера из компании?')
|
||||
// ]); },
|
||||
'delete' => function ($url,$model) {
|
||||
return Html::a(
|
||||
'<span class="glyphicon glyphicon-trash"></span>',
|
||||
[
|
||||
'/company/company-manager/dismiss', 'id' => $model->id,
|
||||
],
|
||||
[
|
||||
'data' => ['confirm' => 'Вы уверены, что хотите удалить этого менеджера?', 'method' => 'post']
|
||||
]
|
||||
);
|
||||
},
|
||||
]
|
||||
],
|
||||
]
|
||||
]); ?>
|
||||
</div>
|
19
backend/modules/company/views/company-manager/update.php
Normal file
19
backend/modules/company/views/company-manager/update.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\company\models\CompanyManager */
|
||||
|
||||
$this->title = 'Изменить менеджера компании: ' . $model->userCard->fio;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Company Managers', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="company-manager-update">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
44
backend/modules/company/views/company-manager/view.php
Normal file
44
backend/modules/company/views/company-manager/view.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\company\models\CompanyManager */
|
||||
|
||||
$this->title = 'Менеджер: ' . $model->userCard->fio;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Company Managers', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
?>
|
||||
<div class="company-manager-view">
|
||||
|
||||
<p>
|
||||
<?= Html::a('Список', ['index', 'id' => $model->id], ['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' => 'company_id',
|
||||
'value' => ArrayHelper::getValue($model, 'company.name'),
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_card_id',
|
||||
'value' => ArrayHelper::getValue($model, 'userCard.fio'),
|
||||
],
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace backend\modules\document\controllers;
|
||||
|
||||
use backend\modules\company\models\CompanyManager;
|
||||
use backend\modules\document\models\Document;
|
||||
use backend\modules\document\models\DocumentSearch;
|
||||
use common\services\DocumentService;
|
||||
@ -9,6 +10,7 @@ use Yii;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\web\Response;
|
||||
|
||||
/**
|
||||
* DocumentController implements the CRUD actions for Document model.
|
||||
@ -175,7 +177,7 @@ class DocumentController extends Controller
|
||||
$model->scenario = $model::SCENARIO_DOWNLOAD_DOCUMENT;
|
||||
|
||||
if ($model->validate()) {
|
||||
DocumentService::downloadPdf($id);
|
||||
DocumentService::downloadDocx($id);
|
||||
}
|
||||
|
||||
Yii::$app->session->setFlash('error', $model->getFirstError('body'));
|
||||
@ -183,4 +185,26 @@ class DocumentController extends Controller
|
||||
'model' => Document::findOne($id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionManagers(): array
|
||||
{
|
||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
if (isset($_POST['depdrop_parents'])) {
|
||||
$parents = $_POST['depdrop_parents'];
|
||||
if ($parents != null) {
|
||||
$company_id = $parents[0];
|
||||
/** @var CompanyManager[] $managers */
|
||||
$managers = CompanyManager::getManagersByCompany($company_id);
|
||||
|
||||
$formattedManagersArr = array();
|
||||
foreach ($managers as $manager){
|
||||
$formattedManagersArr[] = array('id' => $manager->id, 'name' => $manager->userCard->fio);
|
||||
}
|
||||
|
||||
return ['output'=>$formattedManagersArr, 'selected'=>''];
|
||||
}
|
||||
}
|
||||
return ['output'=>'', 'selected'=>''];
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use asmoday74\ckeditor5\EditorClassic;
|
||||
use backend\modules\document\models\DocumentField;
|
||||
use common\helpers\StatusHelper;
|
||||
use mihaildev\ckeditor\CKEditor;
|
||||
@ -27,12 +26,6 @@ use yii\widgets\ActiveForm;
|
||||
]
|
||||
) ?>
|
||||
|
||||
<!-- --><?//= $form->field($model, 'template_body')->widget(EditorClassic::className(), [
|
||||
// 'clientOptions' => [
|
||||
// 'language' => 'ru',
|
||||
// ]
|
||||
// ]); ?>
|
||||
|
||||
<?= $form->field($model, 'template_body')->widget(CKEditor::className(),[
|
||||
'editorOptions' => [
|
||||
'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
|
||||
@ -51,6 +44,7 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="table-responsive">
|
||||
<h2>Поля договоров</h2>
|
||||
<table class="table" id="fieldNameTable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
use backend\modules\company\models\Company;
|
||||
use backend\modules\document\models\DocumentTemplate;
|
||||
use backend\modules\employee\models\Manager;
|
||||
use kartik\depdrop\DepDrop;
|
||||
use kartik\select2\Select2;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
@ -16,48 +17,6 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'company_id')->widget(Select2::class,
|
||||
[
|
||||
'data' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
|
||||
'options' => ['placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'manager_id')->widget(Select2::class,
|
||||
[
|
||||
'data' => Manager::find()->select(['fio', 'manager.id'])
|
||||
->joinWith('userCard')->indexBy('manager.id')->column(),
|
||||
'options' => ['placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'contractor_company_id')->widget(Select2::class,
|
||||
[
|
||||
'data' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
|
||||
'options' => ['placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'contractor_manager_id')->widget(Select2::class,
|
||||
[
|
||||
'data' => Manager::find()->select(['fio', 'manager.id'])
|
||||
->joinWith('userCard')->indexBy('manager.id')->column(),
|
||||
'options' => ['placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'template_id')->widget(Select2::class,
|
||||
@ -70,6 +29,52 @@ use yii\widgets\ActiveForm;
|
||||
]
|
||||
); ?>
|
||||
|
||||
<div>
|
||||
<p>Не обязательные поля:</p>
|
||||
</div>
|
||||
|
||||
<?= $form->field($model, 'company_id')->dropDownList(
|
||||
Company::find()->select(['name', 'id'])->indexBy('id')->column(),
|
||||
[
|
||||
'id' => 'company-id',
|
||||
'prompt' => 'Выберите'
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<?= $form->field($model, 'manager_id')->widget(DepDrop::className(),
|
||||
[
|
||||
'options' => ['id' => 'manager-id'],
|
||||
'pluginOptions' => [
|
||||
'depends' => ['company-id'],
|
||||
'placeholder' => 'Выберите',
|
||||
'url' => Url::to(['/document/document/managers'])
|
||||
]
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'contractor_company_id')->widget(Select2::class,
|
||||
[
|
||||
'data' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
|
||||
'options' => ['id' => 'contractor-company-id','placeholder' => '...','class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'contractor_manager_id')->widget(DepDrop::className(),
|
||||
[
|
||||
'options' => ['id' => 'contractor-manager-id'],
|
||||
'pluginOptions' => [
|
||||
'depends' => ['contractor-company-id'],
|
||||
'placeholder' => 'Выберите',
|
||||
'url' => Url::to(['/document/document/managers']),
|
||||
'params' => ['contractor-company-id']
|
||||
]
|
||||
]
|
||||
); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use asmoday74\ckeditor5\EditorClassic;
|
||||
use mihaildev\ckeditor\CKEditor;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use yii\widgets\ActiveForm;
|
||||
@ -27,11 +27,13 @@ $this->params['breadcrumbs'][] = 'Загрузить';
|
||||
'action' => Url::to(['document/update-document-body', 'id' => $model->id]),
|
||||
'options' => ['method' => 'post']])
|
||||
?>
|
||||
<?= $form->field($model, 'body')->widget(EditorClassic::className(), [
|
||||
'clientOptions' => [
|
||||
'language' => 'ru',
|
||||
]
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'body')->widget(CKEditor::className(),[
|
||||
'editorOptions' => [
|
||||
'preset' => 'full',
|
||||
'inline' => false,
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохраниить изменения', ['class' => 'btn btn-primary']) ?>
|
||||
|
Reference in New Issue
Block a user