<div class="order-summary-content">
  <div class="top">
    <div class="basket-summary left">
      Data zamówienia: <span><?= \S::pretty_date( 'j f Y', strtotime( $this -> order['date_order'] ) );?></span>
    </div>
    <div class="basket-summary left">
      Status zamówienia: <span><?= $this -> statuses[ $this -> order['status'] ];?></span>
    </div>
  </div>
  <div class="products">
    <? if ( is_array( $this -> order['products'] ) and count( $this -> order['products'] ) ):?>
      <? foreach ( $this -> order['products'] as $product ):?>
        <? $product_tmp = \shop\Product::getFromCache( $product['product_id'], $lang['id'] );?>
        <div class="basket-product">
          <div class="image">
            <? if ( file_exists( substr( $product_tmp['images'][0]['src'], 1 ) ) ):?>
              <img class="main-img" src="<?= $product_tmp['images'][0]['src'];?>" alt="">
            <? else:?>

            <? endif;?>
          </div>
          <div class="details">
              <div class="name">
              <?= $product['name'];?>
              <div class="attributes">
                <?= $product['attributes'];?>
              </div>
              <div class="custom-fields">
                <?= $product['custom_fields'];?>
              </div>
              <div class="product-message">
                <?= $product['message'] != '' ? '<strong>Wiadomość:</strong> ' . $product['message'] : '';?>
              </div>
            </div>
          </div>
          <div class="prices">
            <div class="price">
              <?
                echo \S::decimal( $product['price_brutto_promo'] ) . ' zł';

                if ( $product['price_brutto_promo'] and $product['price_brutto_promo'] < $product['price_brutto'] )
                  echo '<u>' . \S::decimal( $product['price_brutto'] ) . ' zł</u>';

                if ( $product['price_brutto_promo'] and $product['price_brutto_promo'] < $product['price_brutto'] )
                  $discount += \S::normalize_decimal( ( $product['price_brutto'] - $product['price_brutto_promo'] ) * $product['quantity'] );
              ?>
              <span>x <?= $product['quantity'];?></span>
              <?= \S::decimal( \S::normalize_decimal( $product['price_brutto'] * $product['quantity'] ) );?> zł
            </div>
          </div>
        </div>
        <? $summary += \S::normalize_decimal( $product['price_brutto'] * $product['quantity'] );?>
      <? endforeach;?>
      <div class="basket-summary">
        Wartość koszyka <span><?= \S::decimal( $summary );?> zł</span>
      </div>
      <? if ( $discount ):?>
        <div class="basket-summary">
          Rabat <span class="text-danger"><?= \S::decimal( $discount );?> zł</span>
        </div>
      <? endif;?>
      <div class="basket-summary">
        <?= $this -> order['transport'];?> <span><?= \S::decimal( $this -> order['transport_cost'] );?> zł</span>
      </div>
      <div class="basket-summary big">
        <?= ucfirst( \S::lang( 'razem-z-dostawa' ) );?>: <span><?= \S::decimal( $summary - $discount + $this -> order['transport_cost'] );?> zł</span>
      </div>
    <? endif;?>
    <? if ( $this -> order['message'] ):?>
      <div class="basket-summary">
        Wiadomość:
        <span class="comment"><?= $this -> order['message'];?></span>
      </div>
    <? endif;?>
  </div>
</div>