view.php 6.67 KB
<?php
    /**
     * @var \common\models\Service $model;
     * @var \common\models\Service[] $others;
     * @var \artbox\core\forms\Module $moduleComment;
     * @var \artbox\core\forms\Module $moduleQuestion;
     * @var \yii\web\View $this
     * @var \artbox\core\components\SeoComponent $seo;
     */
    use artbox\core\helpers\Url;
    use common\models\Service;
    
    $seo = \Yii::$app->get('seo');
    $this->params['entity'] = Service::className();
    $this->params['entity_id'] = $model->id;
    
    $moduleComment = \Yii::$app->getModule('comments');
    
    
    $moduleComment->inputOptions = array_merge($moduleComment->inputOptions, ['entity_id' => [
        'type'    => 'hiddenInput',
        'options' => ['value' => $model->id],
    ],
                                                                                'entity' => [
                                                                                    'type'    => 'hiddenInput',
                                                                                    'options' => ['value' => Service::className()],
                                                                                ]]);
    
    $moduleQuestion = \Yii::$app->getModule('questions');
    $moduleQuestion->inputOptions += ['service_id' => [
        'type'    => 'hiddenInput',
        'options' => ['value' => $model->id],
    ]];
    if ($model->parent !== null){
        if ($model->parent->parent !== null){
            $this->params['breadcrumbs'][] = [
                'label' => $model->parent->parent->title,
                'url' => Url::to(['alias' => $model->parent->parent->language->alias]),
            ];
        }
        $this->params['breadcrumbs'][] = [
            'label' => $model->parent->title,
            'url' => Url::to(['alias' => $model->parent->language->alias]),
        ];
    }
    
  
    
    $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title;
    ?>
    <section class="section-service-page">
    <div class="container">
        <div class="row">
          <div class="hidden-xs col-xs-12 col-sm-4 col-md-4 col-lg-3">
                <div class="style service-list-wr">
                    <ul>
                        <?php foreach ($others as $service){?>
                        <li class="<?=(($model->id == $service->id and $model->level != 2) ? 'active' : '')?>
                        <?=(($model->parent_id == $service->id and $model->level == 2) ? 'active2' : '')?>
                        <?=(!empty($service->services) ? 'has-list' : '')?>">
                            <a href="<?=Url::to(['alias' => $service->language->alias])?>"><?=$service->title?></a>
                         <?php
                           if (($model->id == $service->id or $model->parent_id == $service->id) and !empty($service->services)) {?>
                            <ul>
                              <?php foreach ($service->services as $item){?>
                              <li class="<?=($model->id == $item->id ? 'active' : '')?>"><a href="<?=Url::to(['alias' => $item->language->alias])?>"><?=$item->title?></a></li>
                              <?php }?>
                            </ul>
                          <?php } ?>
                        </li>
                        <?php }?>
                    </ul>
                </div>
            </div>
          <div class="col-xs-12 col-sm-8 col-md-8 col-lg-9">
                <div class="row">
                    <div class="col-xs-12">
                        <h1 class="title-pages"><?=(!empty($seo->h1)) ? $seo->h1 :$model->title?></h1>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 service-text-table-wrapp editor-text">
                        <?=$model->body?>
                        </div>
                </div>
            </div>
        </div>
    </div>
</section>
<section class="section-comments-answers fix-map-margin">
  <div class="container">
    <div class="row">
      <div class="col-xs-12 col-sm-4 col-md-4 fix-form-c-a-wr">
        <div class="title-c-a"><?=\Yii::t('app','Callbacks');?></div>
        <div class="service-comments-wr style">
          <?php foreach ($model->comments as $comment){?>
          <div class="service-comments style">
            <div class="style comments-h-autor"><?=$comment->name?></div>
            <div class="style comments-h-text"><?=$comment->comment?></div>
            <div class="style comments-h-date"><?=date('d.m.Y', $comment->created_at)?></div>
          </div>
          <?php }?>
        </div>
        
        <div class="style service-links-c-a"><a href="<?=Url::to(['site/comments'])?>">
                <?=\Yii::t('app','All callbacks');?></a></div>
        <div class="style service-c-a-btns">
          <span class="btn_"><?=\Yii::t('app','Give feedback');?></span>
        </div>
        <div class="style hidden-form-c-a-wr hidden">
          <div class="style hidden-form-c-a">
            <div class="title-forms-c-a style"><?=\Yii::t('app','Give feedback');?></div>
            <?php $moduleComment->renderForm($this)?>
          </div>
        </div>
      </div>
      <div class="hidden-xs hidden-sm col-sm-1"></div>
      <div class="col-xs-12 col-sm-8 col-md-7 service-ansver-mob-line">
        <div class="title-c-a"><?=\Yii::t('app','Quest/Answer');?></div>
        <?php foreach ($model->questions as $question){?>
        <div class="service-comments-wr style">
          <div class="service-comments style service-ansvers">
            <div class="style comments-h-autor"><?=$question->name?></div>
            <div class="style comments-h-text"><?=$question->question?> </div>
            <div class="service-ansvers-text-wr style">
              <?php if ($question->doctor !== null){?>
              <div class="service-ansvers-title"><?=$question->doctor->position?><span><?=$question->doctor->name?></span></div>
              <?php }?>
              <div class="service-ansvers-txt">
                <?=$question->answer?>
              </div>
            </div>
          </div>
        
        
        </div>
        <?php } ?>
        <div class="style service-links-c-a service-links-a">
            <a href="<?=Url::to(['site/questions'])?>"><?=\Yii::t('app','All questions');?></a></div>
        <div class="style service-c-a-btns">
          <span class="btn_"><?=\Yii::t('app','Asc question');?></span>
        </div>
        
        <div class="style hidden-form-c-a-wr hidden">
          <div class="style hidden-form-c-a">
            <div class="title-forms-c-a style"><?=\Yii::t('app','Asc question');?></div>
            <?php $moduleQuestion->renderForm($this)?>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>