<?php
    
    /**
     * @var View                      $this
     * @var string                    $content
     * @var SeoComponent              $seo
     * @var User                      $user
     * @var PageCategory[]            $pageCategories
     * @var \artbox\core\forms\Module $module ;
     */
    
    use artbox\core\components\SeoComponent;
    use artbox\core\helpers\ImageHelper;
    use artbox\core\helpers\Url;
    use artbox\core\models\Alias;
    use common\models\Feedback;
    use artbox\core\models\Language;
    use artbox\core\models\PageCategory;
    use artbox\core\models\User;
    use artbox\core\seo\widgets\SeoBreadcrumbs;
    use common\models\Service;
    use common\models\Settings;
    use common\models\Visit;
    use frontend\assets\AppAsset;
    use frontend\assets\SliderAsset;
    use frontend\widgets\ArtboxModalWidget;
    use frontend\widgets\LanguageWidget;
    use frontend\widgets\Nav;
    use yii\db\ActiveQuery;
    use yii\helpers\Html;
    use yii\web\View;
    use yii\helpers\Url as DefaultUrl;
    use frontend\microdata\MicrodataFabric;
    use frontend\assets\MapAsset;
    use yii\widgets\ActiveForm;
    
    AppAsset::register($this);
    SliderAsset::register($this);
    MapAsset::register($this);
    $user = \Yii::$app->user->identity;
    $seo = Yii::$app->get('seo');
    $feedback = new Feedback();
    $settings = Settings::getInstance();
    $controller = Yii::$app->controller;
    $default_controller = Yii::$app->defaultRoute;
    $isHome = ( ( $controller->id === $default_controller ) && ( $controller->action->id === $controller->defaultAction ) ) ? true : false;
    $services = Service::find()
                       ->where(
                           [
                               'status' => true,
                               'level'  => 0,
                           ]
                       )
                       ->with(
                           [
                               'language.alias',
                               'services' => function (ActiveQuery $query) {
                                   $query->where([ 'status' => true ])
                                         ->with(
                                             [
                                                 'language.alias',
                                                 'services' => function (ActiveQuery $query) {
                                                     $query->where([ 'status' => true ])
                                                           ->with([ 'language.alias' ]);
                                                 },
                                             ]
                                         );
                               },
                           ]
                       )
                       ->orderBy('sort')
                       ->all();
    
    # для автоматической генерации SEO параметров (title/description) в ситуациях, когда этих параметров нету
    # мне нужно будет автоматически их подгенеривать, поэтому вместо $seo->title, которые является readOnly я использую эту переменную
    $seoTitleName = $seo->title;
    if ($seo->title == '' && \Yii::$app->controller->id == 'site' && \Yii::$app->controller->action->id == 'comments') {
        $currentServiceId = ( !empty(\Yii::$app->request->get('service_id')) ) ? \Yii::$app->request->get(
            'service_id'
        ) : 0;
        $serviceModel = new Service([ 'id' => $currentServiceId ]);
        if ($currentServiceId !== 0) {
            $serviceName = $serviceModel->language->title;
            $seoTitleName = $this->params[ 'breadcrumbs' ][ 0 ] . ' - ' . $serviceName . ' - ' . \Yii::t(
                    'app',
                    'ABC short reverse'
                );
        } else {
            $seoTitleName = $this->params[ 'breadcrumbs' ][ 0 ] . ' - ' . \Yii::t(
                    'app',
                    'General callbacks'
                ) . ' - ' . \Yii::t('app', 'ABC short reverse');
        }
        
    }
    
    //-----------------------------------------------------------------------------------------------------------------------
    //                                             Блок с микроразметкой для FB
    
    # $property нужно для property="og:type" FB
    switch (\Yii::$app->controller->id) {
        case "site":
            $property = 'website';
            break;
        case "blog":
            $property = 'article';
            break;
        case 'service':
            $property = 'product';
            break;
        default:
            $property = 'website';
            break;
    }
    
    $this->registerMetaTag(
        [
            'property' => 'og:description',
            'content'  => $seo->desc,
        ]
    );
    $this->registerMetaTag(
        [
            'property' => "og:type",
            'content'  => $property,
        ]
    );
    $this->registerMetaTag(
        [
            'property' => "og:url",
            'content'  => Url::current(),
        ]
    );
    $this->registerMetaTag(
        [
            'property' => "og:title",
            'content'  => $seo->title,
        ]
    );
    $this->registerMetaTag(
        [
            'name'    => 'description',
            'content' => ( \Yii::$app->controller->id == 'site' && \Yii::$app->controller->action->id == 'comments' && $seo->desc == null ) ? $seoTitleName : $seo->desc,
        ]
    );
    
    //----------------------------------------------------------------------------------------------------------------------
    
    $this->registerMetaTag(
        [
            'name'    => 'robots',
            //            'content' => $seo->robots,
            'content' => 'noindex,nofollow',
        ]
    );
    $module = \Yii::$app->getModule('feedback');
    $aliases = Alias::find()
                    ->where([ 'route' => '{"0":"site/questions"}' ])
                    ->indexBy('route')
                    ->andWhere([ 'language_id' => Language::getCurrent()->id ])
                    ->asArray()
                    ->all();
    $commentUrl = Alias::find()
                       ->where([ 'route' => '{"0":"site/comments","service_id":0}' ])
                       ->indexBy('route')
                       ->andWhere([ 'language_id' => Language::getCurrent()->id ])
                       ->asArray()
                       ->all();

