Skip to content

Commit d251eee

Browse files
committed
Merge branch 'MAGETWO-52746' of github.corp.magento.com:magento-firedrakes/magento2ce into MAGETWO-52746
2 parents 460ac95 + fc2f9cb commit d251eee

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

app/code/Magento/SalesRule/view/adminhtml/ui_component/sales_rule_form.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@
437437
<field name="apply_to_shipping">
438438
<argument name="data" xsi:type="array">
439439
<item name="config" xsi:type="array">
440+
<item name="component" xsi:type="string">Magento_Ui/js/form/element/single-checkbox-toggle-notice</item>
440441
<item name="dataType" xsi:type="string">boolean</item>
441442
<item name="formElement" xsi:type="string">checkbox</item>
442443
<item name="source" xsi:type="string">sales_rule</item>
@@ -445,6 +446,10 @@
445446
<item name="true" xsi:type="number">1</item>
446447
<item name="false" xsi:type="number">0</item>
447448
</item>
449+
<item name="notices" xsi:type="array">
450+
<item name="0" xsi:type="string" translate="true">Discount amount is applied to subtotal only</item>
451+
<item name="1" xsi:type="string" translate="true">Discount amount is applied to subtotal and shipping amount separately</item>
452+
</item>
448453
<item name="default" xsi:type="number">0</item>
449454
<item name="label" xsi:type="string" translate="true">Apply to Shipping Amount</item>
450455
</item>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Copyright © 2016 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'Magento_Ui/js/form/element/single-checkbox'
8+
], function (SingleCheckbox) {
9+
'use strict';
10+
11+
return SingleCheckbox.extend({
12+
defaults: {
13+
notices: [],
14+
tracks: {
15+
notice: true
16+
}
17+
},
18+
19+
/**
20+
* Choose notice on initialization
21+
*
22+
* @returns {*|void|Element}
23+
*/
24+
initialize: function () {
25+
this._super()
26+
.chooseNotice();
27+
28+
return this;
29+
},
30+
31+
/**
32+
* Choose notice function
33+
*
34+
* @returns {void}
35+
*/
36+
chooseNotice: function () {
37+
var checkedNoticeNumber = Number(this.checked());
38+
39+
this.notice = this.notices[checkedNoticeNumber];
40+
},
41+
42+
/**
43+
* Choose notice on update
44+
*
45+
* @returns {void}
46+
*/
47+
onUpdate: function () {
48+
this._super();
49+
this.chooseNotice();
50+
}
51+
});
52+
});

0 commit comments

Comments
 (0)