Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

198 строки
7.8 KiB

  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
  7. ?>
  8. <section class="admin__page-section">
  9. <div class="admin__page-section-title">
  10. <span class="title"><?= $block->escapeHtml(__('Items to Ship')) ?></span>
  11. </div>
  12. <div class="admin__table-wrapper">
  13. <table class="data-table admin__table-primary order-shipment-table">
  14. <thead>
  15. <tr class="headings">
  16. <th class="col-product"><span><?= $block->escapeHtml(__('Product')) ?></span></th>
  17. <th class="col-ordered-qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></th>
  18. <th class="col-qty<?php if ($block->isShipmentRegular()): ?> last<?php endif; ?>">
  19. <span><?= $block->escapeHtml(__('Qty to Ship')) ?></span>
  20. </th>
  21. <?php if (!$block->canShipPartiallyItem()): ?>
  22. <th class="col-ship last"><span><?= $block->escapeHtml(__('Ship')) ?></span></th>
  23. <?php endif; ?>
  24. </tr>
  25. </thead>
  26. <?php $_items = $block->getShipment()->getAllItems() ?>
  27. <?php $_i = 0; foreach ($_items as $_item):
  28. if ($_item->getOrderItem()->getParentItem()):
  29. continue;
  30. endif;
  31. $_i++ ?>
  32. <tbody class="<?= $_i%2 ? 'odd' : 'even' ?>">
  33. <?= $block->getItemHtml($_item) ?>
  34. <?= $block->getItemExtraInfoHtml($_item->getOrderItem()) ?>
  35. </tbody>
  36. <?php endforeach; ?>
  37. </table>
  38. </div>
  39. </section>
  40. <section class="admin__page-section">
  41. <div class="admin__page-section-title">
  42. <span class="title"><?= $block->escapeHtml(__('Shipment Total')) ?></span>
  43. </div>
  44. <div class="admin__page-section-content order-comments-history">
  45. <div class="admin__page-section-item">
  46. <div class="admin__page-section-item-title">
  47. <span class="title"><?= $block->escapeHtml(__('Shipment Comments')) ?></span>
  48. </div>
  49. <div class="admin__page-section-item-content">
  50. <div id="order-history_form" class="admin__field">
  51. <label class="admin__field-label"
  52. for="shipment_comment_text">
  53. <span><?= $block->escapeHtml(__('Comment Text')) ?></span></label>
  54. <div class="admin__field-control">
  55. <textarea id="shipment_comment_text"
  56. class="admin__control-textarea"
  57. name="shipment[comment_text]"
  58. rows="3"
  59. cols="5"><?= $block->escapeHtml($block->getShipment()->getCommentText()) ?></textarea>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="admin__page-section-item order-totals order-totals-actions">
  66. <div class="admin__page-section-item-title">
  67. <span class="title"><?= $block->escapeHtml(__('Shipment Options')) ?></span>
  68. </div>
  69. <div class="admin__page-section-item-content">
  70. <?php if ($block->canCreateShippingLabel()): ?>
  71. <div class="field choice admin__field admin__field-option field-create">
  72. <input id="create_shipping_label"
  73. class="admin__control-checkbox"
  74. name="shipment[create_shipping_label]"
  75. value="1"
  76. type="checkbox"/>
  77. <label class="admin__field-label"
  78. for="create_shipping_label">
  79. <span><?= $block->escapeHtml(__('Create Shipping Label')) ?></span></label>
  80. <?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
  81. 'onclick',
  82. 'toggleCreateLabelCheckbox();',
  83. 'input#create_shipping_label'
  84. ) ?>
  85. </div>
  86. <?php endif ?>
  87. <div class="field choice admin__field admin__field-option field-append">
  88. <input id="notify_customer"
  89. class="admin__control-checkbox"
  90. name="shipment[comment_customer_notify]"
  91. value="1"
  92. type="checkbox"/>
  93. <label class="admin__field-label"
  94. for="notify_customer">
  95. <span><?=$block->escapeHtml(__('Append Comments')) ?></span></label>
  96. </div>
  97. <?php if ($block->canSendShipmentEmail()): ?>
  98. <div class="field choice admin__field admin__field-option field-email">
  99. <input id="send_email"
  100. class="admin__control-checkbox"
  101. name="shipment[send_email]"
  102. value="1"
  103. type="checkbox"/>
  104. <label class="admin__field-label"
  105. for="send_email">
  106. <span><?= $block->escapeHtml(__('Email Copy of Shipment')) ?></span></label>
  107. </div>
  108. <?php endif; ?>
  109. <?= $block->getChildHtml('submit_before') ?>
  110. <div class="order-history-comments-actions actions">
  111. <?= $block->getChildHtml('submit_button') ?>
  112. <?= $block->getChildHtml('submit_after') ?>
  113. </div>
  114. </div>
  115. </div>
  116. </section>
  117. <?php $scriptString = <<<script
  118. require([
  119. "jquery",
  120. "Magento_Ui/js/modal/alert",
  121. "prototype"
  122. ], function(jQuery, alert){
  123. //<![CDATA[
  124. var sendEmailCheckbox = $('send_email');
  125. if (sendEmailCheckbox) {
  126. var notifyCustomerCheckbox = $('notify_customer');
  127. var shipmentCommentText = $('shipment_comment_text');
  128. Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
  129. bindSendEmail();
  130. }
  131. function bindSendEmail() {
  132. if (sendEmailCheckbox.checked == true) {
  133. notifyCustomerCheckbox.disabled = false;
  134. }
  135. else {
  136. notifyCustomerCheckbox.disabled = true;
  137. }
  138. }
  139. window.toggleCreateLabelCheckbox = function() {
  140. var checkbox = $('create_shipping_label');
  141. var submitButton = checkbox.up('.order-totals').select('.submit-button span')[0];
  142. if (checkbox.checked) {
  143. submitButton.innerText += '...';
  144. } else {
  145. submitButton.innerText = submitButton.innerText.replace(/\.\.\.$/, '');
  146. }
  147. }
  148. window.submitShipment = function(btn) {
  149. if (!validQtyItems()) {
  150. alert({
  151. content: '{$block->escapeJs(__('Invalid value(s) for Qty to Ship'))}'
  152. });
  153. return;
  154. }
  155. var checkbox = $(btn).up('.order-totals').select('#create_shipping_label')[0];
  156. if (checkbox && checkbox.checked) {
  157. packaging.showWindow();
  158. } else {
  159. disableElements('submit-button');
  160. // Temporary solution will be replaced after refactoring order functionality
  161. jQuery('#edit_form').on('invalid-form.validate', function() {
  162. enableElements('submit-button');
  163. jQuery('#edit_form').off('invalid-form.validate');
  164. });
  165. jQuery('#edit_form').triggerHandler('save');
  166. }
  167. }
  168. window.validQtyItems = function() {
  169. var valid = true;
  170. $$('.qty-item').each(function(item) {
  171. var val = parseFloat(item.value);
  172. if (isNaN(val) || val < 0) {
  173. valid = false;
  174. }
  175. });
  176. return valid;
  177. }
  178. window.bindSendEmail = bindSendEmail;
  179. window.shipmentCommentText = shipmentCommentText;
  180. window.notifyCustomerCheckbox = notifyCustomerCheckbox;
  181. window.sendEmailCheckbox = sendEmailCheckbox;
  182. //]]>
  183. });
  184. script;
  185. ?>
  186. <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>