view.phtml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. ?>
  6. <?php
  7. /** @var \Magento\Backend\Block\Template $block */
  8. /** @var \Temando\Shipping\ViewModel\Batch\BatchDetails $viewModel */
  9. /** @var \Temando\Shipping\ViewModel\Shipment\ShipmentDetails $shipmentViewModel */
  10. $viewModel = $block->getData('viewModel');
  11. $shipmentViewModel = $block->getData('shipmentViewModel');
  12. /** @var \Temando\Shipping\Model\Batch $batch */
  13. $batch = $viewModel->getBatch();
  14. ?>
  15. <?php if ($batch) : ?>
  16. <section class="admin__page-section">
  17. <div class="admin__page-section-title">
  18. <span class="title"><?= $block->escapeHtml(__('Batch Information')); ?></span>
  19. </div>
  20. <div class="admin__table-wrapper batch-information">
  21. <table class="admin__table-secondary">
  22. <tbody>
  23. <tr>
  24. <th><?= $block->escapeHtml(__('Date Created')); ?></th>
  25. <?php // @codingStandardsIgnoreLine ?>
  26. <td><?= $block->escapeHtml($viewModel->getDate($batch->getCreatedAtDate())->format('Y-m-d g:i a')); ?></td>
  27. </tr>
  28. <tr>
  29. <th><?= $block->escapeHtml(__('Number of Shipments booked successfully')); ?></th>
  30. <td><?= /* @noEscape */ count($batch->getIncludedShipments()); ?></td>
  31. </tr>
  32. <?php $failedShipmentCount = count($batch->getFailedShipments()); ?>
  33. <?php if ($failedShipmentCount) : ?>
  34. <tr>
  35. <th><?= $block->escapeHtml(__('Number of Shipments failed to book')); ?></th>
  36. <td>
  37. <?= /* @noEscape */ $failedShipmentCount ?>
  38. <a href="<?= $block->escapeUrl($viewModel->getSolveUrl()); ?>">
  39. <?= $block->escapeHtml(__('Find Solutions')); ?>
  40. </a>
  41. </td>
  42. </tr>
  43. <?php endif; ?>
  44. <tr>
  45. <th><?= $block->escapeHtml(__('Date Updated')); ?></th>
  46. <?php // @codingStandardsIgnoreLine ?>
  47. <td><?= $block->escapeHtml($viewModel->getDate($batch->getUpdatedAtDate())->format('Y-m-d g:i a')); ?></td>
  48. </tr>
  49. <tr>
  50. <th><?= $block->escapeHtml(__('Batch-id')); ?></th>
  51. <td><?= $block->escapeHtml($batch->getBatchId()); ?></td>
  52. </tr>
  53. <tr>
  54. <th><?= $block->escapeHtml(__('Batch Status')); ?></th>
  55. <td><?= $block->escapeHtml($batch->getStatus()); ?></td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. </div>
  60. </section>
  61. <section class="admin__page-section">
  62. <div class="admin__page-section-title">
  63. <span class="title"><?= $block->escapeHtml(__('Documentation')); ?></span>
  64. </div>
  65. <div class="admin__table-wrapper batch-documentation">
  66. <table class="admin__table-secondary">
  67. <tbody>
  68. <tr>
  69. <?php // @codingStandardsIgnoreLine ?>
  70. <td><?= $block->escapeHtml(__('Shipping labels for each shipment are consolidated into a single compressed file')); ?></td>
  71. <td>
  72. <?php if ($batch->getDocumentation()) : ?>
  73. <a href="<?= $block->escapeHtml($batch->getDocumentation()); ?>">
  74. <?= $block->escapeHtml(__('Download Documentation')); ?>
  75. </a>
  76. <?php else : ?>
  77. <?= $block->escapeHtml(__('Documentation is not available.')); ?>
  78. <?php endif; ?>
  79. </td>
  80. </tr>
  81. </tbody>
  82. </table>
  83. </div>
  84. </section>
  85. <section class="admin__page-section">
  86. <div class="admin__data-grid-wrap batch-shipments">
  87. <table class="data-grid">
  88. <thead>
  89. <tr>
  90. <th class="data-grid-th"><?= $block->escapeHtml(__('Shipment')); ?></th>
  91. <th class="data-grid-th"><?= $block->escapeHtml(__('Ship to Name')); ?></th>
  92. <th class="data-grid-th"><?= $block->escapeHtml(__('Destination Address')); ?></th>
  93. <th class="data-grid-th"><?= $block->escapeHtml(__('Items Ordered')); ?></th>
  94. <th class="data-grid-th"><?= $block->escapeHtml(__('Action')); ?></th>
  95. </tr>
  96. </thead>
  97. <tbody>
  98. <?php foreach ($batch->getIncludedShipments() as $includedShipment) : ?>
  99. <?php $shipmentInfo = $viewModel->getShipmentInfoForGrid($includedShipment->getShipmentId())?>
  100. <?php if ($shipmentInfo->getData('shipment_id')) : ?>
  101. <tr class="data-row">
  102. <td><?= $block->escapeHtml($shipmentInfo->getData('shipment_id')) ?></td>
  103. <td><?= $block->escapeHtml($shipmentInfo->getData('ship_to_name')) ?></td>
  104. <td><?= /* @noEscape */ $shipmentInfo->getData('destination_address') ?></td>
  105. <td><?= /* @noEscape */ $shipmentInfo->getData('items_ordered') ?></td>
  106. <td>
  107. <?php $url = $shipmentViewModel->getViewActionUrl($includedShipment->getShipmentId()) ?>
  108. <a href="<?= $block->escapeUrl($url) ?>"><?= $block->escapeHtml(__('View')) ?></a>
  109. </td>
  110. </tr>
  111. <?php endif;?>
  112. <?php endforeach; ?>
  113. </tbody>
  114. </table>
  115. </div>
  116. </section>
  117. <?php endif; ?>