caboose-cms 0.9.74 → 0.9.75

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5d538f792c9137c2945007d71f917c9b6de7069
4
- data.tar.gz: 0c8b0d4826bc3291f1cb981585690183abde002f
3
+ metadata.gz: 49412491ddf5c193f965625c32b1167873404f55
4
+ data.tar.gz: 5bedcc9cb7a2c100d72fedad93645388b13be5d1
5
5
  SHA512:
6
- metadata.gz: 82df711cad5b8fcaeffca31a1ccc8fb723d5c31675f6181c8df60af453c010b3dacce98a596aa9ea8b15a0b676fe318a1d4a4311d6c869008efd895e86d50439
7
- data.tar.gz: b741a2ac1c6220e557fda96490dd83584fa225da01e3ac7dcc5ceb420ccd388bd545046fbaea052e33780656eff2ca1663160f16a401efa47d636fa8c9862ad3
6
+ metadata.gz: 5944ae55cff565f6084159f53cca38e516bd3112a79854250336b88a6125f6f8747116210b277fa8c752e6154e141b886ad3098bac0cdfbc7318d1f6729a9bf2
7
+ data.tar.gz: e078b698da3047596d8f9976cade911de0eebbdce29b9565a9f4ca7fcbbdc515d8914788e90caf36aac1638f75cf406ab16915f83b0ce69e15eb2d829027c678
@@ -53,7 +53,8 @@ InvoiceController.prototype = {
53
53
  t.amount_refunded = t.amount_refunded == null || isNaN(t.amount_refunded) ? 0.00 : parseFloat(t.amount_refunded);
54
54
  });
55
55
  that.refresh_numbers();
56
- if (after) after();
56
+ if (after) after();
57
+ that.numbers_loading(false);
57
58
  }
58
59
  });
59
60
  },
@@ -63,11 +64,20 @@ InvoiceController.prototype = {
63
64
  var that = this;
64
65
  $('#subtotal').html(curr(that.invoice.subtotal));
65
66
  $('#shipping').html(curr(that.invoice.shipping));
66
- $('#total' ).html(curr(that.invoice.total ));
67
+ $('#total' ).html(curr(that.invoice.total ));
68
+ $('#invoice_' + that.invoice.id + '_tax').val( curr(that.invoice.tax) );
67
69
  $.each(that.invoice.line_items, function(i, li) {
68
70
  $('#li_' + li.id + '_subtotal').html(curr(li.subtotal));
69
71
  });
70
- },
72
+ },
73
+
74
+ numbers_loading: function(is_loading) {
75
+ var that = this;
76
+ if ( is_loading )
77
+ $('.show-loading').addClass('td-loading');
78
+ else
79
+ $('.show-loading').removeClass('td-loading');
80
+ },
71
81
 
72
82
  make_editable: function()
73
83
  {
@@ -83,7 +93,7 @@ InvoiceController.prototype = {
83
93
  { name: 'status' , nice_name: 'Status' , type: 'select' , value: op.status , width: 300, fixed_placeholder: true , options_url: '/admin/invoice-packages/status-options' },
84
94
  { name: 'package_method' , nice_name: 'Package/Method' , type: 'select' , value: op.shipping_package_id + '_' + op.shipping_method_id , width: 300, fixed_placeholder: false, options_url: '/admin/shipping-packages/package-method-options' },
85
95
  { name: 'tracking_number' , nice_name: 'Tracking Number' , type: 'text' , value: op.tracking_number , width: 300, fixed_placeholder: true, align: 'right' },
86
- { name: 'total' , nice_name: 'Shipping Total' , type: 'text' , value: curr(op.total) , width: 300, fixed_placeholder: true, align: 'right' , after_update: function() { that.refresh_invoice(); }}
96
+ { name: 'total' , nice_name: 'Shipping Total' , type: 'text' , value: curr(op.total) , width: 300, fixed_placeholder: true, align: 'right' , after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } }
87
97
  ]
88
98
  });
89
99
  });
