Skip to content

Commit

Permalink
[SOLO-23136] Update region during admin order address edit (Magento i…
Browse files Browse the repository at this point in the history
…ssue magento#4000)
  • Loading branch information
Daniela Sayuri Yassuda committed Aug 15, 2017
1 parent e6ed8de commit 5d396f2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<div class="message message-notice">
<div class="message-inner">
<div class="message-content"><?php /* @escapeNotVerified */ echo __('Changing address information will not recalculate shipping, tax or other order amount.') ?></div>
<div class="message-content"><?= /* @escapeNotVerified */ __('Changing address information will not recalculate shipping, tax or other order amount.') ?></div>
</div>
</div>

<fieldset class="fieldset admin__fieldset-wrapper">
<legend class="legend admin__legend">
<span><?php /* @escapeNotVerified */ echo $block->getHeaderText() ?></span>
<span><?= /* @escapeNotVerified */ $block->getHeaderText() ?></span>
</legend>
<br>
<div class="form-inline">
<?php echo $block->getForm()->toHtml() ?>
<div class="form-inline" data-mage-init='{"Magento_Sales/order/edit/address/form":{}}'>
<?= $block->getForm()->toHtml() ?>
</div>
</fieldset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery'
], function ($) {
'use strict';

/**
* Currently Magento App stores both region_id and region (as text) values.
* To prevent missing region (as text) we need to copy it in hidden field.
* @param {Array} config
* @param {String} element
*/
return function (config, element) {
var form = $(element),
regionId = form.find('#region_id'),

/**
* Set region callback
*/
setRegion = function () {
form.find('#region').val(regionId.filter(':visible').find(':selected').text());
};

if (regionId.is(':visible')) {
setRegion();
}

regionId.on('change', setRegion);
form.find('#country_id').on('change', setRegion);
};
});

0 comments on commit 5d396f2

Please sign in to comment.