<?php
    use common\models\User;
    use yii\helpers\Html;

    /**
     * @var \common\modules\comment\models\Comment $model  Current comment model
     * @var integer                                $key    ID of current comment
     * @var integer                                $index  index of current element according
     *      to current page, starting from 0
     * @var \yii\widgets\ListView                  $widget current ListView instance
     * @var User                                   $user
     */
    $user = $model->user;
?>
    <div class="comments-name">
        <?php
        if(!empty($user)) {
            echo $user->name;
        } else {
            echo $model->user_name;
        }
        ?>
    </div>
<?php
    /* == STATUS PRO ==
    ?>
    <div class="comments-status"><span>Pro</span></div>
    <?php
    */
?>
    <div class="comments-date"><?= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?></div>
<?php
    if(!empty( $model->rating )) {
        ?>
        <div class="rating">
            <!--оценка-->
            <input type="hidden" class="val" value="<?= $model->rating->value ?>"/>
        </div>
        <?php
    }
?>
    <div class="comments-content">
        <?= $model->text ?>
    </div>
<?php
    /* == PROJECT INFO ==
    ?>
    <div class="comments-project-link">Проект: <a href="#">Ремонт спальни</a></div>
    <?php
    */
?>