@@ -91,8 +101,8 @@ InvoiceController.prototype = {
91
101
  var arr = [
92
102
  { name: 'status' , nice_name: 'Status' , type: 'select' , align: 'left' , value: li.status , text: li.status, width: 150, fixed_placeholder: false, options_url: '/admin/invoices/line-items/status-options' },
93
103
  { name: 'tracking_number' , nice_name: 'Tracking Number' , type: 'text' , align: 'left' , value: li.tracking_number , width: 200, fixed_placeholder: false },
94
- { name: 'unit_price' , nice_name: 'Unit Price' , type: 'text' , align: 'right', value: curr(li.unit_price) , width: 75, fixed_placeholder: false, after_update: function() { that.refresh_invoice(); } },
95
- { name: 'quantity' , nice_name: 'Quantity' , type: 'text' , align: 'right', value: li.quantity , width: 75, fixed_placeholder: false, after_update: function() { that.refresh_invoice(); } }
104
+ { name: 'unit_price' , nice_name: 'Unit Price' , type: 'text' , align: 'right', value: curr(li.unit_price) , width: 75, fixed_placeholder: false, after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } },
105
+ { name: 'quantity' , nice_name: 'Quantity' , type: 'text' , align: 'right', value: li.quantity , width: 75, fixed_placeholder: false, after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } }
96
106
  ];
97
107
  if (li.subscription_id)
98
108
  {
@@ -116,11 +126,11 @@ InvoiceController.prototype = {
116
126
  { name: 'status' , nice_name: 'Status' , type: 'select' , value: that.invoice.status , width: 100, fixed_placeholder: false, options_url: '/admin/invoices/status-options' },
117
127
  { name: 'financial_status' , nice_name: 'Status' , type: 'select' , value: that.invoice.financial_status , width: 100, fixed_placeholder: true , width: 200, options_url: '/admin/invoices/financial-status-options' },
118
128
  { name: 'payment_terms' , nice_name: 'Terms' , type: 'select' , value: that.invoice.payment_terms , width: 200, fixed_placeholder: true , width: 200, options_url: '/admin/invoices/payment-terms-options' },
119
- { name: 'tax' , nice_name: 'Tax' , type: 'text' , value: curr(that.invoice.tax) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.refresh_invoice(); }},
120
- { name: 'handling' , nice_name: 'Handling' , type: 'text' , value: curr(that.invoice.handling) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.refresh_invoice(); }},
121
- { name: 'custom_discount' , nice_name: 'Discount' , type: 'text' , value: curr(that.invoice.custom_discount) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.refresh_invoice(); }},
122
- { name: 'notes' , nice_name: 'Notes (not public)' , type: 'textarea' , value: that.invoice.notes , width: 500, fixed_placeholder: false, align: 'left' , after_update: function() { that.refresh_invoice(); }, height: 100 },
123
- { name: 'customer_notes' , nice_name: 'Customer Notes' , type: 'textarea' , value: that.invoice.notes , width: 100, fixed_placeholder: false, align: 'left' , after_update: function() { that.refresh_invoice(); }, height: 50 }
129
+ { name: 'tax' , nice_name: 'Tax' , type: 'text' , value: curr(that.invoice.tax) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } },
130
+ { name: 'handling' , nice_name: 'Handling' , type: 'text' , value: curr(that.invoice.handling) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } },
131
+ { name: 'custom_discount' , nice_name: 'Discount' , type: 'text' , value: curr(that.invoice.custom_discount) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } },
132
+ { name: 'notes' , nice_name: 'Notes (not public)' , type: 'textarea' , value: that.invoice.notes , width: 500, fixed_placeholder: false, align: 'left' , after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } , height: 100 },
133
+ { name: 'customer_notes' , nice_name: 'Customer Notes' , type: 'textarea' , value: that.invoice.notes , width: 100, fixed_placeholder: false, align: 'left' , after_update: function() { that.numbers_loading(true); setTimeout(function() { that.refresh_invoice() }, 1000) } , height: 50 }
124
134
  ]
125
135
  });
126
136
  },
@@ -528,7 +538,7 @@ InvoiceController.prototype = {
528
538
  //tr.append($('<td/>').attr('align', 'right').html(curr(li.unit_price)));
529
539
  tr.append($('<td/>').attr('align', 'right').append($('<div/>').attr('id', 'lineitem_' + li.id + '_unit_price')));
530
540
  tr.append($('<td/>').attr('align', 'right').append($('<div/>').attr('id', 'lineitem_' + li.id + '_quantity')));
531
- tr.append($('<td/>').attr('align', 'right').attr('id', 'li_' + li.id + '_subtotal').html(curr(li.subtotal)));
541
+ tr.append($('<td/>').addClass('show-loading').attr('align', 'right').attr('id', 'li_' + li.id + '_subtotal').html(curr(li.subtotal)));
532
542
  table.append(tr);
533
543
  });
534
544
  }
@@ -725,7 +735,7 @@ InvoiceController.prototype = {
725
735
  //tr.append($('<td/>').attr('align', 'right').html(curr(li.unit_price)));
726
736
  tr.append($('<td/>').attr('align', 'right').append($('<div/>').attr('id', 'lineitem_' + li.id + '_unit_price')));
727
737
  tr.append($('<td/>').attr('align', 'right').append($('<div/>').attr('id', 'lineitem_' + li.id + '_quantity')));
728
- tr.append($('<td/>').attr('align', 'right').attr('id', 'li_' + li.id + '_subtotal').html(curr(li.subtotal)));
738
+ tr.append($('<td/>').addClass('show-loading').attr('align', 'right').attr('id', 'li_' + li.id + '_subtotal').html(curr(li.subtotal)));
729
739
  table.append(tr);
730
740
  });
731
741
  },
@@ -758,8 +768,8 @@ InvoiceController.prototype = {
758
768
 
759
769
  if (that.invoice.line_items.length > 0)
760
770
  {
761
- table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').html('Subtotal' )).append($('<td/>').attr('align', 'right').attr('id', 'subtotal').html(curr(that.invoice.subtotal))));
762
- table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').append('Tax ' ).append($('<a/>').attr('href', '#').html('(calculate)').click(function(e) { e.preventDefault(); that.calculate_tax(); }))).append($('<td/>').attr('align', 'right').append($('<div/>').attr('id', 'invoice_' + that.invoice.id + '_tax'))));
771
+ table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').html('Subtotal' )).append($('<td/>').addClass('show-loading').attr('align', 'right').attr('id', 'subtotal').html(curr(that.invoice.subtotal))));
772
+ table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').append('Tax ' ).append($('<a/>').attr('href', '#').html('(calculate)').click(function(e) { e.preventDefault(); that.calculate_tax(); }))).append($('<td/>').addClass('show-loading').attr('align', 'right').append($('<div/>').attr('id', 'invoice_' + that.invoice.id + '_tax'))));
763
773
  table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').html('Shipping' )).append($('<td/>').attr('align', 'right').attr('id', 'shipping').html(curr(that.invoice.shipping))));
764
774
  table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').append('Handling ' ).append($('<a/>').attr('href', '#').html('(calculate)').click(function(e) { e.preventDefault(); that.calculate_handling(); }))).append($('<td/>').attr('align', 'right').append($('<div/>').attr('id', 'invoice_' + that.invoice.id + '_handling'))));
765
775
  if (that.invoice.discounts)
@@ -775,7 +785,7 @@ InvoiceController.prototype = {
775
785
  });
776
786
  }
777
787
  table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').html('Discount')).append($('<td/>').attr('align', 'right').append($('<div/>').attr('id', 'invoice_' + that.invoice.id + '_custom_discount'))));
778
- table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').html('Total' )).append($('<td/>').attr('align', 'right').attr('id', 'total').html(curr(that.invoice.total))));
788
+ table.append($('<tr/>').append($('<td/>').attr('colspan', requires_shipping ? '5' : '4').attr('align', 'right').html('Total' )).append($('<td/>').addClass('show-loading').attr('align', 'right').attr('id', 'total').html(curr(that.invoice.total))));
779
789
  }
780
790
  else
781
791
  {
@@ -56,7 +56,8 @@ module Caboose
56
56
  return if !user_is_allowed('invoices', 'add')
57
57
  invoice = Invoice.create(
58
58
  :site_id => @site.id,
59
- :status => Invoice::STATUS_PENDING,
59
+ :status => Invoice::STATUS_PENDING,
60
+ :date_created => DateTime.now,
60
61
  :financial_status => Invoice::FINANCIAL_STATUS_PENDING,
61
62
  :invoice_number => @site.store_config.next_invoice_number
62
63
  )
@@ -45,7 +45,7 @@ module Caboose
45
45
  #puts self.invoice.customer.card_brand
46
46
  #puts "--------------------------------------------------------------------"
47
47
 
48
- if self.invoice.customer.card_brand
48
+ if self.invoice.customer && self.invoice.customer.card_brand
49
49
  self.card_type = self.invoice.customer.card_brand
50
50
  self.card_number = self.invoice.customer.card_last4
51
51
  return
@@ -85,7 +85,7 @@ module Caboose
85
85
  def invoice_info
86
86
 
87
87
  invoice_info = "Invoice Number: #{invoice.invoice_number}\n"
88
- invoice_info << "Invoice Date: #{invoice.date_created.strftime('%d %b %Y %H:%M:%S %p')}\n"
88
+ invoice_info << "Invoice Date: #{invoice.date_created.strftime('%d %b %Y %H:%M:%S %p')}\n" if !invoice.date_created.blank?
89
89
  invoice_info << "Status: #{invoice.status.capitalize}\n"
90
90
 
91
91
  tbl = []
@@ -107,12 +107,12 @@ module Caboose
107
107
  billed_to = [
108
108
  [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => ba ? "#{ba.first_name} #{ba.last_name}" : '' , :border_width => 0, :width => 200 }],
109
109
  [{ :content => "Address" , :border_width => 0, :width => 55 },{ :content => ba ? ba_address : '' , :border_width => 0, :width => 200 }],
110
- [{ :content => "Email" , :border_width => 0, :width => 55 },{ :content => "#{c.email}" , :border_width => 0, :width => 200 }],
111
- [{ :content => "Phone" , :border_width => 0, :width => 55 },{ :content => "#{self.formatted_phone(c.phone)}" , :border_width => 0, :width => 200 }]
110
+ [{ :content => "Email" , :border_width => 0, :width => 55 },{ :content => (c ? "#{c.email}" : "N/A") , :border_width => 0, :width => 200 }],
111
+ [{ :content => "Phone" , :border_width => 0, :width => 55 },{ :content => (c ? "#{self.formatted_phone(c.phone)}" : "N/A") , :border_width => 0, :width => 200 }]
112
112
  ]
113
113
 
114
114
  sa = invoice.shipping_address
115
- sa_name = sa && sa.first_name ? "#{sa.first_name} #{sa.last_name}" : "#{c.first_name} #{c.last_name}"
115
+ sa_name = sa && sa.first_name ? "#{sa.first_name} #{sa.last_name}" : (c ? "#{c.first_name} #{c.last_name}" : "N/A")
116
116
  sa_address = sa ?
117
117
  (sa.address1 && sa.address1.length > 0 ? "#{sa.address1}\n" : '') +
118
118
  (sa.address2 && sa.address2.length > 0 ? "#{sa.address2}\n" : '') +
@@ -122,13 +122,13 @@ module Caboose
122
122
 
123
123
  shipped_to = []
124
124
  if invoice.instore_pickup
125
- shipped_to << [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => "#{c.first_name} #{c.last_name}" , :border_width => 0, :width => 200 }]
125
+ shipped_to << [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => (c ? "#{c.first_name} #{c.last_name}" : "N/A") , :border_width => 0, :width => 200 }]
126
126
  shipped_to << [{ :content => "IN-STORE PICKUP" , :border_width => 0, :width => 255 , :colspan => 2 }]
127
127
  else
128
128
  shipped_to << [{ :content => "Name" , :border_width => 0, :width => 55 },{ :content => sa_name , :border_width => 0, :width => 200 }]
129
129
  shipped_to << [{ :content => "Address" , :border_width => 0, :width => 55 },{ :content => sa_address , :border_width => 0, :width => 200 }]
130
- shipped_to << [{ :content => "Email" , :border_width => 0, :width => 55 },{ :content => "#{c.email}" , :border_width => 0, :width => 200 }]
131
- shipped_to << [{ :content => "Phone" , :border_width => 0, :width => 55 },{ :content => "#{self.formatted_phone(c.phone)}" , :border_width => 0, :width => 200 }]
130
+ shipped_to << [{ :content => "Email" , :border_width => 0, :width => 55 },{ :content => (c ? "#{c.email}" : "N/A") , :border_width => 0, :width => 200 }]
131
+ shipped_to << [{ :content => "Phone" , :border_width => 0, :width => 55 },{ :content => (c ? "#{self.formatted_phone(c.phone)}" : "N/A") , :border_width => 0, :width => 200 }]
132
132
  end
133
133
 
134
134
  tbl = []
@@ -66,5 +66,16 @@ table.billing_address td {
66
66
  border: 0 !important;
67
67
  }
68
68
 
69
+ td.td-loading {
70
+ background-image: url("<%= asset_path '/assets/shared/loading.gif' %>") !important;
71
+ background-size: 20px !important;
72
+ background-position: center center !important;
73
+ background-repeat: no-repeat !important;
74
+ color: rgba(0,0,0,0.1) !important;
75
+ }
76
+ td.td-loading .mb_container {
77
+ opacity: 0.1 !important;
78
+ }
79
+
69
80
  </style>
70
81
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.74'
2
+ VERSION = '0.9.75'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.74
4
+ version: 0.9.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2017-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg