OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview 'settings-credit-card-edit-dialog' is the dialog that allows | 6 * @fileoverview 'settings-credit-card-edit-dialog' is the dialog that allows |
7 * editing or creating a credit card entry. | 7 * editing or creating a credit card entry. |
8 */ | 8 */ |
9 | 9 |
10 (function() { | 10 (function() { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 firstYear = selectedYear; | 91 firstYear = selectedYear; |
92 else if (selectedYear > lastYear) | 92 else if (selectedYear > lastYear) |
93 lastYear = selectedYear; | 93 lastYear = selectedYear; |
94 | 94 |
95 var yearList = []; | 95 var yearList = []; |
96 for (var i = firstYear; i <= lastYear; ++i) { | 96 for (var i = firstYear; i <= lastYear; ++i) { |
97 yearList.push(i.toString()); | 97 yearList.push(i.toString()); |
98 } | 98 } |
99 this.yearList_ = yearList; | 99 this.yearList_ = yearList; |
100 | 100 |
101 this.async(function() { | 101 this.async(() => { |
102 this.expirationYear_ = selectedYear.toString(); | 102 this.expirationYear_ = selectedYear.toString(); |
103 this.expirationMonth_ = this.creditCard.expirationMonth; | 103 this.expirationMonth_ = this.creditCard.expirationMonth; |
104 this.$.dialog.showModal(); | 104 this.$.dialog.showModal(); |
105 }.bind(this)); | 105 }); |
106 }, | 106 }, |
107 | 107 |
108 /** Closes the dialog. */ | 108 /** Closes the dialog. */ |
109 close: function() { | 109 close: function() { |
110 this.$.dialog.close(); | 110 this.$.dialog.close(); |
111 }, | 111 }, |
112 | 112 |
113 /** | 113 /** |
114 * Handler for tapping the 'cancel' button. Should just dismiss the dialog. | 114 * Handler for tapping the 'cancel' button. Should just dismiss the dialog. |
115 * @private | 115 * @private |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 this.$.saveButton.disabled = !this.saveEnabled_(); | 152 this.$.saveButton.disabled = !this.saveEnabled_(); |
153 }, | 153 }, |
154 | 154 |
155 /** @private */ | 155 /** @private */ |
156 saveEnabled_: function() { | 156 saveEnabled_: function() { |
157 return (this.creditCard.name && this.creditCard.name.trim()) || | 157 return (this.creditCard.name && this.creditCard.name.trim()) || |
158 (this.creditCard.cardNumber && this.creditCard.cardNumber.trim()); | 158 (this.creditCard.cardNumber && this.creditCard.cardNumber.trim()); |
159 }, | 159 }, |
160 }); | 160 }); |
161 })(); | 161 })(); |
OLD | NEW |