_customer_list_view.php 3.78 KB
<?php
    /**
     * @var User     $model
     * @var mixed    $key
     * @var integer  $index
     * @var ListView $widget
     */
    use common\models\Bookmark;
    use common\models\Project;
    use common\models\User;
    use kartik\rating\StarRating;
    use yii\bootstrap\Html;
    use yii\widgets\ListView;

?>
<div class="search_perform_txt-wr">
    <div class="search_perform_title">
        <?php
            if($model->type == 2) {
                echo Html::a($model->companyInfo->name, [
                    'company/common',
                    'company_id' => $model->id,
                ]);
            } else {
                echo Html::a($model->firstname . $model->lastname, [
                    'performer/common',
                    'performer_id' => $model->id,
                ]);
            }
        ?>
    </div>
    <div class="search_perform-stars-wr">

            <?php
                if($rating = $model->userInfo->rating) {
                    echo StarRating::widget([
                        'name'          => 'rating_customer',
                        'value'         => $rating,
                        'pluginOptions' => [
                            'displayOnly' => true,
                            'size'        => 'xxs',
                        ],
                    ]);
                } else {
                    echo StarRating::widget([
                        'name'          => 'rating_customer',
                        'value'         => 0,
                        'pluginOptions' => [
                            'displayOnly' => true,
                            'size'        => 'xxs',
                        ],
                    ]);
                }
            ?>

        <div class="search_perform-stars-txt">
            <?= count($model->comments) ?> отзывов
            <?php
                if(!empty( $model->userInfo->city )) {
                    echo ", {$model->userInfo->city}";
                }
            ?>
        </div>
    </div>
    <?php
        if($model->type == 2 && !empty( $model->companyInfo->staff )) {
            ?>
            <div class="search_perform_leng">
                <div>Сотрудники: <?= $model->companyInfo->staff ?></div>
            </div>
            <?php
        }
    ?>
    <div class="search_perform_visit">
        <span>Последний визит:</span>
        <?php
            if(( time() - \Yii::$app->formatter->asTimestamp($model->userInfo->date_visit) ) < 1800) {
                echo 'Онлайн';
            } else {
                echo \Yii::$app->formatter->asRelativeTime($model->userInfo->date_visit);
            }
        ?>
    </div>
    <div class="search_perform_projets_nam">
        <?= Html::a("Заказов " . count($model->projects), [
            'search/project',
            (new Project())->formName() . '[user_id]' => $model->id,
        ]) ?>
    </div>
</div>

<div class="right_search_perform_block-wr">
    <div class="right_search_perform_foto-wr">
        <div>
            <?php
                echo Html::img($model->userInfo->image ? : "/images/search_performer_img-1.jpg", [ 'class' => 'search_customer_image' ]);
            ?>
        </div>
    </div>
    <?php
        if(!empty( \Yii::$app->user->identity )) {
            if($model->getIsBookmarked(Bookmark::TYPE_CUSTOMER)) {
                echo Html::a('Убрать из закладок', [ '#' ], [
                    'class'   => 'get-list artbox_bookmark_remove_customer',
                    'data-id' => $model->id,
                ]);
            } else {
                echo Html::a('Добавить в закладки', [ '#' ], [
                    'class'   => 'get-list artbox_bookmark_add_customer',
                    'data-id' => $model->id,
                ]);
            }
        }
    ?>
</div>