<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div id="breadcrumb">
  <div class="container">
    <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>

  </div>
</div>
<div id="group-content">
<div>
<div id="content"><?php echo $content_top; ?>

    <h1 class="title-category"><?php echo $heading_title; ?></h1>
  <table class="list">
    <thead>
      <tr>
        <td class="left" colspan="2"><?php echo $text_order_detail; ?></td>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="left"><?php if ($invoice_no) { ?>
          <b><?php echo $text_invoice_no; ?></b> <?php echo $invoice_no; ?><br />
          <?php } ?>
          <b><?php echo $text_order_id; ?></b> #<?php echo $order_id; ?><br />
          <b><?php echo $text_date_added; ?></b> <?php echo $date_added; ?></td>
        <td class="left"><?php if ($payment_method) { ?>
          <b><?php echo $text_payment_method; ?></b> <?php echo $payment_method; ?><br />
              <?php
              if (!empty($pedidoRede))
              {
                  if (isset($pedidoRede['forma_pagamento']))
                  {
                      echo "<strong>".$text_formapg.":</strong> ".$pedidoRede['forma_pagamento']."<br>";
                  }
                  if ($pedidoRede['forma_pagamento'] == 'CRÉDITO' && $pedidoRede['parcelas'] != "")
                  {
                      echo "<strong>".$text_parcelas.": </strong> ";
                      if ($pedidoRede['parcelas'] > 0)
                          echo $pedidoRede['parcelas']."<br>";
                      else
                          echo $text_avista.'<br>';
                  }

                  if ($pedidoRede['forma_pagamento'] == 'CRÉDITO' && $pedidoRede['card_scheme']!="")
                  {
                      echo '<strong>'.$text_bandeira.': </strong>'.$pedidoRede['card_scheme']."<br>";
                  }

                  if ($pedidoRede['auth_code'] != "")
                  {
                      echo '<strong>'.$text_codigo.': </strong>'.$pedidoRede['auth_code']."<br>";
                  }

                  if ($pedidoRede['forma_pagamento'] == "BOLETO" && isset($pedidoRede['url_boleto']) && $pedidoRede['url_boleto'] != '')
                  {
                      ?><a href="<?php echo $pedidoRede['url_boleto']; ?>" class="button" target="_blank"><?php echo $text_imprimir_boleto; ?></a><br><?php
                  }
              }
              ?>
          <?php } ?>
          <?php if ($shipping_method) { ?>
          <b><?php echo $text_shipping_method; ?></b> <?php echo $shipping_method; ?>
          <?php } ?></td>
      </tr>
    </tbody>
  </table>




  <!-- TABLE -->
<table class="table table-action list">

  <thead>
    <tr>
      <th class="t-medium"><?php echo $text_payment_address; ?></th>
	  <?php if ($shipping_address) { ?>
      <th class="t-medium"><?php echo $text_shipping_address; ?></th>
	  <?php } ?>
    </tr>
  </thead>

  <tbody>
    <tr>


	  <td class="fix"></td>

	  <td class="info_responsive"><b><?php echo $text_payment_address; ?></b></td>
	  <td><?php echo $payment_address; ?></td>

	  <td class="info_responsive"><b><?php echo $text_shipping_address; ?></b></td>
	  <?php if ($shipping_address) { ?>
	  <td><?php echo $shipping_address; ?></td>
	  <?php } ?>
	  </tr>

		<td class="fix-margin"></td>



  </tbody>
</table>
<!-- END TABLE -->



		<script>
			function onAction(prodid, v1) {
				 var valor = $("input[name=quantity_"+prodid+"]").val();

				if ((valor > 1) || (parseInt(v1, 10) == 1)){
					$("input[name=quantity_"+prodid+"]").val(parseInt( valor, 10 ) + parseInt(v1, 10));
				}
			};

			function carrinhoAdd(prodid){
			 var valor = $("input[name=quantity_"+prodid+"]").val();
			 addToCart(prodid, valor);
			}
		</script>

	<style>

	.t-medium{
		padding: 7px !important;
		background-color: #F6F6F6 !important;
	}

	</style>


	 <!-- TABLE -->
