view.php
10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?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\ImageHelper;
use artbox\core\helpers\Url;
use artbox\core\models\Alias;
use common\models\Language;
use common\models\Service;
use yii\web\View;
$seo = \Yii::$app->get('seo');
# die(var_dump($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]),
];
}
$aliases = Alias::find()->where(['route' => '{"0":"site/questions"}'])->indexBy('route')->andWhere(['language_id' => Language::getCurrent()->id])->asArray()->all();
$js = <<<JS
$(document).on('beforeSubmit', '#comment-form', function() {
dataLayer.push({'event': 'formsend_review'});
console.log('push');
return true;
});
$(document).on('beforeSubmit', '#question-form', function() {
dataLayer.push({'event': 'formsend_question'});
console.log('push');
return true;
});
$(document).on('beforeSubmit', '#visit-form', function() {
var service_id = {$model->id};
var parent_id = {$model->parent_id};
if (service_id == 4 || parent_id == 4){
window.dataLayer.push({'event': 'formsend_dermatologiya'});
}
if (service_id == 16 || parent_id == 16){
dataLayer.push({'event': 'formsend_vedenie-beremennosti'});
}
if (service_id == 22 || parent_id == 22){
dataLayer.push({'event': 'formsend_lechenie-besplodiya'});
}
if (service_id == 21 || parent_id == 21){
dataLayer.push({'event': 'formsend_labioplastika'});
}
if (service_id == 19 || parent_id == 19){
dataLayer.push({'event': 'formsend_zabolevaniya-sheyki-matki'});
}
if (service_id == 20 || parent_id == 20){
dataLayer.push({'event': 'formsend_polovye-infekcii'});
}
console.log('push');
return true;
});
JS;
$this->registerJs($js, View::POS_LOAD);
$this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title;
?>
<?=$microdata;?>
<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
<?php if(!(($model->id == $service->id and $model->level != 2))):?>
href="<?=Url::to(['alias' => $service->language->alias])?>"
<?php endif;?>
><?=$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){?>
<?php if($model->id == $item->id) : ?>
<li class="active"><a ><?=$item->title?></a></li>
<?php else: ?>
<li class=""><a href="<?=Url::to(['alias' => $item->language->alias])?>"><?=$item->title?></a></li>
<?php endif;?>
<?php }?>
</ul>
<?php } ?>
</li>
<?php }?>
</ul>
</div>
<div class="style">
<?php if (!empty($model->packages)){
foreach ($model->packages as $package){?>
<div class="packages-page-col">
<a class="packages-page-link" href="<?=Url::to(['alias' => $package->language->alias])?>">
<div class="img-packages-page">
<!--555x344-->
<?=
ImageHelper::set(($package->image) ? $package->image->getPath() : null)
->cropResize(262, 185)
->quality(84)
->renderImage(); ?>
</div>
<div class="table-packages-wr">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><span class="title-packages"><?=$package->title?></span></td>
</tr>
<tr>
<td>
<span class="btn_ packages-btn"><?=\Yii::t('app','More info');?></span>
</td>
</tr>
</table>
</div>
</a>
</div>
<?php }
}?>
</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="<?=(isset($aliases['{"0":"site/questions"}'])) ?
Url::to(['alias' => $aliases['{"0":"site/questions"}']]) : 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>