company.php 20.3 KB
<?php
    /**
     * @var string $content
     * @var View   $this
     */

    use common\models\User;
    use kartik\rating\StarRating;
    use yii\helpers\Html;
    use yii\helpers\Url;
    use yii\web\View;
    use yii\widgets\Menu;

    $this->beginContent('@app/views/layouts/main.php');
?>
    <div class="section-box content">
        <div class="section-box-14" style="background-image: url(<?= $this->params[ 'company' ]->userInfo->poster; ?>); background-repeat: no-repeat; background-position: 50%;">
            <div class="box-wr">
                <div class="box-all">
                    <div class="company_send_message">
                        <?php
                            echo Html::a('Написать сообщение', Url::toRoute([
                                'chat/message',
                                'user_id' => $this->params[ 'company' ]->id,
                            ]));
                        ?>
                    </div>

                    <?php
                        if($this->params[ 'company' ]->id != \Yii::$app->user->getId()) {
                            // Форма "оставить заявку"
                            echo $this->render('//company/_feedback_company', [ 'company' => $this->params[ 'company' ] ]);
                            // Конец формы "оставить заявку"
                            if(!empty( \Yii::$app->user->identity )) {
                                ?>
                                <script>
                                    $(".company_send_message").addClass("withfav");
                                </script>
                                <div class="performance-vacancy-add-favorite">
                                    <?php
                                        if($this->params[ 'company' ]->isBookmarked) {
                                            echo Html::a('', [ '#' ], [
                                                'class'   => 'artbox_bookmark_remove_performer',
                                                'data-id' => $this->params[ 'company' ]->id,
                                            ]);
                                        } else {
                                            echo Html::a('', [ '#' ], [
                                                'class'   => 'artbox_bookmark_add_performer',
                                                'data-id' => $this->params[ 'company' ]->id,
                                            ]);
                                        }
                                    ?>
                                </div>
                                <?php
                            }
                        }
                    ?>
                </div>
            </div>
        </div>


        <div class="section-box menu-content-wr">
            <div class="box-wr">
                <div class="box-all">
                    <?php
                        $items = [
                            [
                                'label' => 'Общее',
                                'url'   => [
                                    'company/common',
                                    'company_id' => $this->params[ 'company' ]->id,
                                    'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                ],
                            ],
                            [
                                'label'   => 'Выполненные работы',
                                'url'     => [
                                    'company/portfolio',
                                    'company_id' => $this->params[ 'company' ]->id,
                                    'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                ],
                                'active' => preg_match('/^portfolio.*$/', $this->context->action->id) ? true : false,
                                'visible' => ( empty( $this->params[ 'type' ] ) || $this->params[ 'type' ] == 'implementer' ) ? true : false,
                            ],
                            [
                                'label'   => 'Заказанные работы',
                                'url'     => [
                                    'company/projects',
                                    'company_id' => $this->params[ 'company' ]->id,
                                    'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                ],
                                'active' => preg_match('/^projects.*$/', $this->context->action->id) ? true : false,
                                'visible' => ( !empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer' ) ? true : false,
                            ],
                            [
                                'label' => 'Вакансии',
                                'url'   => [
                                    'company/vacancy-list',
                                    'company_id' => $this->params[ 'company' ]->id,
                                    'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                ],
                                'active' => preg_match('/^vacancy.*$/', $this->context->action->id) ? true : false,
                            ],
                            [
                                'label' => 'Мнения',
                                'url'   => [
                                    'company/review',
                                    'company_id' => $this->params[ 'company' ]->id,
                                    'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                ],
                            ],
                        ];
                        if(empty($this->params['type']) || $this->params[ 'type' ] == 'implementer') {
                            $items = array_merge($items, [
                                    [
                                        'label' => 'Команда',
                                        'url'   => [
                                            'company/team',
                                            'company_id' => $this->params[ 'company' ]->id,
                                            'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                        ],
                                    ],
                                    [
                                        'label' => 'Блог',
                                        'url'   => [
                                            'company/blog-list',
                                            'company_id' => $this->params[ 'company' ]->id,
                                            'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                        ],
                                        'active' => preg_match('/^blog.*$/', $this->context->action->id) ? true : false,
                                    ],
                                    [
                                        'label' => 'Галерея',
                                        'url'   => [
                                            'company/gallery',
                                            'company_id' => $this->params[ 'company' ]->id,
                                            'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                        ],
                                    ],
                                ]);
                        }
                        echo Menu::widget([
                            'options'        => [
                                'class' => 'menu-content',
                            ],
                            'activeCssClass' => 'active-menu-content',
                            'items'          => $items,
                        ]);
                    ?>
                </div>
            </div>
        </div>
        <div class="section-box-15">
            <div class="box-wr">
                <div class="box-all">
                    <div class="performer-vacancy-sidebar-left-wr">
                        <div class="performer-vacancy-sidebar-left">
                            <div class="performance-vacancy-sidebar-company-wr">
                                <div class="performance-vacancy-sidebar-company-title style"><?= $this->params[ 'company' ]->name ?></div>
                                <div class="performance-vacancy-sidebar-company-job style">
                                    <ul>
                                        <li class="activejob">
                                            <?php
                                                if($this->params[ 'company' ]->userInfo->is_freelancer xor $this->params[ 'company' ]->userInfo->is_customer) {
                                                    if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
                                                        echo Html::tag('span', 'Заказчик', [ 'class' => 'activejob_span' ]);
                                                    } else {
                                                        echo Html::tag('span', 'Исполнитель', [ 'class' => 'activejob_span' ]);
                                                    }
                                                } else {
                                                    if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
                                                        echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
                                                    } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
                                                        echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
                                                    } else {
                                                        echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
                                                    }
                                                    ?>
                                                    <div class="sidebar-droped-wr style">
                                                        <ul>
                                                            <li>
                                                                <?php
                                                                    if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
                                                                        echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
                                                                    } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
                                                                        echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
                                                                    } else {
                                                                        echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
                                                                    }
                                                                ?>
                                                            </li>
                                                            <li style="display: none">
                                                                <?php
                                                                    if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
                                                                        echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
                                                                    } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
                                                                        echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
                                                                    } else {
                                                                        echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
                                                                    }
                                                                ?>
                                                        </ul>
                                                    </div>
                                                    <?php
                                                }
                                            ?>
                                        </li>
                                    </ul>
                                </div>
                                <div class="performance-vacancy-sidebar-stars style">
                                    <?php
                                        echo StarRating::widget([
                                            'name'          => 'rating_company',
                                            'value'         => $this->params[ 'company' ]->userInfo->rating,
                                            'pluginOptions' => [
                                                'displayOnly' => true,
                                                'size'        => 'xxs',
                                                'min'         => 0,
                                                'max'         => 10,
                                                'stars'       => 10,
                                            ],
                                        ]);
                                    ?>
                                </div>
                                <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'company' ]->comments) ?> мнений</div>
                                <?php
                                    if($this->params[ 'company' ]->id != \Yii::$app->user->getId()) {
                                        echo Html::a('написать мнение', [
                                            'company/review',
                                            'company_id' => $this->params[ 'company' ]->id,
                                            'type'       => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                                        ], [ 'class' => 'performance-vacancy-sidebar-write style' ]);
                                    }
                                ?>
                            </div>
                            <div class="performer-vacancy-sidebar-img style"><?= Html::img($this->params[ 'company' ]->userInfo->ShowAvatar($this->params[ 'company' ]->userInfo->image, 180,180)); ?></div>
                            <div class="performer-vacancy-sidebar-all style">
                                <?= $this->render('/patrial/social_list', [
                                    'params' => $this->params,
                                ]) ?>
                                <div class="performer-vacancy-sidebar-views style">
                                    <ul class="style">
                                        <li><img src="/images/sidebar-ico/ico-1.png" alt=""/>
                                            <div class="sidebarvievstxt"><?= $this->params[ 'company' ]->userInfo->view_count; ?> просмотра</div>
                                        </li>
                                        <li><img src="/images/sidebar-ico/ico-2.png" alt=""/>
                                            <div class="sidebarvievstxt">
                                                <span class="sidebar-views-txt">На сайте: </span><?= $this->params[ 'company' ]->liveTime ?>
                                            </div>
                                        </li>
                                        <li><img src="/images/sidebar-ico/ico-3.png" alt=""/>
                                            <div class="sidebarvievstxt">
                                                <span class="sidebar-views-txt">Последний визит: <br/></span>
                                                <?php
                                                    if($this->params[ 'company' ]->isOnline) {
                                                        echo 'Онлайн';
                                                    } else {
                                                        echo $this->params[ 'company' ]->userInfo->lastVisitCabinet;
                                                    }
                                                ?>
                                            </div>
                                        </li>
                                        <li><img src="/images/sidebar-ico/ico-5.png" alt=""/>
                                            <div class="sidebarvievstxt">
                                                <span class="sidebar-views-txt">Сотрудники:<br/></span>
                                                <?php
                                                    if(!empty( $this->params[ 'company' ]->companyInfo->staff )) {
                                                        echo $this->params[ 'company' ]->companyInfo->staff;
                                                    } else {
                                                        echo 0;
                                                    }
                                                ?>
                                            </div>
                                        </li>
                                        <?= $this->render('/patrial/show_phone_list', [
                                            'phones' => $this->params[ 'company' ]->phones,
                                        ]) ?>
                                        <?= $this->render('/patrial/show_site_list', [
                                            'sites' => $this->params[ 'company' ]->site,
                                        ]) ?>
                                        <li><img src="/images/sidebar-ico/ico-8.png" alt=""/>
                                            <div class="sidebarvievstxt">
                                                <span class="sidebar-views-txt">Адрес:<br/></span><?= $this->params[ 'company' ]->address ?>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="section-box performer-vacancy-vacant-wr">
                        <?= $content ?>
                    </div>
                </div>
            </div>
        </div>
        <?php
            /*====Blocks created in view====*/
            if(isset( $this->blocks[ 'our_objects' ] )) {
                echo $this->blocks[ 'our_objects' ];
            }
            if(isset( $this->blocks[ 'blog' ] )) {
                echo $this->blocks[ 'blog' ];
            }
            if(isset( $this->blocks[ 'team' ] )) {
                echo $this->blocks[ 'team' ];
            }
            if(isset( $this->blocks[ 'review' ] )) {
                echo $this->blocks[ 'review' ];
            }
            /*====End of blocks created in view====*/
        ?>
    </div>
    <script>
        $('div.rating').rating(
            {
                fx : 'full',
                readOnly : 'true',
                url : 'rating.php'
            }
        );
    </script>
<?php $this->endContent() ?>