@@ -6,12 +6,11 @@ define([
6
6
"jquery" ,
7
7
'Magento_Ui/js/modal/confirm' ,
8
8
'Magento_Ui/js/modal/alert' ,
9
- 'knockout' ,
10
9
"mage/translate" ,
11
10
"prototype" ,
12
11
"Magento_Catalog/catalog/product/composite/configure" ,
13
12
'Magento_Ui/js/lib/view/utils/async'
14
- ] , function ( jQuery , confirm , alert , ko ) {
13
+ ] , function ( jQuery , confirm , alert ) {
15
14
16
15
window . AdminOrder = new Class . create ( ) ;
17
16
@@ -38,52 +37,49 @@ define([
38
37
this . isOnlyVirtualProduct = false ;
39
38
this . excludedPaymentMethods = [ ] ;
40
39
this . summarizePrice = true ;
41
- this . areasLoadedFlag = ko . observable ( false ) ;
42
40
jQuery . async ( '#order-items' , ( function ( ) {
43
- this . areasLoadedFlag . subscribe ( function ( val ) {
44
- if ( val ) {
45
- this . dataArea = new OrderFormArea ( 'data' , $ ( this . getAreaId ( 'data' ) ) , this ) ;
46
- this . itemsArea = Object . extend ( new OrderFormArea ( 'items' , $ ( this . getAreaId ( 'items' ) ) , this ) , {
47
- addControlButton : function ( button ) {
48
- var controlButtonArea = $ ( this . node ) . select ( '.actions' ) [ 0 ] ;
49
- if ( typeof controlButtonArea != 'undefined' ) {
50
- var buttons = controlButtonArea . childElements ( ) ;
51
- for ( var i = 0 ; i < buttons . length ; i ++ ) {
52
- if ( buttons [ i ] . innerHTML . include ( button . label ) ) {
53
- return ;
54
- }
55
- }
56
- button . insertIn ( controlButtonArea , 'top' ) ;
41
+ this . dataArea = new OrderFormArea ( 'data' , $ ( this . getAreaId ( 'data' ) ) , this ) ;
42
+ this . itemsArea = Object . extend ( new OrderFormArea ( 'items' , $ ( this . getAreaId ( 'items' ) ) , this ) , {
43
+ addControlButton : function ( button ) {
44
+ var controlButtonArea = $ ( this . node ) . select ( '.actions' ) [ 0 ] ;
45
+ if ( typeof controlButtonArea != 'undefined' ) {
46
+ var buttons = controlButtonArea . childElements ( ) ;
47
+ for ( var i = 0 ; i < buttons . length ; i ++ ) {
48
+ if ( buttons [ i ] . innerHTML . include ( button . label ) ) {
49
+ return ;
57
50
}
58
51
}
59
- } ) ;
52
+ button . insertIn ( controlButtonArea , 'top' ) ;
53
+ }
54
+ }
55
+ } ) ;
60
56
61
- var searchButton = new ControlButton ( jQuery . mage . __ ( 'Add Products' ) ) ,
62
- searchAreaId = this . getAreaId ( 'search' ) ;
63
- searchButton . onClick = function ( ) {
64
- $ ( searchAreaId ) . show ( ) ;
65
- var el = this ;
66
- window . setTimeout ( function ( ) {
67
- el . remove ( ) ;
68
- } , 10 ) ;
69
- } ;
70
-
71
- this . dataArea . onLoad = this . dataArea . onLoad . wrap ( function ( proceed ) {
72
- proceed ( ) ;
73
- this . _parent . itemsArea . setNode ( $ ( this . _parent . getAreaId ( 'items' ) ) ) ;
74
- this . _parent . itemsArea . onLoad ( ) ;
75
- } ) ;
57
+ var searchButton = new ControlButton ( jQuery . mage . __ ( 'Add Products' ) ) ,
58
+ searchAreaId = this . getAreaId ( 'search' ) ;
59
+ searchButton . onClick = function ( ) {
60
+ $ ( searchAreaId ) . show ( ) ;
61
+ var el = this ;
62
+ window . setTimeout ( function ( ) {
63
+ el . remove ( ) ;
64
+ } , 10 ) ;
65
+ } ;
76
66
77
- this . itemsArea . onLoad = this . itemsArea . onLoad . wrap ( function ( proceed ) {
78
- proceed ( ) ;
79
- if ( $ ( searchAreaId ) && ! $ ( searchAreaId ) . visible ( ) ) {
80
- this . addControlButton ( searchButton ) ;
81
- }
82
- } ) ;
83
- this . areasLoaded ( ) ;
84
- this . itemsArea . onLoad ( ) ;
85
- }
86
- } , this ) ;
67
+ if ( jQuery ( '#' + this . getAreaId ( 'items' ) ) . is ( ':visible' ) ) {
68
+ this . dataArea . onLoad = this . dataArea . onLoad . wrap ( function ( proceed ) {
69
+ proceed ( ) ;
70
+ this . _parent . itemsArea . setNode ( $ ( this . _parent . getAreaId ( 'items' ) ) ) ;
71
+ this . _parent . itemsArea . onLoad ( ) ;
72
+ } ) ;
73
+
74
+ this . itemsArea . onLoad = this . itemsArea . onLoad . wrap ( function ( proceed ) {
75
+ proceed ( ) ;
76
+ if ( $ ( searchAreaId ) && ! $ ( searchAreaId ) . visible ( ) ) {
77
+ this . addControlButton ( searchButton ) ;
78
+ }
79
+ } ) ;
80
+ this . areasLoaded ( ) ;
81
+ this . itemsArea . onLoad ( ) ;
82
+ }
87
83
} ) . bind ( this ) ) ;
88
84
89
85
jQuery ( '#edit_form' )
0 commit comments