<?php defined('ALTUMCODE') || die() ?>

<div>
    <div class="container">
        <?= \Altum\Alerts::output_alerts() ?>

        <div class="row">
            <div class="col-12 col-lg-6 d-flex flex-column justify-content-center align-items-center align-items-lg-start text-center text-lg-left">
                <div>
                    <span class="badge badge-pill badge-success mb-4">
                        <i class="fas fa-fw fa-star fa-sm text-warning"></i><i class="fas fa-fw fa-star fa-sm text-warning"></i><i class="fas fa-fw fa-star fa-sm text-warning"></i><i class="fas fa-fw fa-star fa-sm text-warning"></i><i class="fas fa-fw fa-star fa-sm text-warning"></i>
                        <?= l('index.stars') ?>
                    </span>
                </div>

                <h1 class="index-header mb-4" ><?= l('index.header') ?></h1>
                <p class="index-subheader"><?= sprintf(l('index.subheader'), '<span class="text-primary-800 font-weight-bold">', '</span>') ?></p>

                <ul class="list-style-none my-4">
                    <li class="d-flex align-items-center mb-2">
                        <i class="fas fa-fw mr-2 fa-check-circle text-primary"></i>
                        <div class="text-muted">
                            <?= l('index.feature.one') ?>
                        </div>
                    </li>

                    <li class="d-flex align-items-center mb-2">
                        <i class="fas fa-fw mr-2 fa-check-circle text-primary"></i>
                        <div class="text-muted">
                            <?= l('index.feature.two') ?>
                        </div>
                    </li>

                    <li class="d-flex align-items-center mb-2">
                        <i class="fas fa-fw mr-2 fa-check-circle text-primary"></i>
                        <div class="text-muted">
                            <?= l('index.feature.three') ?>
                        </div>
                    </li>
                </ul>

                <div>
                    <a href="<?= url('register') ?>" class="btn btn-lg btn-primary rounded-2x index-button"><?= l('index.button') ?> <i class="fas fa-fw fa-sm fa-arrow-right"></i></a>
                </div>
            </div>

            <div class="col-10 col-md-8 col-lg-4 offset-1 offset-md-2 mt-4 mt-lg-0">
                <div class="position-relative index-hero">
                    <img src="<?= get_custom_image_if_any('index/hero-one.webp') ?>" class="img-fluid index-hero-one" alt="<?= l('index.hero_image_alt') ?>" />
                    <img src="<?= get_custom_image_if_any('index/hero-two.webp') ?>" class="img-fluid index-hero-two" alt="<?= l('index.hero_image_alt') ?>" />
                </div>
            </div>
        </div>

    </div>
</div>

<?php if(settings()->stores->example_url): ?>
    <div class="my-10"></div>

    <div class="p-3 p-md-4">
        <div class="bg-primary-800 py-6 rounded-2x">
            <div class="container">
                <div class="d-flex flex-column align-items-center">
                    <div class="text-center">
                        <h2 class="text-gray-50"><?= l('index.example.header') ?></h2>
                        <p class="text-gray-100"><?= l('index.example.subheader') ?></p>
                    </div>

                    <div class="mt-4">
                        <a href="<?= settings()->stores->example_url ?>" target="_blank">
                            <div class="index-qr"></div>
                        </a>
                    </div>

                    <div class="mt-5">
                        <a href="<?= settings()->stores->example_url ?>" class="btn btn-primary index-button" target="_blank">
                            <i class="fas fa-fw fa-sm fa-external-link-alt"></i>
                            <?= l('index.example.button') ?>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php endif ?>

<div class="my-10"></div>

