<?php
/**
 * Copyright © 2016 maijindou.com All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/**
 * @var $block \Magento\CatalogInventory\Block\Stockqty\Composite
 */
?>
<?php if ($block->isMsgVisible()): ?>
    <div class="availability only">
        <a href="#"
           data-mage-init='{"toggleAdvanced": {"selectorsToggleClass": "active", "baseToggleClass": "expanded", "toggleContainers": "#<?php /* @escapeNotVerified */ echo $block->getDetailsPlaceholderId() ?>"}}'
           id="<?php /* @escapeNotVerified */ echo $block->getPlaceholderId() ?>"
           title="<?php /* @escapeNotVerified */ echo __('Only %1 left', ($block->getStockQtyLeft())) ?>"
           class="action show">
            <?php /* @escapeNotVerified */ echo __('Only %1 left', "<strong>{$block->getStockQtyLeft()}</strong>") ?>
        </a>
    </div>
    <div class="availability only detailed" id="<?php /* @escapeNotVerified */ echo $block->getDetailsPlaceholderId() ?>">
        <div class="table-wrapper">
            <table class="data table">
                <caption class="table-caption"><?php /* @escapeNotVerified */ echo __('Product availability'); ?></caption>
                <thead>
                <tr>
                    <th class="col item" scope="col"><?php /* @escapeNotVerified */ echo __('Product Name') ?></th>
                    <th class="col qty" scope="col"><?php /* @escapeNotVerified */ echo __('Qty') ?></th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($block->getChildProducts() as $childProduct) : ?>
                    <?php $childProductStockQty = $block->getProductStockQty($childProduct); ?>
                    <?php if ($childProductStockQty > 0) : ?>
                        <tr>
                            <td data-th="<?php echo $block->escapeHtml(__('Product Name')); ?>" class="col item"><?php /* @escapeNotVerified */ echo $childProduct->getName() ?></td>
                            <td data-th="<?php echo $block->escapeHtml(__('Qty')); ?>" class="col qty"><?php /* @escapeNotVerified */ echo $childProductStockQty ?></td>
                        </tr>
                    <?php endif ?>
                <?php endforeach ?>
                </tbody>
            </table>
        </div>
    </div>
<?php endif ?>
