<?php
use yii\helpers\Html;
use yii\helpers\Url;

use common\models\Settings;
use common\modules\bids\models\Bid;
use common\modules\bids\models\BidFile;
?>

<table height="100%" width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td valign="top" align="center" background="">

            <!--begin spacer -->
            <table width="600" border="0" cellspacing="0" cellpadding="0" class="width270">
                <tr>
                    <td align="left" valign="top" style="font-size:30px; line-height:30px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="30" border="0" /></td>
                </tr>
            </table>
            <!--end spacer -->
            <!--Begin Header2 -->
            <table width="600" border="0" cellspacing="0" cellpadding="0" style="-moz-border-radius:0px; -webkit-border-radius:0px; border:solid 1px #cccccc; border-radius:1px;" class="width270" >
                <tr>
                    <td align="left" valign="top">
                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:8px; line-height:8px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="8" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" class="width270">
                            <tr>
                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>

                                <td align="left" valign="top" bgcolor="#FFFFFF" class="aligncenter">
                                    <a href=""><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/logo.jpg" width="51" height="58" alt="Taskon" border="0"/></a>
                                </td>
                                <td align="right" valign="middle" bgcolor="#ffffff" style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; color:#808080; font-size:20px; mso-line-height-rule:exactly; line-height:28px;">Добро пожаловать</td>

                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>
                            </tr>
                        </table>
                        <!--End Header2 -->


                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" style="font-size:16px; line-height:16px;" class="hide">
                            <tbody><tr>
                                <td align="left" width="20" valign="top" style="font-size:16px; line-height:16px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="8" border="0"></td>
                                <td align="left" valign="top" style="font-size:16px; line-height:16px; border-bottom:#e3e3e3 solid 1px;" class="hideborder"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="8" border="0"></td>
                                <td width="20" align="left" valign="top" style="font-size:16px; line-height:16px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="8" border="0"></td>
                            </tr>
                            </tbody></table>


                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:15px; line-height:15px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="15" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->

                        <table width="600" border="0" cellspacing="0" cellpadding="0" class="width270">
                            <tr>
                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>

                                <td align="left" valign="middle" bgcolor="#ffffff" style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; color:#424242; font-size:16px; mso-line-height-rule:exactly; line-height:30px; font-weight: bold;">Добрый день!</td>

                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>
                            </tr>
                        </table>

                        <table width="600" border="0" cellspacing="0" cellpadding="0" class="width270">
                            <tr>
                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>

                                <td align="left" valign="middle" bgcolor="#ffffff" style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; color:#666666; font-size:14px; mso-line-height-rule:exactly; line-height:18px;">
                                    Уведомляем Вас о том, что на сайте <a href="<?=Url::home(true);?>"><?=Url::home(true);?></a> была оставлена следующая информация: <br><br>
                                </td>

                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>
                            </tr>
                        </table>

                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:10px; line-height:10px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="10" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->

                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:10px; line-height:10px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="30" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" class="width270">
                            <tr>
                                <td align="left" valign="top" bgcolor="#f7f7f7" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>

                                <td align="left" valign="middle" bgcolor="#f7f7f7" style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; color:#666666; font-size:14px; mso-line-height-rule:exactly; line-height:18px;">

                                    <strong>Введенные пользователем данные:</strong> <br><br>

                                    Имя: <?php echo ((isset($model->name)) ? $model->name : 'Не указано');?><br>

                                    Телефон: <?php echo ((isset($model->phone)) ? $model->phone : 'Не указано');?><br>

                                    Email: <?php echo ((isset($model->email)) ? $model->email : 'Не указано'); ?><br>

                                    Сообщение: <?php echo ((isset($model->text)) ? $model->text : 'Не указано');?><br>

                                    <?php if(count($model->files)>0) : ?>
                                        <hr>
                                        Приложенные файлы:
                                        <?php foreach ($model->files as $file)
                                        {
                                            echo Html::a($file->filename,\Yii::$app->params['frontUrl'].BidFile::FILE_FOLDER.$file->filename) . '<br>';
                                        } ?>
                                    <?php endif; ?>

                                    <hr>

                                    Отправлено с элемента дизайна: <?=Bid::$form_titles[$model->form]?><br>
                                    Дата добавления заявки: <?=date('d.m.Y H:i:s', $model->created_at)?><br>

                                    <?php if($session) : ?>

                                        Запрос отправлен со страницы: <a href="<?=Url::to([$session->lastUrl->url], true)?>"><?=Url::to([$session->lastUrl->url], true)?></a> <br>

                                        <?php if($lasts = $session->lastThreeUrls) : ?>
                                            <?php foreach ($lasts as $url) : ?>
                                                <?=date('d.m.Y H:i', $url->created_at)?> - <a href="<?=Url::to([$url->url], true)?>"><?=Url::to([$url->url], true)?></a> <br>
                                            <?php endforeach; ?>

                                            <?php if(count($session->urls)>3) : ?>
                                                <a href="http://taskon.task-on.com/sessions/statistics-admin/details/<?=$session->id;?>">Смотреть полную историю</a> <br>
                                            <?php endif; ?>
                                        <?php else : ?>
                                            Это первая страница, дальше пользователь никуда не переходил.<br>
                                        <?php endif; ?>

                                        <hr>

                                        <?php if($session->utmUrls) : ?>
                                            <h2>Данные о рекламных источниках:</h2>

                                            <?php foreach ($session->utmUrls as $url) :
                                                $params = $url->parseUrl(); ?>

                                                <p>
                                                    Рекламная площадка: <?=$params['utm_medium']?> <br>
                                                    Компания: <?=$params['utm_campaign']?> <br>
                                                    Номер объявления: <?=$params['utm_content']?> <br>
                                                    Ключевое слово: <?=$params['keyword']?> <br>
                                                    Тип блока: <?=$params['position_type']?> <br>
                                                    Позиция объявления в блоке: <?=$params['position']?> <br><br>

                                                    <strong>Дата посещения:</strong> <?=date('d.m.Y H:i', $url->created_at)?> <br>
                                                    <strong>Время пребывания на посадочной странице:</strong> <?=date('H:i:s', mktime(0, 0, $url->time))?> <br>
                                                </p>

                                            <?php endforeach; ?>

                                        <?php else : ?>

                                            <h3>Данных о рекламных источниках нет</h3>

                                        <?php endif; ?>

                                    <?php endif; ?>

                                </td>

                                <td align="left" valign="top" bgcolor="#f7f7f7" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>
                            </tr>
                        </table>


                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:20px; line-height:20px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="20" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->

                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:15px; line-height:15px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="15" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->


                        <table width="600" border="0" cellspacing="0" cellpadding="0" class="width270">
                            <tr>
                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>

                                <td align="left" valign="middle" bgcolor="#ffffff" style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; color:#666666; font-size:14px; mso-line-height-rule:exactly; line-height:18px;">
                                    С уважением, команда <?=Settings::getValue('setting-project-name')?>.
                                </td>

                                <td align="left" valign="top" bgcolor="#FFFFFF" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>
                            </tr>
                        </table>

                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:15px; line-height:15px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="15" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->

                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#0e3242" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:10px; line-height:10px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="10" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->

                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#0e3242" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:10px; line-height:10px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="10" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->

                        <table width="600" border="0" cellspacing="0" cellpadding="0" class="width270">
                            <tr>
                                <td align="left" valign="top" bgcolor="#0e3242" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>

                                <td align="center" valign="middle" bgcolor="#0e3242" style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; color:#ffffff; font-size:14px; mso-line-height-rule:exactly; line-height:24px;">

                                    Данное сообщение было отправлено Вам на основании Вашего согласия получать информационные письма об обновлениях на сайте <a style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; font-size:14px; line-height:24px; color:#1397c1;" href="<?=Url::home(true);?>"><?=Url::home(true);?></a>. В случае если Вы хотите приостановить получение подобных информационных писем, пожалуйста, напишите в службу поддержки <a style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; font-size:14px; line-height:24px; color:#1397c1;" href="mailto:<?=Settings::getValue('bids-support-email-su');?>"><?=Settings::getValue('bids-support-email-su');?></a>. <br><br>

                                    Просьба не отвечать на данное сообщение. По всем вопросам просьба обращаться: <a style="font-family: 'Trebuchet MS',  Arial, Helvetica, sans-serif; font-size:14px; line-height:24px; color:#1397c1;" href="mailto:<?=Settings::getValue('bids-support-email-admin');?>"><?=Settings::getValue('bids-support-email-admin');?></a>

                                </td>

                                <td align="left" valign="top" bgcolor="#0e3242" width="20"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="20" height="1" border="0" style="display:block;"></td>
                            </tr>
                        </table>
                        <!--begin spacer -->
                        <table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#0e3242" class="width270">
                            <tr>
                                <td align="left" valign="top" style="font-size:20px; line-height:20px"><img src="<?=Yii::$app->params['frontUrl'];?>/images/letter/spacer.gif" width="1" height="20" border="0" /></td>
                            </tr>
                        </table>
                        <!--end spacer -->

                    </td>
                </tr>


                </tbody></table>

            <!--END A-2 -->

        </td>
    </tr>
</table>





















