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.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js
index 8412f35d..90fe4a76 100644
--- a/StoneIsland/www/js/lib/cart/CartPayment.js
+++ b/StoneIsland/www/js/lib/cart/CartPayment.js
@@ -2,16 +2,26 @@ var CartPayment = FormView.extend({
el: "#cart_payment",
+ action: sdk.cart.set_credit_card,
+
events: {
+ "change [name=same_as_shipping]": "toggle_shipping",
+ "click .dropdown-wrapper": "toggle_dropdown",
},
initialize: function(opt){
this.parent = opt.parent
this.$form = this.$("form")
this.$msg = this.$(".msg")
+ this.$address_list = this.$(".address_list")
+ this.$address_form = this.$(".address")
+ this.$cc_form = this.$(".cc")
+
this.address = new AddressView ({ parent: this, checkPhone: false })
this.cc = new CreditCardView ({ parent: this })
this.scroller = new IScroll('#cart_payment', app.iscroll_options)
+ this.address.disabled = true
+ this.cc.disabled = true
},
// sdk.cart.set_credit_card
@@ -27,12 +37,29 @@ var CartPayment = FormView.extend({
app.footer.show("CONFIRM >", "CANCEL")
window.location.hash = "#/cart/payment"
+ this.populate()
this.deferScrollToTop()
+ },
+
+ toggle_dropdown: function(state){
+ if (! app.account.ccs.length) {
+ state = false
+ }
+ this.list_mode = typeof state == "boolean" ? state : ! this.list_mode
+ this.address.disabled = this.list_mode
+ this.$address_form.toggle(! this.list_mode)
+ this.$cc_form.toggle(! this.list_mode)
+ this.$address_list.toggle(this.list_mode)
+ },
- sdk.cart.set_payment_type({ data: payment_id })
+ populate: function(){
+ app.account.ccs.forEach(function(cc){
+ })
},
save: function(){
+ // use stored credit card
+ return
},
cancel: function(){