<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title><?php echo $title; ?></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 $store_url; ?>" 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:30px; margin:0; padding:0;"><b><?php echo $text_thank_buy; ?></b></p>
                <p style="font-size:16px; margin:0; padding:0;"><?php echo $text_order_id . ' ' . $order_id . ', ' . $text_date_added . ' ' . $date_added . ', ' . $text_greeting; ?></p>
              </td>
            </tr>
            <tr><td width="600" height="20"></td></tr>
            <?php if ($customer_id) { ?>
              <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; ?>" 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_link; ?>
                  </a>
                </td>
              </tr>
            <?php } ?>
            <tr><td width="600" height="30"></td></tr>
            <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="40" colspan="5"></td></tr>
                  <?php if ($comment) { ?>
                    <tr>
                      <td width="50"></td>
                      <td width="500" colspan="3">
                        <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_instruction; ?></b></p>
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $comment; ?></p>
                      </td>
                      <td width="50"></td>
                    </tr>
                  <?php } ?>
                  <tr><td width="600" height="20" colspan="5"></td></tr>
                  <tr>
                    <td width="50"></td>
                    <td width="240">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_payment_method; ?></b></p>
                      <p style="font-size:16px; margin:0; padding:0;"><?php echo $payment_method; ?></p>
                    </td>
                    <td width="20"></td>
                    <td width="240">
                      <?php if ($shipping_method) { ?>
                        <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_shipping_method; ?></b></p>
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $shipping_method; ?></p>
                      <?php } ?>
                    </td>
                    <td width="50"></td>
                  </tr>
                  <tr><td width="600" height="20" colspan="5"></td></tr>
                  <tr>
                    <td width="50"></td>
                    <td width="240">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_payment_address; ?></b></p>
                      <p style="font-size:16px; margin:0; padding:0;">
                        <?php echo $payment_address; ?>
                      </p>
                    </td>
                    <td width="20"></td>
                    <td width="240">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $shipping_pickup ? $text_pickup_address : $text_shipping_address; ?></b></p>
                      <p style="font-size:16px; margin:0; padding:0;">
                        <?php if ($shipping_pickup) { ?>
                          <?php if ($pickup_address) { ?>
                            <?php echo $pickup_address; ?>
                          <?php } ?>
                        <?php } else { ?>
                          <?php if ($shipping_address) { ?>
                            <?php echo $shipping_address; ?>
                          <?php } ?>
                        <?php } ?>
                      </p>
                    </td>
                    <td width="50"></td>
                  </tr>
                  <tr><td width="600" height="40" colspan="5"></td></tr>
                </table>
              </td>
            </tr>
            <tr><td width="600" height="30"></td></tr>
            <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 } ?>
                </table>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </body>
</html>