<div class="container">
    <div class="text-center d-flex flex-column align-items-center mb-5">
        <h2 class="mt-2"><?= sprintf(l('index.demo.header'), '<span class="text-primary text-underline">', '</span>') ?></h2>
        <ul class="list-style-none d-flex flex-column flex-lg-row mt-4">
            <li class="d-flex align-items-baseline mb-2 mr-lg-4">
                <span class="font-weight-bold text-primary-800 h5 mr-1">1.</span>
                <div class="text-muted">
                    <?= l('index.demo.one') ?>
                </div>
            </li>

            <li class="d-flex align-items-baseline mb-2 mr-lg-4">
                <span class="font-weight-bold text-primary-800 h5 mr-1">2.</span>
                <div class="text-muted">
                    <?= l('index.demo.two') ?>
                </div>
            </li>

            <li class="d-flex align-items-baseline mb-2 mr-lg-4">
                <span class="font-weight-bold text-primary-800 h5 mr-1">3.</span>
                <div class="text-muted">
                    <?= l('index.demo.three') ?>
                </div>
            </li>
        </ul>
    </div>

    <div class="zoom-animation-subtle">
        <img src="<?= get_custom_image_if_any('index/demo.png') ?>" class="img-fluid rounded shadow" loading="lazy" data-aos="fade-up" alt="<?= l('index.demo_image_alt') ?>" />
    </div>
</div>

<div class="my-10"></div>

<div class="container">
    <div class="row justify-content-between" data-aos="fade-up">
        <div class="col-12 col-md-4 d-flex flex-column justify-content-center order-1 order-md-0">
            <small class="text-uppercase font-weight-bold text-muted mb-2"><?= l('index.lightweight.name') ?></small>

            <div>
                <h2 class="h4 mb-3"><?= l('index.lightweight.header') ?></h2>

                <p class="text-muted"><?= l('index.lightweight.subheader') ?></p>
            </div>
        </div>

        <div class="col-12 col-md-7 text-center mb-5 mb-md-0 order-0 order-md-1">
            <img src="<?= get_custom_image_if_any('index/lightweight.png') ?>" class="img-fluid shadow rounded" loading="lazy" alt="<?= l('index.demo_menu_image_alt') ?>" />
        </div>
    </div>
</div>

<div class="my-10"></div>

<div class="container">
    <div class="row justify-content-between" data-aos="fade-up">
        <div class="col-12 col-md-7 text-center mb-5 mb-md-0">
            <img src="<?= get_custom_image_if_any('index/analytics.png') ?>" class="img-fluid shadow rounded" loading="lazy" alt="<?= l('index.demo_analytics_image_alt') ?>" />
        </div>

        <div class="col-12 col-md-4 d-flex flex-column justify-content-center">
            <small class="text-uppercase font-weight-bold text-muted mb-2"><?= l('index.analytics.name') ?></small>

            <div>
                <h2 class="h4 mb-3"><?= l('index.analytics.header') ?></h2>

                <p class="text-muted"><?= l('index.analytics.subheader') ?></p>
            </div>
        </div>
    </div>
</div>

<div class="my-10"></div>

<div class="container">
    <div class="row justify-content-between" data-aos="fade-up">
        <div class="col-12 col-md-4 d-flex flex-column justify-content-center order-1 order-md-0">
            <small class="text-uppercase font-weight-bold text-muted mb-2"><?= l('index.extras_options_variants.name') ?></small>

            <div>
                <h2 class="h4 mb-3"><?= l('index.extras_options_variants.header') ?></h2>

                <p class="text-muted"><?= l('index.extras_options_variants.subheader') ?></p>
            </div>
        </div>

        <div class="col-12 col-md-7 text-center mb-5 mb-md-0 order-0 order-md-1">
            <img src="<?= get_custom_image_if_any('index/extras_options_variants.png') ?>" class="img-fluid shadow rounded" loading="lazy" alt="<?= l('index.demo_item_image_alt') ?>" />
        </div>
    </div>
</div>

