view.php 18.9 KB
<?php

    /**
     * @var View $this
     * @var Project $model
     */
    use common\models\Project;
    use common\modules\comment\models\Comment;
    use kartik\rating\StarRating;
    use \yii\helpers\Html;
use yii\helpers\Url;
    use yii\web\View;
    use yii\widgets\DetailView;

$this->title = 'My Yii Application';
?>
<div class="section-box content">
    <div class="section-box-tender">
        <div class="section-box-tender-title"><?= $model->name ?></div>
        <div class="section-box">
            <div class="box-wr">
                <div class="box-all">
                    <div class="tender-contract-wr style">
                        <div class="tender-contract-left">
                            <?php if(!empty($model->parent->name)):?>
                            <div class="srch-prof-contract-button">ПОДРЯД</div>
                            <div class="srch-prof-contract-txt">
                                <span>Из заказа: </span><?= Html::a($model->parent->name, Url::toRoute(['tender/view', 'tender_id' =>$model->parent->project_id ])) ?>
                            </div>
                            <?php endif; ?>
                        </div>
                        <div class="tender-contract-right">
                            <span>Бюджет: <?= $model->budget?> <?= $model->budgetCurrency->label?></span>
                            <img src="/images/tender/ico-1.png" alt=""/>
                        </div>
                    </div>
                    <div class="tender-date style">
                        <div class="srch-prof-params srch-prof-params-clock">
                            <img src="/images/ico-clock.png" alt=""><span><?= Yii::$app->formatter->asDatetime($model->date_end, 'dd.MM.Y')?></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="section-box-15 tender-page">
        <div class="box-wr">
            <div class="box-all">
                <div class="section-box">
                    <div class="cabinet-message-read-autor-wr style">
                        <div class="cabinet-message-read-foto-wr">
                            <div class="cabinet-message-read-foto"><img src="<?= ($model->user->userInfo->image)?:'' ?>" alt=""/></div>
                        </div>
                        <div class="cab-mes-read-cont">
                            <div class="cab-mes-read-cont-title"><?= $model->user->owner->name ?></div>
                            <div class="cab-mes-read-cont-stars">
                                <?php
                                    echo StarRating::widget([
                                        'name' => 'rating_company',
                                        'value' => $model->user->userInfo->rating,
                                        'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs']
                                    ]);
                                ?>
                            </div>
                            <div class="cab-mes-read-cont-com"><?=count($model->user->comments)?> отзывов</div>
                            <div class="cab-mes-read-cont-soc">
                                <?= Html::a(Html::img('/images/ico-fb.png'),"{$model->user->userInfo->social_fb}",['target'=>'_blank'])?>
                                <?= Html::a(Html::img('/images/ico-tw.png'),"{$model->user->userInfo->social_t}", ['target'=>'_blank'])?>
                                <?= Html::a(Html::img('/images/ico-in.png'),"{$model->user->userInfo->social_in}",['target'=>'_blank'])?>
                                <?= Html::a(Html::img('/images/ico-vk.png'),"{$model->user->userInfo->social_vk}",['target'=>'_blank'])?>
                            </div>
                        </div>
                        <?php
                            if(!empty( \Yii::$app->user->identity )) {
                                ?>
                                <div class="performance-vacancy-add-favorite">
                                    <?php
                                        if($model->isBookmarked) {
                                            echo Html::a('', [ '#' ], [
                                                'class'   => 'artbox_bookmark_remove_project',
                                                'data-id' => $model->project_id,
                                            ]);
                                        } else {
                                            echo Html::a('', [ '#' ], [
                                                'class'   => 'artbox_bookmark_add_project',
                                                'data-id' => $model->project_id,
                                            ]);
                                        }
                                    ?>
                                </div>
                                <?php
                            }
                        ?>
                        <div class="cab-mes-read-last-visit">
                            <div class="cab-mes-read-min-bl" style="width: 204px">
                                <div class="profile-phone-site style">
                                    <div class="style">
                                        <div class="profile-phone">
                                            <img src="/images/sidebar-ico/ico-2.png" alt="">
                                            <span style="font-size: 13px" class="sidebar-views-txt">На сайте: </span><?= $model->user->liveTime?>
                                        </div>
                                    </div>
                                </div>
                            </div>
<!--                            <div class="cab-mes-read-min-bl">-->
<!--                                <div class="profile-phone-site style">-->
<!--                                    <div class="style">-->
<!--                                        <div class="profile-phone" style="width: 175px">-->
<!--                                            <img src="/images/sidebar-ico/ico-4.png" alt="">-->
<!--                                            <span style="font-size: 13px" class="sidebar-views-txt">Последнее обновление:<br></span><p style="padding-left: 24px">1 ноября 2015</p>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
                            <div class="cab-mes-read-min-bl" style="margin-top: 25px; width: 204px">
                                <div class="profile-phone-site style">
                                    <div class="style">
                                        <div class="profile-phone">
                                            <img src="/images/sidebar-ico/ico-3.png" alt="">
                                            <span style="font-size: 13px; margin-left: 7px" class="sidebar-views-txt">Последний визит:<br></span><p style="padding-left: 25px"><?= $model->user->userInfo->lastVisit?></p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php if($model->user->type == 2):?>
                            <div class="cab-mes-read-min-bl" style="margin-top: 25px">
                                <div class="profile-phone-site style">
                                    <div class="style">
                                        <div class="profile-phone" style="width: 175px">
                                            <img src="/images/sidebar-ico/ico-5.png" alt="">
                                            <span style="font-size: 13px" class="sidebar-views-txt">Сотрудники: </span><?= $model->user->companyInfo->staff?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php endif; ?>

                            <div class="cab-mes-read-min-bl" style="margin-top: 25px; width: 204px">
                            <?php foreach($model->user->phones as $phone ):?>
                                <div class="profile-phone-site style">
                                    <div class="style">
                                        <div class="profile-phone">
                                            <img src="/images/ico-phone.png" alt="">
                                            <span style="margin-left: 3px"><?= $phone['phone'] ?></span>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach;?>
                            </div>
                            <div class="cab-mes-read-min-bl" style="margin-top: 25px">
                            <?php foreach($model->user->site as $site ):?>
                                <div class="profile-phone-site style">
                                    <div class="style">
                                        <div class="profile-site">
                                            <img src="/images/ico-site.png" alt="">
                                            <a href="<?= $site['site']?>" target="_blank">Сайт</a>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach;?>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="section-box-tender-navi">
                    <?php if(!empty($model->parent->name)):?>
                        <span>Подряд</span><img src="/images/tender/ico-2.png" alt=""/><?= Html::a(Yii::t('app', 'Main project'), Url::toRoute(['tender/view', 'tender_id' =>$model->parent->project_id ])) ?>
                    <?php endif; ?>
                </div>
                <div class="section-box-tender-info-wr">
                    <div class="tender-info-title style">Краткая информация о заказе</div>
                    <div class="section-box-tender-txt">
                        <?= $model->description ?>
                    </div>
                </div>
                <div class="section-box-tender-tags-wr">
                    <div class="section-box-tender-tags-title style">Специализации</div>
                    <div class="section-box-tender-tags style">
                        <?php foreach($model->specializations as $specialization):?>
                            <span><a href="#"><?= $specialization->specialization_name ?></a>, </span>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>

        </div>

    </div>
    <div class="section-box-map tender-map">
        <div class="shadow-map"></div>
        <div id="map_cloud" style="display: none;">
            <script type="text/javascript">
                function initialize() {
                    var start_position = new google.maps.LatLng('56', '30');
                    var settings = {
                        zoom: 7,
                        scrollwheel: false,
                        center: start_position,
                        mapTypeControl: false,
                        mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
                        navigationControl: false,
                        navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
                        scaleControl: false,
                        streetViewControl: false,
                        rotateControl: false,
                        zoomControl:true,
                        mapTypeId: google.maps.MapTypeId.ROADMAP};
                    var map = new google.maps.Map(document.getElementById("map_canvas"), settings);

                    var image1 = new google.maps.MarkerImage('images/markers/marker-we-1.png',
                        new google.maps.Size(21, 32),
                        new google.maps.Point(0,0),
                        new google.maps.Point(16, 35)
                    );

                    var marker = new google.maps.Marker({
                        position: new google.maps.LatLng('56', '35.3'),
                        map: map,
                        title: 'Marker Title2',
                        icon: image1
                    });

                }
            </script>
        </div>
        <div id="map_canvas" style="width: 100%; height:100%;"></div>
    </div>
    <div class="tabs_1 style">
        <div class="tabs_list style" style="display: none">
            <div class="box-wr">
                <div class="box-all">
                    <ul>
                        <li class="active">Заявки</li>
                        <li>Вопрос-Ответ</li>
                    </ul>
                </div>
            </div>

        </div>
        
        <div class="tabs_views-wr">
           <div class="_tabs style">
                <div class="box-wr">
                    <div class="box-all">
                        <?php
                        echo \common\modules\comment\widgets\CommentWidget::widget([
                            'context'       => $this,
                            'model'         => $model::className(),
                            'model_id'      => $model->project_id,
                            'comment_class' => \common\modules\comment\models\CommentProject::className(),
                            'class_options' => [
                                'scenario'     => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST,
                                'user_id'      => \Yii::$app->user->getId(),
                                'guestComment' => false,
                                'status'       => \common\modules\comment\models\CommentProject::STATUS_ACTIVE,
                            ],
                            'list_options'  => [
                                'view' => 'list-project-comment',
                                'class' => 'section box tender-offer-proj-wr',
                            ],
                            'form_options'  => [
                                'view'  => 'form-project-comment',
                                'tag'   => 'div',
                                'class' => 'artbox_comment_form section-box tender-add-answer',
                            ],
                            'options'       => [
                                'tag' => false,
                            ],
                        ]);
                        ?>
                    </div>
                </div>
           </div>
           <div class="_tabs style">
               <div class="box-wr">
                   <div class="box-all">
                       <?php
                       echo \common\modules\comment\widgets\CommentWidget::widget([
                           'context'       => $this,
                           'model'         => $model->className(),
                           'model_id'      => $model->project_id,
                           'comment_class' => \common\modules\comment\models\CommentProjectAnswer::className(),
                           'class_options' => [
                               'scenario'     => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST,
                               'user_id'      => \Yii::$app->user->getId(),
                               'guestComment' => false,
                               'status'       => \common\modules\comment\models\Comment::STATUS_ACTIVE,
                           ],
                           'success_options' => [
                               'tag'     => 'div',
                               'content' => 'Вопрос успешно создан и появится как только будет получен ответ',
                               'class'   => 'test-class-success',
                           ],
                           'list_options'  => [
                               'view' => 'list-comment-question',
                           ],
                           'form_options'  => [
                               'view' => 'form-comment-answer',
                               'tag'  => 'span',
                           ],
                           'options'       => [
                               'class' => 'proektant-comments-wr style',
                           ],
                       ]);
                       ?>
                   </div>
               </div>
           </div>
        </div>
    </div>




