<?php
/**
 * @var $this View
 */


use yii\web\View;
use yii\widgets\ListView;
use frontend\assets\FlipclockAsset;
FlipclockAsset::register($this);

?>
<?php
$this->title = $model->name;
$this->params['seo']['title'] = $this->title;

$this->params['seo']['h1'] = $this->title;
?>


<div class="wrapper white item_container">
    <div class="container">
	<h1><?=$model->name?></h1>
        <div class="event_block_img">
            <?php if($model->image){?>
                <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'event_left', ['align' => 'left'])?>
            <?php }?>

            <?php

            if(!empty($model->end_at) && strtotime($model->end_at) > strtotime(date("Y-m-d"))){
                ?>
                <div class="clock_style_abs clock"></div>
            <?php $js = "
                         var clock;

                        clock = new FlipClock(jQuery('.clock'),{
                            clockFace: 'DailyCounter',
                            language: 'ru',
                            classes: {
                                active: 'flip-clock-active',
                                before: 'flip-clock-before',
                                divider: 'flip-clock-divider',
                                dot: 'flip-clock-dot',
                                label: 'flip-clock-label',
                                flip: 'flip',
                                play: 'play',
                                wrapper: 'flip-clock-wrapper'
                            },
                        });

                    clock.setTime(".(strtotime($model->end_at) - strtotime(date('Y-m-d H:i:s'))).");
                    clock.setCountdown(true);
                    clock.start();";
            $this->registerJs($js,View::POS_LOAD) ?>


                <?php
            }

            ?>
        </div>

        <div class="body_view">
            <?=$model->body?>
        </div>



        <div class="block-100" itemscope itemtype="http://schema.org/Product">

                <div class="catalog_product_list view_table">
                    <?= ListView::widget([
                        'emptyText' => '',
                        'dataProvider' => $productProvider,
                        'itemView' => function ($model, $key, $index, $widget) {
                            return $this->render('../catalog/_product_item',[
                                'model' => $model,
                                'category' => $model->category,

                            ]);
                        },
                        'layout' => "{items}<div class=\"clearfix\"></div>{pager}",
                    ])

                    ?>
                </div>
        </div>
    </div>
</div>