<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Título</title>
  </head>
  <body style="font-family: Arial, sans-serif; color: black;">
    <table width="100%" border="0" align="center" cellpadding="30" cellspacing="0">
      <tr>
        <td>
          <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="600" align="center" bgcolor="<?php echo $header_background_color; ?>">
                <a href="<?php echo $link_website; ?>" target="_blank" style="display:block;">
                  <img src="<?php echo $logo; ?>" alt="<?php echo $store_name; ?>" border="0" style="display:block; margin:20px; padding:0;">
                </a>
              </td>
            </tr>
            <tr><td width="600" height="30"></td></tr>
            <tr>
              <td width="600">
                <p style="font-size:16px; margin:0; padding:0;"><?php echo $text_order_status; ?></p>
                <p style="font-size:30px; margin:0; padding:0;"><b><?php echo $name; ?></b></p>
                <?php if (isset($order_status_message) && $order_status_message) { ?>
                  <p style="font-size:16px; margin:10px 0; padding:0;"><?php echo $order_status_message; ?></p>
                  <p width="600" height="10" colspan="4" style="border-bottom: 1px solid #dddddd;"></p>
                <?php } ?>
                <p style="font-size:16px; margin:0; padding:0; margin-bottom: 10px;"><?php echo $text_order . ' ' . $order_id . ', ' . $text_date_added . ' ' . $date_added; ?></p>
              </td>
            </tr>
            <?php if (isset($url_store_rating)) { ?>
              <tr>
                <td width="600" align="center" bgcolor="<?php echo $btn_background_color; ?>" style="height:40px">
                  <div style="width:0; height:40px; display:inline-block; vertical-align:middle;"></div>
                  <a href="<?php echo $url_store_rating ?>" target="_blank" style="color:<?php echo $btn_text_color; ?>;font-size:14px;margin:0;padding:0;text-decoration:none;display:inline-block;vertical-align:middle;">
                    <?php echo $text_store_rating ?>
                  </a>
                </td>
              </tr>
            <?php } ?>
            <tr><td width="600" height="30"></td></tr>
            
            <?php if ($payment_code == 'bank_transfer') { ?>
              <tr>
                <td width="600" height="30">
                  <p style="font-size:14px; margin:0; padding:0;"><b><?php echo $text_bank_transfer ?></b></p>
                  <?php echo $data_bank_transfer; ?>
                </td>
              </tr>
            <?php } ?>
            <?php if ($comment || $tracking_codes) { ?>
              <tr>
                <td width="600">
                  <table width="600" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #dddddd; border-collapse:collapse;">
                    <tr><td width="600" height="20" colspan="3"></td></tr>

                    <?php if($comment){ ?>
                      <tr><td width="600" height="20" colspan="3"></td></tr>
                      <tr>
                        <td width="50"></td>
                        <td width="500">
                          <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_comment; ?></b></p>
                          <p style="font-size:16px; margin:0; padding:0;"><?php echo $comment; ?></p>
                        </td>
                        <td width="50"></td>
                      </tr>
                    <?php  }  ?>

                    <?php if($tracking_codes){ ?>
                    <tr><td width="600" height="20" colspan="3"></td></tr>

                    <tr>
                      <td width="50"></td>
                      <td width="500">
                        <p style="font-size:12px; margin:0; padding:0;"><b>Código de rastreio</b></p>
                        <?php foreach($tracking_codes as $tracking_code){ ?>
                        <a href="<?php echo $shipping_code_link; ?>" target="_blank" style="display: block; font-size:16px; margin:0; padding:0;"><?php echo $shipping_code; ?>: <?php echo $tracking_code['tracking_code']; ?></a>
                        <?php  }  ?>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <?php } ?>

                    <tr><td width="600" height="40" colspan="3"></td></tr>

                  </table>
                </td>
              </tr>
              <tr><td width="600" height="30"></td></tr>
            <?php } ?>
            <?php if ($link_pagamento) { ?>
              <tr><td width="600" height="30" style="border-top: 1px solid #dddddd;"></td></tr>
              <tr>
                <td width="600">
                  <table width="600" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                    <tr>
                      <td width="600" align="center" bgcolor="<?php echo $btn_background_color; ?>" style="height:40px">
                        <div style="width:0;height:40px;display:inline-block;vertical-align:middle;"></div>
                        <a href="<?php echo $link_pagamento; ?>" target="_blank" style="color:<?php echo $btn_text_color; ?>;font-size:14px;margin:0;padding:0;text-decoration:none;display:inline-block;vertical-align:middle;">
                          IR PARA A PÁGINA DE PAGAMENTO
                        </a>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr><td width="600" height="30"></td></tr>
            <?php } ?>
            <tr>
              <td>
              <?php foreach ($productlist as $keyTipo => $cartTipo) { ?>
                <div>
                  <?php foreach ($cartTipo as $keyLista => $lista) { ?>
                    <?php if ($lista['isListaEscolar']) { ?>
                      <p style="font-size:16px; padding-top:30px; padding-bottom:10px;"><b><?php  echo $lista['descricao'] ?><b></p>
                    <?php } ?>
                <table width="600" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                  <tr>
                    <td width="50"></td>
                    <td width="350">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_product; ?></b></p>
                    </td>
                    <td width="100">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_price; ?></b></p>
                    </td>
                    <td width="100">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_total; ?></b></p>
                    </td>
                  </tr>
                  <tr>
                    <td width="600" height="10" colspan="4" style="border-bottom: 1px solid #dddddd;"></td>
                  </tr>
                  <?php foreach ($lista['products'] as $keyProduto => $product) { ?>
                    <tr>
                      <td width="600" height="20" colspan="4"></td>
                    </tr>
                    <tr>
                      <td width="50">
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['quantity'] . $text_quantity; ?></p>
                      </td>
                      <td width="350">
                        <p style="font-size:12px; color:#666666; margin:0; padding:0;"><?php echo $text_model . ' ' . $product['model']; ?></p>
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['name']; ?></p>
                        <?php if ($product['itens_kit']) { ?>
                          <?php foreach ($product['itens_kit'] as $itemKit) { ?>
                            <p style="font-size:12px; color:#666666; margin:0; padding:0;">
                              <?php echo $itemKit['quantidade']; ?> - <?php echo $itemKit['descricao']; ?>
                            </p>
                          <?php } ?>
                        <?php } ?>
                        <?php if (isset($product['grades'][0]) && $product['grades'][0]) { ?>
                    			<?php foreach ($product['grades'][0] as $key => $grade) { ?>
                    				<?php if ($grade != '') { ?>
                      		  	<p style="font-size:12px; color:#666666; margin:0; padding:0;"><?php echo $grade; ?></p>
                  		      <?php } ?>
                  			  <?php } ?>
                  		  <?php } ?>
                        <?php if ($product['brinde']) { ?>
                          <div class="top-padding-x-small right-margin-small">
                            <span style="font-size:12px; margin:0; padding:0;"><?php echo $text_gift; ?></span>
                            <span style="font-size:12px; color:#666666; margin:0; padding:0;"><?php echo $product['brinde']['product_name'] ?></span>
                          </div>
                        <?php } ?>
                      </td>
                      <td width="100">
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['price']; ?></p>
                      </td>
                      <td width="100">
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['total']; ?></p>
                      </td>
                    </tr>
                    <tr>
                      <td width="600" height="20" colspan="4" style="border-bottom: 1px solid #dddddd;"></td>
                    </tr>
                  <?php } ?>
                </table>
                    <?php } ?>
                  </div>
                <?php } ?>
                <table>
                  <tr><td width="600" height="30" colspan="4"></td></tr>
                  <?php foreach ($totals as $total) { ?>
                    <tr>
                      <td width="50"></td>
                      <td width="350">
                        <p style="font-size:16px; line-height:28px; margin:0; padding:0;"><?php echo $total['title']; ?></p>
                      </td>
                      <td width="200" colspan="2">
                        <p style="font-size:16px; line-height:28px; margin:0; padding:0;"><?php echo $total['text']; ?></p>
                      </td>
                    </tr>
                  <?php } ?>
                  <tr><td width="600" height="50" colspan="4"></td></tr>
                </table>
              </td>
            </tr>

            <?php if ($store_url) { ?>
            <!-- inicio -->
              <tr>
                <td width="600">
                  <table style="background: #e9ecef;" cellspacing="20">
                    <tr>
                      <td style="vertical-align: middle;">
                        <span style="color: #212529;">Para mais detalhes utilize a opção "acompanhar pedido", em caso de dúvidas entre
                          em contato ou responda esse e-mail.</span>
                      </td>
                    </tr>
                    <tr style="vertical-align: middle">
                      <td>
                        <table>
                          <td width="300" align="center" bgcolor="<?php echo $btn_background_color; ?>"
                            style="height:50px; border-radius: 3px;">
                            <div style="width:0; height:40px; display:inline-block; vertical-align:middle;"></div>
                            <a href="<?php echo $store_url; ?>" target="_blank"
                              style="color:<?php echo $btn_text_color; ?>;font-size:14px;margin:0;padding:0;text-decoration:none;display:inline-block;vertical-align:middle;">
                              <b>Acompanhar pedido</b>
                            </a>
                          </td>
                          <td width="300" align="center" style="height:50px; background: white; border-radius: 3px;">
                            <div style="width:0; height:40px; display:inline-block; vertical-align:middle;"></div>
                            <a href="<?php echo $store_url_contact; ?>" target="_blank"
                              style="color:<?php echo $btn_background_color; ?>;font-size:14px;margin:0;padding:0;text-decoration:none;display:inline-block;vertical-align:middle;">
                              <b>Entre em contato</b>
                            </a>
                          </td>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            <!-- fim -->
            <?php } ?>

            <tr><td width="600" height="30" colspan="4"></td></tr>

            <?php if(isset($send_nfe_info)){ ?>
              <tr>
                <td width="600">
                  <table width="600" border="0" bgcolor="#e9ecef" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                    <tr><td width="600" height="50" colspan="5"></td></tr>
                    <tr>
                      <td width="50"></td>
                      <td width="225" bgcolor="#ffffff">
                        <a href="<?php echo $link_danfe; ?>" target="_blank" style="font-size:16px;margin:20px auto 20px auto;padding:0;text-decoration:none;display:block;text-align:center;">Download DANFE</a>
                      </td>
                      <td width="50"></td>
                      <td width="225" bgcolor="#ffffff">
                        <a href="<?php echo $link_xml; ?>" target="_blank" style="font-size:16px;margin:20px auto 20px auto;padding:0;text-decoration:none;display:block;text-align:center;">Download XML</a>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <tr><td width="600" height="25" colspan="5" style="border-bottom: 1px solid #dddddd"></td></tr>
                    <tr><td width="600" height="25" colspan="5"></td></tr>
                    <tr>
                      <td width="50"></td>
                      <td width="500" colspan="3">
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0;"><b>Como consultar a Nota Fiscal Eletrônica deste pedido?</b></p>
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0; color:#666666;">Acesse o portal da Nota Fiscal Eletrônica do ministério da Fazenda em <a href="http://www.nfe.fazenda.gov.br" target="_blank">www.nfe.fazenda.gov.br</a></p>
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0; color:#666666;">Vá até Serviços > <a href="http://www.nfe.fazenda.gov.br/portal/consultaRecaptcha.aspx?tipoConsulta=resumo&tipoConteudo=d09fwabTnLk=" target="_blank">Consultar Resumo da NF-e.</a> Digite o número da chave de acesso abaixo para acessar todas as informações sobre a NF-e.</p>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <tr><td width="600" height="25" colspan="5"></td></tr>
                    <tr>
                      <td width="50"></td>
                      <td width="500" colspan="3">
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0;"><b>Chave de acesso</b></p>
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0;"><b><?php echo $chave_acesso; ?></b></p>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <tr><td width="600" height="50" colspan="5"></td></tr>
                  </table>
                </td>
              </tr>
            <?php } ?>
          </table>
        </td>
      </tr>
    </table>
  </body>
</html>
