summaryrefslogtreecommitdiff
path: root/StoneIsland
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-30 12:58:41 -0500
committerJules Laplace <jules@okfoc.us>2015-11-30 12:58:41 -0500
commit40fbdbbef86b2b882765d6553fc357cd9a978706 (patch)
tree9322e520add30fcf74d5a80de3cfeca068d7a2de /StoneIsland
parent2df4da05937755e2835ee68777c957bce34fb1e3 (diff)
populate address
Diffstat (limited to 'StoneIsland')
-rw-r--r--StoneIsland/www/css/cart.css4
-rw-r--r--StoneIsland/www/index.html47
-rw-r--r--StoneIsland/www/js/lib/account/AccountView.js2
-rw-r--r--StoneIsland/www/js/lib/cart/CartPayment.js23
-rw-r--r--StoneIsland/www/js/lib/cart/CartShipping.js7
5 files changed, 58 insertions, 25 deletions
diff --git a/StoneIsland/www/css/cart.css b/StoneIsland/www/css/cart.css
index 6ba83675..a927f511 100644
--- a/StoneIsland/www/css/cart.css
+++ b/StoneIsland/www/css/cart.css
@@ -85,6 +85,10 @@ border-right: 1px solid #bbb
top:16px;
}
+#cart h3 {
+ padding-left: 5px;
+}
+
.cart_item_row {
display:table;
position:relative;
diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html
index 36c71839..1f5a8f55 100644
--- a/StoneIsland/www/index.html
+++ b/StoneIsland/www/index.html
@@ -700,27 +700,33 @@
</label>
</div>
</div>
+
+ <div class="billing_address_rapper">
- <div class="address_dropdown dropdown-wrapper">
- <div class="dropdown-title add_edit">add / edit</div>
- <div class="dropdown select_address">
- BILLING ADDRESS
+ <div class="address_dropdown dropdown-wrapper">
+ <div class="dropdown-title add_edit">add / edit</div>
+ <div class="dropdown select_address">
+ BILLING ADDRESS
+ </div>
</div>
- </div>
- <div class="address_list checkbox-container">
- <script type="text/html" class="address_template">
- <div class="checkbox-row">
- <div class="checkbox-toggle">
- <input id="address-checkbox-{{id}}" type="radio" name="AddressId" value="{{id}}" {{checked}}>
- <label for="address-checkbox-{{id}}"></label>
+ <div class="address_list checkbox-container">
+ <script type="text/html" class="address_template">
+ <div class="checkbox-row">
+ <div class="checkbox-toggle">
+ <input id="address-checkbox-{{id}}" type="radio" name="AddressId" value="{{id}}" {{checked}}>
+ <label for="address-checkbox-{{id}}"></label>
+ </div>
+ <label class="checkbox-caption" for="address-checkbox-{{id}}">
+ {{name}}<br>
+ {{address}}<br>
+ {{city}}, {{state}} {{zip}}
+ </label>
</div>
- <label class="checkbox-caption" for="address-checkbox-{{id}}">
- {{name}}<br>
- {{address}}<br>
- {{city}}, {{state}} {{zip}}
- </label>
- </div>
- </script>
+ </script>
+ </div>
+
+ <div class="address"></div>
+
</div>
<div class="cc_dropdown dropdown-wrapper">
@@ -744,9 +750,9 @@
</div>
</script>
</div>
-
+
<div class="cc"></div>
- <div class="address"></div>
+
</div>
<div class="container-fill">
@@ -966,6 +972,7 @@
-->
</div>
</div>
+ <input type="text" name="Phone" placeholder="PHONE NUMBER">
<!--
<div class="checkbox-container save_as_default">
<div class="checkbox-row">
diff --git a/StoneIsland/www/js/lib/account/AccountView.js b/StoneIsland/www/js/lib/account/AccountView.js
index 116d5ba1..1c5c9f16 100644
--- a/StoneIsland/www/js/lib/account/AccountView.js
+++ b/StoneIsland/www/js/lib/account/AccountView.js
@@ -66,7 +66,7 @@ var AccountView = View.extend({
},
populateCreditCards: function(data, cb){
- console.log(data)
+ console.log("populate ccs:", data.CreditCards)
this.ccs = data.CreditCards
this.ccLookup = {}
if (! data.CreditCards || ! data.CreditCards.length) {
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)
diff --git a/StoneIsland/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js
index e52eec4c..1a9653e1 100644
--- a/StoneIsland/www/js/lib/cart/CartShipping.js
+++ b/StoneIsland/www/js/lib/cart/CartShipping.js
@@ -58,7 +58,7 @@ var CartShipping = FormView.extend({
state = false
}
this.list_mode = typeof state == "boolean" ? state : ! this.list_mode
- this.$dropdown_wrapper.toggle( ! app.account.addresses.length )
+ this.$dropdown_wrapper.toggle( !! app.account.addresses.length )
this.address.disabled = this.list_mode
this.$address_form.toggle(! this.list_mode)
this.$address_list.toggle(this.list_mode)
@@ -93,16 +93,17 @@ var CartShipping = FormView.extend({
shipping_info.Name = address_data.Name
shipping_info.Surname = address_data.Surname
- shipping_info.Email = address_data.Name
+ shipping_info.Email = auth.user.Email
shipping_info.Phone = address_data.Phone
shipping_info.Mobile = address_data.Phone
shipping_info.StreetWithNumber = address_data.Address
shipping_info.PostalCode = address_data.ZipCode
shipping_info.City = address_data.City
+ shipping_info.Province = address_data.Province
shipping_info.Region = address_data.Province
shipping_info.CountryCode = "US"
- return address_data
+ return shipping_info
},
success: function(){