summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/cart/CartPayment.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib/cart/CartPayment.js')
-rw-r--r--StoneIsland/www/js/lib/cart/CartPayment.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js
index 62dfe32d..d052e31f 100644
--- a/StoneIsland/www/js/lib/cart/CartPayment.js
+++ b/StoneIsland/www/js/lib/cart/CartPayment.js
@@ -11,7 +11,7 @@ var CartPayment = FormView.extend({
cc_list_mode: false,
events: {
- "change [name=same_as_shipping]": "toggle_shipping",
+ "change [name=SameAsShipping]": "toggle_shipping",
"click .address_dropdown": "toggle_address",
"click .cc_dropdown": "toggle_cc",
},
@@ -20,10 +20,14 @@ var CartPayment = FormView.extend({
this.parent = opt.parent
this.$form = this.$("form")
this.$msg = this.$(".msg")
+ this.$same_as_shipping = this.$("[name=SameAsShipping]")
+ this.$billing_address_rapper = this.$(".billing_address_rapper")
this.$address_list = this.$(".address_list")
this.$address_form = this.$(".address")
+ this.$address_dropdown = this.$(".address_dropdown")
this.$cc_list = this.$(".cc_list")
this.$cc_form = this.$(".cc")
+ this.$cc_dropdown = this.$(".cc_dropdown")
this.address = new AddressView ({ parent: this, checkPhone: false })
this.cc = new CreditCardView ({ parent: this })
@@ -48,11 +52,20 @@ var CartPayment = FormView.extend({
this.populate()
this.deferScrollToTop()
},
+
+ toggle_shipping: function(){
+ setTimeout(function(){
+ var state = this.$same_as_shipping.prop("checked")
+ this.$billing_address_rapper.toggle( ! state )
+ }.bind(this))
+ },
toggle_address: function(state){
if (! app.account.ccs.length) {
state = false
}
+ // this.$address_dropdown.toggle( !! app.account.ccs.length )
+
this.address_list_mode = typeof state == "boolean" ? state : ! this.list_mode
this.address.disabled = this.address_list_mode
this.$address_form.toggle(! this.address_list_mode)
@@ -63,6 +76,8 @@ var CartPayment = FormView.extend({
if (! app.account.ccs.length) {
state = false
}
+ // this.$cc_dropdown.toggle( !! app.account.ccs.length )
+
this.cc_list_mode = typeof state == "boolean" ? state : ! this.cc_list_mode
this.cc.disabled = this.cc_list_mode
this.$cc_form.toggle(! this.cc_list_mode)
@@ -70,6 +85,12 @@ var CartPayment = FormView.extend({
},
populate: function(){
+ this.$(".save_as_default").show()
+ this.$address_list.empty()
+ this.$cc_list.empty()
+ this.toggle_address( !! app.account.ccs.length )
+ this.toggle_cc( !! app.account.ccs.length )
+
app.account.ccs.forEach(function(cc){
console.log(cc)