<?php

use yii\helpers\Html;
use yii\helpers\Url;

$lang = Yii::$app->language;
$this->title = 'QFood';

$script =<<< JS

    $( ".popup" ).click(function(){
        var popup = $("#myPopup");
        // console.log(popup.classList);
        popup.toggle("show");
    });
JS;

$this->registerJs($script);
?>


<div class="home-page">
    <div class="col-xs-6 col-xs-offset-3">
        <div class="circle-img-border">
            <!-- <img src="<?= Url::base()?>/home-icon/aladdin.jpg" alt="" class="img-responsive img-circle"> -->
            <img src="<?= Url::base()?>/<?= $info['logo'] ? $info['logo'] : 'home-icon/blank-logo.jpg' ?>" alt="" class="img-responsive ">
        </div>
    </div>
    <div class="col-sm-8 col-sm-offset-2 col-xs-12">
        <div class="change-language">		<a class="anchor-home col-xs-6" href="<?= Url::base()?>/site/menu-language-arabic?lang=ar&current_url=<?= Url::base()?>/menu/categories">
            <div class="btn-change btn-arabic ">
                    <div class="text-btn">
                    <p> عربي</p>
                    </div>
            </div>			</a>			<a class="anchor-home col-xs-6" href="<?= Url::base()?>/site/menu-language-arabic?lang=en&current_url=<?= Url::base()?>/menu/categories">
            <div class="btn-change btn-english ">
                <div class="Circle c-or">or</div>
                        <div class="text-btn">
                            <p> English</p>
                        </div>
                </div>			</a>
        </div>
    </div>
    <div class="col-xs-10 col-xs-offset-1 col-sm-6 col-sm-offset-3">
        <div class="btn-about">
            <a class="anchor-home" href="<?= Url::base()?>/site/menu-language-arabic?lang=ar&current_url=<?= Url::base()?>/menu/about"> عن كريسبر  </a>
            <a class="anchor-home" href="<?= Url::base()?>/site/menu-language-arabic?lang=en&current_url=<?= Url::base()?>/menu/about"> About Crisper </a>
        </div>
    </div>
    <div class="col-sm-10 col-sm-offset-1 col-xs-12">
            <div class="social-media">
            <?php if($info['branches']): ?>
                <?php if($info['branches'][0]->phone_num != null):?>
                <div class="col-sm-2 col-xs-2">
                    <a href="tel:<?= $info['branches'][0]->phone_num ?>">
                        <img src="<?= Url::base()?>/home-icon/phone-white-01.svg" alt="">
                    </a>
                </div>
                <?php endif;?>
                <?php if($info['branches'][0]->location != null || $info['branches'][0]->english_address != null || $info['branches'][0]->arabic_address != null) : ?>
                <div class="col-sm-2 col-xs-2">
                    <div class="popup">
                        <img class="img-responsive img-social-home" src="<?= Url::base()?>/home-icon/location-white.svg" alt=""> 
                        <span class="popuptext" id="myPopup">
                            <p class="text-popup"><?= $lang == 'en' ? $info['branches'][0]->english_address :  $info['branches'][0]->arabic_address?></p>
                            <a class="popup-link" href="<?= $info['branches'][0]->location?>" target="_blank"><?= Yii::t('app','Show on Map')?><a>
                        </span>
                    </div>
                </div>
                <?php endif;?>
                <?php if(count($info['branches']) > 1) : ?>
                    <div class="col-sm-2 col-xs-2">
                        <a href="<?= Url::base()?>/menu/branches">
                            <img src="<?= Url::base()?>/home-icon/address-white-01.svg" alt="">
                        </a>
                    </div>
                <?php endif; ?>
            <?php endif; ?>

            <?php if($info['whatsapp_link'] != null):?>
            <div class="col-sm-2 col-xs-2">
                <a href="<?= $info['whatsapp_link']?>" target="_blank">
                    <img src="<?= Url::base()?>/home-icon/whatsapp-white-01.svg" alt="">
                </a>
            </div>
            <?php endif;?>
            <?php if($info['facebook_link'] != null):?>
            <div class="col-sm-2 col-xs-2">
                <a href="<?= $info['facebook_link']?>" target="_blank">
                    <img src="<?= Url::base()?>/home-icon/facebook-white-01.svg" alt="">
                </a>
            </div>
            <?php endif;?>
            <?php if($info['messenger_link'] != null):?>
            <div class="col-sm-2 col-xs-2">
                <a href="<?= $info['messenger_link']?>" target="_blank">
                    <img src="<?= Url::base()?>/home-icon/messenger-white-01.svg" alt="">
                </a>
            </div>
            <?php endif;?>
            <?php if($info['instagram_link'] != null):?>
            <div class="col-sm-2 col-xs-2">
                <a href="<?= $info['instagram_link']?>" target="_blank">
                    <img src="<?= Url::base()?>/home-icon/insta-white-01.svg" alt="">
                </a>
            </div>
            <?php endif;?>
            <?php if($info['twitter_link'] != null):?>
            <div class="col-sm-2 col-xs-2">
                <a href="<?= $info['twitter_link']?>" target="_blank">
                    <img src="<?= Url::base()?>/home-icon/twitter-white-01.svg" alt="">
                </a>
            </div>
            <?php endif;?>
        </div>
        
        
    </div>
</div>