<?php if(settings()->main->display_index_testimonials): ?>
    <div class="my-10"></div>

    <div class="p-3 p-md-4">
        <div class="py-7 bg-primary-100 rounded-2x">
            <div class="container">
                <div class="text-center">
                    <h2><?= l('index.testimonials.header') ?> <i class="fas fa-fw fa-xs fa-check-circle text-primary"></i></h2>
                </div>

                <?php
                $language_array = \Altum\Language::get(\Altum\Language::$name);
                if(\Altum\Language::$main_name != \Altum\Language::$name) {
                    $language_array = array_merge(\Altum\Language::get(\Altum\Language::$main_name), $language_array);
                }

                $testimonials_language_keys = [];
                foreach ($language_array as $key => $value) {
                    if(preg_match('/index\.testimonials\.(\w+)\./', $key, $matches)) {
                        $testimonials_language_keys[] = $matches[1];
                    }
                }

                $testimonials_language_keys = array_unique($testimonials_language_keys);
                ?>

                <div class="row mt-8 mx-n3">
                    <?php foreach($testimonials_language_keys as $key => $value): ?>
                        <div class="col-12 col-lg-4 mb-7 mb-lg-0 px-4" data-aos="fade-up" data-aos-delay="<?= $key * 100 ?>">
                            <div class="card border-0 zoom-animation-subtle">
                                <div class="card-body">
                                    <img src="<?= get_custom_image_if_any('index/testimonial-' . $value . '.webp') ?>" class="img-fluid index-testimonial-avatar" alt="<?= l('index.testimonials.' . $value . '.name') . ', ' . l('index.testimonials.' . $value . '.attribute') ?>" loading="lazy" />

                                    <p class="mt-5">
                                        <span class="text-gray-800 font-weight-bold text-muted h5">“</span>
                                        <span class="font-size-little-small"><?= l('index.testimonials.' . $value . '.text') ?></span>
                                        <span class="text-gray-800 font-weight-bold text-muted h5">”</span>
                                    </p>

                                    <div class="blockquote-footer mt-4">
                                        <span class="font-weight-bold"><?= l('index.testimonials.' . $value . '.name') ?></span><br /> <span class="text-muted index-testimonial-comment"><?= l('index.testimonials.' . $value . '.attribute') ?></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endforeach ?>
                </div>
            </div>
        </div>
    </div>
<?php endif ?>

<?php if(settings()->main->display_index_plans): ?>
    <div class="my-10"></div>

    <div id="plans" class="container">
        <div class="text-center mb-5">
            <small class="text-primary font-weight-bold text-uppercase"><?= l('index.pricing.subheader') ?></small>
            <h2 class="mt-2"><?= l('index.pricing.header') ?></h2>
        </div>

        <?= $this->views['plans'] ?>
    </div>
<?php endif ?>