?>

<?php $this->beginPage() ?>
  <!DOCTYPE html >
  <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>">
    <head>
      
      <script type="text/javascript">
          WebFontConfig = {
              google: {families: [ 'Ubuntu:400,500,700' ]}
          };
          (function() {
              var wf = document.createElement('script');
              wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js';
              wf.type = 'text/javascript';
              wf.async = 'true';
              var s = document.getElementsByTagName('script')[ 0 ];
              s.parentNode.insertBefore(wf, s);
          })(); </script>
      
      
      <!-- Global site tag (gtag.js) - Google Analytics -->
      <script async src="https://www.googletagmanager.com/gtag/js?id=UA-120861020-1"></script>
      <script>
          window.dataLayer = window.dataLayer || [];
          function gtag() {
              dataLayer.push(arguments);
          }
          gtag('js', new Date());

          gtag('config', 'UA-120861020-1');
      </script>
      <!-- Google Tag Manager -->
      <script>(function(w, d, s, l, i) {
              w[ l ] = w[ l ] || [];
              w[ l ].push({
                  'gtm.start': new Date().getTime(),
                  event: 'gtm.js'
              });
              var f = d.getElementsByTagName(s)[ 0 ], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
              j.async = true;
              j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
              f.parentNode.insertBefore(j, f);
          })(window, document, 'script', 'dataLayer', 'GTM-N6R7982');</script>
      <!-- End Google Tag Manager -->
      <meta charset="<?= \Yii::$app->charset ?>">
      <meta name="viewport" content="width=device-width">
      <link type="image/x-icon" href="favicon.ico" rel="icon">
        <?= Html::csrfMetaTags() ?>
      
      
      <title><?= Html::encode($seoTitleName); ?></title>
        <?php $this->head() ?>
    </head>
    <body id="body">
      <!-- Google Tag Manager (noscript) -->
      <noscript>
        <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982"
          height="0" width="0" style="display:none;visibility:hidden"></iframe>
      </noscript>
      <!-- End Google Tag Manager (noscript) -->
        <?php $this->beginBody() ?>
      <!-- Google Tag Manager (noscript) -->
      <noscript>
        <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982"
          height="0" width="0" style="display:none;visibility:hidden"></iframe>
      </noscript>
      <!-- End Google Tag Manager (noscript) -->
      <div class="transition-loader">
        <div class="transition-loader-inner">
          <label></label>
          <label></label>
          <label></label>
          <label></label>
          <label></label>
          <label></label>
        </div>
      </div>
      <header id="header_" class="section-box-header">
        <div class="section-box-header-columns">
          <div class="container">
            <div class="row">
              <div class="col-xs-7 col-sm-3 col-md-2 col-lg-2 logo-wrapp">
                
                <a itemprop="url" content="<?= \Yii::$app->homeUrl; ?>"
                    <?php if ( DefaultUrl::current() !== '/site/index' ): ?>
                  href="<?php echo \frontend\helpers\Url::home(); ?>">
                    <?php else: ?>
                      >
                    <?php endif; ?>
                    
                    <?php
                        if ($settings->logo != null) {
                            echo "<img     src='/storage/logo/" . $settings->logo . "' alt='" . \Yii::t(
                                    'app',
                                    'ABC short'
                                ) . "'
                        title='" . \Yii::t('app', 'ABC short') . "'
                        >";
                        } else {
                            echo ImageHelper::set(null)
                                            ->setHeight(44)
                                            ->renderImage(
                                                [
                                                    'alt'   => $settings->name,
                                                    #'alt'=>\Yii::t('app','ABC short'),
                                                    'title' => \Yii::t('app', 'ABC short'),
                                                ]
                                            );
                        }
                    
                    ?>
                
                
                </a>
              </div>
              <div class="col-sm-9 col-md-10 col-lg-10 header-col">
                <ul class="hidden-xs hidden-sm">
                    <li><a href="<?= Url::to(['site/doctor']) ?>"><?= \Yii::t('app', 'Our doctors') ?></a></li>

                </ul>
                
                <div class="hidden-xs table-header-callback">
                  <table cellpadding="0" cellspacing="0" border="0">
                    
                    <tr>
                      <td>
                        <div class="phone-header new-phone-header">
                            <?= $settings->phone ?>
                            
                            <?php
                                # если указаны дополнительные телефоны, указываем их в выпадающем меню
                                if (!empty($settings->phone2)):?>
                                    <?php $phones2 = explode(';', $settings->phone2); ?>
                                  <div class="hidden-header-phone">
                                      <?php foreach ($phones2 as $soloPhone2): ?>
                                          <?= Html::tag('p', $soloPhone2); ?>
                                      <?php endforeach; ?>
                                  </div>
                                <?php endif; ?>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      
                      <td><span class="modal-link" data-form="callback"><?= \Yii::t('app', 'Callback') ?></span>
                      </td>
                    </tr>
                  </table>
                </div>
                
                <div class="hidden-xs btn-header-wr">
                  <span class="btn_ modal-link" data-form="callback"><?= \Yii::t('app', 'Make an appointment') ?></span>
                </div>
                
                <ul class="hidden-xs hidden-sm">
                  <li><a href="/vtoroe-mnenie" class="new"><span> <?= \Yii::t('app', 'Second thing') ?>  </span></a>
                  </li>
                  <li>
                    <a href="<?= ( isset($aliases[ '{"0":"site/questions"}' ]) ) ? Url::to(
                        [ 'alias' => $aliases[ '{"0":"site/questions"}' ] ]
                    ) : Url::to([ 'site/questions' ]) ?>"><?= \Yii::t('app', 'Quest/Answer') ?></a></li>
                  <li>
                    <a href="<?= ( isset($commentUrl[ '{"0":"site/comments","service_id":0}' ]) ) ? Url::to(
                        [ '/' . $commentUrl[ '{"0":"site/comments","service_id":0}' ][ 'value' ] ]
                    ) : Url::to([ 'site/comments' ]) ?>"><?= \Yii::t('app', 'Callbacks') ?></a></li>
                </ul>
                <!--                -->
                <!--                <div class="lang-sep-wr hidden-xs hidden-sm">-->
                <!--                    -->
                <!--                    --><?php //echo LanguageWidget::widget() ?>
                <!--                </div>-->
                
                <div class="hidden-sm hidden-md hidden-lg icon_phone-header-mob btn_call"></div>
                
                <div class="menu_mob hidden-md hidden-lg">
                  <div></div>
                  <div></div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <nav class="hidden-xs hidden-sm">
            <?php
                $items = [];
                foreach ($services as $service) {
                    if ($service->level != 0) {
                        continue;
                    }
                    $items[] = [
                        'label' => $service->title,
                        'url'   => Url::to([ 'alias' => $service->language->alias ]),
                    ];
                }
                $items[] = [
                    'label'   => \Yii::t('app', 'Prices'),
                    'url'     => Url::to([ 'site/prices' ]),
                    'options' => [
                        'class' => 'active',
                    ],
                ];
                $items[] = [
                    'label' => \Yii::t('app', 'Package offerings'),
                    'url'   => Url::to([ 'package/index' ]),
                ];
            
            ?>
            
            <?php echo Nav::widget(
                [
                    'items'         => $items,
                    'activateItems' => false,
                ]
            ); ?>
        </nav>
        <div class="mobile-menu-hidden" style="display: none;">
          <div class="close-lang-mob">
            
            <div class="close-mobile-menu"></div>
          </div>
          <div class="mobi-menu-catalog">
              <?php
                  $itemsMobile = [];
                  foreach ($services as $service) {
                      /**
                       * @var Service $service ;
                       */
                      $servicesChild = [];
                      foreach ($service->services as $item) {
                          $level = [];
                          foreach ($item->services as $child) {
                              $level[] = [
                                  'label' => $child->title,
                                  'url'   => Url::to([ 'alias' => $child->language->alias ]),
                              ];
                          }
                          $servicesChild[] = [
                              'label' => $item->title,
                              'url'   => Url::to([ 'alias' => $item->language->alias ]),
                              'items' => $level,
                          ];
                      }
                      $itemsMobile[] = [
                          'label' => $service->title,
                          'items' => $servicesChild,
                          'url'   => Url::to([ 'alias' => $service->language->alias ]),
                      ];
                  }
                  $itemsMobile[] = [
                      'label'   => \Yii::t('app', 'Prices'),
                      'url'     => Url::to([ 'site/prices' ]),
                      'options' => [
                          'class' => 'active',
                      ],
                  ];
                  $itemsMobile[] = [
                      'label' => \Yii::t('app', 'Package offerings'),
                      'url'   => Url::to([ 'package/index' ]),
                  ]
              ?>
              <?php echo Nav::widget(
                  [
                      'items'   => $itemsMobile,
                      'options' => [
                          'class' => '',
                      ],
                  ]
              ); ?>
          </div>
          <div class="menu-second-mob">
            <ul class="footer-menu">

              <li><a href="<?= Url::to([ 'site/contact' ]) ?>"><?= \Yii::t('app', 'Contacts') ?></a></li>
              <li><a href="/vtoroe-mnenie" class="new"><span><?= \Yii::t('app', 'Second thing') ?></span></a></li>
              <li><a href="<?= ( isset($aliases[ '{"0":"site/questions"}' ]) ) ? Url::to(
                      [ 'alias' => $aliases[ '{"0":"site/questions"}' ] ]
                  ) : Url::to([ 'site/questions' ]) ?>">
                      <?= \Yii::t('app', 'Quest/Answer') ?></a></li>
              <li><a href="#"><?= \Yii::t('app', 'Callbacks') ?></a></li>
            </ul>
          </div>
          
          <div class="mob-menu-btns">
            <div class="style mob-menu-write">
              <span class="btn_ modal-link" data-form="callback"><?= \Yii::t('app', 'Make an appointment') ?></span>
            </div>
            <div class="style mob-menu-callback">
              <p><?= $settings->phone ?></p>
              <span class="modal-link" data-form="callback"><?= \Yii::t('app', 'Callback'); ?></span>
            </div>
          </div>
        </div>
      </header>
        
        <?php #content должен быть в main.php ?>
      <div id="content_" class="section-box-content">
        <!-- start breadcrumbs -->
          <?php if (!empty($this->params[ 'breadcrumbs' ])) { ?>
            <section class="section-breadcrumb">
              <div class="container">
                <div class="row">
                  <div class="col-xs-12 col-sm-12 breadcrumb-wrapp">
                      <?= SeoBreadcrumbs::widget(
                          [
                              'links' => isset($this->params[ 'breadcrumbs' ]) ? $this->params[ 'breadcrumbs' ] : [],
                          ]
                      ) ?>
                  </div>
                </div>
            </section>
          <?php } ?>
          <?php #если не главная выводить сюда
              # end breadcrumbs ?>
          
          <?php #start content ?>
          
          <?= $content ?>
          <?php # end content ?>
        
        
        <div class="section-box-6">
          <div id="map_canvas"></div>
          <div style="display: none" class="adress-map" data-zoom="14" data-start-lat="<?= $settings->lat ?>" data-start-lng="<?= $settings->lon ?>">
            <span data-lat="<?= $settings->lat ?>" data-lng="<?= $settings->lon ?>"></span>
          </div>
          <div class="container">
            <div class="row">
              <div class="col-xs-12 col-sm-5 col-sm-offset-7 col-md-4 col-md-offset-8 contacts-mobile-fix" style="display: table">
                <div class="map-info-wrapp">
                  <div class="map-adress"><?= $settings->address; ?></div>
                    <?php if (!empty($settings->phone) or !empty($settings->phone2)) {
                        $phones = array_merge(explode(';', $settings->phone2), [ $settings->phone ]);
                        ?>
                      <div class="ico-map">
                        <img src="/images/map/phone-map.svg" alt="">
                        <img class="mob-ico-map" style="display: none" src="/images/map/phone-map-1-grey.svg" alt="">
                      </div>
                      <div class="map-phone">
                          <?php foreach ($phones as $phone) { ?>
                            <p><?= $phone ?></p>
                          <?php } ?>
                      </div>
                    <?php } ?>
                    <?php if (!empty($settings->email)) { ?>
                      <div class="ico-map ico-map-mail">
                        <img src="/images/map/mail-map.svg" alt="">
                        <img class="mob-ico-map" style="display: none" src="/images/map/mail-map-1-grey.svg" alt="">
                      </div>
                      <div class="map-mail">
                        <a href="mailto:<?= $settings->email ?>"><?= $settings->email ?></a>
                      </div>
                    <?php } ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      
      </div>
      
      <footer id="footer_" class="section-box-footer">
        
        <div class="section-box-footer-columns">
          <div class="container">
            <div class="row">
              <div class="col-xs-12 hidden-sm hidden-md hidden-lg" style="text-align: center; margin-bottom: 8px">
                <div class="btn-footer-wr">
                  <span class="btn_ modal-link" data-form="callback"><?= \Yii::t('app', 'Make an appointment') ?></span>
                </div>
              </div>
              
              <div class="col-xs-9 col-sm-2">
                <ul class="footer-menu">
                    <li><a href="<?= Url::to(['blog/index']) ?>"><?= \Yii::t('app', 'Блог') ?></a></li>

                    <li><a href="<?= Url::to([ 'site/contact' ]); ?>"><?= \Yii::t('app', 'Contacts'); ?></a></li>
                  <li><a href="/vtoroe-mnenie" class="new"><span><?= \Yii::t('app', 'Second thing'); ?></span></a></li>
                  <li><a href="<?= ( isset($aliases[ '{"0":"site/questions"}' ]) ) ? Url::to(
                          [ 'alias' => $aliases[ '{"0":"site/questions"}' ] ]
                      ) : Url::to([ 'site/questions' ]) ?>"><?= \Yii::t('app', 'Quest/Answer'); ?></a></li>
                  <li><a href="<?= Url::to([ 'site/comments' ]) ?>"><?= \Yii::t('app', 'Callbacks'); ?></a></li>
                </ul>
              </div>
              
              <div class="hidden-xs col-xs-12 col-sm-4">
                  <?php echo Nav::widget(
                      [
                          'items'         => $items,
                          'options'       => [
                              'class' => 'footer-menu footer-menu-catalog',
                          ],
                          'activateItems' => false,
                      ]
                  ); ?>
              </div>
              
              <div class="hidden-xs col-xs-12 col-sm-3 col-md-3">
                <div class="btn-footer-wr">
                    <span class="btn_ modal-link" data-form="callback">
                        <?= \Yii::t('app', 'Make an appointment') ?></span>
                </div>
              </div>
              
              <div class="col-xs-3 col-sm-3">
                <ul class="seti-list">
                    <?php if (!empty($settings->facebook)) { ?>
                      <li><a target="_blank" href="<?= $settings->facebook ?>"><img src="/images/s-1.svg" alt=""></a>
                      </li>
                    <?php } ?>
                    <?php if (!empty($settings->google)) { ?>
                      <li><a target="_blank" href="<?= $settings->google ?>"><img src="/images/s-2.svg" alt=""></a></li>
                    <?php } ?>
                    <?php if (!empty($settings->twitter)) { ?>
                      <li><a target="_blank" href="<?= $settings->twitter ?>"><img src="/images/s-3.svg" alt=""></a>
                      </li>
                    <?php } ?>
                </ul>
              </div>
            </div>
            <div class="row">
              <div class="col-xs-12 col-sm-12 studio-wrapp">
                <div class="all-rights-txt">© <?= \Yii::t('app', 'All rights reserved'); ?> , 2018. Доступный доктор</div>
                <div class="link-studio">
                  <a href="http://artweb.ua"><?= \Yii::t('app', 'Creating sites'); ?></a>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        
        <div style="display: none;" class="btn_up"></div>
        <div style="display: none" class="btn_call_close"></div>
      </footer>
        <?php if (!empty($settings->phone) or !empty($settings->phone2)) {
            $phones = array_merge(explode(';', $settings->phone2), [ $settings->phone ]); ?>
          <div class="call-mobile-wr" style="display: none;">
            <div class="call-mobile">
              <div class="call-mobile-td">
                  <?php foreach ($phones as $phone) { ?>
                    <div class="button-call-mob">
                      <a class="button-call_" href="tel:<?= $settings->phone ?>">
                        <span><?= $phone ?></span>
                      </a>
                    </div>
                  <?php } ?>
                
                <div class="button-call-mob">
                  <a class="call-sms" href="sms:<?= $settings->phone ?>"><?= \Yii::t('app', 'Send SMS'); ?></a>
                </div>
                <div class="button-call-mob">
                  <a class="call-contact" href="/contacts/abclinic.vcf"><?= \Yii::t('app', 'Add to contacts'); ?></a>
                </div>
              </div>
            </div>
          </div>
        <?php } ?>
      <div id="overlay" style="display: none;"></div>
      
      <!--          --><?php
            //              $module = \Yii::$app->getModule('feedback');
            //              ArtboxModalWidget::begin([
            //                                           'modalTagOptions' => [
            //                                               'id' => 'callback'
            //                                           ],
            //                                           'titleTagOptions' => [
            //                                             'class' => 'style form-title'
            //                                           ],
            //                                           'headerText' => \Yii::t('app', 'Callback'),
            //                                           'closeTagButton' => 'span',
            //                                           'closeTagContent' => '',
            //                                           'closeButtonOptions' => [
            //                                             'id' => 'modal_close'
            //                                           ]
            //                                       ]);
            //
            //              $module->renderForm($this);
            //
            //              ArtboxModalWidget::end();
            //          ?>
      
      <div id="callback" class=" forms_ " style="display: none;">
        <div class="style title-callback">Записаться на прием</div>
          <?php
              $model = new Visit(['agree' => 1, 'time' => 1]);
          $form = ActiveForm::begin(['action' => '/site/callback', 'id' => 'callback-form']); ?>
        <div class="input-wr phones_mask required">
            <?= $form->field($model, 'phone')
                     ->textInput([ 'placeholder' => '+38(0__)___-__-__' ])
                     ->label('Телефон') ?>
        </div>
        <div class="input-wr">
          <div class="style callback-params-title">Когда вам удобно перезвонить?</div>
            <?= $form->field($model, 'time')
                     ->radioList(
                         [
                             Visit::DURING_30_MIN => 'В течение 30 минут',
                             Visit::FROM_9_12     => 'с 9:00 до 12:00',
                             Visit::FROM_12_18    => 'с 12:00 до 18:00',
                         ],
                         [
                             'item' => function ($index, $label, $name, $checked, $value) {
                                 $check = $checked ? ' checked="checked"' : '';
                                 return '<div class="style radio_custom"><input id="time_'.$value.'" type="radio" name="'.$name.'" value="'.$value.'" '.$check.'><label for="time_'.$value.'">'.$label.'</label></div>';
                             },
                         ]
                     )->label(false);
            
            echo $form->field($model, 'entity')->hiddenInput(['value' => (isset($this->params['entity']) ? $this->params['entity'] : null)])->label(false);
            echo $form->field($model, 'entity_id')->hiddenInput(['value' => (isset($this->params['entity_id']) ? $this->params['entity_id'] : null)])->label(false)
            
            ?>
            
          <!--                <div class="style radio_custom">-->
          <!--                    <input type="radio" id="order-delivery_id1" name="qwerty" value="1" checked="">-->
          <!--                    <label  for="order-delivery_id1">В течение 30 минут</label>-->
          <!--                </div>-->
          <!---->
          <!--                <div class="style radio_custom">-->
          <!--                    <input type="radio" id="order-delivery_id2" name="qwerty" value="1">-->
          <!--                    <label  for="order-delivery_id2">с 9:00 до 12:00</label>-->
          <!--                </div>-->
          <!---->
          <!--                <div class="style radio_custom">-->
          <!--                    <input type="radio" id="order-delivery_id3" name="qwerty" value="1">-->
          <!--                    <label  for="order-delivery_id3">с 12:00 до 18:00</label>-->
          <!--                </div>-->
          
          <div class="style radio-callback-border"></div>
        </div>
        
        <div class="input-wr sidebar_checks">
            <?= $form->field(
                $model,
                'agree',
                [
                    'template' => '{input}{label}',
                ]
            )
                     ->checkbox([], false)
                     ->label(\Yii::t('app', 'Даю согласие на хранение и обработку персональных данных')); ?>
