<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
// @codingStandardsIgnoreFile

/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer */
$_item = $block->getItem();
$product = $_item->getProduct();
$isVisibleProduct = $product->isVisibleInSiteVisibility();
/** @var \Magento\Msrp\Helper\Data $helper */
$helper = $this->helper('Magento\Msrp\Helper\Data');
$canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product);
?>
<tbody class="cart item">
    <tr class="item-info">
        <td data-th="<?php echo $block->escapeHtml(__('Item')); ?>" class="col-auto item align-middle">

            <div>
                <?php if ($block->hasProductUrl()): ?>
                    <a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl() ?>"
                       title="<?php echo $block->escapeHtml($block->getProductName()) ?>"
                       tabindex="-1"
                       class="product-item-photo">
                       <?php else: ?>
                        <span class="product-item-photo">
                        <?php endif; ?>
                        <?php echo $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml(); ?>
                        <?php if ($block->hasProductUrl()): ?>
                    </a>
                <?php else: ?>
                <?php endif; ?>
                <div class="product-item-details align-middle">
                    <strong class="product-item-name">
                        <?php if ($block->hasProductUrl()): ?>
                            <a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl() ?>"><?php echo $block->escapeHtml($block->getProductName()) ?></a>
                        <?php else: ?>
                            <?php echo $block->escapeHtml($block->getProductName()) ?>
                        <?php endif; ?>
                    </strong>
                    <?php if ($_options = $block->getOptionList()): ?>
                        <div class="item-options">
                            <?php foreach ($_options as $_option) : ?>
                                <div>
                                    <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
                                    <label><?php echo $block->escapeHtml($_option['label']) ?></label>
                                    <span>
                                        <?php if (isset($_formatedOptionValue['full_view'])): ?>
                                            <?php /* @escapeNotVerified */ echo $_formatedOptionValue['full_view'] ?>
                                        <?php else: ?>
                                            <?php /* @escapeNotVerified */ echo $_formatedOptionValue['value'] ?>
                                        <?php endif; ?>
                                    </span>
                                </div>
                            <?php endforeach; ?>
                        </div>
                    <?php endif; ?>
                    <?php if ($messages = $block->getMessages()): ?>
                        <?php foreach ($messages as $message): ?>
                            <div class="cart item message <?php /* @escapeNotVerified */ echo $message['type'] ?>"><div><?php echo $block->escapeHtml($message['text']) ?></div></div>
                        <?php endforeach; ?>
                    <?php endif; ?>
                    <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?>
                    <?php if ($addInfoBlock): ?>
                        <?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
                    <?php endif; ?>
                </div>
            </div>
        </td>

        <?php if ($canApplyMsrp): ?>
            <td class="msrp  align-middle" data-th="<?php echo $block->escapeHtml(__('Price')); ?>">
                <span class="pricing msrp">
                    <span class="msrp notice"><?php /* @escapeNotVerified */ echo __('See price before order confirmation.'); ?></span>
                    <?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
                    <a href="#" class="action help map" id="<?php /* @escapeNotVerified */ echo($helpLinkId); ?>" data-mage-init='{"addToCart":{"helpLinkId": "#<?php /* @escapeNotVerified */ echo $helpLinkId; ?>","productName": "<?php /* @escapeNotVerified */ echo $product->getName(); ?>","showAddToCart": false}}'>
                        <span><?php /* @escapeNotVerified */ echo __("What's this?"); ?></span>
                    </a>
                </span>
            </td>
        <?php else: ?>
            <td class="price align-middle" data-th="<?php echo $block->escapeHtml(__('Price')); ?>">
                <?php echo $block->getUnitPriceHtml($_item); ?>
            </td>
        <?php endif; ?>
        <td class="qty align-middle" data-th="<?php echo $block->escapeHtml(__('Qty')); ?>">
            <div class="field qty">
                <div class="control qty">
                    <input id="cart-<?php /* @escapeNotVerified */ echo $_item->getId() ?>-qty"
                           name="cart[<?php /* @escapeNotVerified */ echo $_item->getId() ?>][qty]"
                           data-cart-item-id="<?php /* @escapeNotVerified */ echo $_item->getSku() ?>"
                           value="<?php /* @escapeNotVerified */ echo $block->getQty() ?>"
                           type="number"
                           size="4"
                           title="<?php echo $block->escapeHtml(__('Qty')); ?>"
                           class="input-text qty form-control"
                           maxlength="12"
                           data-validate="{required:true,'validate-greater-than-zero':true}"
                           data-role="cart-item-qty"/>
                </div>
            </div>
        </td>

        <td class="subtotal align-middle" data-th="<?php echo $block->escapeHtml(__('Subtotal')); ?>">
            <?php if ($canApplyMsrp): ?>
                <span class="cart msrp subtotal">--</span>
            <?php else: ?>
                <?php echo $block->getRowTotalHtml($_item); ?>
            <?php endif; ?>
        </td>
        <td class="cart-actions align-middle">
            <?php /* @escapeNotVerified */ echo $block->getActions($_item) ?>
        </td>
    </tr>
</tbody>