<?php if(settings()->main->display_index_faq): ?>
    <div class="my-10"></div>

    <div class="container">
        <div class="text-center mb-5">
            <h2><?= l('index.faq.header') ?></h2>
        </div>

        <?php
        $language_array = \Altum\Language::get(\Altum\Language::$name);
        if(\Altum\Language::$main_name != \Altum\Language::$name) {
            $language_array = array_merge(\Altum\Language::get(\Altum\Language::$main_name), $language_array);
        }

        $faq_language_keys = [];
        foreach ($language_array as $key => $value) {
            if(preg_match('/index\.faq\.(\w+)\./', $key, $matches)) {
                $faq_language_keys[] = $matches[1];
            }
        }

        $faq_language_keys = array_unique($faq_language_keys);
        ?>

        <div class="accordion index-faq" id="faq_accordion">
            <?php foreach($faq_language_keys as $key): ?>
                <div class="card">
                    <div class="card-body">
                        <div class="" id="<?= 'faq_accordion_' . $key ?>">
                            <h3 class="mb-0">
                                <button class="btn btn-lg font-weight-500 btn-block d-flex justify-content-between text-gray-800 px-0 icon-zoom-animation no-focus" type="button" data-toggle="collapse" data-target="<?= '#faq_accordion_answer_' . $key ?>" aria-expanded="true" aria-controls="<?= 'faq_accordion_answer_' . $key ?>">
                                    <span class="text-left"><?= l('index.faq.' . $key . '.question') ?></span>

                                    <span data-icon>
                                        <i class="fas fa-fw fa-circle-chevron-down"></i>
                                    </span>
                                </button>
                            </h3>
                        </div>

                        <div id="<?= 'faq_accordion_answer_' . $key ?>" class="collapse text-muted mt-2" aria-labelledby="<?= 'faq_accordion_' . $key ?>" data-parent="#faq_accordion">
                            <?= l('index.faq.' . $key . '.answer') ?>
                        </div>
                    </div>
                </div>
            <?php endforeach ?>
        </div>
    </div>

    <?php ob_start() ?>
    <script>
        'use strict';

        $('#faq_accordion').on('show.bs.collapse', event => {
            let svg = event.target.parentElement.querySelector('[data-icon] svg')
            svg.style.transform = 'rotate(180deg)';
            svg.style.color = 'var(--primary)';
        })

        $('#faq_accordion').on('hide.bs.collapse', event => {
            let svg = event.target.parentElement.querySelector('[data-icon] svg')
            svg.style.color = 'var(--primary-800)';
            svg.style.removeProperty('transform');
        })
    </script>
    <?php \Altum\Event::add_content(ob_get_clean(), 'javascript') ?>
<?php endif ?>

<?php if(settings()->users->register_is_enabled): ?>
    <div class="mt-8"></div>

    <div class="container">
        <div class="bg-primary-800 py-6 rounded-2x" data-aos="fade-up">
            <div class="py-3">
                <div class="row align-items-center justify-content-center">
                    <div class="col-12 col-lg-5">
                        <div class="text-center text-lg-left mb-4 mb-lg-0">
                            <h2 class="h2 text-gray-100"><?= l('index.cta.header') ?></h2>
                            <p class="h6 text-gray-200"><?= l('index.cta.subheader') ?></p>
                        </div>
                    </div>

                    <div class="col-12 col-lg-5 mt-4 mt-lg-0">
                        <div class="text-center text-lg-right">
                            <?php if(is_logged_in()): ?>
                                <a href="<?= url('dashboard') ?>" class="btn btn-lg btn-outline-light index-button">
                                    <?= l('dashboard.menu') ?> <i class="fas fa-fw fa-arrow-right"></i>
                                </a>
                            <?php else: ?>
                                <a href="<?= url('register') ?>" class="btn btn-lg btn-outline-light index-button">
                                    <?= l('index.cta.register') ?> <i class="fas fa-fw fa-arrow-right"></i>
                                </a>
                            <?php endif ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php endif ?>

<?php if(settings()->stores->example_url): ?>
    <?php ob_start() ?>
    <script src="<?= ASSETS_FULL_URL . 'js/libraries/jquery-qrcode.min.js?v=' . PRODUCT_CODE ?>"></script>
    <script>
        'use strict';

        let generate_qr = () => {
            let qr_url = <?= json_encode(settings()->stores->example_url) ?>;

            let default_options = {
                render: 'image',
                minVersion: 1,
                maxVersion: 40,
                ecLevel: 'H',
                left: 0,
                top: 0,
                size: 600,
                fill: '#000000',
                background: '#fff',
                text: qr_url,
                radius: 0,
                quiet: 0,
                mode: 0,
                mSize: 0.1,
                mPosX: 0.5,
                mPosY: 0.5,
                fontname: 'arial',
            };

            $('.index-qr').qrcode(default_options);
        }

        generate_qr();
    </script>
    <?php \Altum\Event::add_content(ob_get_clean(), 'javascript') ?>
<?php endif ?>

