<ol class="one-page-checkout" id="checkoutSteps">
  <li id="opc-billing" class="section allow active">
    <div id="checkout-step-billing">
      <?php if (!isset($redirect)) { ?>
        <?php if($text_link_account) { ?>
          <div class="warning">
            <span>
              <?php echo $text_link_account; ?>
              <i class="btn-close fas fa-times" aria-hidden="true"></i>
            </span>
          </div>
        <?php } ?>
        <div class="checkout-product">
          <?php foreach ($cartlist as $keyTipo => $cartTipo) { ?>
            <?php foreach ($cartTipo as $keylista => $lista) {  ?>
              <?php if ($lista['isListaEscolar']) { ?>
                <span class="text-medium text-dark visible-block top-padding-medium"><?php echo $lista['serie']; ?></span>
                <span class="text-small text-gray visible-block top-margin-x-small bottom-padding-medium"><?php echo $lista['escola']; ?></span>
              <?php } ?>
              <?php if (isset($lista['observation']) && (!empty($lista['observation']))) { ?>
                <span class="text-small text-gray visible-block top-margin-x-small bottom-padding-medium"><?php echo $lista['observation']; ?></span>
              <?php } ?>
              <table class="table table-action" id="shopping-cart-table">
                <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>
                    <?php $modulostconf = $this->futuracalcularst->getconfiguracoes();
                    if(($this->customer->isLogged()) && ($this->customer->getTipo_pessoa() == 'J') && ($modulostconf) && ($modulostconf['futuracalcularst_status'])  ){ ?>
                      <th class="t-medium"><?php echo 'Valor ST'; ?></th>
                      <th class="t-medium"><?php echo 'Valor IPI'; ?></th>
                      <th class="t-medium"><?php echo 'Valor FCP ST'; ?></th>
                    <?php } ?>
                    <th class="t-medium"><?php echo $column_price; ?></th>
                    <th class="t-medium"><?php echo $column_total; ?></th>
                  </tr>
                </thead>
                <tbody>
                  <?php foreach ($lista['products'] as $keyProduto => $product) { ?>
                    <?php if($product['recurring']): ?>
                      <tr>
                        <td colspan="6" style="border:none;"><image src="catalog/view/theme/default/image/reorder.png" alt="" title="" style="float:left;" />
                          <span style="float:left;line-height:18px; margin-left:10px;">
                            <strong><?php echo $text_recurring_item ?></strong>
                            <?php echo $product['profile_description'] ?>
                          </span>
                        </td>
                      </tr>
                    <?php endif; ?>
                    <tr>
                      <td class="fix"></td>
                      <td class="info_responsive"><b><?php echo $column_name; ?></b></td>
                      <td class="name">
                        <a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
                        <?php if ($product['itens_kit']) { ?>
                          <?php foreach ($product['itens_kit'] as $itemKit) { ?>
                            <small class="visible-block">
                              <?php echo $itemKit['quantidade']; ?> - <?php echo $itemKit['descricao']; ?>
                            </small>
                          <?php } ?>
                        <?php } ?>

                        <?php if (isset($futuragrade_status) && ($futuragrade_status)) { ?>
                          <?php if(isset($product['color_description'])) { ?>
                            <br>- <small><?php echo $product['color_template_description'].' : '. $product['color_description']; ?></small>
                          <?php } ?>

                          <?php if(isset($product['size_description'])){ ?>
                            <br>- <small><?php echo $product['size_template_description'].' : '.$product['size_description']; ?></small>
                          <?php } ?>

                          <?php if(isset($product['specification_description'])){ ?>
                            <br>- <small><?php echo $product['specification_template_description']; ?> <?php echo $product['specification_description']; ?></small>
                          <?php } ?>
                        <?php } ?>
                        <?php if ($product['brinde']) { ?>
                          <a class="text-x-small top-padding-x-small visible-block" href="<?php echo $product['brinde']['href']; ?>">
                            <span class="text-gray"><?php echo $text_gift; ?></span>
                            <span class="text-dark"><?php echo $product['brinde']['product_name']; ?></span>
                          </a>
                        <?php } ?>

                        <?php if ($product['recurring']): ?>
                          <br>&nbsp;<small><?php echo $text_payment_profile ?>: <?php echo $product['profile_name'] ?></small>
                        <?php endif; ?>
                      </td>
                      <td class="info_responsive"><b><?php echo $column_model; ?></b></td>
                      <td class="model"><?php echo $product['model']; ?></td>
                      <td class="info_responsive"><b><?php echo $column_quantity; ?></b></td>
                      <td class="quantity"><?php echo $product['quantity']; ?></td>
                      <?php $modulostconf = $this->futuracalcularst->getconfiguracoes();
                      if(($this->customer->isLogged()) && ($this->customer->getTipo_pessoa() == 'J') && ($modulostconf) && ($modulostconf['futuracalcularst_status'])) { ?>
                        <td class="valorst">
                          <?php echo ($product['st_valor'] !== 'N') ? $product['st_valor'] : ''; ?>
                        </td>
                        <td class="valoripi">
                          <?php echo ($product['ipi_valor']!== 'N') ? $product['ipi_valor'] : ''; ?>
                        </td>
                        <td class="valorfcpst">
                          <?php echo ($product['fcpst_valor']!== 'N') ? $product['fcpst_valor'] : ''; ?>
                        </td>
                    <?php } ?>
                      <td class="info_responsive"><b><?php echo $column_price; ?></b></td>
                      <td class="price"><?php echo $product['price']; ?></td>
                      <td class="info_responsive"><b><?php echo $column_total; ?></b></td>
                      <td class="total"><?php echo $product['total']; ?></td>
                    </tr>
                  <?php } ?>
                  <?php foreach ($vouchers as $voucher) { ?>
                    <tr>
                      <td class="name"><?php echo $voucher['description']; ?></td>
                      <td class="model"></td>
                      <td class="quantity">1</td>
                      <td class="price"><?php echo $voucher['amount']; ?></td>
                      <td class="total"><?php echo $voucher['amount']; ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            <?php } ?>
          <?php } ?>

          <?php if (isset($payments_with_comments)) { ?>
            <div class="flex">

              <div class="col-xs-12 col-md-6 no-padding">
                <div class="checkout__infos background-white shadow-small rounded-small padding-medium margin-card-top">

                  <div class="flex bottom-margin-small">
                    <h4 class="text-medium">Instruções adicionais</h4>
                    <i class="fas fa-info-circle left-padding-small"></i>
                  </div>

                  <p class="text-small">Finalize o pedido para visualizar as informações detalhadas.</p>
                  <p class="text-small">Seu pedido será enviado somente quando confirmarmos o pagamento.</p>

                </div>
              </div>

              <div class="col-xs-12 col-md-6 no-padding checkout__flex">
                <div class="checkout__infos background-white shadow-small rounded-small padding-medium margin-card-top">
                  <div class="table-action" id="shopping-cart-table">

                    <div class="checkout__flex--title bottom-margin-small">
                      <h4 class="text-medium">Totalizadores</h4>
                      <i class="fa-solid fa-money-check-dollar left-padding-small"></i>
                    </div>

                    <?php foreach ($totals as $total) { ?>
                      <p class="no-padding checkout__flex--text text-small">
                        <?php echo $total['title']; ?>:
                        <b><?php echo $total['text']; ?></b>
                      </p>
                    <?php } ?>

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

              <div class="payment col-md-12 col-xs-12"><?php echo $payments_with_comments; ?></div>

            </div>
          <?php } else { ?>
            <?php if (isset($payment)) { ?>

              <div class="col-xs-12 col-md-12 no-padding checkout__flex bottom-margin-medium">
                <div class="checkout__infos background-white shadow-small rounded-small padding-medium margin-card-top">
                  <div class="table-action" id="shopping-cart-table">

                    <div class="checkout__flex--title bottom-margin-small">
                      <h4 class="text-medium">Totalizadores</h4>
                      <i class="fa-solid fa-money-check-dollar left-padding-small"></i>
                    </div>

                    <?php foreach ($totals as $total) { ?>
                      <p class="no-padding checkout__flex--text text-small">
                        <?php echo $total['title']; ?>:
                        <b><?php echo $total['text']; ?></b>
                      </p>
                    <?php } ?>

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

              <div class="payment"><?php echo $payment; ?></div> 
            <?php } ?>
          <?php } ?>

        </div>

      <?php } else { ?>
        <script type="text/javascript">
          location = '<?php echo $redirect; ?>';
        </script>
      <?php } ?>
    </div>
  </li>
</ol>

<style>
.checkout__infos {
  width: fit-content;
  max-width: 500px;
  min-width: 400px;
  height: fit-content;
}
.checkout__flex {
  display: flex;
  flex-direction: row;
  justify-content: end;
}
.checkout__flex--title {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
}
.checkout__flex--text {
  display: flex;
  justify-content: space-between;
}

@media only screen and (max-width: 991px) {
  .checkout__flex {
    justify-content: flex-start;
    margin-top: 1rem;
  }
  .checkout__infos {
    width: 100%;
  }
  .checkout__flex--title {
    justify-content: flex-start;
  }  
}
</style>
