<?php

error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);



$brand = $_dataView['brand'];

$pageDetail = $_dataView['pageDetail'];

?>

<!DOCTYPE html>

<html lang=vi>



<head>

    <title><?= $_dataView['title'] ?></title>

    <meta name="description" content="<?= $brand['congty_gioithieungan'] ?>" />

    <meta property="og:title" content="<?= $brand['congty_tenwebsite'] ?>" />

    <meta property="og:description" itemprop="description" content="<?= $brand['congty_gioithieungan'] ?>" />

    <meta property="og:image" content="<?= $brand['congty_logo'] ?>" />

    <meta name="copyright" content="<?= $brand['congty_ten'] ?>" />

    <meta name="GENERATOR" content="<?= $brand['congty_ten'] ?>" />

    <meta property="og:site_name" content="<?= $brand['congty_tenwebsite'] ?>" />

    <link href="<?= $brand['congty_icon'] ?>" rel="shortcut icon" type="image/x-icon" />

	

	<meta name="google-site-verification" content="IFn3BAb46bCr99WjETLPCgP6PjbpEewwKNvHVEfhVPQ" />



    <!-- THẺ CƠ BẢN -->

    <?php

    if(isset($_SERVER['HTTPS']) &&

    ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||

    isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&

    $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {

        $protocol = 'https://';

    }

    else {

        $protocol = 'http://';

    }

    $baseUrlHref = str_replace('http://', $protocol, $GLOBALS['base_url']);

    ?>

    <base href="<?= $baseUrlHref ?>/">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <?php

    if(REALSTATUS){

    ?>

    <meta name="robots" content="all" />

    <?php

    }else{

    ?>

    <meta name="robots" content="noindex, nofollow">

    <?php

    }

    ?>

    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <meta http-equiv="audience" content="General" />

    <meta name="resource-type" content="Document" />

    <meta name="distribution" content="Global" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <meta property="og:type" content="article" />

    <meta property="og:locale" content="vi_VN" />

    <meta http-equiv="content-language" content="vi" />



    <!-- XỬ LÝ HIỆN THỊ -->

    <link href="public/defineColor.css?time=<?= time() ?>" rel="stylesheet" type="text/css" />

    <link href="public/defineFont.css?time=<?= time() ?>" rel="stylesheet" type="text/css" />

    <link href="public/defineText.css?time=<?= time() ?>" rel="stylesheet" type="text/css" />

    <link href="public/style.css?time=<?= time() ?>" rel="stylesheet" type="text/css" />



    <!-- THƯ VIỆN JQUERY -->

    <script type="text/javascript" src="public/jquery.min.js"></script>



    <!-- XỬ LÝ CƠ BẢN -->

    <script type="text/javascript" src="public/script.js?time=<?= time() ?>"></script>



    <!--Slide click-->

    <link href="public/slick-slide/slick.css" rel="stylesheet">

    <link href="public/slick-slide/slick-theme.css" rel="stylesheet">

    <script src="public/slick-slide/slick.min.js"></script>



    <!--Slide unitegallery-->

    <script type='text/javascript' src='public/unitegallery/js/unitegallery.min.js'></script>		

	<link rel='stylesheet' href='public/unitegallery/css/unite-gallery.css' type='text/css' />

    <script type='text/javascript' src='public/unitegallery/themes/compact/ug-theme-compact.js'></script>

    <script type='text/javascript' src='public/unitegallery/themes/tiles/ug-theme-tiles.js'></script>

    <script type='text/javascript' src='public/unitegallery/themes/tilesgrid/ug-theme-tilesgrid.js'></script>

    

    <!--Slide magiczoomplus-->

    <link href="public/magiczoomplus/magiczoomplus.css" rel="stylesheet" type="text/css" media="screen" />

    <script src="public/magiczoomplus/magiczoomplus.js" type="text/javascript"></script>

    

    <!--Slide filoSlider-->

    <link rel="stylesheet" href="public/filo-slider/css/filoSlider.css">

    <script type='text/javascript' src='public/filo-slider/js/filoSlider.js'></script>

    

    <!-- dissolve-slide -->

    <script type='text/javascript' src='public/dissolve-slide/jquery.slideshowad.js'></script>

	

	<!-- Nhúng -->

	<?php

	echo $brand['addon_code'];

	?>

    

</head>



<body style="background-color: <?= $brand['mau_nen_he_thong'] ?>;">



    <img src="public/loadingpreview.jpg" class="loadingpreviewimg">



    <?= $this->getPageView() ?>

</body>



<?php



// Tạm ẩn header

if($pageDetail['IsHideHeader']){

?>

<style>

    main.fixIsHideHeader{

        padding-top: 0!important;

    }

</style>

<script>

$(document).ready(function() {

    // Logic 2025-08-22

    // $('header').addClass('scroll');

    // $('main').addClass('fixIsHideHeader');

    // setInterval(function(){

    //     if($('header.scrollup').length > 0){

    //         $('main').removeClass('fixIsHideHeader');

    //     }

    // }, 150);



    // Logic mới nhất

    $('header').addClass('displaynone');

    $('main').addClass('fixIsHideHeader');

});

</script>



<?php

}



// Tạm ẩn footer

if($pageDetail['IsHideFooter']){

?>

<script>

$(document).ready(function() {

    // Logic 2025-08-22

    // $('footer').addClass('hidden');

    // setInterval(function(){

    //     if($('header.scrollup').length > 0){

    //         $('footer').removeClass('hidden');

    //     }

    // }, 150);



    // Logic mới nhất

    $('footer').addClass('displaynone');

});

</script>



<?php

}

?>



<link href="/public/animate/style.css" rel="stylesheet">

<script src="/public/animate/wow.min.js"></script>



<script>





    // Nhấp liên kết

    $(document).on('click','[data-link]',function(){

        var $clickThis = $(this);

        

        // Mở liên kết đa phương tiện

        if($clickThis.attr('data-openFullMedia') == 'video' || $clickThis.attr('data-openFullMedia') == 'image'){

            openFullMedia($clickThis);

        }else{

            if($clickThis.attr('data-link') != ''){

                $clickThis.css({

                    'opacity': '0.4'

                });

                setTimeout(function(){

                    $clickThis.css({

                        'opacity': ''

                    });

                    let _link = $clickThis.attr('data-link');

                    if(_link != ''){

                        window.location.href = _link;

                    }

                }, 200);

            }

        }

    });

	

    var currentHash = $(location).attr('hash');

	$(document).ready(function() {

		if($(currentHash).length > 0){

			$('body').addClass('loading');

			$('body').addClass('loadingpreview');



            // Hiện thị các thành phần trong header-fix

            $('header .menuicon > div').removeClass('wow');

            $('header .logoicon > div').removeClass('wow');

            $('header .ngonnguicon > div').removeClass('wow');

		}else{

            setTimeout(function(){

                $('html, body').animate({

                    scrollTop: $('main').offset().top

                }, 'slow');

            }, 100);

        }

		setTimeout(function(){

			if($(location).attr('hash') != ''){

                if($($(location).attr('hash')).length > 0){

					$('html, body').animate({

                        scrollTop: $($(location).attr('hash')).offset().top

                    }, 'slow');

				}

				$('body').removeClass('loading');

				$('body').removeClass('loadingpreview');



                // Loại bỏ ID trên url

                history.replaceState('', document.title, window.location.pathname);

			}			

		}, 3000);

	});



    // Hiệu ứng hiện thị

    <?php

    if(!$KichHoatHieuUng = $pageDetail['KichHoatHieuUng']){

        $KichHoatHieuUng = 100;

    }

    // $KichHoatHieuUng = 100;

    $KichHoatHieuUng = $KichHoatHieuUng / 100;

    ?>

    setTimeout(function(){

        let __wowOffset = $(window).height() - (<?= $KichHoatHieuUng ?> * $(window).height());

        console.log(<?= $pageDetail['KichHoatHieuUng'] ?>);

        console.log(__wowOffset);

        var wow = new WOW({

            boxClass:     'wow', 

            animateClass: 'animated',

            offset:       __wowOffset, 	// Cách chân trang __wowOffset px

            mobile:       true        	// Hiệu ứng trên di động

        });

        wow.init();



        // Sửa vấn đề menu

        if(currentHash != ''){

            setTimeout(function(){            

                $('.menufix .wow').css({

                    'visibility': 'visible'

                });

                $('.ngonngufix .wow').css({

                    'visibility': 'visible'

                });

            }, 100);

        }

    }, 150);

    

</script>



<style>

    pre{

        position: relative;

        z-index: 9999;

    }

</style>



<div class="openFullMedia displaynone">

    <div class="content">

        <div class="close"></div>

        <div class="video">

            <video controls autoplay muted loop id="openFullMediaVideo">

                <source src="">

            </video>

        </div>

        <div class="image">

            <img src="">

        </div>

    </div>

</div>

<style>

    .openFullMedia{

        position: fixed;

        top: 0;

        left: 0;

        width: 100%;

        height: 100%;

        background: #000;

        z-index: 9;

    }

    .openFullMedia .content{

        position: absolute;

        top: 0;

        left: 0;

        width: 100%;

        height: 100%;

    }

    .openFullMedia .close{

        position: fixed;

        top: 0;

        right: 0;

        background: url('/public/svg/close.svg') no-repeat center;

        width: 50px;

        height: 50px;

        z-index: 2;

    }

    .openFullMedia .video, .openFullMedia .image{        

        position: absolute;

        left: 0;

        top: 0;

        width: 100%;

        height: 100%;

        overflow: hidden;

        z-index: 1; 

        display: none;

    }

    .openFullMedia .video.active, .openFullMedia .image.active{ 

        display: block;

    }

    .openFullMedia video, .openFullMedia img{      

        position: absolute;

        left: 50%;

        top: 50%;

        overflow: hidden;

        transform: translateX(-50%) translateY(-50%);

        -webkit-transform: translateX(-50%) translateY(-50%);

        max-width: 100%;

        max-height: 100%;

        display: block;

    }    

</style>

<script>

    function openFullMediaExit(){

        $('.openFullMedia source').attr('src', '');

        $('.openFullMedia img').attr('src', '');

        $('.openFullMedia .video').removeClass('active');

        $('.openFullMedia .image').removeClass('active');

        $('.openFullMedia').addClass('displaynone');

    }

    function openFullMedia($this){

        let _link = $this.attr('data-link');

        if(_link != ''){

            $('.openFullMedia').removeClass('displaynone');

            if($this.attr('data-openfullmedia') == 'video'){

                $('.openFullMedia source').attr('src', _link);

                $('.openFullMedia .video').addClass('active');

                document.getElementById('openFullMediaVideo').load();

                // $(location).attr('href', _link);

            }else{

                $('.openFullMedia img').attr('src', _link);

                $('.openFullMedia .image').addClass('active');

            }

        }

    }

    $('.openFullMedia .close').click(function(){

        openFullMediaExit();

    });

    document.getElementById('openFullMediaVideo').addEventListener('webkitendfullscreen', function(e) { 

        openFullMediaExit();

    });





    // XỬ LÝ ÂM THANH VIDEO

    $(document).on('click','.mediaVolume .on',function(){

        // Tắt âm thanh

        $('.mediaVolume').removeClass('active');

        $('video').prop('muted', true);

    });

    $(document).on('click','.mediaVolume .off',function(){



        // Mở âm thanh

        $(this).parents('.slideconfigs').find('.mediaVolume').addClass('active');

        $(this).parents('.slideconfigs').find('video').prop('muted', false);

    });

    $.fn.isInViewport = function() {

        var elementTop = $(this).offset().top;

        var elementBottom = elementTop + $(this).outerHeight();



        var viewportTop = $(window).scrollTop();

        var viewportBottom = viewportTop + $(window).height();



        return elementBottom > viewportTop && elementTop < viewportBottom;

    };

    setInterval(function() {

        $('video').each(function(){



            let id = $(this).attr("id");

            let played = $(this).attr("played");



            if ($(this).isInViewport()) {

                if (played == "false") { 

                    $(this)[0].play();

                    $(this).attr("played", "true");

                    // if($(this).prop('muted', false)){

                    //     $(this).parents('.slideconfigs').find('.mediaVolume').addClass('active');

                    // }

                }

            } else {

                if (played == "true") { 

                    $(this)[0].pause();

                    $(this).attr("played", "false");  

                }

            }

        });

    }, 1000);



    // KẾT THÚC XỬ LÝ ÂM THANH VIDEO

    

</script>



<!-- Chặn hiện thị trên máy tính -->

<div class="hiddenWithDesktop displaynone">

<?php

// Xử lý hiện thị

$hiddenWithDesktop = $this->hiddenWithDesktop();

foreach($hiddenWithDesktop[$hiddenWithDesktop['Ma']. '/list'] as $items){

    foreach($items as $key => $data){

        if($data['IsActive']){

            $template = $data[$key .'/mau-thiet-ke'][$key .'/mau-thiet-ke/component-key']['GiaTri'] .'/'. $data[$key .'/mau-thiet-ke'][$key .'/mau-thiet-ke/template-key']['GiaTri']; 

            $dataFormat = $this->convertDataAPI($data, $key);

            $dataFormat['pageKey'] = $pageDetail['Ma'];

            $dataFormat['___dataView___'] = $dataView;

            $this->include('component/'. $template .'/template', $dataFormat);

        }

    }

}

?>

</div>

<style>

    .hiddenWithDesktop{

        position: fixed;

        top: 0;

        left: 0;

        width: 100vw;

        height: 100vh;

        z-index: 9;

        background: #FFF;

    }

</style>

<script>

    if(!isMobileAndTablet()){

        $('.hiddenWithDesktop').removeClass('displaynone');

        $('body').addClass('disable-scroll');

    }

</script>

<!-- Kết thúc chặn hiện thị trên máy tính -->



<!-- Xử lý cuộn lên đầu thẻ -->

<script> 

var lastScrollTopDauThe=0;

$(window).scroll(function(event){

    let st=$(this).scrollTop();

    if(st > lastScrollTopDauThe){

        

    }else{

        // Đang cuộn lên lại

        $('.component-BASIC05 .content').scrollTop(0);

    }

    lastScrollTopDauThe=st;

});

</script>

<!-- Kết thúc xử lý cuộn lên đầu thẻ -->



</html>