Skip to content

Commit 501a96f

Browse files
author
Evgeniy Kolesov
committed
MAGETWO-44528: Poor UX of "Create Packages" popup while creating shipping label
1 parent 8cca451 commit 501a96f

File tree

10 files changed

+227
-687
lines changed

10 files changed

+227
-687
lines changed

app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,7 @@ public function getDeliveryConfirmationTypes()
307307
public function getPrintButton()
308308
{
309309
$data['shipment_id'] = $this->getShipment()->getId();
310-
$url = $this->getUrl('adminhtml/order_shipment/printPackage', $data);
311-
return $this->getLayout()->createBlock(
312-
'Magento\Backend\Block\Widget\Button'
313-
)->setData(
314-
['label' => __('Print'), 'onclick' => 'setLocation(\'' . $url . '\')']
315-
)->toHtml();
310+
return $this->getUrl('adminhtml/order_shipment/printPackage', $data);
316311
}
317312

318313
/**

app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/grid.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
$customsValueDisplay = ' style="display: none;" ';
7171
$customsValueValidation = '';
7272
}
73+
7374
?>
7475
<td <?php /* @escapeNotVerified */ echo $customsValueDisplay ?>>
7576
<input type="text"
@@ -88,7 +89,7 @@
8889
name="qty"
8990
value="<?php /* @escapeNotVerified */ echo $item->getQty()*1; ?>"
9091
class="input-text admin__control-text qty<?php if ($item->getOrderItem()->getIsQtyDecimal()): ?> qty-decimal<?php endif ?>">&nbsp;
91-
<button type="button" class="action-delete delete icon-btn" onclick="packaging.deleteItem(this);" style="display:none;">
92+
<button type="button" class="action-delete" data-action="package-delete-item" onclick="packaging.deleteItem(this);" style="display:none;">
9293
<span><?php /* @escapeNotVerified */ echo __('Delete') ?></span>
9394
</button>
9495
</td>

app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,14 @@
157157
jQuery('#packed_window').modal('openModal');
158158
}
159159
</script>
160-
<?php
161-
$printLocation = $block->getUrl(
162-
'adminhtml/order_shipment/printPackage',
163-
array('shipment_id' => $block->getShipment()->getId())
164-
);
165-
?>
160+
166161
<script type="text/x-magento-init">
167162
{
168163
"#packed_window": {
169164
"Magento_Shipping/js/packages":{
170165
"type":"slide",
171166
"title":"<?= /* @escapeNotVerified */ __('Packages') ?>",
172-
"url": "<?= /* @escapeNotVerified */ $printLocation ?>"
167+
"url": "<?= /* @escapeNotVerified */ $block->getPrintButton(); ?>"
173168
}
174169
}
175170
}

app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml

Lines changed: 1 addition & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -78,202 +78,4 @@ $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 :
7878
});
7979
});
8080
</script>
81-
<div id="packaging_window">
82-
<div class="message message-warning" style="display: none"></div>
83-
<section class="admin__page-section" id="package_template" style="display:none;">
84-
<div class="admin__page-section-title">
85-
<span class="title">
86-
<?php /* @escapeNotVerified */ echo __('Package') ?> <span data-role="package-number"></span>
87-
</span>
88-
<div class="actions _primary">
89-
<button type="button" class="action-secondary" data-action="package-save-items" onclick="packaging.packItems(this);">
90-
<span><?php /* @escapeNotVerified */ echo __('Add Selected Product(s) to Package') ?></span>
91-
</button>
92-
<button type="button" class="action-secondary" data-action="package-add-items" onclick="packaging.getItemsForPack(this);">
93-
<span><?php /* @escapeNotVerified */ echo __('Add Products to Package') ?></span>
94-
</button>
95-
</div>
96-
</div>
97-
<div class="admin__control-table-wrapper admin__page-subsection">
98-
<table class="data-table admin__control-table">
99-
<thead>
100-
<tr>
101-
<th class="col-type"><?php /* @escapeNotVerified */ echo __('Type') ?></th>
102-
<?php if ($girthEnabled == 1): ?>
103-
<th class="col-size"><?php /* @escapeNotVerified */ echo __('Size') ?></th>
104-
<th class="col-girth"><?php /* @escapeNotVerified */ echo __('Girth') ?></th>
105-
<th>&nbsp;</th>
106-
<?php endif; ?>
107-
<th class="col-custom" <?php echo $block->displayCustomsValue() ? '' : 'style="display: none;"' ?>>
108-
<?php /* @escapeNotVerified */ echo __('Customs Value') ?>
109-
</th>
110-
<th class="col-total-weight"><?php /* @escapeNotVerified */ echo __('Total Weight') ?></th>
111-
<th class="col-length"><?php /* @escapeNotVerified */ echo __('Length') ?></th>
112-
<th class="col-width"><?php /* @escapeNotVerified */ echo __('Width') ?></th>
113-
<th class="col-height"><?php /* @escapeNotVerified */ echo __('Height') ?></th>
114-
<th>&nbsp;</th>
115-
<?php if ($block->getDeliveryConfirmationTypes()): ?>
116-
<th class="col-signature"><?php /* @escapeNotVerified */ echo __('Signature Confirmation') ?></th>
117-
<?php endif; ?>
118-
<th class="col-actions">&nbsp;</th>
119-
</tr>
120-
</thead>
121-
<tbody>
122-
<tr>
123-
<td class="col-type">
124-
<?php $containers = $block->getContainers(); ?>
125-
<select name="package_container"
126-
onchange="packaging.changeContainerType(this);packaging.checkSizeAndGirthParameter(this, <?php /* @escapeNotVerified */ echo $girthEnabled ?>);"
127-
<?php if (empty($containers)):?>
128-
title="<?php /* @escapeNotVerified */ echo __('USPS domestic shipments don\'t use package types.') ?>"
129-
disabled=""
130-
class="admin__control-select disabled"
131-
<?php else: ?>
132-
class="admin__control-select"
133-
<?php endif; ?>>
134-
<?php foreach ($block->getContainers() as $key => $value): ?>
135-
<option value="<?php /* @escapeNotVerified */ echo $key ?>" >
136-
<?php /* @escapeNotVerified */ echo $value ?>
137-
</option>
138-
<?php endforeach; ?>
139-
</select>
140-
</td>
141-
<?php if ($girthEnabled == 1 && !empty($sizeSource)): ?>
142-
<td>
143-
<select name="package_size"
144-
class="admin__control-select"
145-
onchange="packaging.checkSizeAndGirthParameter(this, <?php /* @escapeNotVerified */ echo $girthEnabled ?>);">
146-
<?php foreach ($sizeSource as $key => $value): ?>
147-
<option value="<?php /* @escapeNotVerified */ echo $sizeSource[$key]['value'] ?>">
148-
<?php /* @escapeNotVerified */ echo $sizeSource[$key]['label'] ?>
149-
</option>
150-
<?php endforeach; ?>
151-
</select>
152-
</td>
153-
<td>
154-
<input type="text"
155-
class="input-text admin__control-text validate-greater-than-zero"
156-
name="container_girth" />
157-
</td>
158-
<td>
159-
<select name="container_girth_dimension_units"
160-
class="options-units-dimensions measures admin__control-select"
161-
onchange="packaging.changeMeasures(this);">
162-
<option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::INCH ?>" selected="selected" ><?php /* @escapeNotVerified */ echo __('in') ?></option>
163-
<option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::CENTIMETER ?>" ><?php /* @escapeNotVerified */ echo __('cm') ?></option>
164-
</select>
165-
</td>
166-
<?php endif; ?>
167-
<?php
168-
if ($block->displayCustomsValue()) {
169-
$customsValueDisplay = '';
170-
$customsValueValidation = ' validate-zero-or-greater ';
171-
} else {
172-
$customsValueDisplay = ' style="display: none;" ';
173-
$customsValueValidation = '';
174-
}
175-
?>
176-
<td class="col-custom" <?php /* @escapeNotVerified */ echo $customsValueDisplay ?>>
177-
<div class="admin__control-addon">
178-
<input type="text"
179-
class="customs-value input-text admin__control-text <?php /* @escapeNotVerified */ echo $customsValueValidation ?>"
180-
name="package_customs_value" />
181-
<span class="admin__addon-suffix">
182-
<span class="customs-value-currency"><?php /* @escapeNotVerified */ echo $block->getCustomValueCurrencyCode(); ?></span>
183-
</span>
184-
</div>
185-
</td>
186-
<td class="col-total-weight">
187-
<div class="admin__control-addon">
188-
<input type="text"
189-
class="options-weight input-text admin__control-text required-entry validate-greater-than-zero"
190-
name="container_weight" />
191-
<select name="container_weight_units"
192-
class="options-units-weight measures admin__control-select"
193-
onchange="packaging.changeMeasures(this);">
194-
<option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Weight::POUND ?>" selected="selected" ><?php /* @escapeNotVerified */ echo __('lb') ?></option>
195-
<option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Weight::KILOGRAM ?>" ><?php /* @escapeNotVerified */ echo __('kg') ?></option>
196-
</select>
197-
<span class="admin__addon-prefix"></span>
198-
</div>
199-
</td>
200-
<td class="col-length">
201-
<input type="text"
202-
class="input-text admin__control-text validate-greater-than-zero"
203-
name="container_length" />
204-
</td>
205-
<td class="col-width">
206-
<input type="text"
207-
class="input-text admin__control-text validate-greater-than-zero"
208-
name="container_width" />
209-
</td>
210-
<td class="col-height">
211-
<input type="text"
212-
class="input-text admin__control-text validate-greater-than-zero"
213-
name="container_height" />
214-
</td>
215-
<td class="col-measure">
216-
<select name="container_dimension_units"
217-
class="options-units-dimensions measures admin__control-select"
218-
onchange="packaging.changeMeasures(this);">
219-
<option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::INCH ?>" selected="selected" ><?php /* @escapeNotVerified */ echo __('in') ?></option>
220-
<option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::CENTIMETER ?>" ><?php /* @escapeNotVerified */ echo __('cm') ?></option>
221-
</select>
222-
</td>
223-
<?php if ($block->getDeliveryConfirmationTypes()): ?>
224-
<td>
225-
<select name="delivery_confirmation_types" class="admin__control-select">
226-
<?php foreach ($block->getDeliveryConfirmationTypes() as $key => $value): ?>
227-
<option value="<?php /* @escapeNotVerified */ echo $key ?>" >
228-
<?php /* @escapeNotVerified */ echo $value ?>
229-
</option>
230-
<?php endforeach; ?>
231-
</select>
232-
</td>
233-
<?php endif; ?>
234-
<td class="col-actions">
235-
<button type="button" class="action-delete DeletePackageBtn" onclick="packaging.deletePackage(this);">
236-
<span><?php /* @escapeNotVerified */ echo __('Delete Package') ?></span>
237-
</button>
238-
</td>
239-
</tr>
240-
</tbody>
241-
</table>
242-
<?php if ($block->getContentTypes()): ?>
243-
<table class="data-table admin__control-table" cellspacing="0">
244-
<thead>
245-
<tr>
246-
<th><?php /* @escapeNotVerified */ echo __('Contents') ?></th>
247-
<th><?php /* @escapeNotVerified */ echo __('Explanation') ?></th>
248-
</tr>
249-
</thead>
250-
<tbody>
251-
<tr>
252-
<td>
253-
<select name="content_type"
254-
class="admin__control-select"
255-
onchange="packaging.changeContentTypes(this);">
256-
<?php foreach ($block->getContentTypes() as $key => $value): ?>
257-
<option value="<?php /* @escapeNotVerified */ echo $key ?>" >
258-
<?php /* @escapeNotVerified */ echo $value ?>
259-
</option>
260-
<?php endforeach; ?>
261-
</select>
262-
</td>
263-
<td>
264-
<input name="content_type_other"
265-
type="text"
266-
class="input-text admin__control-text options-content-type disabled"
267-
disabled="disabled" />
268-
</td>
269-
</tr>
270-
</tbody>
271-
</table>
272-
<?php endif; ?>
273-
</div>
274-
<div class="admin__page-subsection" data-role="package-items">
275-
<div class="grid_prepare admin__page-subsection"></div>
276-
</div>
277-
</section>
278-
<div id="packages_content"></div>
279-
</div>
81+
<?php include ($block->getTemplateFile('Magento_Shipping::order/packaging/popup_content.phtml')) ?>

0 commit comments

Comments
 (0)