<?php if (!empty($data->blog_posts)): ?>
    <div class="my-5">&nbsp;</div>

    <div class="container">
        <div class="text-center mb-5">
            <h2><?= sprintf(l('index.blog.header'), '<span class="text-primary">', '</span>') ?></h2>
        </div>

        <div class="row mx-n2 mx-lg-n3">
            <?php foreach($data->blog_posts as $blog_post): ?>
                <div class="col-12 col-lg-4 px-2 py-4 px-lg-3">
                    <div class="card h-100 zoom-animation-subtle position-relative">
                        <div class="card-body">
                            <?php if($blog_post->image): ?>
                                <a href="<?= SITE_URL . ($blog_post->language ? \Altum\Language::$active_languages[$blog_post->language] . '/' : null) . 'blog/' . $blog_post->url ?>" aria-label="<?= $blog_post->title ?>">
                                    <img src="<?= \Altum\Uploads::get_full_url('blog') . $blog_post->image ?>" class="blog-post-image-small img-fluid w-100 rounded mb-4" alt="<?= $blog_post->image_description ?>" loading="lazy" />
                                </a>
                            <?php endif ?>

                            <a href="<?= SITE_URL . ($blog_post->language ? \Altum\Language::$active_languages[$blog_post->language] . '/' : null) . 'blog/' . $blog_post->url ?>" class="stretched-link text-decoration-none">
                                <h3 class="h5 card-title d-inline"><?= $blog_post->title ?></h3>
                            </a>

                            <p class="text-muted mt-2 mb-0 font-size-small"><?= $blog_post->description ?></p>
                        </div>
                    </div>
                </div>
            <?php endforeach ?>
        </div>
    </div>
<?php endif ?>


<?php ob_start() ?>
<link rel="stylesheet" href="<?= ASSETS_FULL_URL . 'css/libraries/aos.min.css?v=' . PRODUCT_CODE ?>">
<?php \Altum\Event::add_content(ob_get_clean(), 'head') ?>

<?php ob_start() ?>
<script src="<?= ASSETS_FULL_URL . 'js/libraries/aos.min.js?v=' . PRODUCT_CODE ?>"></script>

<script>
    'use strict';

    AOS.init({
        duration: 650,
        easing: 'ease-out-cubic',
        once: true,
    });
</script>
<?php \Altum\Event::add_content(ob_get_clean(), 'javascript') ?>

<?php ob_start() ?>
<script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "Organization",
        "name": "<?= settings()->main->title ?>",
        "url": "<?= url() ?>",
    <?php if(settings()->main->{'logo_' . \Altum\ThemeStyle::get()}): ?>
        "logo": "<?= settings()->main->{'logo_' . \Altum\ThemeStyle::get() . '_full_url'} ?>",
        <?php endif ?>
    "slogan": "<?= l('index.header') ?>",
        "contactPoint": {
            "@type": "ContactPoint",
            "url": "<?= url('contact') ?>",
            "contactType": "Contact us"
        }
    }
</script>

<script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "BreadcrumbList",
        "itemListElement": [
            {
                "@type": "ListItem",
                "position": 1,
                "name": "<?= l('index.title') ?>",
                    "item": "<?= url() ?>"
                }
            ]
        }
</script>

<?php if(settings()->main->display_index_faq): ?>
    <?php
    $faqs = [];
    foreach($faq_language_keys as $key) {
        $faqs[] = [
                '@type' => 'Question',
                'name' => l('index.faq.' . $key . '.question'),
                'acceptedAnswer' => [
                        '@type' => 'Answer',
                        'text' => l('index.faq.' . $key . '.answer'),
                ]
        ];
    }
    ?>
    <script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "FAQPage",
            "mainEntity": <?= json_encode($faqs) ?>
        }
    </script>
<?php endif ?>
<?php \Altum\Event::add_content(ob_get_clean(), 'javascript') ?>

<?php ob_start() ?>
<link href="<?= ASSETS_FULL_URL . 'css/index-custom.css?v=' . PRODUCT_CODE ?>" rel="stylesheet" media="screen,print">
<?php \Altum\Event::add_content(ob_get_clean(), 'head') ?>