<?php foreach ($products as $product) { ?>
<table class="table table-action list">

  <thead>
    <tr>
      <th class="t-medium"><?php echo $column_name; ?></th>
      <th class="t-medium"><?php echo $column_model; ?></th>
	  <th class="t-medium"><?php echo $column_quantity; ?></th>
	  <th class="t-medium"><?php echo $column_price; ?></th>
	  <th class="t-medium"><?php echo $column_repurchase; ?></th>


    </tr>
  </thead>

  <tbody>
    <tr>


	  <td class="fix"></td>

	  <td class="info_responsive"><b><?php echo $column_name; ?></b></td>
	  <td>
		<?php echo $product['name']; ?>
          <?php foreach ($product['option'] as $option) { ?>
          <br />
          &nbsp;<small> - <?php echo $option['name']; ?>: <?php echo $option['value']; ?></small>
          <?php } ?>
      </td>

	  <td class="info_responsive"><b><?php echo $column_model; ?></b></td>
	  <td><?php echo  $product['model']; ?></td>

	  <td class="info_responsive"><b><?php echo $column_quantity; ?></b></td>
	  <td class="quantidade">

			<input type="button" id="decrease_<?php echo $product['product_id']; ?>" value="-"  onclick="javascript:onAction('<?php echo $product['product_id']; ?>', -1, 'af');" style="width:20px; text-indent:0px;" />
			<input type="text" name="quantity_<?php echo $product['product_id']; ?>" style="width:35px;" size="2" value="<?php echo $product['quantity']; ?>" class="numeric">
			<input type="button" id="increase_<?php echo $product['product_id']; ?>" value="+" onclick="javascript:onAction('<?php echo $product['product_id']; ?>', 1, 'af');" style="width:20px; text-indent:0px;"/>

	  </td>

	  <td class="info_responsive"><b><?php echo $column_price; ?></b></td>
	  <td class="preco"><?php echo $product['price']; ?></td>

	  <td class="info_responsive"><b><?php echo $column_repurchase; ?></b></td>
	  <td class="pedido-total">
      <div style="margin:5px;">
        <a onclick="carrinhoAdd('<?php echo $product['product_id']; ?>');" ><i class="fa fa-shopping-cart recover-list" aria-hidden="true"></i></a>
      </div>
	  </td>

	  <?php } ?>
	  </tr>

	  <table class="table table-action list">
	  <?php foreach ($vouchers as $vouchers) { ?>
                            <tr>
                                <td class="image"></td>
                                <td class="name"><?php echo $vouchers['description']; ?></td>
                                <td class="quantity"><input type="text" name="" value="1" size="1" disabled="disabled" />
                                    &nbsp;<a href="<?php echo $vouchers['remove']; ?>" class="remove-item"><img src="catalog/view/theme/default/image/remove.png" alt="<?php echo $button_remove; ?>" title="" /></a></td>
                                <td class="price"><?php echo $vouchers['amount']; ?></td>
                                <td class="total"><?php echo $vouchers['amount']; ?></td>
                            </tr>
                            <?php } ?>

      <?php foreach ($totals as $total) { ?>
      <tr>
        <td colspan="4" class="right"><b><?php echo $total['title']; ?>:</b></td>
        <td class="right"><?php echo $total['text']; ?></td>
        <?php if ($products) { ?>
        <?php } ?>
      </tr>
      <?php } ?>
	  </table>



		<td class="fix-margin"></td>



  </tbody>
</table>
<!-- END TABLE -->

  <?php if ($comment) { ?>
  <table class="list">
    <thead>
      <tr>
        <td class="left"><?php echo $text_comment; ?></td>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="left"><?php echo $comment; ?></td>
      </tr>
    </tbody>
  </table>
  <?php } ?>
  <?php if ($histories) { ?>
  <h2><?php echo $text_history; ?></h2>


  <!-- TABLE -->
<?php foreach ($histories as $history) { ?>
<table class="table table-action list">

  <thead>
    <tr>
      <th class="t-medium"><?php echo $column_date_added; ?></th>
      <th class="t-medium"><?php echo $column_status; ?></th>
	   <?php if ($history['comment']) { ?>
	  <th class="t-medium"><?php echo $column_comment; ?></th>
	  <?php } ?>
    </tr>
  </thead>

  <tbody>
    <tr>


	  <td class="fix"></td>

	  <td class="info_responsive"><b><?php echo $column_date_added; ?></b></td>
	  <td><?php echo $history['date_added']; ?></td>

	  <td class="info_responsive"><b><?php echo $column_status; ?></b></td>
	  <td><?php echo $history['status']; ?></td>

	  <?php if ($history['comment']) { ?>
	  <td class="info_responsive"><b><?php echo $column_comment; ?></b></td>
	  <td><?php echo $history['comment']; ?> </td>
	  <?php } ?>

	  <?php } ?>
	  </tr>

		<td class="fix-margin"></td>



  </tbody>
</table>
<?php } ?>
<!-- END TABLE -->

  <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; ?>
