From f64ade2fbca3d64db984b4dc9d4b872ec756df26 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Wed, 29 Oct 2025 11:57:43 +0300 Subject: [PATCH] =?utf8?q?=D0=9E=D1=82=D1=87=D0=B5=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/actions/grade/AdminUpdateAction.php | 13 +- erp24/api3/core/services/ReportService.php | 101 ++++++++++++++- ...27_071121_create_admin_positions_table.php | 43 +++++++ ...admin_position_id_field_to_admin_table.php | 64 ++++++++++ ...p_id_fields_to_employee_position_table.php | 119 ++++++++++++++++++ erp24/records/AdminGroup.php | 14 +++ erp24/records/EmployeePosition.php | 54 +++++++- erp24/records/EmployeePositionSearch.php | 17 ++- erp24/views/crud/employee-position/_form.php | 6 + .../views/crud/employee-position/_search.php | 6 + erp24/views/crud/employee-position/create.php | 2 +- erp24/views/crud/employee-position/index.php | 12 +- erp24/views/crud/employee-position/update.php | 2 +- erp24/views/crud/employee-position/view.php | 24 +++- erp24/views/grade/admin-update.php | 5 +- 15 files changed, 460 insertions(+), 22 deletions(-) create mode 100644 erp24/migrations/m251027_071121_create_admin_positions_table.php create mode 100644 erp24/migrations/m251027_071237_add_admin_position_id_field_to_admin_table.php create mode 100644 erp24/migrations/m251028_141001_add_salary_and_group_id_fields_to_employee_position_table.php diff --git a/erp24/actions/grade/AdminUpdateAction.php b/erp24/actions/grade/AdminUpdateAction.php index c4db7f36..e81eefdd 100644 --- a/erp24/actions/grade/AdminUpdateAction.php +++ b/erp24/actions/grade/AdminUpdateAction.php @@ -11,6 +11,7 @@ use yii_app\records\AdminGroup; use yii_app\records\AdminStores; use yii_app\records\CityStore; use yii_app\records\Companies; +use yii_app\records\EmployeePosition; use yii_app\records\ExportImportTable; use yii_app\services\HistoryService; @@ -74,6 +75,14 @@ class AdminUpdateAction extends Action Yii::$app->cache->set("dirtyAuthSettings", true); } + // Обновляем group_name на основе выбранной группы + if (isset($attributes['group_id'])) { + $adminGroup = AdminGroup::findOne($attributes['group_id']); + if ($adminGroup) { + $attributes['group_name'] = $adminGroup->name; + } + } + $model->setAttributes($attributes, false); if (Yii::$app->user->can("manageAvatarka", ['id' => $model->id])) { @@ -145,7 +154,7 @@ class AdminUpdateAction extends Action } $admins = ArrayHelper::map($adminArr, 'id', 'name', 'groupName'); - + $positions = EmployeePosition::find()->orderBy('posit')->all(); $cityStores = ArrayHelper::map(CityStore::find()->select(['id', 'name'])->all(), 'id', 'name'); $adminHistoryCategories = HistoryService::getHistoryAdmin($model->id); @@ -153,6 +162,6 @@ class AdminUpdateAction extends Action $companies = ArrayHelper::map(Companies::find()->all(), 'id', 'name'); return $this->controller->render('admin-update', compact('model', 'adminGroups', 'admins', - 'cityStores', 'adminHistoryCategories', 'companies')); + 'cityStores', 'adminHistoryCategories', 'companies', 'positions')); } } diff --git a/erp24/api3/core/services/ReportService.php b/erp24/api3/core/services/ReportService.php index 096f6d4d..97f98620 100644 --- a/erp24/api3/core/services/ReportService.php +++ b/erp24/api3/core/services/ReportService.php @@ -7,8 +7,10 @@ use yii\db\Exception; use yii\db\Expression; use yii\helpers\ArrayHelper; use yii_app\api3\modules\v1\models\timetable\Timetable; +use yii_app\records\Admin; use yii_app\records\AdminPayrollDays; use yii_app\records\CityStore; +use yii_app\records\EmployeePosition; use yii_app\records\ExportImportTable; use yii_app\records\Products1c; use yii_app\records\ProductsClass; @@ -28,6 +30,7 @@ class ReportService $currentDate = $data->date_start; $reports = []; + $totalEmployeePositionsOnShift = []; $employees = Sales::find()->select(["COUNT(*) as cnt", "admin_id"]) ->where([ @@ -39,11 +42,54 @@ class ReportService ->groupBy(['admin_id'])->asArray()->all(); $employeeCount = count($employees); + // Получаем все уникальные admin_id сотрудников за период + $allAdminsInPeriod = Timetable::find()->alias('t') + ->select(['admin_id']) + ->distinct() + ->where(['t.store_id' => $data->stores]) + ->andWhere(['>=', 'date', date("Y-m-01", strtotime($data->date_start))]) + ->andWhere(['<=', 'date', $data->date_end]) + ->andWhere(['tabel' => 0, 'slot_type_id' => Timetable::TIMESLOT_WORK]) + ->asArray()->all(); + + $adminIdsInPeriod = ArrayHelper::getColumn($allAdminsInPeriod, 'admin_id'); + + $employeePositions = EmployeePosition::find()->select(['id', 'name'])->indexBy('id')->asArray()->all(); + + $adminPositions = Admin::find()->select(['id', 'employee_position_id', 'group_name']) + ->where(['id' => $adminIdsInPeriod]) + ->indexBy('id') + ->asArray()->all(); + + // Создаем карту должностей для каждого admin_id + $positionMap = []; + foreach ($adminPositions as $adminId => $admin) { + $positionName = ''; + + if (!empty($admin['employee_position_id']) && isset($employeePositions[$admin['employee_position_id']])) { + $positionName = $employeePositions[$admin['employee_position_id']]['name']; + } elseif (!empty($admin['group_name'])) { + // Ищем похожее название в employee_positions + $groupNameLower = mb_strtolower(trim($admin['group_name'])); + $found = false; + foreach ($employeePositions as $empPos) { + if (mb_strpos($groupNameLower, mb_strtolower(trim($empPos['name']))) !== false || + mb_strpos(mb_strtolower(trim($empPos['name'])), $groupNameLower) !== false) { + $positionName = $empPos['name']; + $found = true; + break; + } + } + if (!$found) { + $positionName = $admin['group_name']; + } + } + + $positionMap[$adminId] = $positionName; + } + while ($currentDate <= $data->date_end) { - $report = [ - "date" => $currentDate, - "shift_type" => $data->shift_type, - ]; + $report = []; $shift_id = $data->shift_type == 0 ? [1, 2, 5, 8] : ($data->shift_type == 1 ? [1, 5, 8] : [2]); @@ -65,6 +111,26 @@ class ReportService $adminIdsMonth = ArrayHelper::getColumn($timetablesMonth, 'admin_id'); $adminIds = ArrayHelper::getColumn($timetables, 'admin_id'); + // Подсчет должностей на смене для этого дня + $employeePositionsOnShift = []; + foreach ($timetables as $timetable) { + $adminId = $timetable['admin_id']; + $positionName = $positionMap[$adminId] ?? ''; + + if (!empty($positionName)) { + if (!isset($employeePositionsOnShift[$positionName])) { + $employeePositionsOnShift[$positionName] = 0; + } + $employeePositionsOnShift[$positionName]++; + + // Суммируем для общего отчета + if (!isset($totalEmployeePositionsOnShift[$positionName])) { + $totalEmployeePositionsOnShift[$positionName] = 0; + } + $totalEmployeePositionsOnShift[$positionName]++; + } + } + $adminPayrollDaysMonth = AdminPayrollDays::find()->select(["FLOOR(SUM(day_payroll)) as total", "store_id"]) ->where(['>=', 'date', date("Y-m-01", strtotime($currentDate))]) ->andWhere(['<=', 'date', $currentDate]) @@ -360,11 +426,27 @@ class ReportService $totalServicePerDayTotal += $totalServicePerDay; $totalPottedPerDayTotal += $totalPottedPerDay; + // Подсчет должностей для этого магазина + $storeEmployeePositionsOnShift = []; + if (isset($adminNames[$store->id])) { + foreach ($adminNames[$store->id] as $adminRecord) { + $adminId = $adminRecord['id']; + $positionName = $positionMap[$adminId] ?? ''; + + if (!empty($positionName)) { + if (!isset($storeEmployeePositionsOnShift[$positionName])) { + $storeEmployeePositionsOnShift[$positionName] = 0; + } + $storeEmployeePositionsOnShift[$positionName]++; + } + } + } $reportStore = [ "name" => $store->name, "id" => $store->id, "admins" => $adminNames[$store->id] ?? [], + "employee_positions_on_shift" => $storeEmployeePositionsOnShift, "visitors_quantity" => $storeVisitorsQuantity, "sale_quantity" => $storeSaleQuantity, "sale_total" => $storeSaleTotal, @@ -415,9 +497,18 @@ class ReportService "total_wrap_per_day" => $totalWrapPerDayTotal, "total_services_per_day" => $totalServicePerDayTotal, "total_potted_per_day" => $totalPottedPerDayTotal, + "employee_positions_on_shift" => $employeePositionsOnShift, + ]; + + // Создаем итоговый массив для дня с правильным порядком полей + $dayReport = [ + "date" => $currentDate, + "shift_type" => $data->shift_type, + "stores" => $report["stores"] ?? [], + "total" => $report['total'], ]; - $reports[] = $report; + $reports[] = $dayReport; $currentDate = date("Y-m-d", strtotime("+1 day", strtotime($currentDate))); } diff --git a/erp24/migrations/m251027_071121_create_admin_positions_table.php b/erp24/migrations/m251027_071121_create_admin_positions_table.php new file mode 100644 index 00000000..c805a672 --- /dev/null +++ b/erp24/migrations/m251027_071121_create_admin_positions_table.php @@ -0,0 +1,43 @@ +db->getTableSchema(self::TABLE_NAME); + + if (!isset($tableSchema)) { + $this->createTable(self::TABLE_NAME, [ + 'id' => $this->primaryKey(), + 'name' => $this->string()->notNull()->comment('Наименование должности'), + 'alias' => $this->string()->notNull()->comment('Алиас должности'), + 'salary' => $this->decimal(10, 2)->notNull()->comment('Ставка в рублях'), + 'created_at' => $this->dateTime()->notNull()->comment('Дата создания'), + 'created_by' => $this->integer()->notNull()->comment('ИД создателя'), + 'updated_at' => $this->dateTime()->null()->comment('Дата обновления'), + 'updated_by' => $this->integer()->null()->comment('ИД редактировавшего'), + ]); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropTable('{{%admin_positions}}'); + } +} diff --git a/erp24/migrations/m251027_071237_add_admin_position_id_field_to_admin_table.php b/erp24/migrations/m251027_071237_add_admin_position_id_field_to_admin_table.php new file mode 100644 index 00000000..367c7e19 --- /dev/null +++ b/erp24/migrations/m251027_071237_add_admin_position_id_field_to_admin_table.php @@ -0,0 +1,64 @@ +db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema) && !isset($tableSchema->columns[self::COLUMN_NAME])) { + $this->addColumn(self::TABLE_NAME, self::COLUMN_NAME, $this->integer()->null()->comment('ID должности администратора')); + $this->addForeignKey( + 'fk-admin-employee_position_id', + self::TABLE_NAME, + self::COLUMN_NAME, + 'erp24.employee_position', + 'id', + 'SET NULL', + 'CASCADE' + ); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema) && isset($tableSchema->columns[self::COLUMN_NAME])) { + $this->dropForeignKey('fk-admin-employee_position_id', self::TABLE_NAME); + $this->dropColumn(self::TABLE_NAME, self::COLUMN_NAME); + } else { + echo "m251027_071237_add_admin_position_id_field_to_admin_table cannot be reverted.\n"; + return false; + } + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m251027_071237_add_admin_position_id_field_to_admin_table cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/erp24/migrations/m251028_141001_add_salary_and_group_id_fields_to_employee_position_table.php b/erp24/migrations/m251028_141001_add_salary_and_group_id_fields_to_employee_position_table.php new file mode 100644 index 00000000..c616df3c --- /dev/null +++ b/erp24/migrations/m251028_141001_add_salary_and_group_id_fields_to_employee_position_table.php @@ -0,0 +1,119 @@ +db->getTableSchema(self::TABLE_NAME); + + // Добавляем поле salary + if (isset($tableSchema) && !isset($tableSchema->columns['salary'])) { + $this->addColumn(self::TABLE_NAME, 'salary', $this->integer()->null()->comment('Зарплата')); + } + + // Добавляем поле alias + if (isset($tableSchema) && !isset($tableSchema->columns['alias'])) { + $this->addColumn(self::TABLE_NAME, 'alias', $this->string(255)->null()->comment('Алиас')); + } + + // Добавляем поле group_id + if (isset($tableSchema) && !isset($tableSchema->columns['group_id'])) { + $this->addColumn(self::TABLE_NAME, 'group_id', $this->integer()->null()->comment('Ссылка на группу')); + $this->addForeignKey( + 'fk-employee_position-group_id', + self::TABLE_NAME, + 'group_id', + 'erp24.admin_group', + 'id', + 'SET NULL', + 'CASCADE' + ); + } + + // Добавляем поле created_by + if (isset($tableSchema) && !isset($tableSchema->columns['created_by'])) { + $this->addColumn(self::TABLE_NAME, 'created_by', $this->integer()->null()->comment('Кем создано')); + } + + // Добавляем поле updated_by + if (isset($tableSchema) && !isset($tableSchema->columns['updated_by'])) { + $this->addColumn(self::TABLE_NAME, 'updated_by', $this->integer()->null()->comment('Кем изменено')); + } + + // Добавляем поле created_at + if (isset($tableSchema) && !isset($tableSchema->columns['created_at'])) { + $this->addColumn(self::TABLE_NAME, 'created_at', $this->timestamp()->null()->comment('Дата создания')); + } + + // Добавляем поле updated_at + if (isset($tableSchema) && !isset($tableSchema->columns['updated_at'])) { + $this->addColumn(self::TABLE_NAME, 'updated_at', $this->timestamp()->null()->comment('Дата изменения')); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + + // Удаляем поле updated_by + if (isset($tableSchema) && isset($tableSchema->columns['updated_by'])) { + $this->dropColumn(self::TABLE_NAME, 'updated_by'); + } + + // Удаляем поле created_by + if (isset($tableSchema) && isset($tableSchema->columns['created_by'])) { + $this->dropColumn(self::TABLE_NAME, 'created_by'); + } + + // Удаляем поле group_id + if (isset($tableSchema) && isset($tableSchema->columns['group_id'])) { + $this->dropForeignKey('fk-employee_position-group_id', self::TABLE_NAME); + $this->dropColumn(self::TABLE_NAME, 'group_id'); + } + + // Удаляем поле alias + if (isset($tableSchema) && isset($tableSchema->columns['alias'])) { + $this->dropColumn(self::TABLE_NAME, 'alias'); + } + + // Удаляем поле updated_at + if (isset($tableSchema) && isset($tableSchema->columns['updated_at'])) { + $this->dropColumn(self::TABLE_NAME, 'updated_at'); + } + + // Удаляем поле created_at + if (isset($tableSchema) && isset($tableSchema->columns['created_at'])) { + $this->dropColumn(self::TABLE_NAME, 'created_at'); + } + + // Удаляем поле salary + if (isset($tableSchema) && isset($tableSchema->columns['salary'])) { + $this->dropColumn(self::TABLE_NAME, 'salary'); + } + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m251028_141001_add_salary_and_group_id_fields_to_employee_position_table cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/erp24/records/AdminGroup.php b/erp24/records/AdminGroup.php index cdce32c6..5a53070a 100755 --- a/erp24/records/AdminGroup.php +++ b/erp24/records/AdminGroup.php @@ -4,6 +4,7 @@ declare(strict_types = 1); namespace yii_app\records; use yii\db\ActiveRecord; +use yii\helpers\ArrayHelper; /** * Class AdminGroup @@ -189,4 +190,17 @@ class AdminGroup extends ActiveRecord { return in_array($this->id, [7, Admin::ADMINISTRATOR_GROUP_ID]); } + + public static function getAllIdName() + { + $result = []; + + $values = self::find()->all(); + + if(!empty($values)){ + $result = ArrayHelper::map($values, 'id', 'name'); + } + + return $result; + } } \ No newline at end of file diff --git a/erp24/records/EmployeePosition.php b/erp24/records/EmployeePosition.php index 5b24e83e..31d47c28 100755 --- a/erp24/records/EmployeePosition.php +++ b/erp24/records/EmployeePosition.php @@ -4,6 +4,8 @@ namespace yii_app\records; use Yii; use yii\helpers\ArrayHelper; +use yii\behaviors\TimestampBehavior; +use yii\behaviors\BlameableBehavior; /** * This is the model class for table "employee_position". @@ -12,6 +14,13 @@ use yii\helpers\ArrayHelper; * @property string $name * @property int $next_position_id * @property int $posit + * @property int $salary + * @property string $alias + * @property int $group_id + * @property string $created_at + * @property int $created_by + * @property string $updated_at + * @property int $updated_by */ class EmployeePosition extends \yii\db\ActiveRecord { @@ -23,6 +32,28 @@ class EmployeePosition extends \yii\db\ActiveRecord return 'employee_position'; } + /** + * {@inheritdoc} + */ + public function behaviors() + { + return [ + [ + 'class' => TimestampBehavior::class, + 'createdAtAttribute' => 'created_at', + 'updatedAtAttribute' => 'updated_at', + 'value' => function () { + return date('Y-m-d H:i:s'); + }, + ], + [ + 'class' => BlameableBehavior::class, + 'createdByAttribute' => 'created_by', + 'updatedByAttribute' => 'updated_by', + ], + ]; + } + /** * {@inheritdoc} */ @@ -30,8 +61,10 @@ class EmployeePosition extends \yii\db\ActiveRecord { return [ [['name'], 'required'], - [['name'], 'string', 'max' => 45], - [['next_position_id', 'posit'], 'safe'], + [['name', 'alias'], 'string', 'max' => 255], + [['next_position_id', 'posit', 'salary', 'group_id', 'created_by', 'updated_by'], 'integer'], + [['created_at', 'updated_at'], 'safe'], + [['salary', 'alias', 'group_id', 'created_at', 'created_by', 'updated_at', 'updated_by'], 'default', 'value' => null], ]; } @@ -42,9 +75,16 @@ class EmployeePosition extends \yii\db\ActiveRecord { return [ 'id' => 'ID', - 'name' => 'Name', - 'next_position_id' => 'Next Position Id', - 'posit' => 'Posit', + 'name' => 'Название', + 'next_position_id' => 'Следующая должность', + 'posit' => 'Позиция', + 'salary' => 'Зарплата', + 'alias' => 'Алиас', + 'group_id' => 'Группа', + 'created_at' => 'Дата создания', + 'created_by' => 'Кем создано', + 'updated_at' => 'Дата изменения', + 'updated_by' => 'Кем изменено', ]; } @@ -68,4 +108,8 @@ class EmployeePosition extends \yii\db\ActiveRecord public function getSkills() { return $this->hasMany(EmployeeSkill::class, ['id' => 'skill_id'])->via('positionSkill'); } + + public function getAdminGroup() { + return $this->hasOne(\yii_app\records\AdminGroup::class, ['id' => 'group_id']); + } } diff --git a/erp24/records/EmployeePositionSearch.php b/erp24/records/EmployeePositionSearch.php index c9cc96b6..5071f74d 100755 --- a/erp24/records/EmployeePositionSearch.php +++ b/erp24/records/EmployeePositionSearch.php @@ -9,16 +9,22 @@ use yii_app\records\EmployeePosition; /** * EmployeePositionSearch represents the model behind the search form of `yii_app\records\EmployeePosition`. */ -class EmployeePositionSearch extends EmployeePosition +class EmployeePositionSearch extends Model { + public $id; + public $name; + public $alias; + public $salary; + public $group_id; + /** * {@inheritdoc} */ public function rules() { return [ - [['id'], 'integer'], - [['name'], 'safe'], + [['id', 'salary', 'group_id'], 'integer'], + [['name', 'alias'], 'safe'], ]; } @@ -59,9 +65,12 @@ class EmployeePositionSearch extends EmployeePosition // grid filtering conditions $query->andFilterWhere([ 'id' => $this->id, + 'salary' => $this->salary, + 'group_id' => $this->group_id, ]); - $query->andFilterWhere(['like', 'name', $this->name]); + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'alias', $this->alias]); return $dataProvider; } diff --git a/erp24/views/crud/employee-position/_form.php b/erp24/views/crud/employee-position/_form.php index eccf21fd..680dd3d1 100755 --- a/erp24/views/crud/employee-position/_form.php +++ b/erp24/views/crud/employee-position/_form.php @@ -23,6 +23,12 @@ function printBlock($title, $block) { field($model, 'name')->textInput(['maxlength' => true])->label(false)) ?> + field($model, 'alias')->textInput(['maxlength' => true])->label(false)) ?> + + field($model, 'salary')->textInput(['type' => 'number'])->label(false)) ?> + + field($model, 'group_id')->dropDownList(\yii_app\records\AdminGroup::getAllIdName(), ['prompt' => 'Выберите группу'])->label(false)) ?> + field($model, 'posit')->textInput(['maxlength' => true])->label(false)) ?>
diff --git a/erp24/views/crud/employee-position/_search.php b/erp24/views/crud/employee-position/_search.php index ecfb9ab1..d6ef204e 100755 --- a/erp24/views/crud/employee-position/_search.php +++ b/erp24/views/crud/employee-position/_search.php @@ -19,6 +19,12 @@ use yii\widgets\ActiveForm; field($model, 'name') ?> + field($model, 'alias') ?> + + field($model, 'salary') ?> + + field($model, 'group_id')->dropDownList(\yii_app\records\AdminGroup::getAllIdName(), ['prompt' => 'Все группы']) ?> +
'btn btn-primary']) ?> 'btn btn-outline-secondary']) ?> diff --git a/erp24/views/crud/employee-position/create.php b/erp24/views/crud/employee-position/create.php index b980eed3..2c14c8b4 100755 --- a/erp24/views/crud/employee-position/create.php +++ b/erp24/views/crud/employee-position/create.php @@ -9,7 +9,7 @@ $this->title = 'Создать позицию работника'; $this->params['breadcrumbs'][] = ['label' => 'Employee Positions', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> -
+

title) ?>

