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

    /**
     * @var \common\modules\comment\models\CommentProject $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="performer-vacancy-sidebar-left-wr">
    <div class="performer-vacancy-sidebar-left">
        <div class="performer-vacancy-sidebar-img style">
            <?= Html::img($user->userInfo->image) ?>
        </div>
        <div class="performer-vacancy-sidebar-all style">
            <div class="performer-vacancy-sidebar-soc style">
                <ul>
                    <?php
                        if(!empty( $user->userInfo->social_fb )) {
                            echo '<li>' . Html::a(Html::img('/images/ico-fb.png'), $user->userInfo->social_fb, [ 'target' => '_blank' ]) . '</li>';
                        }
                    ?>
                    <?php
                        if(!empty( $user->userInfo->social_t )) {
                            echo '<li>' . Html::a(Html::img('/images/ico-tw.png'), $user->userInfo->social_t, [ 'target' => '_blank' ]) . '</li>';
                        }
                    ?>
                    <?php
                        if(!empty( $user->userInfo->social_in )) {
                            echo '<li>' . Html::a(Html::img('/images/ico-in.png'), $user->userInfo->social_in, [ 'target' => '_blank' ]) . '</li>';
                        }
                    ?>
                    <?php
                        if(!empty( $user->userInfo->social_vk )) {
                            echo '<li>' . Html::a(Html::img('/images/ico-vk.png'), $user->userInfo->social_vk, [ 'target' => '_blank' ]) . '</li>';
                        }
                    ?>
                </ul>
            </div>
            <div class="performer-vacancy-sidebar-views style">
                <ul class="style">
                    <li><img src="/images/sidebar-ico/ico-1.png" alt="">
                        <div class="sidebarvievstxt"><?= $user->userInfo->view_count ?></div>
                    </li>
                    <li><img src="/images/sidebar-ico/ico-9.png" alt="">
                        <div class="sidebarvievstxt">
                            <span class="sidebar-views-txt">Статус: </span><?= ( empty( $user->userInfo->busy ) ? 'Свободен' : 'Занят' ) ?>
                        </div>
                    </li>
                    <li><img src="/images/sidebar-ico/ico-2.png" alt="">
                        <div class="sidebarvievstxt">
                            <span class="sidebar-views-txt">На сайте: </span><?= $user->liveTime ?>
                        </div>
                    </li>
                    <li><img src="/images/sidebar-ico/ico-3.png" alt="">
                        <div class="sidebarvievstxt"><span class="sidebar-views-txt">Последний визит:<br></span><?= $user->lastVisit ?>
                        </div>
                    </li>
                </ul>
                <?= Html::a('Посмотреть профиль', $user->link, [ 'class' => 'tender-see-profile style' ]) ?>
            </div>
        </div>
    </div>
</div>
<div class="tender-offer-proj-block-right-wr">
    <div class="tender-offer-proj-block-right">
        <div class="tender-offer-proj-min-blocks">
            <span><?= $model->budget_from . '-' . $model->budget_to . ' ' . $model->currency->label ?></span>
        </div>
        <div class="tender-offer-proj-min-blocks">
            <span><?= $model->term_from . '-' . $model->term_to ?> ДНЯ</span></div>
    </div>
    <div class="tender-offer-proj-block-left">
        <div class="search-worker-blocks-title-wr">
            <div class="search-worker-blocks-title-title"><?= $user->name ?></div>
            <div class="rating-new">
                <!--оценка-->
                <input type="hidden" class="val" value="<?= $user->userInfo->rating ?>"/>
            </div>
            <?= Html::a(count($user->comments) . ' отзывов', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?>
        </div>
        <div class="tender-offer-proj-txt">
            <?= $model->text ?>
        </div>
        <ul class="download-list-files">
            <?php
                foreach($model->getFilesList() as $file) {
                    ?>
                    <li>
                        <span></span>
                        <?= Html::a($file->name, $file->dir, [ 'class' => 'download-link-file' ]) ?>
                        <?= Html::a('Скачать', $file->dir, [
                            'class'    => 'download-link',
                            'download' => 'download',
                        ]) ?>
                    </li>
                    <?php
                }
            ?>
        </ul>
    </div>
    <div class="tender-more-buttons-wr">
        <?= Html::a('Портфолио', $user->getLink('portfolio'), [ 'class' => 'get-project-new' ]) ?>
        <?= Html::a('Контакты', $user->link, [ 'class' => 'get-list-new' ]) ?>
    </div>
    <?php
        if(\Yii::$app->user->getId() == $model->owner->user_id) {
            ?>
            <div class="project_owner_control" style="clear:both">
                <span>Отметить как: </span>
                <?php
                    echo Html::a('новый', [ '#' ], [
                        'data-project-id' => $model->owner->project_id,
                        'data-comment-id' => $model->comment_id,
                        'class'           => 'artbox_project_make_new',
                    ]);
                    echo Html::a('кандидат', [ '#' ], [
                        'data-project-id' => $model->owner->project_id,
                        'data-comment-id' => $model->comment_id,
                        'class'           => 'artbox_project_make_candidate',
                    ]);
                    echo Html::a('исполнитель', [ '#' ], [
                        'data-project-id' => $model->owner->project_id,
                        'data-comment-id' => $model->comment_id,
                        'class'           => 'artbox_project_make_performer',
                    ]);
                    echo Html::a('отказать', [ '#' ], [
                        'data-project-id' => $model->owner->project_id,
                        'data-comment-id' => $model->comment_id,
                        'class'           => 'artbox_project_make_deny',
                    ]);
                ?>
            </div>
            <?php
        }
    ?>

</div>
