<div class="alert alert-info" role="alert">
<?php
$currentPosition = $admin->employeePosition;
+ $currentStatus = \yii_app\records\EmployeePositionStatus::findOne([
+ 'admin_id' => $admin->id,
+ 'closed_at' => null
+ ]);
+
if ($currentPosition):
?>
<strong>Текущий грейд:</strong> <?= Html::encode($currentPosition->name) ?>
- <br><small>Установлен с: <?= $currentPosition->created_at ?? 'дата неизвестна' ?></small>
+ <br><small>Установлен с: <?= $currentStatus ? Yii::$app->formatter->asDatetime($currentStatus->created_at, 'php:d.m.Y H:i') : 'дата неизвестна' ?></small>
<?php else: ?>
<strong style="color: #dc3545;">⚠️ Грейд не установлен</strong>
<br><small>Пожалуйста, выберите грейд из списка ниже</small>
$positionHistory = \yii_app\records\EmployeePositionStatus::find()
->where(['admin_id' => $admin->id])
->orderBy(['created_at' => SORT_DESC])
- ->with('employeePosition')
->all();
if (!empty($positionHistory)):