<?php
/**
 * Copyright © Magento, Inc. 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="<?= /* @escapeNotVerified */
    $block->getPostActionUrl() ?>" method="post" class="multicheckout address form">
        <div class="title">
            <strong><?= /* @escapeNotVerified */
                __('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"><?= /* @escapeNotVerified */
                    __('Please select a shipping address for applicable items.') ?></caption>
                <thead>
                <tr>
                    <th class="product" scope="col"><?= /* @escapeNotVerified */
                        __('Product') ?></th>
                    <th class="qty" scope="col"><?= /* @escapeNotVerified */
                        __('Qty') ?></th>
                    <th class="address" scope="col"><?= /* @escapeNotVerified */
                        __('Send To') ?></th>
                    <th class="actions" scope="col">&nbsp;</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($block->getItems() as $_index => $_item): ?>
                    <?php if ($_item->getQuoteItem()) : ?>
                        <tr>
                            <td class="product" data-th="<?= $block->escapeHtml(__('Product')) ?>"><?= $block->getItemHtml($_item->getQuoteItem()) ?></td>
                            <td class="qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>">
                                <div class="field qty">
                                    <label for="ship-<?= /* @escapeNotVerified */
                                    $_index ?>-<?= /* @escapeNotVerified */
                                    $_item->getQuoteItemId() ?>-qty" class="label">
                                        <span><?= /* @escapeNotVerified */
                                            __('Qty') ?></span>
                                    </label>
                                    <div class="control">
                                        <input type="number" data-multiship-item-id="<?= /* @escapeNotVerified */
                                        $_item->getSku() ?>" id="ship-<?= /* @escapeNotVerified */
                                        $_index ?>-<?= /* @escapeNotVerified */
                                        $_item->getQuoteItemId() ?>-qty" name="ship[<?= /* @escapeNotVerified */
                                        $_index ?>][<?= /* @escapeNotVerified */
                                        $_item->getQuoteItemId() ?>][qty]" value="<?= $block->escapeHtml($_item->getQty()) ?>" size="2" class="input-text qty"
                                               data-validate="{number: true}"/>
                                    </div>
                                </div>
                            </td>
                            <td class="address" data-th="<?= $block->escapeHtml(__('Send To')) ?>">
                                <?php if ($_item->getProduct()->getIsVirtual()): ?>
                                    <div class="applicable"><?= /* @escapeNotVerified */
                                        __('A shipping selection is not applicable.') ?></div>
                                <?php else: ?>
                                    <div class="field address">
                                        <label for="ship_<?= /* @escapeNotVerified */
                                        $_index ?>_<?= /* @escapeNotVerified */
                                        $_item->getQuoteItemId() ?>_address" class="label">
                                            <span><?= /* @escapeNotVerified */
                                                __('Send To') ?></span>
                                        </label>
                                        <div class="control">
                                            <?= $block->getAddressesHtmlSelect($_item, $_index) ?>
                                        </div>
                                    </div>
                                <?php endif; ?>
                            </td>
                            <td class="actions" data-th="<?= $block->escapeHtml(__('Actions')) ?>">
                                <a href="<?= /* @escapeNotVerified */
                                $block->getItemDeleteUrl($_item) ?>" title="<?= /* @escapeNotVerified */
                                __('Remove Item') ?>" class="action delete" data-multiship-item-update="">
                                    <span><?= /* @escapeNotVerified */
                                        __('Remove item') ?></span>
                                </a>
                            </td>
                        </tr>
                    <?php endif; ?>
                <?php endforeach; ?>
                </tbody>
            </table>
        </div>
        <div class="actions-toolbar">
            <div class="primary">
                <button type="submit" title="<?= /* @escapeNotVerified */
                __('Go to Shipping Information') ?>" class="action btn btn-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><?= /* @escapeNotVerified */
                        __('Go to Shipping Information') ?></span></button>
            </div>
            <div class="secondary">
                <button type="submit" data-multiship-item-update="" class="action btn btn-secondary update" data-role="can-continue" data-flag="0"><span><?= /* @escapeNotVerified */
                        __('Update Qty &amp; Addresses') ?></span></button>
                <button type="button" title="<?= /* @escapeNotVerified */
                __('Enter a New Address') ?>" class="action add btn btn-secondary" data-role="add-new-address"><span><?= /* @escapeNotVerified */
                        __('Enter a New Address') ?></span></button>
                <a href="<?= /* @escapeNotVerified */
                $block->getBackUrl() ?>" class="action back"><span><?= /* @escapeNotVerified */
                        __('Back to Shopping Cart') ?></span></a>
            </div>
        </div>
    </form>
