<?php
/**
 * MB "Vienas bitas" (Magetrend.com)
 *
 * @category MageTrend
 * @package  Magetend/PdfTemplates
 * @author   Edvinas Stulpinas <edwin@magetrend.com>
 * @license  http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * @link     https://www.magetrend.com/magento-2-pdf-invoice-pro
 */

$columnConfig = $block->getColumnConfig();
$rows = 3;
if (!$block->isShipment() && $block->getPaperHeight() >= 842) {
    $rows = 5;
}
?>
<div data-resizable="true" data-resizable-handle="table" class="pdf-element element_items" id="" style="height: auto !important;">
    <table cellpadding="0" cellspacing="0" width="100%" height="100%" class="pdf-table" style="border-width: 0; border-style: solid">
        <tr class="pdf-table-header">
            <?php foreach ($columnConfig as $key => $column) : ?>
            <th<?php if (isset($column['align'])) : ?> style="text-align: <?php echo $column['align'] ?>" <?php endif; ?> class="pdf-translate-<?php echo $key; ?> column-<?php echo $key; ?>"><?php echo $column['label'] ?></th>
            <?php endforeach; ?>
        </tr>

        <?php for($i = 1; $i <= $rows; $i++) : ?>
            <tr class="pdf-table-item line-<?php echo $i%2==0?'2':'1'; ?>">
                <?php foreach ($columnConfig as $key => $column) : ?>
                <td<?php if (isset($column['align'])) : ?> style="text-align: <?php echo $column['align'] ?>" <?php endif; ?> class="cell-<?php echo $key; ?>  column-<?php echo $key; ?>">
                    <?php if ($key == 'product') : ?>
                        <img class="product-image" src="<?php echo $block->getImagePlaceholder(); ?>">
                    <?php endif; ?>
                        <?php echo $column['default']['item_'.$i]; ?>
                        <?php if ($key == 'product') : ?>

                    <?php endif; ?>
                </td>
                <?php endforeach; ?>
            </tr>

        <?php endfor; ?>
    </table>
</div>
