summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/cart/CartSummary.js
blob: 290627d3964ca339bc6ce056cc0f25fd845b6693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var CartSummary = ScrollableView.extend({
  
  el: "#cart_summary",
  
  events: {
  },
  
  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 = new IScroll('#cart_summary', app.iscroll_options)
  },
  
  show: function(){
    document.body.className = "cart"
    app.cart.el.className = "summary"
    this.$loader.show()
    
    sdk.cart.get_status({
      success: this.populate.bind(this),
      error: this.error.bind(this),
    })
  },
  
  populate: function(data){
    this.$loader.hide()
    app.footer.show("SHIPPING >", "CANCEL")

    console.log(data)

    this.parent.$itemcount.html("1 ITEM")

    this.$el.removeClass("empty").addClass("full")
    this.deferScrollToTop()
  },
  
  error: function(){
    this.$loader.hide()
    app.footer.hide()
    this.parent.$itemcount.html("0 ITEMS")
    this.$el.addClass("empty").removeClass("full")
  },

  ok: function(){
  },
  
  cancel: function(){
  },

})