<?php
$cs = Yii::app()->getClientScript();
$baseUrl = Yii::app()->baseUrl;
$livesite = Yii::app()->getBaseUrl(true) . "/";
?>
<html lag="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>ERP | <?php
            if (isset($this->title)) {
                echo $this->title;
            } else {
                echo "Dashboard";
            }
            ?>
        </title>
        <!-- Tell the browser to be responsive to screen width -->
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" rel="stylesheet">
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
        <?php $this->renderPartial('//layouts/scriptfile') ?>
        <?php $this->renderPartial('//layouts/script') ?>
        <?php // $this->renderPartial('//layouts/url_redirection'); ?>
    </head>
    <body class="menu-closed">
        <div id="loading">
            <div class="throbber">
                Loading...
            </div>
        </div>
        <style>
            .prm
            {
                color:white;
                background: #d90c0c;
                padding: 4px;
                border-radius: 6px;
            }
            .tbl_bank tr
            {
                line-height:25px !important;
                color:black;
                font-size:15px;
            }
        </style>
        <header class="main">
            <div class="logo-holder">
                <div class="logo">
                    <img src="images/logo.png" alt="Logo">
                    <a href="<?php echo $baseUrl . "/index.php"; ?>">
                    </a>
                </div>
                <div class="menu-ham closed">
                    <span></span>
                    <span></span>
                    <span></span>
                    <span></span>
                    <span></span>
                    <span></span>
                </div>
            </div>
            <div class="header-right">
                <div class="submenu-holder" id="submenu-holder"></div>
                <div class="hrt menu-2">
                    <!--  notification end -->
                    <div class="pull-right profile">
                        <ul class="nav top-menu dd-list"></ul>
                        <ul class="nav top-menu">
                            <div id="clockdate">
                                <div class="clockdate-wrapper">
                                    <div id="clock1"></div>
                                    <div id="date1"></div>
                                </div>
                            </div>
                        </ul>
                        <ul class="nav top-menu">
                            <li class="dropdown">
                                <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                    <img alt="" src="images/avatar.png" width="30px" height="30px">
                                    <span class="username"><?php
                                        $user = User::model()->findByPk(Yii::app()->user->id);
                                        echo $user->username;
                                        ?></span>
                                    <b class="caret"></b>
                                </a>
                                <ul class="dropdown-menu extended logout">
                                    <div class="log-arrow-up"></div>
                                    <li><a href="#" onclick="loadPopupModal('site/changepassword', 'Change Password', 'lg')"><i class="fa fa-key"></i> Change Password</a></li>
                                    <li><a href="<?php echo $baseUrl; ?>/index.php?r=site/logout"><i class="fa fa-key"></i> Log Out</a></li>
                                </ul>
                            </li>
                            <!-- user login dropdown end -->
                        </ul>
                        <!--search & user info start-->
                        <!--notification bell-->
                        <?php //$this->renderPartial('//layouts/notification')  ?>
                        <!-- end notification bell-->
                    </div>          </ul>
                </div>
            </div>
            <div class="ql">
                <ul class="q-links">
                </ul>
            </div>
        </div>
    </header>

    <aside class="menu-2">
        <br>

        <br>
        <br>
    </aside>
    <section class="content-body">
        <section class="content">
            <?php echo $content; ?>
        </section>
    </section>
    <div id="loader">
        <div class="loading-container">
            <div class="cssload-dots">
                <div class="cssload-dot"></div>
                <div class="cssload-dot"></div>
                <div class="cssload-dot"></div>
                <div class="cssload-dot"></div>
                <div class="cssload-dot"></div>
            </div>
            <svg version="1.1" xmlns="http://www.w3.org/2000/svg">
            <defs>
            <filter id="goo">
                <feGaussianBlur in="SourceGraphic" result="blur" stdDeviation="12"></feGaussianBlur>
                <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0	0 1 0 0 0	0 0 1 0 0	0 0 0 18 -7" result="goo"></feColorMatrix>
            </filter>
            </defs>
            </svg>
        </div>
    </div>
    <input type="hidden" value="<?php echo $livesite; ?>" name="liveSite" id="liveSite">
    <input type="hidden" value="<?php echo $layout_default_warehouse_id; ?>" name="" id="layout_default_warehouse_id" />
    <input type="hidden" id="menu_helper" value="" name="menu_helper">
</body>
</html>
<?php
if (Yii::app()->components['user']->loginRequiredAjaxResponse) {
    Yii::app()->clientScript->registerScript('ajaxLoginRequired', '
        $(window).bind("ajaxComplete", function(e, xhr, settings) {
        if (xhr.responseText === "' . Yii::app()->components['user']->loginRequiredAjaxResponse . '") {
            $("#loader").hide();
            loadPopupModal("site/newlogin","Login","sm");
        }
    });', CClientScript::POS_HEAD);
}
?>
<script type="text/javascript">
    function startTime() {
        var today = new Date();
        var hr = today.getHours();
        var min = today.getMinutes();
        var sec = today.getSeconds();
        ap = (hr < 12) ? "AM" : "PM";
        hr = (hr == 0) ? 12 : hr;
        hr = (hr > 12) ? hr - 12 : hr;
        //Add a zero in front of numbers<10
        hr = checkTime(hr);
        min = checkTime(min);
        sec = checkTime(sec);
        document.getElementById("clock1").innerHTML = hr + ":" + min + ":" + sec + " " + ap;
        var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
        var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
        var curWeekDay = days[today.getDay()];
        var curDay = today.getDate();
        var curMonth = months[today.getMonth()];
        var curYear = today.getFullYear();
        var date = curWeekDay + ", " + curDay + " " + curMonth + " " + curYear;
        document.getElementById("date1").innerHTML = date;
        var time = setTimeout(function () {
            startTime()
        }, 500);
    }
    function checkTime(i) {
        if (i < 10) {
            i = "0" + i;
        }
        return i;
    }
    startTime();
</script>