<!--          <input type="checkbox" id="loginform-rememberme" name="LoginForm[rememberMe]" value="1" checked="">-->
<!--          <label class="control-label" for="loginform-rememberme">Даю согласие на хранение и обработку персональных данных</label>-->
        </div>
        <div class="button-wr">
          <div class="close-callback"><span id="modal_close">Закрыть окно</span></div>
          <button type="submit">Отправить</button>
        </div>
          <?php ActiveForm::end() ?>
      </div>
        
        <?php
            /* @var \artbox\core\forms\Module $moduleVisit */
            $moduleVisit = \Yii::$app->getModule('visit');
            if (isset($this->params[ 'entity' ]) and isset($this->params[ 'entity_id' ])) {
                $moduleVisit->inputOptions = array_merge(
                    $moduleVisit->inputOptions,
                    [
                        'entity'    => [
                            'type'    => 'hiddenInput',
                            'options' => [ 'value' => $this->params[ 'entity' ] ],
                        ],
                        'entity_id' => [
                            'type'    => 'hiddenInput',
                            'options' => [ 'value' => $this->params[ 'entity_id' ] ],
                        ],
                    ]
                );
            }
            ArtboxModalWidget::begin(
                [
                    'modalTagOptions'    => [
                        'id' => 'write-to',
                    ],
                    'titleTagOptions'    => [
                        'class' => 'style form-title',
                    ],
                    'headerText'         => \Yii::t('app', 'Make an appointment'),
                    'closeTagButton'     => 'span',
                    'closeTagContent'    => '',
                    'closeButtonOptions' => [
                        'id' => 'modal_close',
                    ],
                ]
            );
            
            $moduleVisit->renderForm($this);
            
            ArtboxModalWidget::end();
        ?>
      
      <div id="success_form" style="display: none;">
        <span id="modal_close"></span>
        <div class="txt-success"><span><?= \Yii::t('app', 'Thanks for request') ?></span>
          <p><?= Yii::t('app', 'We`ll call you later') ?>.</p></div>
      </div>
        <?php
            //----------------------------------------------------------------------------------------
            // микроразметка организации
            
            /**
             * <script type="application/ld+json">
             * {
             * "@context": "http://schema.org",
             * "@type": "Organization",
             * "url": "http://www.your-company-site.com",
             * "logo": "http://www.example.com/logo.png",
             * "contactPoint": [{
             * "@type": "ContactPoint",
             * "telephone": "+1-401-555-1212",
             * "contactType": "customer service"
             * }]
             * }
             * </script>
             */
            
            $layoutMicrodata = [
                'context'      => 'http://schema.org/',
                'type'         => 'Organization',
                'url'          => Url::home(true),
                #'logo'=>'http://www.example.com/logo.png',
                'logo'         => Url::home(true) . "storage/logo/" . $settings->logo,
                'contactPoint' => [
                    '@type'       => 'ContactPoint',
                    'contactType' => "customer service",
                ],
            
            ];
            
            if (isset($phones[ 0 ])) {
                $layoutMicrodata[ 'contactPoint' ][ 'telephone' ] = "+38" . $phones[ 0 ];
            }
            
            $settings->email;
            $microdata = new MicrodataFabric();
            $pageMicrodata = $microdata::createJsonFromOrganization($layoutMicrodata)
                                       ->toJson();
            echo $pageMicrodata
        
        ?>
        
        <?php # выводить если главная страница  ?>
        
        
        <?php $this->endBody() ?>
      <script>var telerWdWidgetId="7b7cad41-1769-4be9-982c-ecd9aa6f0faa";var telerWdDomain="dodo.phonet.com.ua";</script> <script src="//dodo.phonet.com.ua/public/widget/call-catcher/lib-v3.js"></script>
    </body>
  </html>
<?php $this->endPage() ?>