This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,50 @@
define([
'jquery',
'Magento_Ui/js/grid/columns/actions',
'Magento_Ui/js/modal/modal',
'mage/translate'
], function ($, Actions, modal, $t) {
'use strict';
return Actions.extend({
getActionHandler: function (action) {
if (action.modal) {
return this.openLegacyOrderModal.bind(this, action);
}
return this._super(action);
},
openLegacyOrderModal: function (action) {
var $dialog = $('#legacy-order-view-modal');
if (!$dialog.length) {
$dialog = $('<div id="legacy-order-view-modal"/>').appendTo('body');
modal({
type: 'popup',
title: $t('Legacy Order Details'),
responsive: true,
innerScroll: true,
modalClass: 'legacy-order-view-modal',
buttons: []
}, $dialog);
}
$dialog.html('<div class="legacy-order-modal-loading">' + $t('Loading...') + '</div>');
$dialog.modal('openModal');
$.ajax({
url: action.href,
type: 'GET',
dataType: 'html',
showLoader: true
}).done(function (html) {
$dialog.html(html);
}).fail(function () {
$dialog.html('<div class="message message-error error"><div>' +
$t('Unable to load the legacy order details.') +
'</div></div>');
});
}
});
});
@@ -0,0 +1,98 @@
define([
'jquery',
'Magento_Ui/js/grid/massactions',
'Magento_Ui/js/modal/modal',
'Magento_Ui/js/modal/alert',
'mageUtils',
'mage/translate'
], function ($, Massactions, modal, alert, utils, $t) {
'use strict';
return Massactions.extend({
applyAction: function (actionIndex) {
if (actionIndex === 'bind_customer') {
this.openBindCustomerModal();
this.close();
return this;
}
return this._super(actionIndex);
},
openBindCustomerModal: function () {
var data = this.getSelections(),
action = this.getAction('bind_customer'),
$dialog = $('#legacy-order-bind-customer-modal'),
self = this;
if (!data || !data.total) {
alert({content: this.noItemsMsg});
return;
}
if (!$dialog.length) {
$dialog = $(
'<div id="legacy-order-bind-customer-modal">' +
'<label class="admin__field-label" for="legacy-order-mass-customer"><span>' +
$t('Customer ID or Email') +
'</span></label>' +
'<input id="legacy-order-mass-customer" class="admin__control-text" type="text" />' +
'<p class="note">' +
$t('All selected orders will be linked to the matching customer in each order website.') +
'</p></div>'
).appendTo('body');
modal({
type: 'popup',
title: $t('Bind Customer'),
responsive: true,
modalClass: 'legacy-order-bind-customer-modal',
buttons: [{
text: $t('Cancel'),
class: 'action-secondary',
click: function () {
this.closeModal();
}
}, {
text: $t('Bind Customer'),
class: 'action-primary',
click: function () {
self.submitCustomerBinding(
$dialog.data('action'),
$dialog.data('selections'),
$dialog,
this
);
}
}]
}, $dialog);
}
$dialog.data('action', action).data('selections', data);
$dialog.find('input').val('');
$dialog.modal('openModal');
window.setTimeout(function () {
$dialog.find('input').trigger('focus');
}, 100);
},
submitCustomerBinding: function (action, data, $dialog, modalInstance) {
var customer = $.trim($dialog.find('input').val()),
itemsType,
params = {};
if (!customer) {
alert({content: $t('Enter a customer ID or email.')});
return;
}
itemsType = data.excludeMode ? 'excluded' : 'selected';
params[itemsType] = Array.isArray(data[itemsType]) && data[itemsType].length ?
data[itemsType] : false;
$.extend(params, data.params || {});
params.customer = customer;
modalInstance.closeModal();
utils.submit({url: action.url, data: params});
}
});
});