summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
diff options
context:
space:
mode:
authorRene Ae <aehtyb@gmail.com>2015-11-30 15:24:27 -0600
committerRene Ae <aehtyb@gmail.com>2015-11-30 15:24:27 -0600
commit9d0e54228c79d151c30c527ea83efa7479793686 (patch)
tree3baf83427cd61cb1994e8551eefba5cd21d1a65b /StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
parentb208cb0283c23d68e8013c0dd5ddd4e5e6df8950 (diff)
parentd26e72aea3b3127c95c5ba7069c95f73cf52a2fd (diff)
Merge branch 'master' of https://github.com/okfocus/stone-island
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js')
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js54
1 files changed, 53 insertions, 1 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js b/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
index f5bf1661..b8b260ab 100644
--- a/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
@@ -2,8 +2,26 @@ var ShippingView = FormView.extend({
el: "#shipping",
+ action: sdk.address.add,
+
events: {
},
+
+ test_data: {
+ "Name":"name",
+ "Surname":"surname",
+ "Address":"address1\naddress2",
+ "IsDefault":false,
+ "IsBillingDefault":false,
+ "IsOwner":false,
+ "ZipCode":"88040",
+ "City":"City",
+ "Province":"NY",
+ "Phone":"1234567890",
+ "Mobile":"Mobile",
+ "Mail":"Mail",
+ "UserId": sdk.auth.user_id,
+ },
initialize: function(){
this.$form = this.$("form")
@@ -14,11 +32,45 @@ var ShippingView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+// this.preload( this.data || this.test_data )
app.footer.show("SAVE", "CANCEL")
document.body.className = "shipping"
},
- save: function(){
+ populate: function(data){
+ this.data = data || this.data
+ this.address.populate(data)
+ },
+
+ finalize: function(data){
+ if (this.address.data && this.address.data.Id) {
+ sdk.address.destroy({
+ id: this.address.data.Id,
+ success: function(){},
+ error: function(){},
+ })
+ }
+
+ data.IsDefault = "true" // this.$isDefault.prop("checked") ? "true" : "false"
+ data.UserId = sdk.auth.user_id
+
+ console.log(data)
+ return data
+ },
+
+ success: function(data){
+ app.curtain.show("loading")
+ app.account.listAddresses(function(){
+ app.curtain.hide("loading")
+ })
+ },
+
+ error: function(data){
+ console.log(data)
+ },
+
+ cancel: function(){
+ app.router.go("intro")
},
}) \ No newline at end of file