diff --git a/erp24/views/crud/employee-position/index.php b/erp24/views/crud/employee-position/index.php index 5b887028..a6679d04 100755 --- a/erp24/views/crud/employee-position/index.php +++ b/erp24/views/crud/employee-position/index.php @@ -13,7 +13,7 @@ use yii\grid\GridView; $this->title = 'Позиции работников'; $this->params['breadcrumbs'][] = $this->title; ?> -
+

title) ?>

@@ -21,7 +21,7 @@ $this->params['breadcrumbs'][] = $this->title; 'btn btn-success']) ?>

- render('_search', ['model' => $searchModel]); ?> + render('_search', ['model' => $searchModel]); ?> $dataProvider, @@ -37,6 +37,14 @@ $this->params['breadcrumbs'][] = $this->title; return Html::a($model->name, ['/crud/employee-position/update', 'id' => $model->id], ['class' => 'btn btn-link']); } ], + 'alias', + 'salary', + [ + 'attribute' => 'group_id', + 'value' => function ($model) { + return $model->adminGroup ? $model->adminGroup->name : null; + } + ], [ 'class' => ActionColumn::className(), 'urlCreator' => function ($action, EmployeePosition $model, $key, $index, $column) { diff --git a/erp24/views/crud/employee-position/update.php b/erp24/views/crud/employee-position/update.php index e33ca527..5e2183d7 100755 --- a/erp24/views/crud/employee-position/update.php +++ b/erp24/views/crud/employee-position/update.php @@ -10,7 +10,7 @@ $this->params['breadcrumbs'][] = ['label' => 'Employee Positions', 'url' => ['in $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Update'; ?> -
+
Редактирование регламента:

Назад diff --git a/erp24/views/crud/employee-position/view.php b/erp24/views/crud/employee-position/view.php index 635d6529..0e493804 100644 --- a/erp24/views/crud/employee-position/view.php +++ b/erp24/views/crud/employee-position/view.php @@ -18,7 +18,7 @@ $this->params['breadcrumbs'][] = $this->title;

-
+

title) ?>

@@ -38,6 +38,28 @@ $this->params['breadcrumbs'][] = $this->title; 'attributes' => [ 'id', 'name', + 'alias', + 'salary', + [ + 'attribute' => 'group_id', + 'value' => function ($model) { + return $model->adminGroup ? $model->adminGroup->name : null; + } + ], + 'created_at', + [ + 'attribute' => 'created_by', + 'value' => function ($model) { + return $model->created_by ? \yii_app\records\Admin::findOne($model->created_by)->name ?? 'Неизвестен' : null; + } + ], + 'updated_at', + [ + 'attribute' => 'updated_by', + 'value' => function ($model) { + return $model->updated_by ? \yii_app\records\Admin::findOne($model->updated_by)->name ?? 'Неизвестен' : null; + } + ], ], ]) ?> diff --git a/erp24/views/grade/admin-update.php b/erp24/views/grade/admin-update.php index afd4561d..9ad62f9e 100644 --- a/erp24/views/grade/admin-update.php +++ b/erp24/views/grade/admin-update.php @@ -5,6 +5,7 @@ use dosamigos\datetimepicker\DateTimePicker; use yii\widgets\ActiveForm; use yii\helpers\Html; +use yii\helpers\ArrayHelper; use yii_app\helpers\PrintBlockHelper; use yii_app\records\Admin; use yii_app\records\Products1c; @@ -47,7 +48,9 @@ use yii_app\services\FileService; } ?> - field($model, 'group_name')->textInput(['maxlength' => true])->label(false)) ?> + field($model, 'employee_position_id')->dropDownList( + ArrayHelper::map($positions, 'id', 'name'), ['prompt' => 'Выберите должность'] + )->label(false)) ?>
field($model, 'work_rate')->dropDownList([1 => '5/2', 2 => '2/2', 3 => '3/3'])->label(false)) ?> -- 2.39.5