summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/android/assets/www/js/lib/account
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/android/assets/www/js/lib/account')
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/lib/account/AccountView.js62
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/lib/account/OrdersView.js5
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/lib/account/PaymentView.js19
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/lib/account/ProfileView.js5
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/lib/account/SettingsView.js5
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/lib/account/ShippingView.js14
6 files changed, 86 insertions, 24 deletions
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/account/AccountView.js b/StoneIsland/platforms/android/assets/www/js/lib/account/AccountView.js
index 7d3b719a..9e6f1714 100755
--- a/StoneIsland/platforms/android/assets/www/js/lib/account/AccountView.js
+++ b/StoneIsland/platforms/android/assets/www/js/lib/account/AccountView.js
@@ -21,11 +21,16 @@ var AccountView = View.extend({
ccs: [],
ccLookup: {},
- listAddresses: function(cb){
+ listAddresses: function(opt){
sdk.address.list({
success: function(data){
- this.populateAddresses(data, cb)
- }.bind(this)
+ this.populateAddresses(data, opt.success)
+ }.bind(this),
+ error: function(data){
+ console.log("error listing addresses!")
+ console.log(data.responseText)
+ opt.error && opt.error()
+ }.bind(this),
})
},
@@ -53,6 +58,7 @@ var AccountView = View.extend({
}.bind(this))
app.cart.shipping.populate()
+ app.cart.payment.populate()
cb && cb()
},
@@ -98,25 +104,45 @@ var AccountView = View.extend({
}
if ( ! auth.has_cart() ) {
app.curtain.show("loading")
- auth.create_cart(function(){
- if (auth.deferred_product) {
- auth.add_deferred_product_to_cart(function(){
- app.router.go("cart")
- setTimeout(function(){
- app.curtain.hide("loading")
- }, 500)
- })
- }
- else {
- app.router.go("account/profile")
- app.curtain.hide("loading")
- }
+ auth.create_cart({
+ success: function(){
+ if (auth.deferred_product) {
+ auth.add_deferred_product_to_cart({
+ success: function(){
+ app.router.go("cart")
+ setTimeout(function(){
+ app.curtain.hide("loading")
+ }, 500)
+ },
+ error: function(){
+ // TODO: should not be called because cart was just created
+ console.log("ERROR ADDING PRODUCT TO NEW CART")
+ },
+ })
+ }
+ else {
+ app.router.go("account/profile")
+ app.curtain.hide("loading")
+ }
+ },
+ error: function(){
+ // error CREATING cart...
+ console.log("ERROR CREATING CART")
+ auth.log_out()
+ app.account.logged_out()
+ },
})
}
else {
if (auth.deferred_product) {
- auth.add_deferred_product_to_cart(function(){
- app.router.go("cart")
+ auth.add_deferred_product_to_cart({
+ success: function(){
+ app.router.go("cart")
+ },
+ error: function(){
+ // TODO: cart might be invalid..
+ console.log("CALLED LOGGED_IN, HAD DEFERRED PRODUCT")
+ },
})
}
else {
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/account/OrdersView.js b/StoneIsland/platforms/android/assets/www/js/lib/account/OrdersView.js
index a1b83767..b3ff3e7a 100755
--- a/StoneIsland/platforms/android/assets/www/js/lib/account/OrdersView.js
+++ b/StoneIsland/platforms/android/assets/www/js/lib/account/OrdersView.js
@@ -31,6 +31,11 @@ var OrdersView = ScrollableView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO VIEW<br>YOUR ORDERS.", "")
+ return
+ }
app.header.set_back(false)
app.footer.hide()
document.body.className = "orders"
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/account/PaymentView.js b/StoneIsland/platforms/android/assets/www/js/lib/account/PaymentView.js
index 8b49ed1d..f773c05b 100755
--- a/StoneIsland/platforms/android/assets/www/js/lib/account/PaymentView.js
+++ b/StoneIsland/platforms/android/assets/www/js/lib/account/PaymentView.js
@@ -34,6 +34,11 @@ var PaymentView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO CHANGE<br>YOUR PAYMENT INFO.", "")
+ return
+ }
app.footer.show("SAVE")
document.body.className = "payment"
this.deferScrollToTop()
@@ -50,8 +55,8 @@ var PaymentView = FormView.extend({
if (this.cc.data && this.cc.data.Guid) {
sdk.payment.delete_credit_card({
guid: this.cc.data.Guid,
- success: function(){},
- error: function(){},
+ success: function(){ console.log("deleted credit card") },
+ error: function(){ console.log("error deleting credit card") },
})
}
@@ -67,12 +72,18 @@ var PaymentView = FormView.extend({
success: function(data){
app.curtain.show("loading")
- app.account.listAddresses(function(){
- app.curtain.hide("loading")
+ app.account.listAddresses({
+ success: function(){
+ app.curtain.hide("loading")
+ },
+ error: function(){
+ app.curtain.hide("loading")
+ },
})
},
error: function(data){
+ console.log("ERROR WITH PAYMENT")
console.log(data)
},
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/account/ProfileView.js b/StoneIsland/platforms/android/assets/www/js/lib/account/ProfileView.js
index d36f7f38..df6bc865 100755
--- a/StoneIsland/platforms/android/assets/www/js/lib/account/ProfileView.js
+++ b/StoneIsland/platforms/android/assets/www/js/lib/account/ProfileView.js
@@ -15,6 +15,11 @@ var ProfileView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>EDIT YOUR PROFILE.", "")
+ return
+ }
app.footer.show("SAVE")
document.body.className = "profile"
if (auth.user.BirthDay.match(/T/)) {
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/account/SettingsView.js b/StoneIsland/platforms/android/assets/www/js/lib/account/SettingsView.js
index 0d6fa807..f6eae13c 100755
--- a/StoneIsland/platforms/android/assets/www/js/lib/account/SettingsView.js
+++ b/StoneIsland/platforms/android/assets/www/js/lib/account/SettingsView.js
@@ -17,6 +17,11 @@ var SettingsView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO CHANGE<br>YOUR NOTIFICATION SETTINGS.", "")
+ return
+ }
document.body.className = "settings"
this.deferScrollToTop()
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/account/ShippingView.js b/StoneIsland/platforms/android/assets/www/js/lib/account/ShippingView.js
index 0bf88025..71cd9eef 100755
--- a/StoneIsland/platforms/android/assets/www/js/lib/account/ShippingView.js
+++ b/StoneIsland/platforms/android/assets/www/js/lib/account/ShippingView.js
@@ -32,6 +32,11 @@ var ShippingView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>EDIT YOUR SHIPPING INFO.", "")
+ return
+ }
// this.preload( this.data || this.test_data )
app.footer.show("SAVE")
document.body.className = "shipping"
@@ -61,8 +66,13 @@ var ShippingView = FormView.extend({
success: function(data){
app.curtain.show("loading")
- app.account.listAddresses(function(){
- app.curtain.hide("loading")
+ app.account.listAddresses({
+ success: function(){
+ app.curtain.hide("loading")
+ },
+ error: function(){
+ app.curtain.hide("loading")
+ },
})
},