<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">
                <p style="font-size:30px; margin:0; padding:0;"><b><?php echo $text_new_received_to; ?></b></p>
                <p style="font-size:16px; margin:0; padding:0;"><?php echo $text_order_id . ' ' . $order_id . ', ' . $text_date_added . ' ' . $date_added . ', ' . $status; ?></p>
              </td>
            </tr>
            <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>
                  <tr>
                    <td width="50"></td>
                    <td width="500" colspan="3">
                      <p style="font-size:16px; margin:0; padding:0;"><b><?php echo $text_email; ?></b> <?php echo $email; ?></p>
                      <p style="font-size:16px; margin:0; padding:0;"><b><?php echo $text_ip; ?></b> <?php echo $ip; ?></p>
                      <p style="font-size:16px; margin:0; padding:0;"><b><?php echo ($telephone) ? $text_telephone : '' ?></b> <?php echo ($isfone) ? ftr_geral::mask($telephone, '(##) ####-####') : ''; ?></p>
                      <p style="font-size:16px; margin:0; padding:0;"><b><?php echo ($celular) ? $text_celular : '' ?></b> <?php echo ($iscelular) ? ftr_geral::mask($celular, '(##) #####-####') : ''; ?></p>
                    </td>
                    <td width="50"></td>
                  </tr>
                  <tr><td width="600" height="20" colspan="5"></td></tr>
                  <?php if ($payment_code == 'bank_transfer') { ?>
                    <tr>
                      <td width="50"></td>
                      <td width="600" height="20" colspan="5">
                        <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_bank_transfer ?></b></p>
                        <?php echo $data_bank_transfer; ?>
                      </td>
                      <td width="50"></td>
                    </tr>

                    <tr><td width="600" height="20" colspan="5"></td></tr>
                  <?php } ?>

                  <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 if (isset($shipping_address)) {
                            echo $text_shipping_address;
                          } elseif (isset($pickup_address)) {
                            echo $text_pickup_address;
                          } ?>
                        </b>
                      </p>
                      <p style="font-size:16px; margin:0; padding:0;">
                        <?php if (isset($shipping_address)) {
                          echo $shipping_address;
                        } elseif (isset($pickup_address)) {
                          echo $pickup_address;
                        } ?>
                      </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;">Brinde:</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>
