<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css">
<!-- Change the theme color if it is set -->
   <script type="text/javascript">
    if(theme_skin!='skin-blue'){
      $("body").addClass(theme_skin);
      $("body").removeClass('skin-blue');
    }
    if(sidebar_collapse=='true'){
      $("body").addClass('sidebar-collapse');
    }
  </script> 
  <!-- end -->

<?php 
    $CI =& get_instance();
  ?>
<header class="main-header">

    <!-- Logo -->
    <a href="<?php echo $base_url; ?>dashboard" class="logo">
      <span class="logo-mini"><b>POS</b></span>
      <span class="logo-lg"><b><?php  echo $SITE_TITLE;?></b></span>
    </a>

    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- Sidebar toggle button-->
      <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
        <span class="sr-only">Toggle navigation</span>
      </a>
      <div class="btn-group hidden-xs">
            <a href="#" class="btn navbar-btn btn-success dropdown-toggle "   data-toggle="dropdown" aria-expanded="false">
                <i class="fa fa-plus"></i> 
            </a>
            <ul class="dropdown-menu" >
                  <?php if($CI->permissions('sales_add')) { ?>
                  <li class="border_bottom">
                    <a href="<?php echo $base_url; ?>sales/add" ><h4><i class="fa fa-plus text-green"></i> <?= $this->lang->line('sales'); ?></h4></a>
                  </li> 
                  <?php } ?>
                  <?php if($CI->permissions('purchase_add')) { ?>
                  <li class="border_bottom">
                    <a href="<?php echo $base_url; ?>purchase/add" ><h4><i class="fa fa-plus text-green"></i> GRN </h4></a>
                  </li> 
                  <?php } ?>
                  <?php if($CI->permissions('customers_add')) { ?>
                  <li class="border_bottom">
                    <a href="<?php echo $base_url; ?>customers/add" ><h4><i class="fa fa-plus text-green"></i> <?= $this->lang->line('customer'); ?></h4></a>
                  </li> 
                  <?php } ?>
                  <?php if($CI->permissions('suppliers_add')) { ?>
                  <li class="border_bottom">
                    <a href="<?php echo $base_url; ?>suppliers/add" ><h4><i class="fa fa-plus text-green"></i> <?= $this->lang->line('supplier'); ?></h4></a>
                  </li>
                  <?php } ?>
                  <?php if($CI->permissions('items_add')) { ?>
                  <li class="border_bottom">
                    <a href="<?php echo $base_url; ?>items/add" ><h4><i class="fa fa-plus text-green"></i> <?= $this->lang->line('item'); ?></h4></a>
                  </li> 
                  <?php } ?>
                  <?php if($CI->permissions('expense_add')) { ?>
                  <li hidden class="border_bottom">
                    <a href="<?php echo $base_url; ?>expense/add" ><h4><i class="fa fa-plus text-green"></i> <?= $this->lang->line('expense'); ?></h4></a>
                  </li>  
                  <?php } ?>
            </ul>
        </div>
      <!-- Navbar Right Menu -->
      <div class="navbar-custom-menu">
       
        <ul class="nav navbar-nav">
          <!-- <li class="text-center hidden-xs" id="">
            <form class="navbar-form navbar-left" role="search">
            <div class="form-group">
              <input type="text" class="form-control" id="navbar-search-input" placeholder="Search Sales Invoice">
            </div>
          </form> 
          </li> -->
          <!-- User Account Menu -->
            
            <li class="dropdown tasks-menu">
            <a href="#" class="dropdown-toggle text-right" data-toggle="dropdown" title="App Language" data-toggle='tooltip'>
              <i class="fa fa-language "></i>
                    <?= $this->session->userdata('language'); ?>
            </a>
            <ul class="dropdown-menu " style="width: auto;height: auto;">
              <li>
                <ul class="menu">
                  <?php 
                  $lang_query=$this->db->query('select * from db_languages where status=1 order by language asc');
                  foreach ($lang_query->result() as $res) { 
                    $selected='';
                    if($this->session->userdata('language')==$res->language){
                      $selected ='text-blue';
                    }
                    ?>
                    <li>
                    <a href="<?= $base_url;?>site/langauge/<?= $res->id;?>" ><h3 class='<?=$selected;?>'><?= $res->language;?></h3></a>
                  </li>  
                  <?php } ?>
                </ul>
              </li>
            </ul>
          </li>
          
          <?php if($CI->permissions('sales_add')) { ?>
          <li class="text-center" id="">
            <a title="POS" href="<?php echo $base_url; ?>pos"><i class="fa fa-plus-square " ></i> POS </a>   
          </li>
          <?php } ?>

          <li class="text-center hidden-xs" id="">
            <a title="Dashboard" href="<?php echo $base_url; ?>dashboard"><i class="zmdi zmdi-home" ></i> <?= $this->lang->line('dashboard'); ?></a>
          </li>
          <li class="text-center" >
            <a href="<?php echo $base_url; ?>logout" > <i class="fa fa-sign-out" aria-hidden="true"></i> Logout
              <!-- <img src="<?php // echo get_profile_picture(); ?>" class="user-image" alt="User Image"> -->
              <!-- <span class="hidden-xs"><?php // print ucfirst($this->session->userdata('inv_username')); ?></span> -->
            </a>

            <ul class="dropdown-menu" >
              <!-- User image -->

              <li class="user-header" id="log_dropdown">
                <img src="<?php echo get_profile_picture(); ?>" class="img-circle" alt="User Image">

                <p>
                 <?php print ucfirst($this->session->userdata('inv_username')); ?>
                  <small>Year <?=date("Y");?></small>
                </p>
              </li>
              <!-- Menu Body -->
              <!-- Menu Footer-->
              <li class="user-footer">
                <div class="pull-left">
                  <a href="<?php echo $base_url; ?>users/edit/<?= $this->session->userdata('inv_userid'); ?>" class="btn btn-default btn-flat">Profile</a>
                </div>
                <div class="pull-right">
                  <a href="<?php echo $base_url; ?>logout" class="btn btn-default btn-flat">Sign out</a>
                </div>
              </li>
            </ul>
          </li>
          <li class="hidden-xs">
            <a href="#" data-toggle="control-sidebar"><i class="zmdi zmdi-settings zmdi-hc-spin"></i></a>
          </li>
        </ul>
      </div>

    </nav>
  </header>
 
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <div class="user-panel">
        <div class="pull-left image">
          <img src="<?php echo get_profile_picture(); ?>" class="img-circle" alt="User Image">
        </div>
        <div class="pull-left info">
          <p><?php print ucfirst($this->session->userdata('inv_username')); ?><i class="fa fa-fw fa-check-circle text-aqua"></i></p>
          <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
        </div>
      </div>
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu">
        <!--<li class="header">MAIN NAVIGATION</li>-->
		<li class="dashboard-active-li "><a href="<?php echo $base_url; ?>dashboard"><i class="zmdi zmdi-home text-aqua" style="font-size: 20px;">&nbsp;</i> <span><?= $this->lang->line('dashboard'); ?></span></a></li>
		
		
		<!--<li class="header">SALES</li>-->
    <?php if($CI->permissions('sales_add')  || $CI->permissions('sales_view') || $CI->permissions('sales_return_view') || $CI->permissions('sales_return_add') || $CI->permissions('import_daraz') || $CI->permissions('ins_view')) { ?>
		<li class="pos-active-li fb-fees-active-li sales-list-active-li ins_list-active-li sales-active-li sales-return-active-li sales-return-list-active-li import_daraz-active-li trans_daraz-active-li treeview">
          <a href="#">
            <i class="zmdi zmdi-shopping-cart animated infinite fadeInLeft text-aqua"  style="font-size: 20px;">&nbsp;</i> <span> <?= $this->lang->line('sales'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
        <?php if($CI->permissions('sales_add')) { ?>
        <li class="pos-active-li"><a href="<?php echo $base_url; ?>pos"><i class="fa fa-calculator "></i> <span>POS</span></a></li>

		    <!-- <li class="sales-active-li"><a href="<?php echo $base_url; ?>sales/add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_sales'); ?></span></a></li>
        <?php } ?> -->
        
        <?php if($CI->permissions('sales_view')) { ?>
        <li class="sales-list-active-li"><a href="<?php echo $base_url; ?>sales"><i class="fa fa-list "></i> Invoice List </span></a></li>
        <?php } ?>

        <?php if($CI->permissions('ins_view')) { ?>
        <li hidden class="ins_list-active-li"><a href="<?php echo $base_url; ?>sales/ins_view"><i class="fa fa-plus-square-o "></i> <span><span><?= $this->lang->line('ins'); ?></span></a></li>
        <?php } ?>

        <?php if($CI->permissions('sales_return_add')) { ?>
        <li class="sales-return-active-li"><a href="<?php echo $base_url; ?>sales_return/new_add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_sales_return'); ?></span></a></li>
        <?php } ?>

        <?php if($CI->permissions('sales_return_view')) { ?>
        <li  class="sales-return-list-active-li"><a href="<?php echo $base_url; ?>sales_return"><i class="fa fa-list "></i> <span>Invoice Return List </span></a></li>
        <?php } ?>

        <?php if($CI->permissions('facebook_fees_view')) { ?>
        <li hidden class="fb-fees-active-li"><a href="<?php echo $base_url; ?>sales/fb_fees"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('facebook_fees'); ?></span></a></li>
        <?php } ?>

        <?php if($CI->permissions('import_daraz')) { ?>
               <li hidden class="import_daraz-active-li"><a href="<?php echo $base_url; ?>daraz_order"><i class="fa fa-arrow-circle-o-left "></i> <span>Daraz Orders</span></a></li>
        <?php } ?>

        <?php if($CI->permissions('trans_daraz')) { ?>
               <li hidden class="trans_daraz-active-li"><a href="<?php echo $base_url; ?>daraz_order/transactions"><i class="fa fa-arrow-circle-o-left "></i> <span>Daraz transaction</span></a></li>
        <?php } ?>

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

    <!--<li class="header">SALES</li>-->
    <?php //if($CI->permissions('quotation_add')  || $CI->permissions('quotation_view')) { ?>
		  <li class="pos-active-li fb-fees-active-li quotation-list-active-li ins_list-active-li quotation-active-li quotation-return-active-li quotation-return-list-active-li import_daraz-active-li trans_daraz-active-li treeview">
          <a href="#">
            <i class="zmdi zmdi-file animated infinite fadeInLeft text-aqua"  style="font-size: 20px;">&nbsp;</i> <span>Quotation</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php //if($CI->permissions('quotation_add')) { ?>
            <li class="pos-active-li"><a href="<?php echo $base_url; ?>quotation_p"><i class="fa fa-calculator "></i> <span>New Quotation </span></a></li>

            <!-- <li class="quotation-active-li"><a href="<?php echo $base_url; ?>quotation_p"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_quotation'); ?></span></a></li>
            <?php //} ?> -->
            
            <?php //if($CI->permissions('quotation_view')) { ?>
            <li class="quotation-list-active-li"><a href="<?php echo $base_url; ?>quotation_s"><i class="fa fa-list "></i> Quotation List </span></a></li>
            <?php //} ?>
          </ul>
        </li>
    <?php //} ?>

		<!--<li class="header">CUSTOMERS</li>-->
    <?php if($CI->permissions('customers_add') || $CI->permissions('customers_view') || $CI->permissions('import_customers')) { ?>
    <li id="cusArea" hidden class="customers-view-active-li customers-active-li import_customers-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-accounts text-aqua"  style="font-size: 20px;">&nbsp;</i> <span><?= $this->lang->line('customers'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
         <?php if($CI->permissions('customers_add')) { ?>
        <li class="customers-active-li"><a href="<?php echo $base_url; ?>customers/add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_customer'); ?></span></a></li>
        <?php } ?>
        <?php if($CI->permissions('customers_view')) { ?>
         <li class="customers-view-active-li"><a href="<?php echo $base_url; ?>customers"><i class="fa fa-list "></i> <span><?= $this->lang->line('customers_list'); ?></span></a></li>
         <?php } ?>

         <?php if($CI->permissions('import_customers')) { ?>
         <li class="import_customers-active-li"><a href="<?php echo $base_url; ?>import/customers"><i class="fa fa-arrow-circle-o-left "></i> <span><?= $this->lang->line('import_customers'); ?></span></a></li>
         <?php } ?>

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

    <?php if($CI->permissions('purchase_add') || $CI->permissions('purchase_view') || $CI->permissions('purchase_return_view') || $CI->permissions('new_purchase_return')) { ?>
		<li class="purchase-list-active-li purchase-active-li purchase-returns-list-active-li purchase-returns-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-view-dashboard text-aqua"  style="font-size: 20px;">&nbsp;</i> <span>  GRN </span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('purchase_add')) { ?>
    		    <li class="purchase-active-li"><a href="<?php echo $base_url; ?>purchase/add"><i class="fa fa-plus-square-o "></i> <span>New GRN</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('purchase_view')) { ?>
            <li class="purchase-list-active-li"><a href="<?php echo $base_url; ?>purchase"><i class="fa fa-list "></i> <span>GRN List</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('purchase_return_view')) { ?>
            <li class="purchase-returns-active-li"><a href="<?php echo $base_url; ?>purchase_return/create"><i class="fa fa-plus-square-o "></i> New GRN Returns </span></a></li>
            <?php } ?>
            <?php if($CI->permissions('purchase_return_view')) { ?>
            <li class="purchase-returns-list-active-li"><a href="<?php echo $base_url; ?>purchase_return"><i class="fa fa-list "></i> <span> GRN Returns List </span></a></li>
            <?php } ?>
          </ul>
        </li>
        <?php } ?>

        <?php if($CI->permissions('suppliers_add') || $CI->permissions('suppliers_view') || $CI->permissions('import_suppliers')) { ?>
        <li id="supArea" hidden class="suppliers-list-active-li suppliers-active-li import_suppliers-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-accounts-add text-aqua"  style="font-size: 20px;">&nbsp;</i> <span><?= $this->lang->line('suppliers'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
              <?php if($CI->permissions('suppliers_add')) { ?>
              <li class="suppliers-active-li"><a href="<?php echo $base_url; ?>suppliers/add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_supplier'); ?></span></a></li>
              <?php } ?>
              <?php if($CI->permissions('suppliers_view')) { ?>
              <li class="suppliers-list-active-li"><a href="<?php echo $base_url; ?>suppliers"><i class="fa fa-list "></i> <span><?= $this->lang->line('suppliers_list'); ?></span></a></li>
              <?php } ?>

              <?php if($CI->permissions('import_suppliers')) { ?>
               <li hidden class="import_suppliers-active-li"><a href="<?php echo $base_url; ?>import/suppliers"><i class="fa fa-arrow-circle-o-left "></i> <span><?= $this->lang->line('import_suppliers'); ?></span></a></li>
               <?php } ?>
         
          </ul>
        </li>
        <?php } ?>
        
        <?php if($CI->permissions('items_add') || $CI->permissions('items_view') || $CI->permissions('items_category_add') || $CI->permissions('items_category_view') || $CI->permissions('brand_add') || $CI->permissions('brand_view') || $CI->permissions('print_labels')) { ?>
        <li class="items-list-active-li items-active-li transfer-view-active-li category-view-active-li category-active-li colors-list-active-li size-list-active-li brand-active-li brand-view-active-li labels-active-li import_items-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-apps text-aqua"  style="font-size: 20px;">&nbsp;</i> <span><?= $this->lang->line('items'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('items_add')) { ?>
            <li class="items-active-li"><a href="<?php echo $base_url; ?>items/add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_item'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('items_view')) { ?>
            <li class="items-list-active-li"><a href="<?php echo $base_url; ?>items"><i class="fa fa-list "></i> <span><?= $this->lang->line('items_list'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('items_category_add')) { ?>
            <li hidden class="category-active-li"><a href="<?php echo $base_url; ?>category/add"><i class="fa fa-plus-square-o "></i> <span>Category Images</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('items_category_view')) { ?>
            <li class="category-view-active-li"><a href="<?php echo $base_url; ?>category/view"><i class="fa fa-list "></i> <span><?= $this->lang->line('categories_list'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('colors_view')) { ?>
            <li hidden class="colors-list-active-li color-active-li"><a href="<?php echo $base_url; ?>colors/"><i class="fa fa-list "></i> <span><?= $this->lang->line('colors_list'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('size_view')) { ?>
            <li hidden class="size-list-active-li size-active-li"><a href="<?php echo $base_url; ?>size/"><i class="fa fa-list "></i> <span><?= $this->lang->line('sizes_list'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('brand_add')) { ?>
            <li class="brand-active-li"><a href="<?php echo $base_url; ?>brands/add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_brand'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('brand_view')) { ?>
            <li class="brand-view-active-li"><a href="<?php echo $base_url; ?>stock/view"><i class="fa fa-list "></i> <span>Stock List</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('brand_add')) { ?>
            <li class="transfer-items-active-li"><a href="<?php echo $base_url; ?>stock/transfer_items"><i class="fa fa-plus-square-o "></i> <span>Stock Transfer</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('brand_view')) { ?>
            <li class="transfer-view-active-li"><a href="<?php echo $base_url; ?>stock/transfer"><i class="fa fa-list "></i> <span>Stock Transfer History</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('print_labels')) { ?>
            <li class="labels-active-li"><a href="<?php echo $base_url; ?>items/labels"><i class="fa fa-barcode "></i> <span>Barcode Print</span></a></li>
            <?php } ?>

            <?php if($CI->permissions('import_items')) { ?>
               <li hidden class="import_items-active-li"><a href="<?php echo $base_url; ?>import/items"><i class="fa fa-arrow-circle-o-left "></i> <span><?= $this->lang->line('import_items'); ?></span></a></li>
            <?php } ?>
          </ul>
        </li>
        <?php } ?>

        <?php if($CI->permissions('expense_add') || $CI->permissions('expense_view') || $CI->permissions('expense_category_add') || $CI->permissions('expense_category_view')) { ?>
       <li id="expArea" hidden class="expense-list-active-li expense-active-li expense-category-active-li expense-category-list-active-li treeview">
          <a href="#">
            <i class="fa fa-minus-circle text-aqua"></i> <span><?= $this->lang->line('expenses'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('expense_add')) { ?>
            <li class="expense-active-li"><a href="<?php echo $base_url; ?>expense/add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_expense'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('expense_view')) { ?>
            <li class="expense-list-active-li"><a href="<?php echo $base_url; ?>expense"><i class="fa fa-list "></i> <span><?= $this->lang->line('expenses_list'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('expense_category_add')) { ?>
            <li class="expense-category-active-li"><a href="<?php echo $base_url; ?>expense/category_add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_category'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('expense_category_view')) { ?>
            <li class="expense-category-list-active-li "><a href="<?php echo $base_url; ?>expense/category"><i class="fa fa-list "></i> <span><?= $this->lang->line('categories_list'); ?></span></a></li>
            <?php } ?>

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

		<?php if($CI->permissions('places_add') || $CI->permissions('places_view')) { ?>
		<li id="c_balanceArea" hidden class="country-active-li city-list-active-li country-list-active-li state-active-li state-list-active-li city-active-li treeview">
          <a href="#">
            <i class="fa fa-paper-plane-o text-aqua"></i> <span>Cash Balance</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('places_add')) { ?>
            <li class="country-active-li"><a href="<?php echo $base_url; ?>cash/add"><i class="fa fa-plus-square-o "></i> <span>Cash In</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('places_view')) { ?>
            <li class="country-list-active-li "><a href="<?php echo $base_url; ?>cash"><i class="fa fa-list "></i> <span>Summary</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('places_add')) { ?>
            <li hidden class="state-active-li"><a href="<?php echo $base_url; ?>state/add"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_state'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('places_view')) { ?>
            <li hidden class="state-list-active-li "><a href="<?php echo $base_url; ?>state"><i class="fa fa-list "></i> <span><?= $this->lang->line('states_list'); ?></span></a></li>
            <?php } ?>
    </ul>
        </li>
    <?php } ?>

    <?php if($CI->permissions('places_add') || $CI->permissions('places_view')) { ?>
		<li hidden class="agent-active-li agent-list-active-li agent-com-active-li state-list-active-li city-active-li treeview">
          <a href="#">
            <i class="zmdi zmdi-accounts-add  text-aqua" style="font-size: 20px;">&nbsp;</i> <span>Agent</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('places_add')) { ?>
            <li hidden class="agent-active-li"><a href="<?php echo $base_url; ?>agent/add"><i class="fa fa-plus-square-o "></i> <span>New  Agent</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('places_add')) { ?>
            <li class="agent-list-active-li "><a href="<?php echo $base_url; ?>agent"><i class="fa fa-list "></i> <span>Agent List</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('places_add')) { ?>
            <li hidden class="agent-com-active-li"><a href="<?php echo $base_url; ?>agent/agent_Comissions"><i class="fa fa-list "></i> <span>Agent Comissions</span></a></li>
            <?php } ?>
            <?php if($CI->permissions('places_view')) { ?>
            <li class="agent-pay-active-li "><a href="<?php echo $base_url; ?>agent/payments"><i class="fa fa-list "></i> <span>Agent Payments</span></a></li>
            <?php } ?>
    </ul>
        </li>
    <?php } ?>

    <!--<li class="header">CHEQUE</li>-->
    <?php //if($CI->permissions('cheque_search') || $CI->permissions('cheque_history')) { ?>
    <?php if(($this->session->userdata('role_id')=='1')||($this->session->userdata('role_id')=='2')){ ?>
      <li class="cheque-search-active-li cheque-history-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-money-box text-aqua"  style="font-size: 20px;">&nbsp;</i> <span>Cheque</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
         <?php //if($CI->permissions('cheque_search')) { ?>
        <li hidden class="cheque-search-active-li"><a href="<?php echo $base_url; ?>payment_types/search"><i class="fa fa-plus-square-o "></i> <span>Search Cheque No.</span></a></li>
        <?php //} ?>
        <?php //if($CI->permissions('cheque_history')) { ?>
         <li class="cheque-history-active-li"><a href="<?php echo $base_url; ?>payment_types/history"><i class="fa fa-list "></i> <span>Cheque History</span></a></li>
         <?php //} ?>
          </ul>
        </li>    
    <?php } ?>

   
		<!--<li class="header">REPORTS</li>-->
    <?php if($CI->permissions('item_purchase_report') ||$CI->permissions('sales_report') || $CI->permissions('item_sales_report') || $CI->permissions('purchase_report') || $CI->permissions('purchase_return_report') || $CI->permissions('expense_report') || $CI->permissions('profit_report') || $CI->permissions('stock_report') || $CI->permissions('purchase_payments_report') || $CI->permissions('sales_payments_report') || $CI->permissions('expired_items_report')) { ?>
		<li id="reportArea" hidden class="report-sales-active-li report-sales-return-active-li report-purchase-active-li report-purchase-return-active-li report-revenue-active-li report-expense-active-li report-agent-commision-active-li report-profit-loss-active-li report-stock-active-li report-purchase-payments-active-li report-sales-item-active-li report-sales-payments-active-li report-expired-items-active-li report-purchase-item-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-chart text-aqua"  style="font-size: 20px;">&nbsp;</i> <span><?= $this->lang->line('reports'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">

            <?php if($CI->permissions('profit_report')) { ?>
              <li hidden class="report-profit-loss-active-li"><a href="<?php echo $base_url; ?>reports/agent_commision" ><i class="fa fa-files-o "></i> <span>Agent Commissions</span></a></li>
            <?php } ?>

            <?php if($CI->permissions('profit_report')) { ?>
            <li class="report-profit-s-loss-active-li"><a href="<?php echo $base_url; ?>reports/profit_loss" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('profit_and_loss_report'); ?></span></a></li>
            <?php } ?>

            <?php if($CI->permissions('purchase_report')) { ?>
            <li class="report-purchase-active-li"><a href="<?php echo $base_url; ?>reports/purchase" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('purchase_report'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('purchase_return_report')) { ?>
            <li class="report-purchase-return-active-li"><a href="<?php echo $base_url; ?>reports/purchase_return" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('purchase_return_report'); ?></span></a></li>
            <?php } ?>

            <?php if($CI->permissions('purchase_payments_report')) { ?>
            <li class="report-purchase-payments-active-li"><a href="<?php echo $base_url; ?>reports/purchase_payments" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('purchase_payments_report'); ?></span></a></li>
            <?php } ?>

            <?php if($CI->permissions('item_sales_report')) { ?>
            <li class="report-sales-item-active-li"><a href="<?php echo $base_url; ?>reports/item_sales" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('item_sales_report'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('item_purchase_report')) { ?>
            <li class="report-purchase-item-active-li"><a href="<?php echo $base_url; ?>reports/item_purchase" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('item_purchase_report'); ?></span><span class="pull-right-container">
            </span></a></li>
            <?php } ?>
            <?php if($CI->permissions('sales_report')) { ?>
            <li class="report-sales-active-li"><a href="<?php echo $base_url; ?>reports/sales" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('sales_report'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('sales_return_report')) { ?>
            <li class="report-sales-return-active-li"><a href="<?php echo $base_url; ?>reports/sales_return" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('sales_return_report'); ?></span></a></li>
            <?php } ?>
            
            <?php if($CI->permissions('sales_payments_report')) { ?>
            <li class="report-sales-payments-active-li"><a href="<?php echo $base_url; ?>reports/sales_payments" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('sales_payments_report'); ?></span></a></li>  
            <?php } ?>

            <?php if($CI->permissions('stock_report')) { ?>
            <li class="report-stock-active-li"><a href="<?php echo $base_url; ?>reports/stock" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('stock_report'); ?></span>
              </a></li>
            <?php } ?>

            <?php if($CI->permissions('stock_report')) { ?>
            <li class="report-stock-active-li"><a href="<?php echo $base_url; ?>reports/stock_analysis" ><i class="fa fa-files-o "></i> <span> Stock Analysis </span>
              </a></li>
            <?php } ?>

            <?php if($CI->permissions('expense_report')) { ?>
            <li hidden class="report-revenue-active-li"><a href="<?php echo $base_url; ?>reports/revenue" ><i class="fa fa-files-o "></i> <span>Daraz Order Revenue History</span></a></li>
            <?php } ?>

            <?php if($CI->permissions('expense_report')) { ?>
            <li class="report-expense-active-li"><a href="<?php echo $base_url; ?>reports/expense" ><i class="fa fa-files-o "></i> <span><?= $this->lang->line('expense_report'); ?></span></a></li>
            <?php } ?>
            
            <?php if($CI->permissions('expired_items_report')) { ?>
            <li hidden class="report-expired-items-active-li"><a href="<?php echo $base_url; ?>stock/stock_history" ><i class="fa fa-files-o "></i> <span>Stock History</span></a></li>  
            <?php } ?>
	       </ul>
      </li>
      <?php } ?>

	   <!-- Users -->
     <?php if($CI->permissions('users_add') || $CI->permissions('users_view') || $CI->permissions('roles_view')) { ?>
     <li class="users-view-active-li users-active-li roles-list-active-li role-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-accounts-add text-aqua"  style="font-size: 20px;">&nbsp;</i> <span><?= $this->lang->line('users'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('users_add')) { ?>
            <li class="users-active-li"><a href="<?php echo $base_url; ?>users/"><i class="fa fa-plus-square-o "></i> <span><?= $this->lang->line('new_user'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('users_view')) { ?>
            <li class="users-view-active-li"><a href="<?php echo $base_url; ?>users/view"><i class="fa fa-list "></i> <span><?= $this->lang->line('users_list'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('roles_view')) { ?>
            <li class="roles-list-active-li role-active-li">
              <a href="<?php echo $base_url; ?>roles/view">
                <i class="fa fa-list "></i> 
                <span><?= $this->lang->line('roles_list'); ?></span></a>
            </li>
            <?php } ?>
          </ul>
        </li>
        <?php } ?>
    <!-- SMS -->
     <?php if($CI->permissions('send_sms') || $CI->permissions('sms_template_view') || $CI->permissions('sms_api_view')) { ?>
     <li hidden class="sms-active-li sms-api-active-li sms-template-active-li sms-templates-list-active-li treeview">
          <a href="#">
            <i class="fa fa-envelope text-aqua"></i> <span><?= $this->lang->line('sms'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('send_sms')) { ?>
            <li class="sms-active-li"><a href="<?php echo $base_url; ?>sms"><i class="fa fa-envelope-o "></i> <span><?= $this->lang->line('send_sms'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('sms_template_view')) { ?>
            <li class="sms-templates-list-active-li sms-template-active-li"><a href="<?php echo $base_url; ?>templates/sms"><i class="fa fa-list "></i> <span><?= $this->lang->line('sms_templates'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('sms_api_view')) { ?>
            <li class="sms-api-active-li"><a href="<?php echo $base_url; ?>sms/api"><i class="fa fa-cube "></i> <span><?= $this->lang->line('sms_api'); ?></span></a></li>
            <?php } ?>
          </ul>
        </li>
        <?php } ?>
		<!--<li class="header">SETTINGS</li>-->
    <?php if($change_password=true) { ?>
		<li class=" company-profile-active-li site-settings-active-li  change-pass-active-li dbbackup-active-li warehouse-active-li warehouse-list-active-li tax-active-li currency-view-active-li currency-active-li  database_updater-active-li tax-list-active-li units-list-active-li unit-active-li payment_types_list-active-li payment_types-active-li treeview">
          <a href="#">
          <i class="zmdi zmdi-settings text-aqua"  style="font-size: 20px;">&nbsp;</i> <span><?= $this->lang->line('settings'); ?></span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <?php if($CI->permissions('company_edit')) { ?>
            <li class="company-profile-active-li"><a href="<?php echo $base_url; ?>company"><i class="fa fa-suitcase "></i> <span><?= $this->lang->line('company_profile'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('site_edit')) { ?>
            <li class="site-settings-active-li"><a href="<?php echo $base_url; ?>site"><i class="fa fa-shield  "></i> <span>Main Settings</span></a></li>
            <?php } ?>

            
            <?php if($CI->permissions('tax_view')) { ?>
            <li hidden class="tax-active-li  tax-list-active-li"><a href="<?php echo $base_url; ?>tax"><i class="fa fa-percent  "></i> <span><?= $this->lang->line('tax_list'); ?></span></a></li>
            <?php } ?>
            <?php if($CI->permissions('units_view')) { ?>
            <li class="units-list-active-li unit-active-li"><a href="<?php echo $base_url; ?>units/"><i class="fa fa-list "></i> <span><?= $this->lang->line('units_list'); ?></span></a></li>
            <?php } ?>

            <?php if($CI->permissions('payment_types_view')) { ?>
            <li class="payment_types_list-active-li payment_types-active-li"><a href="<?php echo $base_url; ?>payment_types/"><i class="fa fa-list "></i> <span><?= $this->lang->line('payment_types_list'); ?></span></a></li>
            <?php } ?>

            <?php if($CI->permissions('currency_view')) { ?>
            <li hidden class="currency-view-active-li currency-active-li"><a href="<?php echo $base_url; ?>currency/view"><i class="fa fa-gg "></i> <span><?= $this->lang->line('currency_list'); ?></span></a></li>
            <?php } ?>
            <li class="change-pass-active-li"><a href="<?php echo $base_url; ?>users/password_reset"><i class="fa fa-lock "></i> <span><?= $this->lang->line('change_password'); ?></span></a></li>


            <?php if($CI->permissions('database_backup')) { ?>
            <li class="dbbackup-active-li"><a href="<?php echo $base_url; ?>users/dbbackup"><i class="fa fa-database "></i> <span><?= $this->lang->line('database_backup'); ?></span></a></li>
            <?php } ?>
            
		   </ul>
        </li>
        <?php } ?>
        <li hidden><a href="<?php echo $base_url; ?>help/" target="_blank"  ><i class="fa fa-book "></i> <span><?= $this->lang->line('help'); ?></span></a></li>
      </ul>
    </section>
    <!-- /.sidebar -->
  </aside>

<script>
  $(document).ready(function() {
    if(/Mobi/i.test(navigator.userAgent)) {
      //alert("Mobile device detected");
    } else {
      document.onkeydown = fkey;
      document.onkeypress = fkey
      document.onkeyup = fkey;

      var wasPressed = false;

      function fkey(e){
              e = e || window.event;
            if( wasPressed ) return; 
            var userName = "<?php $this->session->userdata('inv_userid'); ?>";
            console.log(userName);

              if (e.keyCode == 113) {
                
                  wasPressed = true;
              }else {
                $('#c_balanceArea').attr('hidden',true);
              }
      }
    }
  });
</script>
