123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- // @codingStandardsIgnoreFile
- ?>
- <section class="admin__page-section">
- <div class="admin__page-section-title">
- <span class="title"><?= /* @escapeNotVerified */ __('Items to Ship') ?></span>
- </div>
- <div class="admin__table-wrapper">
- <table class="data-table admin__table-primary order-shipment-table">
- <thead>
- <tr class="headings">
- <th class="col-product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th>
- <th class="col-ordered-qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th>
- <th class="col-qty<?php if ($block->isShipmentRegular()): ?> last<?php endif; ?>">
- <span><?= /* @escapeNotVerified */ __('Qty to Ship') ?></span>
- </th>
- <?php if (!$block->canShipPartiallyItem()): ?>
- <th class="col-ship last"><span><?= /* @escapeNotVerified */ __('Ship') ?></span></th>
- <?php endif; ?>
- </tr>
- </thead>
- <?php $_items = $block->getShipment()->getAllItems() ?>
- <?php $_i = 0; foreach ($_items as $_item): if ($_item->getOrderItem()->getParentItem()): continue; endif; $_i++ ?>
- <tbody class="<?= /* @escapeNotVerified */ $_i%2 ? 'odd' : 'even' ?>">
- <?= $block->getItemHtml($_item) ?>
- <?= $block->getItemExtraInfoHtml($_item->getOrderItem()) ?>
- </tbody>
- <?php endforeach; ?>
- </table>
- </div>
- </section>
- <section class="admin__page-section">
- <div class="admin__page-section-title">
- <span class="title"><?= /* @escapeNotVerified */ __('Shipment Total') ?></span>
- </div>
- <div class="admin__page-section-content order-comments-history">
- <div class="admin__page-section-item">
- <div class="admin__page-section-item-title">
- <span class="title"><?= /* @escapeNotVerified */ __('Shipment Comments') ?></span>
- </div>
- <div class="admin__page-section-item-content">
- <div id="order-history_form" class="admin__field">
- <label class="admin__field-label"
- for="shipment_comment_text">
- <span><?= /* @escapeNotVerified */ __('Comment Text') ?></span></label>
- <div class="admin__field-control">
- <textarea id="shipment_comment_text"
- class="admin__control-textarea"
- name="shipment[comment_text]"
- rows="3"
- cols="5"><?= /* @escapeNotVerified */ $block->getShipment()->getCommentText() ?></textarea>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="admin__page-section-item order-totals order-totals-actions">
- <div class="admin__page-section-item-title">
- <span class="title"><?= /* @escapeNotVerified */ __('Shipment Options') ?></span>
- </div>
- <div class="admin__page-section-item-content">
- <?php if ($block->canCreateShippingLabel()): ?>
- <div class="field choice admin__field admin__field-option field-create">
- <input id="create_shipping_label"
- class="admin__control-checkbox"
- name="shipment[create_shipping_label]"
- value="1"
- type="checkbox"
- onclick="toggleCreateLabelCheckbox();"/>
- <label class="admin__field-label"
- for="create_shipping_label">
- <span><?= /* @escapeNotVerified */ __('Create Shipping Label') ?></span></label>
- </div>
- <?php endif ?>
- <div class="field choice admin__field admin__field-option field-append">
- <input id="notify_customer"
- class="admin__control-checkbox"
- name="shipment[comment_customer_notify]"
- value="1"
- type="checkbox"/>
- <label class="admin__field-label"
- for="notify_customer">
- <span><?= /* @escapeNotVerified */ __('Append Comments') ?></span></label>
- </div>
- <?php if ($block->canSendShipmentEmail()): ?>
- <div class="field choice admin__field admin__field-option field-email">
- <input id="send_email"
- class="admin__control-checkbox"
- name="shipment[send_email]"
- value="1"
- type="checkbox"/>
- <label class="admin__field-label"
- for="send_email">
- <span><?= /* @escapeNotVerified */ __('Email Copy of Shipment') ?></span></label>
- </div>
- <?php endif; ?>
- <?= $block->getChildHtml('submit_before') ?>
- <div class="order-history-comments-actions actions">
- <?= $block->getChildHtml('submit_button') ?>
- <?= $block->getChildHtml('submit_after') ?>
- </div>
- </div>
- </div>
- </section>
- <script>
- require([
- "jquery",
- "Magento_Ui/js/modal/alert",
- "prototype"
- ], function(jQuery, alert){
- //<![CDATA[
- var sendEmailCheckbox = $('send_email');
- if (sendEmailCheckbox) {
- var notifyCustomerCheckbox = $('notify_customer');
- var shipmentCommentText = $('shipment_comment_text');
- Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
- bindSendEmail();
- }
- function bindSendEmail() {
- if (sendEmailCheckbox.checked == true) {
- notifyCustomerCheckbox.disabled = false;
- }
- else {
- notifyCustomerCheckbox.disabled = true;
- }
- }
- window.toggleCreateLabelCheckbox = function() {
- var checkbox = $('create_shipping_label');
- var submitButton = checkbox.up('.order-totals').select('.submit-button span')[0];
- if (checkbox.checked) {
- submitButton.innerText += '...';
- } else {
- submitButton.innerText = submitButton.innerText.replace(/\.\.\.$/, '');
- }
- }
- window.submitShipment = function(btn) {
- if (!validQtyItems()) {
- alert({
- content: '<?= /* @escapeNotVerified */ __('Invalid value(s) for Qty to Ship') ?>'
- });
- return;
- }
- var checkbox = $(btn).up('.order-totals').select('#create_shipping_label')[0];
- if (checkbox && checkbox.checked) {
- packaging.showWindow();
- } else {
- disableElements('submit-button');
- // Temporary solution will be replaced after refactoring order functionality
- jQuery('#edit_form').on('invalid-form.validate', function() {
- enableElements('submit-button');
- jQuery('#edit_form').off('invalid-form.validate');
- });
- jQuery('#edit_form').triggerHandler('save');
- }
- }
- window.validQtyItems = function() {
- var valid = true;
- $$('.qty-item').each(function(item) {
- var val = parseFloat(item.value);
- if (isNaN(val) || val < 0) {
- valid = false;
- }
- });
- return valid;
- }
- window.bindSendEmail = bindSendEmail;
- window.shipmentCommentText = shipmentCommentText;
- window.notifyCustomerCheckbox = notifyCustomerCheckbox;
- window.sendEmailCheckbox = sendEmailCheckbox;
- //]]>
- });
- </script>
|