<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Ship to multiple address template
 *
 * @var $block \Magento\Multishipping\Block\Checkout\Addresses
 */
?>
<form id="checkout_multishipping_form" data-mage-init='{"multiShipping":{}, "validation":{}}' action="<?php /* @escapeNotVerified */ echo $block->getPostActionUrl() ?>" method="post" class="multicheckout address form">
    <div class="title">
        <strong><?php /* @escapeNotVerified */ echo __('Please select a shipping address for applicable items.') ?></strong>
    </div>
    <input type="hidden" name="continue" value="0" id="can_continue_flag"/>
    <input type="hidden" name="new_address" value="0" id="add_new_address_flag"/>
    <div class="table-wrapper">
        <table class="items data table" id="multiship-addresses-table">
            <caption class="table-caption"><?php /* @escapeNotVerified */ echo __('Please select a shipping address for applicable items.') ?></caption>
            <thead>
            <tr>
                <th class="col product" scope="col"><?php /* @escapeNotVerified */ echo __('Product') ?></th>
                <th class="col qty" scope="col"><?php /* @escapeNotVerified */ echo __('Qty') ?></th>
                <th class="col address" scope="col"><?php /* @escapeNotVerified */ echo __('Send To') ?></th>
                <th class="col actions" scope="col">&nbsp;</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach ($block->getItems() as $_index => $_item): ?>
                <?php if ($_item->getQuoteItem()) : ?>
                    <tr>
                        <td class="col product" data-th="<?php echo $block->escapeHtml(__('Product'));?>"><?php echo $block->getItemHtml($_item->getQuoteItem()) ?></td>
                        <td class="col qty" data-th="<?php echo $block->escapeHtml(__('Qty'));?>">
                            <div class="field qty">
                                <label for="ship-<?php /* @escapeNotVerified */ echo $_index ?>-<?php /* @escapeNotVerified */ echo $_item->getQuoteItemId() ?>-qty" class="label">
                                    <span><?php /* @escapeNotVerified */ echo __('Qty') ?></span>
                                </label>
                                <div class="control">
                                    <input type="number" data-multiship-item-id="<?php /* @escapeNotVerified */ echo $_item->getSku() ?>" id="ship-<?php /* @escapeNotVerified */ echo $_index ?>-<?php /* @escapeNotVerified */ echo $_item->getQuoteItemId() ?>-qty" name="ship[<?php /* @escapeNotVerified */ echo $_index ?>][<?php /* @escapeNotVerified */ echo $_item->getQuoteItemId() ?>][qty]" value="<?php echo $block->escapeHtml($_item->getQty()) ?>" size="2" class="input-text qty" data-validate="{number: true}"/>
                                </div>
                                <div class="qty-changer">
                                    <a href="javascript:void(0)" class="qty-inc"><i class="porto-icon-up-dir"></i></a>
                                    <a href="javascript:void(0)" class="qty-dec"><i class="porto-icon-down-dir"></i></a>
                                </div>
                            </div>
                        </td>
                        <td class="col address" data-th="<?php echo $block->escapeHtml(__('Send To'));?>">
                            <?php if ($_item->getProduct()->getIsVirtual()): ?>
                                <div class="applicable"><?php /* @escapeNotVerified */ echo __('A shipping selection is not applicable.'); ?></div>
                            <?php else: ?>
                                <div class="field address">
                                    <label for="ship_<?php /* @escapeNotVerified */ echo $_index ?>_<?php /* @escapeNotVerified */ echo $_item->getQuoteItemId() ?>_address" class="label">
                                        <span><?php /* @escapeNotVerified */ echo __('Send To') ?></span>
                                    </label>
                                    <div class="control">
                                        <?php echo $block->getAddressesHtmlSelect($_item, $_index); ?>
                                    </div>
                                </div>
                            <?php endif; ?>
                        </td>
                        <td class="col actions" data-th="<?php echo $block->escapeHtml(__('Actions'));?>">
                            <a href="<?php /* @escapeNotVerified */ echo $block->getItemDeleteUrl($_item) ?>" title="<?php /* @escapeNotVerified */ echo __('Remove Item') ?>" class="action delete" data-multiship-item-update="">
                                <span><?php /* @escapeNotVerified */ echo __('Remove item') ?></span>
                            </a>
                        </td>
                    </tr>
                <?php endif; ?>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
    <div class="actions-toolbar">
        <div class="primary">
            <button type="submit" title="<?php /* @escapeNotVerified */ echo __('Go to Shipping Information') ?>" class="action primary continue<?php if ($block->isContinueDisabled()):?> disabled<?php endif; ?>" data-role="can-continue" data-flag="1"<?php if ($block->isContinueDisabled()):?> disabled="disabled"<?php endif; ?>><span><?php /* @escapeNotVerified */ echo __('Go to Shipping Information') ?></span></button>
        </div>
        <div class="secondary">
            <button type="submit" data-multiship-item-update="" class="action update" data-role="can-continue" data-flag="0"><span><?php /* @escapeNotVerified */ echo __('Update Qty &amp; Addresses') ?></span></button>
            <button type="button" title="<?php /* @escapeNotVerified */ echo __('Enter a New Address') ?>" class="action add" data-role="add-new-address"><span><?php /* @escapeNotVerified */ echo __('Enter a New Address') ?></span></button>
            <a href="<?php /* @escapeNotVerified */ echo $block->getBackUrl() ?>" class="action back"><span><?php /* @escapeNotVerified */ echo __('Back to Shopping Cart') ?></span></a>
        </div>
    </div>
</form>
