diff options
Diffstat (limited to 'StoneIsland/platforms/android/assets/www/js/lib/cart')
7 files changed, 0 insertions, 890 deletions
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartConfirm.js b/StoneIsland/platforms/android/assets/www/js/lib/cart/CartConfirm.js deleted file mode 100755 index 6909dcc3..00000000 --- a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartConfirm.js +++ /dev/null @@ -1,194 +0,0 @@ -var CartConfirm = FormView.extend({ - - el: "#cart_confirm", - - template: $("#cart_confirm .template").html(), - - events: { - }, - - initialize: function(opt){ - this.parent = opt.parent - this.$rows = this.$(".rows") - this.$subtotal = this.$(".subtotal") - this.$shipping = this.$(".shipping") - this.$tax = this.$(".tax") - this.$total = this.$(".total") - - this.$shipping_address = this.$(".shipping_address") - this.$shipping_method = this.$(".shipping_method") - - this.$payment_name = this.$(".payment_name") - this.$payment_method = this.$(".payment_method") - this.$payment_address = this.$(".payment_address") - - this.scroller = ScrollFactory('#cart_confirm', app.iscroll_options) - }, - - show: function(){ - document.body.className = "cart" - app.cart.el.className = "confirm" - app.footer.show("PLACE ORDER") - window.location.hash = "#/cart/confirm" - this.deferScrollToTop() - - app.view = this - app.curtain.show("loading") - promise(sdk.cart.get_status).then( this.populate.bind(this) ) - }, - - populate: function(data){ - console.log(data) - - data = data.Cart - - this.$rows.empty() - - data.Items.forEach(function(item){ - var $el = $("<div class='item'><img src='img/spinner.gif'></div>") - this.$rows.append($el) - var code_ten = item.Code10 - var size_id = item.Size - - var code = code_ten.substr(0, 8) - app.product.find(code, function(data, details){ - var descriptions = app.product.get_descriptions( details ) - - var name_partz = descriptions['ModelNames'].split(' ') - var num = name_partz.shift() - var title = name_partz.join(' ') - var type = title_case( descriptions['MicroCategory'] ) - - var color_name, size_name - - details.Item.ModelColors.some(function(color){ - if (color['Code10'] == code_ten) { - color_name = color['ColorDescription'] - return true - } - return false - }) - - details.Item.ModelSizes.some(function(size){ - if (size['SizeId'] == size_id) { - // console.log(size) - size_name = size['Default']['Text'] - size_name = SIZE_LOOKUP[ size_name ] || size_name - if (! size_name && ! size['Default']['Labeled']) { - size_name = size['Default']['Text'] + " " + size['Default']['ClassFamily'] - } - - return true - } - return false - }) - -// size_name = item.DefaultSize + " " + item.DefaultSizeClassFamily - - var t = this.template - .replace(/{{image}}/, sdk.image(item['Code10'], '11_f')) - .replace(/{{sku}}/, num) - .replace(/{{title}}/, title) - .replace(/{{type}}/, type) - .replace(/{{size}}/, size_name || "DEFAULT") - .replace(/{{color}}/, color_name || "DEFAULT") - .replace(/{{quantity}}/, 1) - .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) - $el.data("price", details.Item.Price.DiscountedPrice) - $el.html(t) - this.refreshScroller() - }.bind(this)) - }.bind(this)) - - var subtotal = data.Totals.TotalWithoutPromotions - var shipping_cost = data.DeliveryMethod.Selected.Amount.Total - var tax = data.Totals.TotalSalesTax - var total = data.Totals.TotalToPay - - this.$subtotal.html( as_cash(subtotal) ) - this.$shipping.html( as_cash(shipping_cost) ) - this.$tax.html( as_cash(tax) ) - this.$total.html( as_cash(total) ) - - if (data.Receiver) { - var street = data.Receiver.StreetWithNumber.replace(/\n$/,"").replace("\n", ", ") - var address = data.Receiver.Name.toUpperCase() + " " + data.Receiver.Surname.toUpperCase() + "<br>" + street + ", " - address += data.Receiver.City + ", " + data.Receiver.Region + " " + data.Receiver.PostalCode - - this.$shipping_address.html(address) - this.$shipping_method.html(data.DeliveryMethod.Selected.Type == 1 ? "* STANDARD SHIPPING" : "* EXPRESS SHIPPING") - } else { - this.$shipping_address.html( "Please enter your shipping information." ) - this.$shipping_method.html( "" ) - } - - var cc = data.Payment.CreditCard - if (cc) { - var cc_street = cc.HolderAddress.replace(/\n$/,"").replace("\n", ", ") - var cc_type = cc.Type == "AmericanExpress" ? "American Express" : cc.Type - var cc_name = cc.HolderName.toUpperCase() + " " + cc.HolderSurname.toUpperCase() - var cc_eNcrYpTed = cc_type.toUpperCase() + " XXXX-XXXX-XXXX-" + cc.Last4 - this.$payment_name.html( cc_name ) - this.$payment_method.html( cc_eNcrYpTed ) - } else { - this.$payment_name.html( "Please enter your credit card information." ) - this.$payment_method.html( "" ) - } - - app.curtain.hide("loading") - }, - - save: function(){ - app.curtain.show("loading") - promise(sdk.cart.finalize, {}).then(function(){ - app.curtain.hide("loading") - app.router.go('cart/thanks') - }.bind(this)).error(function(res){ - const data = res.responseJSON - console.log(data) - app.curtain.hide("loading") - // {"Header":{"StatusCode":403,"Description":"403 Forbidden"},"Error":{"Description":"GenericApiError:CartAlreadyClosed"}} - // {"Header":{"StatusCode":409,"Description":"304 NotModified"},"Error":{"Description":"FinalizationError:\\"Item has been removed from cart because it is no longer available.\\"\\n235"}}' - // {"Header":{"StatusCode":409,"Description":"304 NotModified"},"Error":{"Description":"FinalizationError:\"The cart cannot be empty.\"\n233"}} - // {"Header":{"StatusCode":409,"Description":"304 NotModified"},"Error":{"Description":"FinalizationError:\"The reciever validation fails."}} - // {"Header":{"StatusCode":440,"Description":"304 NotModified"},"Error":{"Description":"GenericApiError:CartFinalizationNotYetCompleted"}} - // {"Header":{"StatusCode":441,"Description":"304 NotModified"},"Error":{"Description":"GenericApiError:EmptyCreditCard"}} - switch (data.StatusCode || data.Header.StatusCode) { - case 403: // cart already closed - auth.clear_cart(auth.create_cart) - app.router.go('thanks') - break - case 409: // finalization error - this.finalization_error(data) - break - case 440: // genericapierror (credit card error!) - case 441: // genericapierror (credit card empty) - app.router.go('cart/payment') - app.cart.payment.show_errors([["Number","There was a problem with your credit card."]]) - break - } - }.bind(this)) - }, - - finalization_error: function(data){ - if (data['Error']['Description'].match(/receiver validation fails/i)) { - console.log('cc error') - app.router.go('cart/billing') - app.cart.payment.show_errors([["Number","There was a problem with your credit card."]]) - } - else if (data['Error']['Description'].match(/cart cannot be empty/i)) { - console.log('cart empty') - app.router.go('cart/summary') - } - else if (data['Error']['Description'].match(/Item has been removed/i)) { - console.log('item does not exist') - app.router.go('cart/error') - app.cart.error.show_error("We're sorry, but one or more items was out of stock. Please check your cart and try again.") - } - }, - - cancel: function(){ - app.router.go('cart/payment') - }, - -})
\ No newline at end of file diff --git a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartError.js b/StoneIsland/platforms/android/assets/www/js/lib/cart/CartError.js deleted file mode 100755 index f9a1963e..00000000 --- a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartError.js +++ /dev/null @@ -1,28 +0,0 @@ -var CartError = View.extend({ - - el: "#cart_error", - - events: { - }, - - initialize: function(opt){ - this.parent = opt.parent - this.$error = this.$(".errrrrrrrrrrrrrrr") - }, - - show: function(){ - document.body.className = "cart" - app.cart.el.className = "error" - app.footer.show("< BACK TO CART") - app.footer.hide() - }, - - show_error: function(msg){ - this.$error.html(msg) - }, - - ok: function(){ - app.router.go("cart/summary") - }, - -})
\ No newline at end of file diff --git a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartPayment.js b/StoneIsland/platforms/android/assets/www/js/lib/cart/CartPayment.js deleted file mode 100755 index 40d08d9e..00000000 --- a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartPayment.js +++ /dev/null @@ -1,203 +0,0 @@ -var CartPayment = FormView.extend({ - - el: "#cart_payment", - - address_template: $("#cart_payment .address_row_template").html(), - cc_template: $("#cart_payment .cc_template").html(), - - action: sdk.cart.set_credit_card, - - address_list_mode: false, - cc_list_mode: false, - data: {}, - - events: { - "change [name=SameAsShipping]": "toggle_shipping", - "click .address_dropdown": "toggle_address", - "click .cc_dropdown": "toggle_cc", - "focus [name=Number]": "focus_on_cc", - }, - - initialize: function(opt){ - 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.$cc_confirm = this.$(".cc_confirm") - - this.address = new AddressView ({ parent: this, checkPhone: false }) - this.cc = new CreditCardView ({ parent: this }) - this.scroller = ScrollFactory('#cart_payment', app.iscroll_options) - this.scroller.on('scrollStart', function(){ - if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'SELECT') { - document.activeElement.blur() - } - }) - this.address.disabled = true - this.cc.disabled = true - }, - - show: function(){ - document.body.className = "cart" - app.cart.el.className = "payment" - app.footer.show("CONFIRM >") - window.location.hash = "#/cart/payment" - - app.view = this - this.populate() - this.deferScrollToTop() - }, - - toggle_shipping: function(){ - setTimeout(function(){ - var state = this.$same_as_shipping.prop("checked") - this.$billing_address_rapper.toggle( ! state ) - this.address.disabled = 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.address_list_mode - this.address.disabled = this.address_list_mode - this.$address_form.toggle(! this.address_list_mode) - this.$address_list.toggle(this.address_list_mode) - }, - - toggle_cc: function(state){ - 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) - this.$cc_list.toggle(this.cc_list_mode) - this.$cc_confirm.toggle(this.cc_list_mode) - }, - - focus_on_cc: function(e){ - this.scroller.scrollToElement(e.currentTarget) - if (e.currentTarget.textShadow === '') { - e.currentTarget.textShadow = 'rgba(0,0,0,0) 0 0 0'; - } else { - e.currentTarget.textShadow = ''; - } - }, - - 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){ - var address_t = this.address_template.replace(/{{id}}/g, cc.Id) - .replace(/{{checked}}/g, cc.IsDefault ? "checked" : "") - .replace(/{{name}}/g, (cc.Name + " " + cc.Surname).toUpperCase()) - .replace(/{{address}}/g, cc.Address.replace(/\n$/,"").replace("\n", ", ")) - .replace(/{{city}}/g, cc.City) - .replace(/{{state}}/g, cc.Province) - .replace(/{{zip}}/g, cc.ZipCode) - - var cc_t = this.cc_template.replace(/{{id}}/g, cc.Id) - .replace(/{{checked}}/g, cc.IsDefault ? "checked" : "") - .replace(/{{number}}/g, cc['Number']) - .replace(/{{type}}/g, cc.Type.toUpperCase()) - .replace(/{{exp}}/g, cc.ExpirationMonth + "/" + cc.ExpirationYear) - - this.$address_list.append(address_t) - this.$cc_list.append(cc_t) - }.bind(this)) - }, - - finalize: function(data){ - var shipping_info = {}, address_data, address_id, cc_info = {}, cc_data, cc_id - var shipping_type = $("[name=ShippingType]").filter(function(){ return $(this).prop("checked") }).val() - - if (this.$same_as_shipping.prop("checked")) { - address_data = app.cart.shipping.data - } - else if (this.address_list_mode) { - address_id = this.$("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val() - address_data = app.account.addressLookup[ address_id ] - } - else { - address_data = data - } - - if (this.cc_list_mode) { - cc_id = this.$("[name=CCId]").filter(function(){ return $(this).prop("checked") }).val() - cc_data = app.account.ccLookup[ cc_id ] - - var card_on_file = { - "guid": cc_data.Guid, - "cvv": this.$("[name=CvvConfirm]"), - } - - app.curtain.show("loading") - promise(sdk.cart.use_stored_credit_card, { data: card_on_file }).then(function(data){ - app.curtain.hide("loading") - this.success() - }.bind(this)).error(function(data){ - app.curtain.hide("loading") - console.log("card payment error") - console.log(data) - app.cart.payment.show_errors([["","There was a problem with your credit card."]]) - }.bind(this)) - - return - } - else { - cc_data = data - } - - var credit_info = { - "HolderName": address_data.Name, - "HolderSurname": address_data.Surname, - "HolderAddress": address_data.Address || address_data.StreetWithNumber, - "HolderCity": address_data.City, - "HolderProvince": address_data.Province, - "HolderZip": address_data.PostalCode || address_data.ZipCode, - "HolderISOCountry": CANADIAN_LOOKUP[ address_data.Province ] ? "CA" : "US", - "HolderEmail": auth.user.Email, - "CardNumber": cc_data['Number'], - "Type": cc_data.Type, - "ExpirationMonth": cc_data.ExpirationMonth, - "ExpirationYear": cc_data.ExpirationYear.substr(2,3), - "Cvv": cc_data.Cvv, - } - - console.log( credit_info ) - - return credit_info - }, - - success: function(){ - app.router.go('cart/confirm') - }, - - error: function(data){ - console.log("card payment error") - console.log(data) - app.cart.payment.show_errors([["Number","There was a problem with your credit card."]]) - }, - - cancel: function(){ - app.router.go('cart/shipping') - }, - -})
\ No newline at end of file diff --git a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartShipping.js b/StoneIsland/platforms/android/assets/www/js/lib/cart/CartShipping.js deleted file mode 100755 index b5d6647b..00000000 --- a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartShipping.js +++ /dev/null @@ -1,152 +0,0 @@ -var CartShipping = FormView.extend({ - - el: "#cart_shipping", - - action: sdk.cart.set_shipping_address, - - list_mode: true, - data: {}, - - template: $("#cart_shipping .template").html(), - - events: { - "click .dropdown-wrapper": "toggle_dropdown", - }, - - initialize: function(opt){ - this.parent = opt.parent - this.$form = this.$(".form") - this.$dropdown_wrapper = this.$(".dropdown-wrapper") - this.$address_list = this.$(".address_list") - this.$address_form = this.$(".address") - this.$msg = this.$(".msg") - this.address = new AddressView ({ parent: this }) - this.scroller = ScrollFactory('#cart_shipping', app.iscroll_options) - this.address.disabled = true - }, - - show: function(){ - document.body.className = "cart" - app.cart.el.className = "shipping" - app.footer.show("PAYMENT >") - window.location.hash = "#/cart/shipping" - app.view = this - this.populate() - this.deferScrollToTop() - }, - - populate: function(){ - // id checked name address city state zip - this.$(".save_as_default").show() - this.$address_list.empty() - if (! app.account.addresses.length) { - this.toggle_dropdown(false) - return - } - app.account.addresses.forEach(function(address){ - var t = this.template.replace(/{{id}}/g, address.Id) - .replace(/{{checked}}/g, address.IsDefault ? "checked" : "") - .replace(/{{name}}/g, (address.Name + " " + address.Surname).toUpperCase()) - .replace(/{{address}}/g, address.Address.replace(/\n$/,"").replace("\n", ", ")) - .replace(/{{city}}/g, address.City) - .replace(/{{state}}/g, address.Province) - .replace(/{{zip}}/g, address.ZipCode) - this.$address_list.append(t) - }.bind(this)) - }, - - load_form: function(cart_data){ - var data = cart_data.Cart.Receiver - var addy = data.StreetWithNumber.split("\n") - data.Address1 = addy[0] || "" - data.Address2 = addy[1] || "" - data.ZipCode = data.PostalCode - data.Province = data.Region - this.load_data(data) - - this.data = data - if (cart_data.Cart.DeliveryMethod && cart_data.Cart.DeliveryMethod.Selected && cart_data.Cart.DeliveryMethod.Type) { - $("#standard-shipping").prop("checked", cart_data.Cart.DeliveryMethod.Type == 1) - $("#express-shipping").prop("checked", cart_data.Cart.DeliveryMethod.Type == 2) - } - }, - - toggle_dropdown: function(state){ - if (! app.account.addresses.length) { - state = false - } - this.list_mode = typeof state == "boolean" ? state : ! this.list_mode - 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) - }, - - // sdk.cart.set_shipping_address - // sdk.shipping.get_delivery_types - // sdk.shipping.set_delivery_type - - shipping_types: { - Standard: 1, - Express: 2, - }, - - finalize: function(data){ - var shipping_info = {}, address_data, address_id - var shipping_type = $("[name=ShippingType]").filter(function(){ return $(this).prop("checked") }).val() - - sdk.shipping.set_delivery_type({ - id: this.shipping_types[shipping_type], - success: function(data){ console.log("set shipping type", data) }, - error: function(data){ console.log("didnt set shipping type", data) }, - }) - - if (this.list_mode) { - address_id = this.$("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val() - address_data = app.account.addressLookup[ address_id ] - } - else { - address_data = data - } - - shipping_info.Name = address_data.Name - shipping_info.Surname = address_data.Surname - 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 = CANADIAN_LOOKUP[ address_data.Province ] ? "CA" : "US" - - this.data = shipping_info - - return shipping_info - }, - - success: function(){ - app.router.go('cart/payment') - }, - - error: function(res){ - console.log('error', res.responseJSON) - var data = res.responseJSON || { 'Error': { 'Description': 'Unknown' } } - const errors = [] - switch(data['Error']['Description']) { - case 'InvalidFormatParameterException:AddressPostalCode': - errors.push(['ZipCode', 'Please enter a valid US/Canada Zip Code.']) - break - default: - errors.push(['', 'An unknown error occured.']) - break - } - this.show_errors(errors) - }, - - cancel: function(){ - app.router.go('cart/summary') - }, - -})
\ No newline at end of file diff --git a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartSummary.js b/StoneIsland/platforms/android/assets/www/js/lib/cart/CartSummary.js deleted file mode 100755 index 51aa35ef..00000000 --- a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartSummary.js +++ /dev/null @@ -1,213 +0,0 @@ -var CartSummary = ScrollableView.extend({ - - el: "#cart_summary", - - template: $("#cart_summary .template").html(), - - events: { - "click .remove": "remove_item", - }, - - data: null, - - initialize: function(opt){ - this.parent = opt.parent - this.$loader = this.$(".loader") - this.$cart_body = this.$(".cart_body") - this.$cart_empty = this.$(".cart_empty") - this.scroller = ScrollFactory('#cart_summary', app.iscroll_options) - - this.$rows = this.$(".rows") - this.$subtotal = this.$(".subtotal") - this.$shipping = this.$(".shipping") - this.$tax = this.$(".tax") - this.$total = this.$(".total") - }, - - show: function(){ - document.body.className = "cart" - app.cart.el.className = "summary" - window.location.hash = "#/cart/summary" - app.view = this - if (auth.has_cart()) { - this.load() - } - else { - this.empty() - } - }, - - load: function(){ - this.el.className = "loading" - app.footer.show("SHIPPING >") - app.curtain.show("loading") - sdk.cart.get_status({ - success: this.populate.bind(this), - error: this.empty.bind(this), - }) - }, - - populate: function(data){ - this.data = data - - console.log("CART", data) - - if (! data.Cart.Items || data.Cart.Items.length == 0) { - return this.empty() - } - - this.parent.$steps.show() - this.updateCounts() - - this.$rows.empty() - - data.Cart.Items.forEach(function(item){ - var code_ten = item['Code10'] - var code = code_ten.substr(0, 8) - var size_id = item['Size'] - - var $el = $("<div>").addClass("cart_item_row") - $el.html("<img src='img/spinner.gif'>") - $el.data({ - code: code_ten, - size: size_id, - }) - this.$rows.append($el) - app.product.find(code, function(data, details){ - // console.log(data, details) - var descriptions = app.product.get_descriptions( details ) - // console.log(descriptions) - - var name_partz = descriptions['ModelNames'].split(' ') - var num = name_partz.shift() - var title = name_partz.join(' ') - var type = title_case( descriptions['MicroCategory'] ) - - var color_name, size_name - // console.log(code) - details.Item.ModelColors.some(function(color){ - if (color['Code10'] == code_ten) { - color_name = color['ColorDescription'] - // console.log(color) - return true - } - return false - }) - details.Item.ModelSizes.some(function(size){ - if (size['SizeId'] == size_id) { - // console.log(size) - size_name = size['Default']['Text'] - size_name = SIZE_LOOKUP[ size_name ] || size_name - if (! size_name && ! size['Default']['Labeled']) { - size_name = size['Default']['Text'] + " " + size['Default']['ClassFamily'] - } - - return true - } - return false - }) - - var t = this.template - .replace(/{{image}}/, sdk.image(item['Code10'], '11_f')) - .replace(/{{sku}}/g, num) - .replace(/{{code8}}/g, data['Code8']) - .replace(/{{title}}/g, title) - .replace(/{{cleantitle}}/g, stonewash(title)) - .replace(/{{type}}/, type) - .replace(/{{size}}/, size_name) - .replace(/{{color}}/, color_name) - .replace(/{{quantity}}/, 1) - .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) - $el.html(t) - this.refreshScroller() - }.bind(this)) - }.bind(this)) - - if (data.Cart.Receiver && data.Cart.Receiver.City) { - app.cart.shipping.load_form( data ) - } - - this.updateTotals() - - this.el.className = "full" - this.refreshScroller() - app.curtain.hide("loading") - }, - - updateCounts: function(){ - app.header.set_cart_count( this.data.Cart.Items.length ) - this.parent.setHeaderCount( this.data.Cart.Items.length ) - }, - - updateTotals: function(){ - var subtotal = this.data.Cart.Totals.TotalWithoutPromotions - var shipping_cost = this.data.Cart.DeliveryMethod.Selected.Amount.Total - var tax = this.data.Cart.Totals.TotalSalesTax - var total = this.data.Cart.Totals.TotalToPay - - this.$subtotal.html( as_cash(subtotal) ) - this.$shipping.html( as_cash(shipping_cost) ) - this.$tax.html( as_cash(tax) ) - this.$total.html( as_cash(total) ) - }, - - empty: function(){ - app.footer.hide() - app.header.set_cart_count(0) - this.parent.setHeaderCount( 0 ) - this.parent.$itemcount.html("0 ITEMS") - this.el.className = "empty" - this.parent.$steps.hide() - app.curtain.hide("loading") - }, - - save: function(){ - app.router.go('cart/shipping') - }, - - cancel: function(){ - app.router.go('intro') - }, - - remove_item: function(e){ - var $el = $( e.currentTarget ).closest(".cart_item_row") - var data = $el.data() - - console.log("REMOVE FROM CART") - console.log(data.size + " " + data.code) - - console.log(this.data.Cart) - - this.data.Cart.Totals.TotalWithoutPromotions -= data.price - this.data.Cart.Totals.TotalToPay -= data.price - this.data.Cart.Items = this.data.Cart.Items.filter(function(item){ - return ( item['Code10'] !== data.code || item['Size'] !== data.size) - }) - - this.updateTotals() - this.updateCounts() - $el.remove() - this.refreshScroller() - - if (this.data.Cart.Items.length == 0) { - this.empty() - } - - app.curtain.show("loading") - console.log("loading") - sdk.cart.delete_item({ - data: { - Code10: data.code, - Size: data.size, - }, - success: function(){ - console.log("success") - app.curtain.hide("loading") - }, - error: function(){ - app.curtain.hide("loading") - }, - }) - }, - -})
\ No newline at end of file diff --git a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartThanks.js b/StoneIsland/platforms/android/assets/www/js/lib/cart/CartThanks.js deleted file mode 100755 index 03a45d4d..00000000 --- a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartThanks.js +++ /dev/null @@ -1,28 +0,0 @@ -var CartThanks = View.extend({ - - el: "#cart_thanks", - - events: { - }, - - initialize: function(opt){ - this.parent = opt.parent - }, - - show: function(){ - document.body.className = "cart" - app.cart.el.className = "thanks" - app.header.set_cart_count(0) - app.footer.show("< BACK TO COLLECTION") - app.footer.hide() - - app.orders.loaded = false - - sdk.auth.clear_cart() - }, - - ok: function(){ - app.router.go("store") - }, - -})
\ No newline at end of file diff --git a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartView.js b/StoneIsland/platforms/android/assets/www/js/lib/cart/CartView.js deleted file mode 100755 index 6ed8238f..00000000 --- a/StoneIsland/platforms/android/assets/www/js/lib/cart/CartView.js +++ /dev/null @@ -1,72 +0,0 @@ -var CartView = View.extend({ - - el: "#cart", - - events: { - "click .summary_step": "show_summary", - "click .shipping_step": "show_shipping", - "click .payment_step": "show_payment", - }, - - initialize: function(){ - this.summary = new CartSummary ({ parent: this }) - this.payment = new CartPayment ({ parent: this }) - this.shipping = new CartShipping ({ parent: this }) - this.confirm = new CartConfirm ({ parent: this }) - this.thanks = new CartThanks ({ parent: this }) - this.error = new CartError ({ parent: this }) - - this.$steps = this.$(".steps") - this.$full_msg = this.$(".full_msg") - this.$empty_msg = this.$(".empty_msg") - this.$itemcount = this.$(".itemcount") - }, - - load: function(){ - sdk.cart.get_status({ - success: function(data){ - this.summary.data = data - this.summary.updateCounts() - }.bind(this), - error: function(data){ - console.log(data) - auth.clear_cart() - }, - }) - }, - - show: function(){ - if (! navigator.onLine) { - app.closed.showElement() - app.closed.setMessage("PLEASE GO ONLINE TO<br>VIEW YOUR CART.", "") - return - } - document.body.className = "cart" - this.show_summary() - }, - - show_summary: function(){ - this.summary.show() - }, - - show_shipping: function(){ - this.shipping.show() - }, - - show_payment: function(){ - this.payment.show() - }, - - setHeaderCount: function(n){ - if (n) { - this.$itemcount.html(pluralize(n, "ITEM", "S")) - this.$full_msg.show() - this.$empty_msg.hide() - } - else { - this.$full_msg.hide() - this.$empty_msg.show() - } - }, - -})
\ No newline at end of file |
