
<div class="loaderFull hidden"><div class="loader"></div></div>

<?php
$admin = $this->admin_db->get_admin_details();
$name = $admin[0]['contact_name'];

$approval_count = $this->admin_db->get_pending_approvals_count();

//print_r($inactive);

$type_id = $this->session->userdata('user_type_id');

/** $type_id type listed here
 * BY Rimzan
  1-Master Admin
  3-Sales Manager
  4-Sales Agent
  5-Admin Manager
  6-Admin Agent
 */

if($type_id == 1){
    $admin_privilege = 'super_admin';
}
if($type_id == 2){
    $admin_privilege = 'accountant';
}
if($type_id == 3){
    $admin_privilege = 'sales_manager';
}
if($type_id == 4){
    $admin_privilege = 'salesmen';
}
if($type_id == 5){
    $admin_privilege = 'auditor';
}
if($type_id == 6){
    $admin_privilege = 'director';
}
$all_modules = $this->admin_db->get_admin_privilege_modules($admin_privilege);

$module_array = array();

if($all_modules){
    foreach ($all_modules as $module){
        array_push($module_array, $module['module_name']);
    
    }
}
?>

<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN SIDEBAR -->
	<div class="page-sidebar-wrapper">
		<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
		<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
		<div class="page-sidebar navbar-collapse collapse">
			<!-- BEGIN SIDEBAR MENU -->
			<ul class="page-sidebar-menu" data-auto-scroll="true" data-slide-speed="200">
				<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
				<li class="sidebar-toggler-wrapper">
					<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
					<div class="sidebar-toggler">
					</div>
					<!-- END SIDEBAR TOGGLER BUTTON -->
				</li>
                                
                            <?php if($title == "Dashboard"){ ?>
                                <li class="start active ">
                            <?php }else{ ?>
                                <li class="start ">
                            <?php } ?>
                                    <a href="<?php echo base_url().'dashboard'; ?>">
                                    <i class="icon-home"></i>
                                    <span class="title">Dashboard </span>
                                    <span class="selected"></span>
                                    </a>
                                </li>
                            
                            <?php if (in_array("Suppliers", $module_array)) { ?>
                                <?php if($title == "Suppliers" || $title == "Supplier Profile"){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'suppliers'; ?>">
                                        <i class="icon-users"></i>
                                        <span class="title">Suppliers </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?> 
                            
                            <?php if (in_array("Carriers", $module_array)) { ?>
                                <?php if($title == "Carriers" || $title == "Carrier Profile"){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'carriers'; ?>">
                                        <i class="icon-users"></i>
                                        <span class="title">Carriers </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?> 
                            
                            <?php if (in_array("Customers", $module_array)) { ?>
                                <?php if($title == "Customers" || $title == "Customer Profile" || $title == "View Payment Details"){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'customers'; ?>">
                                        <i class="icon-users"></i>
                                        <span class="title">Customers </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?>  
                            
                            <?php if (in_array("Good Received Notes", $module_array)) { ?>
                                <?php if($title == "Good Received Notes" || $title == "Do Pruchases" || $title == "View Good Received Note"){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'grns'; ?>">
                                        <i class="icon-basket-loaded"></i>
                                        <span class="title">Good Received Notes </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?>  
                            
                            <?php if (in_array("24K Customers", $module_array)) { ?>
                                <?php if($title == "24K Customers" || $title == "24K Customer Profile"){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'24k_customers'; ?>">
                                        <i class="icon-users"></i>
                                        <span class="title">24K Customers </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?>  
                                    
                            <?php if($title == "Sales" || $title == 'Do Sales' || $title == 'View Sale Details' || $title == 'View Returned Sale Details' || $title == "Box Sales" || $title == 'Do Box Sales' || $title == 'View Box Sale Details' || $title == "24K Sales" || $title == 'Do 24K Sales' || $title == 'View 24K Sale Details' || $title == 'View Returned 24K Sale Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                    <a href="javascript:;">
                                    <i class="icon-basket-loaded"></i>
                                    <span class="title">Sales</span>
                                    <span class="arrow "></span>
                                    </a>
                                    <ul class="sub-menu">   
                                        <?php if (in_array("Sales", $module_array)) { ?>       
                                            <?php if($title == "Sales" || $title == 'Do Sales' || $title == 'View Sale Details'){ ?>
                                                <li class="start active ">
                                            <?php }else{ ?>
                                                <li class="start ">
                                            <?php } ?>
                                                    <a href="<?php echo base_url().'sales'; ?>">
                                                    <span class="title">DXB Sales </span>
                                                    <span class="selected"></span>
                                                    </a>
                                                </li>
                                        <?php } ?>
                                    
                                        <?php if (in_array("Box Sales", $module_array)) { ?>       
                                            <?php if($title == "Box Sales" || $title == 'Do Box Sales' || $title == 'View Box Sale Details'){ ?>
                                                <li class="start active ">
                                            <?php }else{ ?>
                                                <li class="start ">
                                            <?php } ?>
                                                    <a href="<?php echo base_url().'box_sales'; ?>">
                                                    <span class="title">Box Sales </span>
                                                    <span class="selected"></span>
                                                    </a>
                                                </li>
                                        <?php } ?>
                                    
                                        <?php if (in_array("24K Sales", $module_array)) { ?>       
                                            <?php if($title == "24K Sales" || $title == 'Do 24K Sales' || $title == 'View 24K Sale Details' || $title == 'View Returned 24K Sale Details'){ ?>
                                                <li class="start active ">
                                            <?php }else{ ?>
                                                <li class="start ">
                                            <?php } ?>
                                                    <a href="<?php echo base_url().'24k_sales'; ?>">
                                                    <span class="title">24K Sales </span>
                                                    <span class="selected"></span>
                                                    </a>
                                                </li>
                                        <?php } ?>
                                    </ul>
                                </li> 
                                    
                            <?php if($title == "Returned DXB Sales" || $title == 'Returned Box Sales' || $title == 'View Returned DXB Sale Details' || $title == 'View Returned Box Sale Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                    <a href="javascript:;">
                                    <i class="icon-basket-loaded"></i>
                                    <span class="title">Returned Sales</span>
                                    <span class="arrow "></span>
                                    </a>
                                    <ul class="sub-menu">   
                                        <?php if (in_array("Returned DXB Sales", $module_array)) { ?>       
                                            <?php if($title == "Returned DXB Sales" || $title == 'View Returned DXB Sale Details'){ ?>
                                                <li class="start active ">
                                            <?php }else{ ?>
                                                <li class="start ">
                                            <?php } ?>
                                                    <a href="<?php echo base_url().'returned_sales?type=dxb'; ?>">
                                                    <span class="title">Returned DXB Sales </span>
                                                    <span class="selected"></span>
                                                    </a>
                                                </li>
                                        <?php } ?>
                                    
                                        <?php if (in_array("Returned Box Sales", $module_array)) { ?>       
                                            <?php if($title == "Returned Box Sales" || $title == 'View Returned Box Sale Details'){ ?>
                                                <li class="start active ">
                                            <?php }else{ ?>
                                                <li class="start ">
                                            <?php } ?>
                                                    <a href="<?php echo base_url().'returned_sales?type=box'; ?>">
                                                    <span class="title">Returned Box Sales </span>
                                                    <span class="selected"></span>
                                                    </a>
                                                </li>
                                        <?php } ?>
                                    </ul>
                                </li> 
                                
                            <?php if($title == "Debtors" || $title == 'View Debtor Details' || $title == "Box Debtors" || $title == 'View Box Debtor Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                    <a href="javascript:;">
                                    <i class="icon-user"></i>
                                    <span class="title">Debtors</span>
                                    <span class="arrow "></span>
                                    </a>
                                    <ul class="sub-menu"> 
                                        <?php if (in_array("Debtors", $module_array)) { ?>    
                                            <?php if($title == "Debtors" || $title == 'View Debtor Details'){ ?>
                                                <li class="start active ">
                                            <?php }else{ ?>
                                                <li class="start ">
                                            <?php } ?>
                                                    <a href="<?php echo base_url().'debtors'; ?>">
                                                    <span class="title">DXB Debtors </span>
                                                    <span class="selected"></span>
                                                    </a>
                                                </li>
                                        <?php } ?>
                                
                                        <?php if (in_array("Box Debtors", $module_array)) { ?>    
                                            <?php if($title == "Box Debtors" || $title == 'View Box Debtor Details'){ ?>
                                                <li class="start active ">
                                            <?php }else{ ?>
                                                <li class="start ">
                                            <?php } ?>
                                                    <a href="<?php echo base_url().'box_debtors'; ?>">
                                                    <span class="title">Box Debtors </span>
                                                    <span class="selected"></span>
                                                    </a>
                                                </li>
                                        <?php } ?>
                                    </ul>
                                </li> 
                                
                            <?php if (in_array("Creditors", $module_array)) { ?>  
                                <?php if($title == "Creditors" || $title == 'Creditor Profile' || $title == "Settle Creditor" || $title == "Settle UNA Creditor"){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                    <a href="javascript:;">
                                    <i class="icon-user"></i>
                                    <span class="title">Creditors</span>
                                    <span class="arrow "></span>
                                    </a>
                                    <ul class="sub-menu">
                                        <?php if($title == "Creditors" || $title == 'Creditor Profile'){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                            <a href="<?php echo base_url().'creditors'; ?>">
                                            Creditors</a>
                                        </li>
                                        <?php if($title == "Settle Creditor"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                            <a href="<?php echo base_url().'creditor_settlements'; ?>">
                                            Creditor Settlement</a>
                                        </li>
                                        <?php if($title == "Settle UNA Creditor"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                            <a href="<?php echo base_url().'una_creditor_settlements'; ?>">
                                            UNA Creditor Settlement</a>
                                        </li>
                                    </ul>
                                </li>  
                            <?php } ?> 
                                
                            <?php if (in_array("Cheques", $module_array)) { ?>  
                                <?php if($title == "Cheques" || $title == 'View Cheque Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'cheques'; ?>">
                                        <i class="icon-calendar"></i>
                                        <span class="title">Cheques </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?> 
                                
                            <?php if (in_array("Expenses", $module_array)) { ?>  
                                <?php if($title == "Expenses" || $title == 'Add Expenses' || $title == 'View Expense Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'expenses'; ?>">
                                        <i class="fa fa-minus-circle"></i>
                                        <span class="title">Expenses </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?> 
                                
                            <?php if (in_array("Other Income", $module_array)) { ?>  
                                <?php if($title == "Other Income" || $title == 'Add Other Income' || $title == 'View Other Income Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'other_income'; ?>">
                                        <i class="fa fa-plus-circle"></i>
                                        <span class="title">Other Income </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?> 
                                
                            <?php if (in_array("Approvals", $module_array)) { ?>
                                <?php if($title == "Approvals" || $title == 'View Request Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'approvals'; ?>">
                                        <i class="icon-bell"></i>
                                        <span class="badge badge-danger" id="approval_count"><?php echo $approval_count; ?></span>
                                        <span class="title">Approvals </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?>
                                
                            <?php if (in_array("UNA", $module_array)) { ?>
                                <?php if($title == "UNA" || $title == 'Purchase UNA' || $title == 'View UNA Details' || $title == 'View UNA Payment Details'){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'una'; ?>">
                                        <i class="icon-disc"></i>
                                        <span class="title">UNA Details </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?>
                                
                            <?php if (in_array("Reports", $module_array)) { ?>
                                <?php if($title == "Reports" || $title == "DXB Sales Report" || $title == "BOX Sales Report" || $title == "24K Sales Report" || $title == "DXB Debtors Detailed Report" || $title == "DXB Debtors Aging Report" || $title == "DXB Cash Logs Report" || $title == "Sales Return Report" || $title == "DXB Sales Receipts Report"){ ?>
                                    <li class="start active ">
                                <?php }else{ ?>
                                    <li class="start ">
                                <?php } ?>
                                        <a href="<?php echo base_url().'reports'; ?>">
                                        <i class="fa fa-stack-overflow"></i>
                                        <span class="title">Reports </span>
                                        <span class="selected"></span>
                                        </a>
                                    </li>
                            <?php } ?>
                                
                            <?php if($title == "Stock Balances" || $title == "Stock Balance Details" || $title == "User Privileges" || $title == "User Module Privileges" || $title == "System Users" || $title == "User Profile" || $title == "Bank Accounts" || $title == "Bank Account Profile" || $title == "Stock Items" || $title == "Stock Item Details" || $title == "Rates" || $title == "Rate Details" || $title == "Expense Categories" || $title == "Expense Category Details" || $title == "Daily Audits" || $title == "Daily Audit Details" || $title == "Stock Item Categories" || $title == "Stock Item Category Details"){ ?>
                                <li class="start active ">
                            <?php }else{ ?>
                                <li class="start ">
                            <?php } ?>
                                    <a href="javascript:;">
                                    <i class="icon-settings"></i>
                                    <span class="title">Settings</span>
                                    <span class="arrow "></span>
                                    </a>
                                    <ul class="sub-menu">
                                        
                                    <?php if (in_array("Daily Audit", $module_array)) { ?>
                                        <?php if($title == "Daily Audits" || $title == "Daily Audit Details"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'daily_audits'; ?>">
                                                Daily Audits</a>
                                            </li>
                                    <?php } ?>
                                        
                                    <?php if (in_array("Stock Items", $module_array)) { ?>
                                        <?php if($title == "Stock Items" || $title == "Stock Item Details"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'stock_items'; ?>">
                                                Stock Items</a>
                                            </li>
                                    <?php } ?>
                                        
                                    <?php if (in_array("Stock Item Categories", $module_array)) { ?>
                                        <?php if($title == "Stock Item Categories" || $title == "Stock Item Category Details"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'stock_item_categories'; ?>">
                                                Stock Item Categories</a>
                                            </li>
                                    <?php } ?>
                                        
                                    <?php if (in_array("Expense Categories", $module_array)) { ?>
                                        <?php if($title == "Expense Categories" || $title == "Expense Category Details"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'expense_categories'; ?>">
                                                Expense Categories</a>
                                            </li>
                                    <?php } ?>
                                        
                                    <?php if (in_array("Bank Accounts", $module_array)) { ?>
                                        <?php if($title == "Bank Accounts" || $title == "Bank Account Profile"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'bank_accounts'; ?>">
                                                Bank Accounts</a>
                                            </li>
                                    <?php } ?>
                                            
                                    <?php if (in_array("User Privileges", $module_array)) { ?>
                                        <?php if($title == "User Privileges"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'user_privileges'; ?>">
                                                User Privileges</a>
                                            </li>
                                    <?php } ?>
                                        
                                    <?php if (in_array("User Module Privileges", $module_array)) { ?>
                                        <?php if($title == "User Module Privileges"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'user_module_privileges'; ?>">
                                                User Module Privileges</a>
                                            </li>
                                    <?php } ?>
                                    
                                    <?php if (in_array("System Users", $module_array)) { ?>    
                                        <?php if($title == "System Users" || $title == "User Profile"){ ?>
                                            <li class="start active ">
                                        <?php }else{ ?>
                                            <li class="start ">
                                        <?php } ?>
                                                <a href="<?php echo base_url().'system_users'; ?>">
                                                System Users</a>
                                            </li>
                                    <?php } ?>
                                    </ul>
				</li>
			</ul>
			<!-- END SIDEBAR MENU -->
		</div>
	</div>
	<!-- END SIDEBAR -->
        
        <!-- BEGIN CONTENT -->
        <div class="page-content-wrapper">
            <div class="page-content">
                <!-- BEGIN PAGE HEADER-->
                <div class="row">
                    <div class="col-md-12">
                        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                        <h3 class="page-title">
                        <?php echo $title; ?> <small>statistics and more</small>
                        </h3>
                        <ul class="page-breadcrumb breadcrumb">
                            <li>
                                <i class="fa fa-home"></i>
                                <a href="<?php echo base_url().'dashboard'; ?>">Home</a>
                                <i class="fa fa-angle-right"></i>
                            </li>
                            <li>
                                <a href="#"><?php echo $title; ?></a>
                            </li>
                            <li class="pull-right no-text-shadow">
                                <div id="" class="dashboard-date-range tooltips no-tooltip-on-touch-device responsive" data-tablet="" data-desktop="tooltips" data-placement="top" data-original-title="" style="display: block;">
                                    <i class="icon-calendar"></i>
                                    <span><?php echo date('l | jS \of F Y') ?></span>
                                </div>
                            </li>
                        </ul>
                        <!-- END PAGE TITLE & BREADCRUMB-->
                    </div>
                </div>
                <!-- END PAGE HEADER-->