</div>
<script>
    $(document).ready(function () {
        tabs_();
        inputNumber();
        tenderMark();
        function inputNumber() {
            $("#commentproject-budget_from, #commentproject-budget_to, #commentproject-term_from, #commentproject-term_to").keypress(function(e){return 8==e.which||e.which>47&&e.which<58?void 0:!1})
        }

        function tabs_() {
            $('.tabs_list').css('display','block')
            $('._tabs').css({display:'none'})
            $('._tabs:first-child').css({display:'block'})
            $('.tabs_list ul li').click(function () {
                $('.tabs_list ul li').removeClass('active')
                $(this).addClass('active')
                var index = $(this).index()
                var tabs = $('._tabs')
                tabs.css({display:'none'})
                $(tabs[index]).css({display:'block'})
            })
        }
        function tenderMark() {
            var markParrent = $('.project_owner_control')
            markParrent.addClass('_on')
            for(var i=0; i<markParrent.length;i++) {
                var markTxt = $(markParrent[i]).find('a.active')
                console.log(markTxt.text())
                $(markParrent[i]).find('p.new_mark_').html(markTxt.text())
                markTxt.css({display:'none'})
            }



            markParrent.click(function () {
                $(this).toggleClass('focus')
                if($(this).hasClass('focus')) {
                    $(this).addClass('shadow_')
                    var height = $(this).height()
                    var newHeight = ($(this).find('div').height())+2
                    $(this).css({height:(height+newHeight)})
                    markParrent.find('a').click(function () {
                        $(this).parent().prev().html($(this).text())

                    })
                } else {
                    $(this).removeClass('shadow_')
                    $(this).css({height:29})
                }
            })

        }

    })
</script>
<script>
    $('div.rating, div.rating-new').rating({
        fx: 'full',
        readOnly: 'true',
        url: 'rating.php'
    });
</script>