<?php

defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  
  <title><?php echo $this->company;?> - Administrator area</title>
  <base href="<?php echo base_url();?>" />
  <!-- <link rel="manifest" href="manifest.json"> //-->
    
  <!-- Stylesheets -->
  <link rel="stylesheet" href="assets/css/style.css">
  <link rel="stylesheet" href="assets/css/bootstrap.min.css"/>
  <link rel="stylesheet" href="assets/css/font-awesome.min.css"/>
  <link rel="stylesheet" href="assets/css/owl.carousel.min.css"/>
  <link rel="stylesheet" href="assets/css/nice-select.css"/>
  <link rel="stylesheet" href="assets/css/magnific-popup.css"/>
  <link rel="stylesheet" href="assets/css/slicknav.min.css"/>
  <link rel="stylesheet" href="assets/css/animate.css"/>
    
  <link rel="icon" href="favicon.ico" type="image/x-icon">
  <link rel="apple-touch-icon" href="images/logo.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="theme-color" content="white">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Web App">
  <meta name="msapplication-TileImage" content="images/logo.png">
  <meta name="msapplication-TileColor" content="#FFFFFF">
  <?php
	if($main_content=="products" || $main_content=="manageproducts" || $main_content=="productsprice"  || $main_content=="purchase"   || $main_content=="managepurchase" || $main_content=="stockstatus" || $main_content=="outletsstock" || $main_content=="managestocktransfer" || $main_content=="itemledger" || $main_content=="managemergeitem" || $main_content=="o2ostocktransfer" || $main_content=="o2wstocktransfer" || $main_content=="manageo2ostocktransfer" || $main_content=="w2wstocktransfer" || $main_content=="managew2wstocktransfer" || $main_content=="itemstock" || $main_content=="gifts" || $main_content=="managegifts" || $main_content=="itemsale" || $main_content=="wbilling")
	{
  ?>
<link rel="stylesheet" href="assets/css/select2.min.css"/>
  <?php
	}
  ?>
   <?php
	if($main_content=="managepages")
	{
  ?>
  <script type="text/javascript" src="assets/ckeditor/ckeditor/ckeditor.js"></script>
  <script type="text/javascript" src="assets/ckeditor/ckfinder/ckfinder.js"></script>
  <?php
	}
  ?>
  
  <!-- Add jQuery library -->
  <script type="text/javascript" src="assets/js/jquery-1.10.2.min.js"></script>

	<!-- Add fancyBox main JS and CSS files -->
	<script type="text/javascript" src="assets/js/jquery.fancybox.pack.js?v=2.1.5"></script>
	<link rel="stylesheet" type="text/css" href="assets/css/jquery.fancybox.css?v=2.1.5" media="screen" />
	<script type="text/javascript">
		$(document).ready(function() {
			$('.fancybox').fancybox();
			
			$("#fancybox-manual-b").click(function() {
				$.fancybox.open({
					type : 'iframe',
					padding : 0
				});
			});
			$('.fancybox2-reloadparent').fancybox(
			{
				type: 'iframe',
				afterClose: function () { // USE THIS IT IS YOUR ANSWER THE KEY WORD IS "afterClose"
				parent.location.reload(true);
				}
			});
		});
	</script>
	
	<script type="text/javascript" src="assets/account/js/common_function.js"></script>
    
    <style>
    	.accordion {
		  width: 100%;  
		}
		
		.accordion ul {
	      background: #fdfdfd;
		  margin: 0em;
		  padding: 0;
		}
		
		.accordion .pagenav {
		  position: relative;
		  margin-bottom: 0px;
		  border-bottom: 1px solid #ddd;
		  list-style: none;
		  background: #eaf7ff;
		}
		.accordion .pagenav:hover{ background: #ffffff; }
		
		.accordion .pagenav a {
		  text-decoration: none;
		  color: #2149c1;
		}
		
		.accordion .pagenav ul {
		  display: none; /* hides all ul content by default (see exceptions in JS) */
		  padding: 10px;
		  margin: 0;
		}
		
		.accordion .pagenav li {
		  margin-bottom: 5px 0;
		  padding: 5px 10px;
		  display: block;
		  font-size: 15px;
		  list-style: none;
		}
		.accordion .pagenav li i{ 
			font-size: 15px;
			color: #2149c1;
			float: left;
			vertical-align: top;
			display: inline-block;
			margin: 3px 10px 0 0;
		}
		
		.accordion .pagenav h4 {
		  font-size: 17px;
		  padding: 10px 20px;
		  margin: 0;
		  cursor: pointer;
		  font-weight: 400;
		}
		
		.accordion .pagenav h4 i {
		  font-size: 22px;
		  position: absolute;
		  right: 20px;
		  line-height: 20px;
		  transition: .2s;
		  -webkit-transition: .2s;
		  -ms-transition: .2s;
		}
		
		.accordion .pagenav.open h4 i {
		  transform: rotate(90deg);
		}
		
		.accordion a:hover, .accordion .pagenav li.current_page_item a {
		  text-decoration: none;
		  color: #000;
		}
    </style>
  
</head>

<body class="m-0">
    <!-- Header Section -->
    <?php
    if($main_content=="products" || $main_content=="productsprice") // for 100% width
    {
    ?>
  <div class="container_fluid mr-0 p-0">
     <div class="m-auto">
        <div class="header-info border-dark">
          <div class="row">
            <div class="col-md-6 d-sm-block col-sm-4"><a href="account/dashboard" class="d-block mt-2"><?php echo ADMLOGOTITLE;?></a></div>
        	<div class="p-0 d-sm-none d-flex ml-auto">
                <span class="usrnam ml-0 pt-3">Welcome <?php echo $this->lguserinfo["sessName"];?>! ( <?php echo $this->lguserinfo["sessType"];?> )</span><a href="account/logout" class="topright-bx" title="Logout"><span class="fa fa-power-off btn"></span></a>
             </div>
          </div>
        </div>
      </div>
     <?php
	}
	else
	{
     ?>
  <div class="container mr-0 p-0">    
     <div class="m-auto">
        <div class="header-info border-dark">
	        <a href="account/dashboard" class="d-block d-sm-block d-md-none mt-2"><?php echo ADMLOGOTITLE;?></a>
        	 <div class="p-0 d-sm-none d-flex ml-auto">
                <span class="usrnam ml-0 pt-3">Welcome <?php echo $this->lguserinfo["sessName"];?>! ( <?php echo $this->lguserinfo["sessType"];?> )</span><a href="account/logout" class="topright-bx" title="Logout"><span class="fa fa-power-off btn"></span></a>
             </div>
              <input type="checkbox" class="openSidebarMenu" id="openSidebarMenu">
              <label for="openSidebarMenu" class="sidebarIconToggle">
                <div class="spinner diagonal part-1"></div>
                <div class="spinner horizontal"></div>
                <div class="spinner diagonal part-2"></div>
              </label>
              <div id="sidebarMenu">
                <ul class="sidebarMenuInner">
      <li class="logo d-sm-none border-bottom bg-light border-dark"><a href="account/dashboard"><h4 class="mb-0 mt-1"><?php echo ADMLOGOTITLE;?></h4></a></li>
    </ul>
    <div class="accordion">
      <ul>
          <?php
            if(in_array("all", $this->userrights) || in_array("category", $this->userrights))
            {
          ?>
          <li class="pagenav<?php if($sliderexpstatus=="yes") { echo ' open'; } ?>">
            <h4><a name="Masters">Masters</a><i class="fa fa-angle-right"></i></h4>
            <ul<?php if($sliderexpstatus=="yes") { echo ' style="display:block;"'; } ?>>
                <li class="page_item"><i class="fa fa-list"></i><a href="account/category">Manage Category </a></li>
                <li class="page_item"><i class="fa fa-asterisk"></i><a href="account/brand">Manage Brand </a></li>
                <li class="page_item"><i class="fa fa-map-signs"></i><a href="account/zone">Manage Zone </a></li>
                <li class="page_item"><i class="fa fa-cubes"></i><a href="account/products">Manage Products</a></li>
                <li class="page_item"><i class="fa fa-gift"></i><a href="account/gifts">Manage Gifts</a></li>
                <li class="page_item"><i class="fa fa-inr"></i><a href="account/productsprice">Manage Products Price</a></li>
                <li class="page_item"><i class="fa fa-bank"></i><a href="account/warehouse">Manage Warehouse </a></li>
                <li class="page_item"><i class="fa fa-user-circle"></i><a href="account/vendors">Manage Vendors </a></li>
                <li class="page_item"><i class="fa fa-bank"></i><a href="account/outlets">Manage Outlets </a></li>
                <li class="page_item"><i class="fa fa-group"></i><a href="account/customers">Manage Customers </a></li>
                <li class="page_item"><i class="fa fa-paper-plane"></i><a href="account/staff">Manage Staff</a></li>
            </ul>
          </li>
      </ul>
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("brand", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("zone", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("product", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("price", $this->userrights))
        {
      ?>

      <?php
        }
        if(in_array("all", $this->userrights) || in_array("warehouse", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("vendor", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("purchase", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("outlet", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("customer", $this->userrights))
        {
      ?>
      		
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("billing", $this->userrights))
        {
      ?>
      <ul>
      <li class="pagenav<?php if($sliderexpstatus=="yes") { echo ' open'; } ?>">
        <h4><a name="Transactions">Transactions</a><i class="fa fa-angle-right"></i></h4>
         <ul<?php if($sliderexpstatus=="yes") { echo ' style="display:block;"'; } ?>>
         	<li class="page_item"><i class="fa fa-location-arrow"></i><a href="account/purchase">Manage Purchase </a></li>
	     	<li class="page_item"><i class="fa fa-pencil"></i><a href="account/billing">Manage Billing</a></li> 
            <li class="page_item"><i class="fa fa-paper-plane"></i><a href="account/wbilling">Warehouse Billing</a></li>
            <li class="page_item"><i class="fa fa-exchange"></i><a href="account/stocktransfer">Stock Transfer - WH To Outlet </a></li>
      		<li class="page_item"><i class="fa fa-exchange"></i><a href="account/o2wstocktransfer">Stock Transfer - Outlet To WH </a></li>
      		<li class="page_item"><i class="fa fa-exchange"></i><a href="account/o2ostocktransfer">Stock Transfer - Outlet To Outlet </a></li>
      		<li class="page_item"><i class="fa fa-exchange"></i><a href="account/w2wstocktransfer">Stock Transfer - WH To WH </a></li>
            <li class="page_item"><i class="fa fa-power-off"></i><a href="account/dayoff">Day Off </a></li>
            <li class="page_item"><i class="fa fa-ban"></i><a href="account/billing/cnclrqts">Cancellation Requests</a></li>
         </ul>
      </li>
     </ul>    
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("pendingwork", $this->userrights))
        {
      ?>
     <ul>
      <li class="pagenav<?php if($sliderexpstatus=="yes") { echo ' open'; } ?>">
        <h4><a name="Reports">Reports</a><i class="fa fa-angle-right"></i></h4>
         <ul<?php if($sliderexpstatus=="yes") { echo ' style="display:block;"'; } ?>>
          <li class="page_item"><i class="fa fa-bar-chart"></i><a href="account/stockstatus">Stock Status </a></li>
          <li class="page_item"><i class="fa fa-bar-chart-o"></i><a href="account/outletsstock">Outlets Status </a></li>
          <li class="page_item"><i class="fa fa-ban"></i><a href="account/pendingwork">Pending Works</a></li>
          <li class="page_item"><i class="fa fa-bar-chart"></i><a href="account/netstockstatus">Total Stock Status </a></li>
          <li class="page_item"><i class="fa fa-bank"></i><a href="account/stocks">Stock - Warehouse & Outlets </a></li>
          <li class="page_item"><i class="fa fa-file"></i><a href="account/itemledger">Item Ledger </a></li>
	      <li class="page_item"><i class="fa fa-bar-chart"></i><a href="account/itemsale">Item Sale Report </a></li>
          <li class="page_item"><i class="fa fa-bar-chart"></i><a href="account/itemstock">Item Stock </a></li>
          <li class="page_item"><i class="fa fa-bar-chart-o"></i><a href="account/report/sale">Sale Report </a></li>
          <li class="page_item"><i class="fa fa-gears"></i><a href="account/report/discountedsale">Sale Under Scheme </a></li>
         </ul>
       </li>
      </ul>
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("cancellation", $this->userrights))
        {
      ?>
              
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("stransfer", $this->userrights))
        {
      ?>
      
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("sstatus", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("netstockstatus", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("stocks", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("outletstatus", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("itemledger", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("itemstock", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("sale", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("salescheme", $this->userrights))
        {
      ?>
      
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("wdemand", $this->userrights))
        {
      ?>
      <!--<li><span class="material-icons">list</span><a href="account/wdemands">Warehouse Demands </a></li>//-->
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("odemand", $this->userrights))
        {
      ?>
       <!--<li><span class="material-icons">list</span><a href="account/odemands">Outlets Demands </a></li>//-->
      <?php
        }
        if(in_array("all", $this->userrights) || in_array("dayoff", $this->userrights))
        {
      ?>
       
      <?php
        }
        if(in_array("all", $this->userrights))
        {
      ?>
     
      <?php
        }
      ?>
      <ul>
      <li class="pagenav<?php if($sliderexpstatus=="yes") { echo ' open'; } ?>">
        <h4><a name="Settings">Settings</a><i class="fa fa-angle-right"></i></h4>
        <ul<?php if($sliderexpstatus=="yes") { echo ' style="display:block;"'; } ?>>
          <li class="page_item"><i class="fa fa-edit"></i><a href="account/updateinfo">Update Info.</a></li>
      	  <li class="page_item"><i class="fa fa-key"></i><a href="account/changepass">Change Password</a></li>
	      <li class="page_item"><i class="fa fa-database"></i><a href="account/dbbackup">Database Backup</a></li>				        </ul>
       </li>
       
       <ul>
         <li class="pagenav<?php if($sliderexpstatus=="yes") { echo ' open'; } ?>">
        	<h4><a href="account/logout">Logout</a><i class="fa fa-power-off"></i></h4>    
      	 	
         </li>         
	   </ul>

  </div>
        </div>
      </div>
      <?php
	}
      ?>
        <?php $this->load->view("account/" . $main_content); ?>
        
        <div class="clearfix">&nbsp;</div>
      <footer>
    	© <?php echo date("Y");?>, <?php echo WEBNAME;?>
    </footer>
	</div>
    <div class="clearfix"></div>
	
    <!-- <script src="js/main.js"></script> //-->
<?php
	if($this->router->fetch_method()=="report" || $this->router->fetch_method()=="orders" || $main_content=="storders"|| $main_content=="stockstatus"  || $main_content=="outletsstock" || $main_content=="billing" || $main_content=="purchase" || $main_content=="stocktransfer" || $main_content=="managestocktransfer" || $main_content=="customers"  || $main_content=="wdemands" || $main_content=="odemands" || $main_content=="dayoff" || $main_content=="itemledger" || $main_content=="managemergeitem" || $main_content=="o2ostocktransfer" || $main_content=="o2wstocktransfer" || $main_content=="manageo2ostocktransfer" || $main_content=="w2wstocktransfer" || $main_content=="managew2wstocktransfer" || $main_content=="itemstock" || $main_content=="gifts" || $main_content=="managegifts" || $main_content=="itemsale" || $main_content=="wbilling") // include date for specific criteria
	{
?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
    <script>
  	// INCLUDE JQUERY & JQUERY UI 1.12.1
		$( function() {
			$( ".datepicker" ).datepicker({
				dateFormat: "dd-mm-yy",
				maxDate: "<?php echo date("d-m-Y");?>",
				duration: "fast"
			});
			$( ".datepickerfuture" ).datepicker({
				dateFormat: "dd-mm-yy",
				minDate: "<?php echo date("d-m-Y");?>",
				duration: "fast"
			});
		} );
		
	$(document).ready(function() {
    $('.js-example-basic-single').select2();
});
    </script>
    <script src="assets/js/select2.min.js"></script>
    
<?php
	}
?>
    
    <script>
    		$(document).ready(function() {
			$('.minus').click(function () {
				var $input = $(this).parent().find('input');
				var count = parseInt($input.val()) - 1;
				count = count < 1 ? 1 : count;
				$input.val(count);
				$input.change();
				return false;
			});
			$('.plus').click(function () {
				var $input = $(this).parent().find('input');
				$input.val(parseInt($input.val()) + 1);
				$input.change();
				return false;
			});
		});
    </script>
<?php
		if($main_content=="products" || $main_content=="manageproducts" || $main_content=="productsprice"  || $main_content=="purchase"   || $main_content=="managepurchase" || $main_content=="stockstatus" || $main_content=="outletsstock")
	{
?>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>//-->
<script>
$(document).ready(function() {
$('.js-example-basic-single').select2();
//$('.js-example-basic-multiple').select2();
});
</script>
<script src="assets/js/select2.min.js"></script>
<?php
	}
?>

<script>
// In this function every menu which has an active link opens if a link is active. Its ul parent opens itself and adds the class 'open' to its parent (the arrow) so it turns 90 degrees
$('.pagenav li').each(function(i, el) {
  if ($(el).hasClass('current_page_item')) {
    $(el).parent().show().parent().addClass('open');
  };
});

// This function ensures that a menu pops open when you click on it. All other menu's automatically close if the user clicks on a ul header. All the opened ul's close except the one clicked on
$('.accordion h4').click(function(event) {
  $('.accordion > ul > li > ul:visible').not($(this).nextAll('ul')).stop().hide(200).parent().removeClass('open'); //
  $(this).nextAll('ul').slideToggle(200, function() {
    $(this).parent('.pagenav').toggleClass('open');
  });
});
</script>

</body>
</html>
