<!doctype html>

<html lang="en">

<head>

        <meta charset="utf-8">

        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

        <title><?php echo $this->session->userdata("company");?> Commodity Admin</title>

        <!-- App favicon -->

        <link rel="shortcut icon" href="<?php echo base_url();?>adminassets/dist/img/favicon.png">

        <!--Global Styles(used by all pages)-->

        <link href="<?php echo base_url();?>adminassets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">

        <link href="<?php echo base_url();?>adminassets/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">

        <link href="<?php echo base_url();?>adminassets/plugins/fontawesome/css/all.min.css" rel="stylesheet">

        <link href="<?php echo base_url();?>adminassets/plugins/typicons/src/typicons.min.css" rel="stylesheet">

        <link href="<?php echo base_url();?>adminassets/plugins/themify-icons/themify-icons.min.css" rel="stylesheet">

        <!--Third party Styles(used by this page)--> 

        <link href="<?php echo base_url();?>adminassets/plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">

        <!--Start Your Custom Style Now-->

        <link href="<?php echo base_url();?>adminassets/dist/css/style.css" rel="stylesheet">

		<script src="<?php echo base_url();?>adminassets/plugins/jQuery/jquery-3.4.1.min.js"></script>

        <script src="<?php echo base_url();?>adminassets/dist/js/popper.min.js"></script>

        <script src="<?php echo base_url();?>adminassets/plugins/bootstrap/js/bootstrap.min.js"></script>

    </head>

    <body class="fixed">

        <!-- Page Loader -->

        <div class="page-loader-wrapper">

            <div class="loader">

                <div class="preloader">

                    <div class="spinner-layer pl-green">

                        <div class="circle-clipper left">

                            <div class="circle"></div>

                        </div>

                        <div class="circle-clipper right">

                            <div class="circle"></div>

                        </div>

                    </div>

                </div>

                <p>Please wait...</p>

            </div>

        </div>

        <!-- #END# Page Loader -->

        <div class="wrapper">

            <!-- Sidebar  -->

            <nav class="sidebar sidebar-bunker">

                <div class="sidebar-header" style="background:#fff;">

                    <!--<a href="index.html" class="logo"><span>bd</span>task</a>-->

                    <a href="<?php echo base_url();?>" class="logo"><img src="<?php echo base_url();?>assets/images/logo2.png" alt=""></a>

                </div><!--/.sidebar header-->

                <div class="profile-element d-flex align-items-center flex-shrink-0">

                    <div class="avatar online">

                        <img src="<?php echo base_url();?>adminassets/dist/img/avatar5.png" class="img-fluid rounded-circle" alt="">

                    </div>

                    <div class="profile-text">

                        <h6 class="m-0"><?php echo strtoupper($this->session->userdata("loggeduser"));?></h6>

                    </div>

                </div><!--/.profile element-->

               

                <div class="sidebar-body">

                    <nav class="sidebar-nav">

                        <ul class="metismenu">

                            <li <?php if(!$this->uri->segment(2)){echo 'class="mm-active"';}?>><a href="<?php echo base_url();?>swadmin"><i class="fa fa-home mr-2"></i> Dashboard</a></li>

                            <li <?php if($this->uri->segment(2)=='settings'){echo 'class="mm-active"';}?>><a href="<?php echo base_url();?>swadmin/settings"><i class="fa fa-cog mr-2"></i> Settings</a></li>

                            <li <?php if($this->uri->segment(2)=='users' || $this->uri->segment(2)=='user_report'){echo 'class="mm-active"';}?>><a href="<?php echo base_url();?>swadmin/users"><i class="fa fa-users mr-2"></i> Clients</a></li>

                            <li <?php if($this->uri->segment(2)=='deposites'){echo 'class="mm-active"';}?>>

                                <a class="has-arrow material-ripple" href="#">

                                    <i class="fa fa-credit-card mr-2"></i>

                                    Manage Deposites

                                </a>

                                <ul class="nav-second-level">

                                    <li><a href='<?php echo base_url();?>swadmin/deposites'>New/Pending Deposites</a></li>

                                    <li><a href='<?php echo base_url();?>swadmin/deposites/Reject'>Rejected</a></li>

                                    <li><a href='<?php echo base_url();?>swadmin/deposites/Approved'>Approved</a></li>

                                </ul>

                            </li>

                            <li <?php if($this->uri->segment(2)=='withdrawls'){echo 'class="mm-active"';}?>>

                                <a class="has-arrow material-ripple" href="#">

                                    <i class="fa fa-credit-card mr-2"></i>

                                    Manage WithDrawals

                                </a>

                                <ul class="nav-second-level">

                                    <li><a href='<?php echo base_url();?>swadmin/withdrawls'>New/Pending WithDrawls</a></li>

                                    <li><a href='<?php echo base_url();?>swadmin/withdrawls/Reject'>Rejected</a></li>

                                    <li><a href='<?php echo base_url();?>swadmin/withdrawls/Approved'>Approved</a></li>

                                </ul>

                            </li>
                           <li <?php if($this->uri->segment(2)=='enquiries'){echo 'class="mm-active"';}?>><a href="<?php echo base_url();?>swadmin/enquiries"><i class="fa fa-envelope mr-2"></i> Contact Enquiries</a></li>
							
                            <li <?php if($this->uri->segment(2)=='notifications'){echo 'class="mm-active"';}?>><a href="<?php echo base_url();?>swadmin/enquiries"><i class="fa fa-bell mr-2"></i> Notifications</a></li>
                        </ul>

                    </nav>

                </div><!-- sidebar-body -->

            </nav>

             <div class="content-wrapper">

                <div class="main-content">

                    <nav class="navbar-custom-menu navbar navbar-expand-lg m-0">

                        <div class="sidebar-toggle-icon" id="sidebarCollapse">

                            sidebar toggle<span></span>

                        </div><!--/.sidebar toggle icon-->

                        <div class="d-flex flex-grow-1">

                            <ul class="navbar-nav flex-row align-items-center ml-auto">

                                <!--/.dropdown-->

                                <li class="nav-item">

                                    <a class="nav-link" href="<?php echo base_url();?>swadmin/enquiries"><i class="typcn typcn-messages"></i></a>

                                </li>

                                <li class="nav-item dropdown notification">

                                    <a class="nav-link dropdown-toggle badge-dot" href="#" data-toggle="dropdown">

                                        <i class="typcn typcn-bell"></i>

                                    </a>

                                    <div class="dropdown-menu dropdown-menu-right">
