File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
SalesRule/view/adminhtml/ui_component
Ui/view/base/web/js/form/element Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 437
437
<field name =" apply_to_shipping" >
438
438
<argument name =" data" xsi : type =" array" >
439
439
<item name =" config" xsi : type =" array" >
440
+ <item name =" component" xsi : type =" string" >Magento_Ui/js/form/element/single-checkbox-toggle-notice</item >
440
441
<item name =" dataType" xsi : type =" string" >boolean</item >
441
442
<item name =" formElement" xsi : type =" string" >checkbox</item >
442
443
<item name =" source" xsi : type =" string" >sales_rule</item >
445
446
<item name =" true" xsi : type =" number" >1</item >
446
447
<item name =" false" xsi : type =" number" >0</item >
447
448
</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 >
448
453
<item name =" default" xsi : type =" number" >0</item >
449
454
<item name =" label" xsi : type =" string" translate =" true" >Apply to Shipping Amount</item >
450
455
</item >
Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments