<?php $user_id=$this->session->userdata('user_id');
if(!$user_id){
  redirect('user/login_view', 'refresh');
}
?>
<!DOCTYPE html>
<html lang="en">

                       <?php
                     $this->load->view('head.php');
                     ?>

<body>

    <div id="wrapper">

      <div class="admin-title">
      <div class="row">
       <?php $this->load->view('header.php'); ?>
      </div>
    </div>
        
     <div class="content-area">
      <div class="row">
        <div class="col-xs-12 col-sm-3 col-md-3">
          <div class="admin-menu">
            <?php $this->load->view('sidebar.php'); ?>
          </div>
        </div>
        <div class="col-xs-12 col-sm-9 col-md-9">
          <div class="main-content">
            
             <div class="panel-heading headingnone">
              <h2 class="transac">Expense Trash</h2>
              
            </div>

            <!-- /.panel-heading -->
           
            <div class="panel-body " id="printableArea" >

              <div class="tab-content">

                <div id="home" class="tab-pane fade in active">


                  <table width="100%" class="table table-striped table-bordered table-hover mytable" id="dataTables-example">
                               
                                <thead>
                                    <tr>
                       <th><p><label><input type="checkbox" id="checkAll" name="check_list[]"/> </label></p></th>
                        <th>DATE</th>
                        <th>TYPE</th>
                        <th>CASH PAY</th>
                        <th>CB</th>
                        <th>cHEQUE PAY</th>
                        <th>TOTAL</th>
                        <th>ACTION</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    
                                     <?php $k=1;
                                    for ($i = 0; $i < count($deptlist); ++$i) {
                                    ?>
                                       <tr class="delete_mem<?php echo $deptlist[$i]->id; ?>">
                              <td><input type="checkbox" id="printpagebutton" id="chk" name="selected_item" value="<?php echo  $deptlist[$i]->id; ?>" /></td>
                              <td><?php echo  date('d F,Y',strtotime($deptlist[$i]->date)); ?></td>
                              <td><?php echo ucfirst($deptlist[$i]->type); ?></td>
                              <td><?php echo number_format($deptlist[$i]->cash_pay,2) ; ?>€</td>
                              <td class="center"><?php echo  number_format($deptlist[$i]->bank_card,2); ?>€</td>
                              <td class="center"><?php echo number_format($deptlist[$i]->cheque_pay,2); ?>€</td>
                              <td class="center"><?php echo  number_format($deptlist[$i]->total,2); ?>€</td>
                                       
                                       
                                        <td class="action type-center"><a class="btn" onclick="mytrash(<?php echo $deptlist[$i]->id;?>)" >recover</a> <a id="printpagebutton" class="btn btn-danger btn-xs" onclick="myFunction(<?php echo $deptlist[$i]->id;?>)" >Remove</a></td>
                                        
                                    </tr>
                                 <?php  } ?>
                               
                                </tbody>
                            </table>
                    </div>

                      </div>
                    </div>

         

     
      
                  </div>
                </div>
              </div>
            </div>
    

    </div>
    <div class="pagi" style ="float:right;">
           <?php echo $this->pagination->create_links(); ?>   
          </div>

  
    
  <script type="text/javascript" src="<?= base_url() ?>assets/admin/js/jquery-1.8.3.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="<?= base_url() ?>assets/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?= base_url() ?>assets/admin/js/my.js"></script>
<script type="text/javascript" src="<?= base_url() ?>assets/admin/js/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>
     <script>
function myFunction(ref) {
    
swal({
          
  title: "Are you sure?",
  text: "Your will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonClass: "btn-danger",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
              var datastr=ref;
     
        //var datastr='ref='+ encodeURIComponent(ref)
       
            $.ajax({
            url: "<?php echo base_url()?>user/trash_delete", 
            type: "POST",
            data    : {'uristring':datastr},
           success: function(data){
    
    
      
  }
        });
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
          $(".delete_mem" + ref).fadeOut('slow');
    
});
  
    }

    </script>
    
    <script>
        function mytrash(ref) {
           swal({
          
  title: "Are you sure?",
  text: "Your will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonClass: "btn-danger",
  confirmButtonText: "Yes, recover it!",
  closeOnConfirm: false
},
function(){
              var datastr=ref;
     
        //var datastr='ref='+ encodeURIComponent(ref)
       
            $.ajax({
            url: "<?php echo base_url()?>user/trash_recover", 
            type: "POST",
            data    : {'uristring':datastr},
           success: function(data){
    
    
      
  }
        });
  swal("Deleted!", "Your imaginary file has been recovered.", "success");
          $(".delete_mem" + ref).fadeOut('slow');
    
});
        }
    </script>
 <style>
     .type-center{
         text-align: center;
         width: 34%;
     }
     .action{
         width: 20%;
     }
     .save{
         margin-right: 650px;
     }
    </style>
</body>

</html>
