<?php 
    $sesi = $this -> session -> ci_usrid;
    $uri1 = $this -> uri -> segment(1);
    $uris = $this -> uri -> uri_string();
?>

<header id="header">
    <?php if(isset($navtop)) : ?>
        <nav class="top-menu">
            <div class="container d-flex justify-content-between align-items-center">
                <ul class="d-flex align-items-center">
                    <li>
                        <a href="">
                            Bantuan
                        </a>
                    </li>
                    <li>
                        <a href="">
                            Kontak Kami
                        </a>
                    </li>
                </ul>
                <ul class="d-flex align-items-center">
                    <?php if($sesi) : ?>
                        <li>
                            <a href="javascript:void(0)" class="_notif">
                                <i class="fa fa-bell me-1"></i>
                                <span class="<?= count($this -> app -> get_notif(0)) == 0 ? 'd-none' : '' ?>"></span>
                                Notifikasi
                            </a>
                        </li>
                        <li>
                            <a href="<?= site_url('akun') ?>">
                                Akun
                            </a>
                        </li>
                    <?php else:  ?>
                        <li>
                            <a href="<?= site_url('auth/masuk') ?>">
                                Masuk
                            </a>
                        </li>
                        <li>
                            <a href="<?= site_url('auth/daftar') ?>">
                                Buat Akun
                            </a>
                        </li>
                    <?php endif  ?>
                </ul>
            </div>
        </nav>
    <?php endif ?>

    <div class="header">
        <div class="container d-flex justify-content-between align-items-center">
            <!-- header kiri -->
            <div class="_left">
                <!-- judul website -->
                <?php if(isset($page_title)) : ?>
                    <div class="webTitle-mob">
                        <h2 class="mb-0">
                            <a href="<?= isset($backto) ? $backto : 'javascript:history.back()' ?>" class="me-2">
                                <i class="fa fa-arrow-left"></i>
                            </a>
                            <?= $page_title ?>
                        </h2>
                    </div>                    
                <?php endif ?>
                <h1 class="webTitle">
                    <a href="<?= site_url() ?>">
                        <?php if(app('app_logo_type') == 'img') : ?>
                            <img src="<?= base_url('upload/' . app('app_logo_url')) ?>" alt="<?= app('app_name') ?>">
                        <?php else: ?>
                            <?= app('app_name') ?>
                        <?php endif ?>
                    </a>
                </h1>
            </div>
            
            <?php if(isset($search_input)) : ?>
                <!-- header tengah -->
                <div class="_mid d-flex justify-content-between align-items-center">
                    <input type="search" class="__input searching" placeholder="Cari Produk...">
                    <label for="" class="fa fa-search __label"></label>

                    <nav class="src-list">
                        <ul>
                            <li>
                                <div class="text-center py-4">
                                    <div class="spinner-border text-primary" role="status">
                                        <span class="sr-only">Loading...</span>
                                    </div>
                                    <h6 class="mb-0 mt-2"> 
                                        Memuat Data
                                    </h6>
                                </div>
                            </li>                                
                        </ul>
                    </nav>
                </div>
            <?php endif ?>
            
            <?php if(isset($header_right)) : ?>
                <div class="_right d-flex justify-content-end flex-wrap align-items-center">
                    <ul class="icon-group d-flex align-items-center">
                        <li>
                            <a href="<?= site_url('keranjang') ?>">
                                <i class="fa fa-shopping-basket _icon"></i>
                                <span class="cart-dot dot <?= $this -> app -> get_jml_keranjang() == 0 ? 'd-none' : '' ?>"></span>
                            </a>
                        </li>
                    </ul>
                    
                    <?php if($uri1 == 'akun') : ?>
                        <ul class="icon-group-mob d-none align-items-center">
                            <li>
                                <a href="<?= site_url('keranjang') ?>" >
                                    <i class="fa fa-shopping-basket _icon"></i>
                                    <span class="dot <?= $this -> app -> get_jml_keranjang() == 0 ? 'd-none' : '' ?>"></span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:void(0)" class="_notif">
                                    <i class="fa fa-bell _icon"></i>
                                    <span class="dot <?= count($this -> app -> get_notif(0)) == 0 ? 'd-none' : '' ?>"></span>
                                </a>
                            </li>
                        </ul>
                     <?php else: ?>
                        <ul class="icon-group-mob d-none align-items-center">
                            <?php if(!isset($page_title)) : ?>
                                <li>
                                    <a href="javascript:void(0)" class="btn_src_mob" >
                                        <i class="fa fa-search _icon"></i>
                                    </a>
                                </li>
                            <?php endif ?>
                            <li>
                                <a href="javascript:void(0)" class="_notif">
                                    <i class="fa fa-bell _icon"></i>
                                    <span class="dot <?= count($this -> app -> get_notif(0)) == 0 ? 'd-none' : '' ?>"></span>
                                </a>
                            </li>
                        </ul>
                     <?php endif ?>
                </div>
            <?php endif ?>
        </div>
    </div>
</header>

<!-- main -->
<main id="main">