<div class="container-fluid">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title"><i class="fa fa-bar-chart"></i> <?php echo $text_list; ?></h3>
    </div>
    <div class="panel-body">
      <div class="table-responsive">
        <table border="1" class="table table-bordered">
          <thead>
          <tr>
            <td><?php echo $text_customer_info; ?></td>
            <td><?php echo $text_product_name; ?></td>
            <td><?php echo $text_booking_date; ?></td>
            <td><?php echo $text_price; ?></td>
            <td><?php echo $text_quantity; ?></td>
            <td><?php echo $text_total; ?></td>
            <?php foreach($payment_methods as $payment_method){ ?>
            <td><?php echo $payment_method; ?></td>
            <?php } ?>
          </tr>
          </thead>
          <?php foreach($orders as $order){ ?>
          <tr>
            <td rowspan="<?php echo max(count($order['products']),1);?>">
              <?php echo $order['firstname']; ?><br>
              <?php echo $order['sername']; ?><br>
              <?php echo $order['phone']; ?><br>
              <?php echo $order['mail']; ?><br>
              <?php echo $order['date_start']; ?><br>
              <?php echo $order['date_end']; ?><br>
            </td>
            <?php $firt=true;
                  foreach($order['products'] as $product){
                    if (!$firt){ ?><tr><?php } else { $firt=false; } ?>
            <td><?php echo $product['name']; ?>
              <?php if($product['options']) { ?>
              <p><?php echo $product['options']; ?></p>
              <?php } ?>
            </td>
            <td><?php echo $product['booking_date'];?></td>
            <td><?php echo (int)$product['price'];?></td>
            <td><?php echo (int)$product['quantity'];?></td>
            <td><?php echo (int)$product['total'];?></td>
            <?php foreach($payment_methods as $payment_method){ ?>
            <td><?php if(isset($product['payments'][$payment_method])){
                        echo $product['payments'][$payment_method];} ?>
            </td>
            <?php } ?>
          </tr>
          <?php }
              if (count($order['products'])==0){?>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <?php foreach($payment_methods as $payment_method){ ?>
          <td></td>
          <?php } ?>
          </tr>
          <?php } ?>
          <?php } ?>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>