| 1 |
weForms.routeComponents.Transactions = { |
| 2 |
template: '#tmpl-wpuf-transactions', |
| 3 |
data: function() { |
| 4 |
return { |
| 5 |
selected: 0, |
| 6 |
no_transactions: false, |
| 7 |
forms: {}, |
| 8 |
form_title: 'Loading...', |
| 9 |
}; |
| 10 |
}, |
| 11 |
|
| 12 |
created: function(){ |
| 13 |
this.get_forms(); |
| 14 |
}, |
| 15 |
|
| 16 |
methods: { |
| 17 |
get_forms: function(){ |
| 18 |
var self = this; |
| 19 |
|
| 20 |
wp.ajax.send( 'weforms_form_list', { |
| 21 |
data: { |
| 22 |
_wpnonce: weForms.nonce, |
| 23 |
page: self.currentPage, |
| 24 |
filter: 'transactions', |
| 25 |
}, |
| 26 |
success: function(response) { |
| 27 |
|
| 28 |
if ( Object.keys(response.forms).length ) { |
| 29 |
self.forms = response.forms; |
| 30 |
self.selected = self.forms[Object.keys(self.forms)[0]].id; |
| 31 |
} else { |
| 32 |
self.form_title = 'No transaction found'; |
| 33 |
self.no_transactions = true; |
| 34 |
} |
| 35 |
}, |
| 36 |
error: function(error) { |
| 37 |
alert(error); |
| 38 |
} |
| 39 |
}); |
| 40 |
}, |
| 41 |
}, |
| 42 |
}; |
| 43 |
|