<!--
                                        <h6 class="notification-title">Notifications</h6>-->

                                        <p class="notification-text">You have <?php 
										
										echo $this->db->get_where("notifications",array("notif_read"=>"","notif_user"=>""))->num_rows();?> unread notification</p>

                                        <div class="notification-list">
											<?php 
											
											$this->db->limit(4);$this->db->order_by("notif_id","desc");
											$chk=$this->db->get_where("notifications",array("notif_read"=>"","notif_user"=>""));
											$notes=$chk->result();
											foreach($notes as $n){?>
                                            <div class="media new">

                                                <div class="img-user"><img src="<?php echo base_url();?>adminassets/dist/img/avatar.png" alt=""></div>

                                                <a class="media-body" href="<?php echo base_url().'swadmin/users';?>">

                                                    <h6><?php echo $n->notif_title;?><br/>
                                                    <small><?php echo $n->notif_msg;?></small></h6>
                                                    

                                                    <label class="badge badge-warning"><i class="fa fa-clock-o"></i> 
                                                    <?php 
													//$time_ago =  strtotime($n->notif_datetime) ? strtotime($time_ago) : $time_ago;
													$time  = time() - strtotime($n->notif_datetime);


// seconds
if($time <= 60){
$ttt= 'less than a minute ago';
}else if($time >= 60 && $time < 3600){
$ttt= (round($time/60) == 1) ? 'a minute' : round($time/60).' minutes ago';
}else if($time >= 3600 && $time < 86400){
$ttt= (round($time/3600) == 1) ? 'a hour ago' : round($time/3600).' hours ago';
}else if($time >= 86400 && $time < 604800){
$ttt= (round($time/86400) == 1) ? 'a day ago' : round($time/86400).' days ago';
}else if($time >= 604800 && $time < 2600640){
$ttt= (round($time/604800) == 1) ? 'a week ago' : round($time/604800).' weeks ago';
}else if($time >= 2600640 && $time < 31207680){
$ttt= (round($time/2600640) == 1) ? 'a month ago' : round($time/2600640).' months ago';
}else if($time >= 31207680){
$ttt= (round($time/31207680) == 1) ? 'a year ago' : round($time/31207680).' years ago';
}echo '<i class="fa fa-clock-o"></i>'.$ttt;?>
                                                    </label>

                                                </a>

                                            </div><!--/.media -->
											<?php  }?>
                                            

                                        </div><!--/.notification -->

                                        <div class="dropdown-footer"><a href="<?php echo base_url().'swadmin/notifications';?>">View All Notifications</a></div>

                                    </div><!--/.dropdown-menu -->

                                </li><!--/.dropdown-->

                                <li class="nav-item dropdown user-menu">

                                    <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown">

                                        <!--<img src="<?php echo base_url();?>adminassets/dist/img/user2-160x160.png" alt="">-->

                                        <i class="typcn typcn-user-add-outline"></i>

                                    </a>

                                    <div class="dropdown-menu dropdown-menu-right" >

                                        <div class="dropdown-header d-sm-none">

                                            <a href="#" class="header-arrow"><i class="icon ion-md-arrow-back"></i></a>

                                        </div>

                                        <div class="user-header">

                                            <!--<div class="img-user">

                                                <img src="<?php echo base_url();?>adminassets/dist/img/avatar-1.jpg" alt="">

                                            </div>  -->

                                            <h6><?php echo $this->session->userdata("loggeduser");?></h6>

                                            

                                        </div><!-- user-header -->

                                        <!--<a href="#" class="dropdown-item"><i class="typcn typcn-user-outline"></i> My Profile</a>

                                        <a href="#" class="dropdown-item"><i class="typcn typcn-arrow-shuffle"></i> Activity Logs</a>

                                        <a href="#" class="dropdown-item"><i class="typcn typcn-cog-outline"></i> Account Settings</a>-->

                                        <a href="<?php echo base_url().'swadmin/logout';?>" class="dropdown-item"><i class="typcn typcn-key-outline"></i> Sign Out</a>

                                    </div><!--/.dropdown-menu -->

                                </li>

                            </ul><!--/.navbar nav-->

                            <div class="nav-clock">

                                <div class="time">

                                    <span class="time-hours"></span>

                                    <span class="time-min"></span>

                                    <span class="time-sec"></span>

                                </div>

                            </div><!-- nav-clock -->

                        </div>

                    </nav><!--/.navbar-->

           