|
3 | 3 | * See COPYING.txt for license details.
|
4 | 4 | */
|
5 | 5 |
|
6 |
| -'use strict'; |
| 6 | +define([ |
| 7 | + 'uiComponent', |
| 8 | + 'Magento_Ui/js/modal/confirm', |
| 9 | + 'jquery', |
| 10 | + 'ko', |
| 11 | + 'mage/translate', |
| 12 | + 'mage/template', |
| 13 | + 'text!Magento_LoginAsCustomerUi/template/confirmation-popup/store-view-ptions.html' |
| 14 | +], function (Component, confirm, $, ko, $t, template, selectTpl) { |
7 | 15 |
|
8 |
| -define( |
9 |
| - [ |
10 |
| - 'uiComponent', |
11 |
| - 'Magento_Ui/js/modal/confirm', |
12 |
| - 'jquery', |
13 |
| - 'ko', |
14 |
| - 'mage/translate', |
15 |
| - 'mage/template', |
16 |
| - 'text!Magento_LoginAsCustomerUi/template/confirmation-popup/store-view-ptions.html' |
17 |
| - ], |
18 |
| - function (Component, confirm, $, ko, $t, template, selectTpl, undefined) { |
| 16 | + 'use strict'; |
19 | 17 |
|
20 |
| - return Component.extend({ |
21 |
| - /** |
22 |
| - * Initialize Component |
23 |
| - */ |
24 |
| - initialize: function () { |
25 |
| - this._super(); |
26 |
| - var self = this, |
27 |
| - content = '<div class="message message-warning">' + self.content + '</div>'; |
| 18 | + return Component.extend({ |
| 19 | + /** |
| 20 | + * Initialize Component |
| 21 | + */ |
| 22 | + initialize: function () { |
| 23 | + var self = this, |
| 24 | + content = '<div class="message message-warning">' + self.content + '</div>'; |
28 | 25 |
|
29 |
| - if (self.showStoreViewOptions) { |
30 |
| - content = template( |
31 |
| - selectTpl, |
32 |
| - { |
33 |
| - data: { |
34 |
| - showStoreViewOptions: self.showStoreViewOptions, |
35 |
| - storeViewOptions: self.storeViewOptions, |
36 |
| - label: $t('Store View') |
37 |
| - } |
38 |
| - }) + content; |
39 |
| - } |
| 26 | + this._super(); |
40 | 27 |
|
41 |
| - /** |
42 |
| - * Confirmation popup |
43 |
| - * |
44 |
| - * @param {String} url |
45 |
| - * @returns {Boolean} |
46 |
| - */ |
47 |
| - window.lacConfirmationPopup = function (url) { |
48 |
| - confirm({ |
49 |
| - title: self.title, |
50 |
| - content: content, |
51 |
| - modalClass: 'confirm lac-confirm', |
52 |
| - actions: { |
53 |
| - /** |
54 |
| - * Confirm action. |
55 |
| - */ |
56 |
| - confirm: function () { |
57 |
| - var storeId = $('#lac-confirmation-popup-store-id').val(); |
| 28 | + if (self.showStoreViewOptions) { |
| 29 | + content = template( |
| 30 | + selectTpl, |
| 31 | + { |
| 32 | + data: { |
| 33 | + showStoreViewOptions: self.showStoreViewOptions, |
| 34 | + storeViewOptions: self.storeViewOptions, |
| 35 | + label: $t('Store View') |
| 36 | + } |
| 37 | + }) + content; |
| 38 | + } |
58 | 39 |
|
59 |
| - if (storeId) { |
60 |
| - url += ((url.indexOf('?') == -1) ? '?' : '&') + 'store_id=' + storeId; |
61 |
| - } |
62 |
| - window.open(url); |
63 |
| - } |
64 |
| - }, |
65 |
| - buttons: [{ |
66 |
| - text: $t('Cancel'), |
67 |
| - class: 'action-secondary action-dismiss', |
| 40 | + /** |
| 41 | + * Confirmation popup |
| 42 | + * |
| 43 | + * @param {String} url |
| 44 | + * @returns {Boolean} |
| 45 | + */ |
| 46 | + window.lacConfirmationPopup = function (url) { |
| 47 | + confirm({ |
| 48 | + title: self.title, |
| 49 | + content: content, |
| 50 | + modalClass: 'confirm lac-confirm', |
| 51 | + actions: { |
| 52 | + /** |
| 53 | + * Confirm action. |
| 54 | + */ |
| 55 | + confirm: function () { |
| 56 | + var storeId = $('#lac-confirmation-popup-store-id').val(); |
68 | 57 |
|
69 |
| - /** |
70 |
| - * Click handler. |
71 |
| - */ |
72 |
| - click: function (event) { |
73 |
| - this.closeModal(event); |
| 58 | + if (storeId) { |
| 59 | + url += url.indexOf('?') === -1 ? '?' : '&'; |
| 60 | + url += 'store_id=' + storeId; |
74 | 61 | }
|
75 |
| - }, { |
76 |
| - text: $t('Login as Customer'), |
77 |
| - class: 'action-primary action-accept', |
| 62 | + window.open(url); |
| 63 | + } |
| 64 | + }, |
| 65 | + buttons: [{ |
| 66 | + text: $t('Cancel'), |
| 67 | + class: 'action-secondary action-dismiss', |
78 | 68 |
|
79 |
| - /** |
80 |
| - * Click handler. |
81 |
| - */ |
82 |
| - click: function (event) { |
83 |
| - this.closeModal(event, true); |
84 |
| - } |
85 |
| - }] |
86 |
| - }); |
| 69 | + /** |
| 70 | + * Click handler. |
| 71 | + */ |
| 72 | + click: function (event) { |
| 73 | + this.closeModal(event); |
| 74 | + } |
| 75 | + }, { |
| 76 | + text: $t('Login as Customer'), |
| 77 | + class: 'action-primary action-accept', |
87 | 78 |
|
88 |
| - return false; |
89 |
| - }; |
90 |
| - } |
91 |
| - }); |
92 |
| - } |
93 |
| -); |
| 79 | + /** |
| 80 | + * Click handler. |
| 81 | + */ |
| 82 | + click: function (event) { |
| 83 | + this.closeModal(event, true); |
| 84 | + } |
| 85 | + }] |
| 86 | + }); |
| 87 | + |
| 88 | + return false; |
| 89 | + }; |
| 90 | + } |
| 91 | + }); |
| 92 | +}); |
0 commit comments