<?php

use yii\widgets\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;

use common\modules\content\models\CoContent;
use common\modules\bids\models\Bid;

$more = CoContent::find()
    ->where([
        'category_id' => 4,
        'active' => true
    ])
    ->andWhere(['!=', 'id', $model->id])
    ->orderBy('RAND()')
    ->one();
?>

<!-- <section class="short_keys_sect">
    <div class="container"> -->
        <div class="row">
            <div class="col-md-12 col-xs-12 col-sm-12">
                <h2 class="short_keys_title">Посмотрите еще один<br/> короткий кейс</h2>
            </div>
        </div>
        <div class="row">
            <?php if($more) : ?>
                <div class="col-md-6 col-xs-6 col-sm-12">
                    <div class="short_keys_block">
                        <img src="<?=$more->preview?>" height="338" width="455">
                        <a href="<?=Url::to(['/'.$more->url]);?>" style="color:<?if($more->custom==CoContent::CUSTOM_WHITE){?>#fff<?}else{?>#2d3642<?}?>;" class="short_keys_title_link"><?=$more->lang->title?></a>
                        <div class="short_keys_foot">
                            <a href="<?=Url::to(['/'.$more->url]);?>" class="short_keys_btn_more"><span>Подробнее</span></a>
                            <!-- <a href="#" class="short_keys_tags"># Big data</a> -->
                        </div>
                    </div>
                </div>
            <?php endif; ?>

            <div class="col-md-6 col-xs-6 col-sm-12">
                <div class="subsc_block">
                    <h2 class="subsc_block_title">Подписаться на обновления</h2>
                    <div class="subsc_block_txt">Нам будет приятно, если вы захотите подписаться на обновления наших проектов</div>
                    <?php 
                    $model = new Bid;
                    $model->scenario = Bid::SCENARIO_SUBSCRIBE;
                    $model->form = Bid::FORM_SUBSCRIBE;

                    $form = ActiveForm::begin([
                        'action' => '/bids/bid/add',
                        'enableClientValidation' => false,
                        'options' => [
                            'class' => 'subsc_form bids-form',
                            'data-title' => 'Кейс: ' . $title,
                            'data-form' => 'Подписаться на обновление',
                            'data-tag' => Bid::TAG_INVOLVEMENT
                        ],
                    ]); ?>

                        <?php echo Html::hiddenInput('scenario', $model->scenario, ['class' => 'not_clear']); ?>

                        <?php echo $form->field($model, 'form', ['template' => '{input}'])->hiddenInput(['class' => 'not_clear']); ?>

                        <?php echo $form->field($model, 'email', [
                            'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
                            'errorOptions' => []
                        ])->textInput([
                            'placeholder' => 'E-mail*'
                        ]); ?>

                        <?php echo Html::submitButton('Подписаться', ['class' => 'save-button']); ?>

                    <?php ActiveForm::end(); ?>
                </div>
            </div>
        </div>
    <!-- </div>
</section> -->
<style type="text/css">
    .field-bid-email,
    .field-bid-email input {
        margin-bottom: 0;
    }
</style>