<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?php
      $this->load->view('user/common_style');
      $this->load->view('user/header');
    ?> 
  
</head>
  <body >
      <?php
        $this->load->view('user/login_header');
        $currency_info = defaultcurrency();
      ?>

     <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
      
    <?php if($this->session->flashdata('success_message')) {?>
      <p class="frgtpwd frgtpwd1"><i class="fa fa-thumbs-up"></i><?php echo $this->session->flashdata('success_message');?></p>
      <?php } elseif ($this->session->flashdata('error_message')) { ?>
       <p class="frgtpwd frgtpwd1 frgtpwdred"><i class="fa fa-thumbs-down"></i><?php echo $this->session->flashdata('error_message');?></p>
      <?php } else { }?>
     <div class="table-list clearfix mb-20">

    <h4 class="other-title theme-color">My Order History</h4>
    
    <div class="table-responsive  main-table">
       
       <table>
          <thead>
            <tr>
              <th>Time</th>
              <th>Type</th>
              <th>Pair</th>
              <th>Price</th>
              <th>Amount(Locked)</th>
              <th>Total</th>
              <th style="text-align:center;">Action</th>
            </tr>
          </thead>
          <tbody>
          <?php
            $userid=$this->session->userdata('uusersid');
            $res=$this->db->query("select * from exchange where type in('3','4') and status='1' and userid='$userid' and exchange_mode='0' order by date desc");
            $row=$res->result();
            if($row)
            {
              foreach($row as $row)
              {
                $type=$row->type;
                if($type=="3")
                  $type="<span class='green'>BUY</span>";
                else
                  $type="<span class='purple'>SELL</span>";

                $first_dat=$this->db->query("select * from coin_info where coid='".$row->pair."'");
                $fir_d=$first_dat->result();
                $sec_dat=$this->db->query("select * from coin_info where coid='".$row->market_type."'");
                $sec_d=$sec_dat->result();
                $pair=strtoupper($fir_d[0]->coin_symbol).'/'.strtoupper($sec_d[0]->coin_symbol);
            ?>
                <tr>
                  <td><?php echo $row->date;?></td>
                  <td><?php echo $type;?></td>
                  <td><?php echo $pair;?></td>
                  <td><?php echo $row->price;?> <?php echo strtoupper($sec_d[0]->coin_symbol);?></td>
                  <td><?php echo $row->amount;?> <?php echo strtoupper($fir_d[0]->coin_symbol);?></td>
                  <td><?php echo $row->total;?> <?php echo strtoupper($sec_d[0]->coin_symbol);?></td>
                  <td>
                    <a href="<?php echo base_url();?>cancel/<?php echo $row->cid;?>" style='color:#345678;text-decoration:underline !important;' title='Ask/buy'> <i class="fa fa-close"></i>cancel</a>
                  </td>

                </tr>

                <?php
              }

            }

          ?>
         
          </tbody>
        </table>

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

<?php
$this->load->view('user/footer');
$this->load->view('user/common_script');
  // $this->load->view('user/result_check');
?>
  </body>
</html>
