<?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>CRM | <?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') ?>






</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->getFullname();
                                ?></span>
                                <b class="caret"></b>

                            </a>
                            <ul class="dropdown-menu extended logout">
                                <div class="log-arrow-up"></div>
                                <li><a href="<?php echo $baseUrl; ?>/index.php?r=site/logout"><i class="fa fa-key"></i> Log Out</a></li>

                            </ul>

                        </li>
                    </ul>

                </div>          </ul>



            </div>

        </div>

        <div class="ql">

            <ul class="q-links">

            </ul>

        </div>

    </div>

</header>

<?php //$this->renderPartial('//layouts/url_redirection') ?>

<aside class="menu-2">

    <br>

    <ul class="asidemenu menu-2">

        <?php
        $user_id   = (int) Yii::app()->user->id;
        $modeluser = User::model()->findByPk($user_id);
        ?>
        <?php if ($modeluser->user_group_id == 1) { ?>
           <li id="masexpensetype" <?php echo "class='has-sub l2'"; ?>>
              <a href="<?php echo $baseUrl; ?>/index.php?r=masexpensetype/index" data-target="#operations_menu"><i class="fa fa-list"></i><span>Expense Type</span></a>
          </li>
      <?php } ?>
      <li id="expense" <?php echo "class='has-sub l2'"; ?>>
          <a href="<?php echo $baseUrl; ?>/index.php?r=expense/index" data-target="#operations_menu"><i class="fa fa-money"></i><span>Expense</span></a>
      </li>

      <?php if ($modeluser->user_group_id == 1) { ?>
         <li id="expense" <?php echo "class='has-sub l2'"; ?>>
          <a href="<?php echo $baseUrl; ?>/index.php?r=expensesettlement/index" data-target="#operations_menu"><i class="fa fa-calculator"></i><span>Expense Settlement</span></a>
      </li>
  <?php } ?>


   <?php if ($modeluser->user_group_id == 1) { ?>
    <li id="expense" class="has-sub l2">
        <a href="<?php echo $baseUrl; ?>/index.php?r=projects/index" data-target="#operations_menu">
            <i class="fa fa-file-word-o"></i><span>Projects </span>
        </a>
    </li>
<?php } ?>


  <?php if ($modeluser->user_group_id == 1) { ?>
    <li id="expense" class="has-sub l2">
        <a href="<?php echo $baseUrl; ?>/index.php?r=userprojects/index" data-target="#operations_menu">
            <i class="fa fa-file-word-o"></i><span>User Projects </span>
        </a>
    </li>
<?php } ?>
  
  <?php if ($modeluser->user_group_id == 1) { ?>
    <li id="expense" class="has-sub l2">
        <a href="<?php echo $baseUrl; ?>/index.php?r=settlementreport/index" data-target="#operations_menu">
            <i class="fa fa-file-word-o"></i><span>Reports</span>
        </a>
    </li>
<?php } ?>
<?php if ($modeluser->user_group_id == 1) { ?>
    <li id="expense" class="has-sub l2">
        <a href="<?php echo $baseUrl; ?>/index.php?r=users/index" data-target="#operations_menu">
            <i class="fa fa-users"></i><span>Users</span>
        </a>
    </li>
<?php } ?>
<?php if ($modeluser->user_group_id == 1) { ?>
    <li id="inventory_products" class="has-sub l2">
        <a href="<?php echo $baseUrl; ?>/index.php?r=inventoryProducts/index" data-target="#operations_menu">
            <i class="fa fa-cubes"></i><span>Inventory Products</span>
        </a>
    </li>
<?php } ?>
<?php if ($modeluser->user_group_id == 1) { ?>
    <li id="sales_invoice" class="has-sub l2">
        <a href="<?php echo $baseUrl; ?>/index.php?r=salesInvoice/index" data-target="#operations_menu">
            <i class="fa fa-file-invoice"></i><span>Sales Invoice</span>
        </a>
    </li>
<?php } ?>
<?php if ($modeluser->user_group_id == 1) { ?>
<li id="sales_return" class="has-sub l2">
    <a href="<?php echo $baseUrl; ?>/index.php?r=salesReturn/index">
        <i class="fa fa-undo"></i><span>Sales Return</span>
    </a>
</li>
<?php } ?>
<?php if ($modeluser->user_group_id == 1) { ?>
    <li id="expense" class="has-sub l2">
        <a href="<?php echo $baseUrl; ?>/index.php?r=users/index" data-target="#operations_menu">
            <i class="fa fa-users"></i><span>Users</span>
        </a>
    </li>
<?php } ?>
    
    
   <li id="master" <?php echo "class='$masters has-sub l2'"; ?> >
     <?php //if (Yii::app()->user->authorised_user == 1 || (int) Yii::app()->user->havePermissionOn["sales_menu_view"] || (int) Yii::app()->user->havePermissionOn["logistics_menu_view"] ||  (int) Yii::app()->user->havePermissionOn["inventory_menu_view"] || isset(Yii::app()->user->haveHrPermissionOn['master_application_view'])||  (int) Yii::app()->user->havePermissionOn["finance_menu_view"]  || (isset(Yii::app()->user->project_module) && Yii::app()->user->project_module == 'Y') ){ ?>

        <a href="<?php echo $baseUrl; ?>/index.php?r=masbanner/index" data-target="#masters_menu"><i class="fa fa-tags"></i><span>Project Intership</span></a>

        <ul class="menu-2-sub" id="masters_menu">
        <li class="has-sub l2"><a href="javascript:void(0);"><i class="fa fa-tags"></i>Project Intership</a>

                <ul class="sub-l2">
                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=customers/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Customers</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=mascategory/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Category</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=locations/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Locations</span>
                     </a>
                </li>


                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=subcategory/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Subcategory</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=masbrands/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Brands</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=masSubBrands/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Sub Brands</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=suppliers/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Suppliers</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=country/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Country</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=state/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>State</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=customerlocations/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Customer Locations</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=masinvrack/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Inventory Rack</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=masinvbin/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Inventory Bin</span>
                     </a>
                </li>

                <li>
                 <a href="<?php echo $baseUrl; ?>/index.php?r=customerdocument/index" data-target="#operations_menu">
                     <i class="fa fa-users"></i><span>Customer Document</span>
                     </a>
                </li>
                
                </ul>

        </li>
        </ul>
    <?php //} ?>
</li>   
    

</ul>
<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>
<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>