<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <h1><?php echo $heading_title; ?></h1>
  <?php if ($orders) { ?>
  <?php foreach ($orders as $order) { ?>
  <div class="order-list">
    <div class="order-id"><b><?php echo $text_order_id; ?></b> #<?php echo $order['order_id']; ?></div>


            <?php
            $segundavia = $this->db->query("select o.payment_code from `" . DB_PREFIX . "order` o inner join `" . DB_PREFIX . "order_status` os on o.order_status_id=os.order_status_id where o.order_id = '" . $order['order_id'] . "'  and o.payment_code like 'boleto%' and os.name <> 'Completo' and os.name <> 'Entregue'");
                if (isset($segundavia->row['payment_code'])){
                    $this->load->library('encryption');
            		$encryption = new Encryption($this->config->get('config_encryption'));
                    echo '<div class="order-status"><a style="font-weight:bold;color:red" target="_blank" href="index.php?route=payment/' . $segundavia->row['payment_code'] . '/callback&order_id=' . $encryption->encrypt($order['order_id']) . '">Emitir 2&ordf; via do Boleto</a></div>';
                }
            ?>


    <div class="order-status"><b><?php echo $text_status; ?></b> <?php echo $order['status']; ?></div>
    <div class="order-content">
      <div><b><?php echo $text_date_added; ?></b> <?php echo $order['date_added']; ?><br />
        <b><?php echo $text_products; ?></b> <?php echo $order['products']; ?></div>
      <div><b><?php echo $text_customer; ?></b> <?php echo $order['name']; ?><br />
        <b><?php echo $text_total; ?></b> <?php echo $order['total']; ?></div>
      <div class="order-info">
        <a href="<?php echo $order['href']; ?>" title="<?php echo $button_view; ?>" alt="<?php echo $button_view; ?>" ><i class="fa fa fa-bars recover-list" aria-hidden="true"></i></a>
      	<!-- <a href="<?php //echo $order['reorder']; ?>"><img src="catalog/view/theme/default/image/re-order.png" alt="<?php //echo $button_reorder; ?>" title="<?php //echo $button_reorder; ?>" /></a> -->
      </div>
    </div>
  </div>
  <?php } ?>
  <div class="pagination"><?php echo $pagination; ?></div>
  <?php } else { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <?php } ?>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><?php echo $button_continue; ?></a></div>
  </div>
  <?php echo $content_bottom; ?></div>
<?php echo $footer; ?>
