caboose-cms 0.9.77 → 0.9.78

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: 4aa7c4f9117cd898e7d0b2762debd2949c55bb55
4
- data.tar.gz: f6e97205063f9d1cc6eedb2858769eccd77b9611
3
+ metadata.gz: ee8ecb4c9c7e4d56f905c869c54528bd6a5e56bb
4
+ data.tar.gz: d06492e063533258dec0dc43503e8fb79f48c3b4
5
5
  SHA512:
6
- metadata.gz: 9b700cb00edb349c732367b43c16fe024877b679053a03950811f81c7847227bb8dfa69f97711b2ac70d5d2c46f813abcca671f33617bad35f1420fef359ca8d
7
- data.tar.gz: bf8a292aa05dff7a726ced9d0b57c5ff092e0ee49ccf51a725b95592f59ff56dc5fc0e62ea16af3fa9914813bfd7321b279bb82d10ec0e6f2380ff718c338bfd
6
+ metadata.gz: 906e2228f18312dae8e8cd7ba76834f307d0a69916fb9ceabba7d205d6e40f5b87237298f96b9a696cc2ca60e0c0eb3e8fcde555783d8749294ec13b9d55a874
7
+ data.tar.gz: e7fbad86da05e316c13f7aa385d0b08067296462d571f55ff60b75a3873cd996ddabe4a303460e1813d2310094cbd192e0fccf2a645f560237a0e8311a3d47ee
@@ -66,7 +66,21 @@ module Caboose
66
66
  :user_id => logged_in_user.id,
67
67
  :date_logged => DateTime.now.utc,
68
68
  :invoice_action => InvoiceLog::ACTION_INVOICE_CREATED
69
- )
69
+ )
70
+ if !params[:colonnade_game_id].blank? && defined?(Colonnade::Campus) && Colonnade::Campus.where(:site_id => @site.id).exists?
71
+ game = Colonnade::Game.where(:id => params[:colonnade_game_id], :site_id => @site.id).first
72
+ menu = Colonnade::Menu.where(:game_id => game.id, :site_id => @site.id).first if game
73
+ user = Caboose::User.where(:site_id => @site.id, :id => params[:colonnade_user_id]).first
74
+ suite = Colonnade::Suite.where(:id => params[:colonnade_suite_id], :site_id => @site.id).first
75
+ if suite && menu && user && invoice
76
+ sm = Colonnade::SuiteMenu.where(:suite_id => suite.id, :menu_id => menu.id, :user_id => user.id, :invoice_id => invoice.id).first
77
+ sm = Colonnade::SuiteMenu.create(:suite_id => suite.id, :menu_id => menu.id, :user_id => user.id, :invoice_id => invoice.id, :site_id => @site.id, :status => 'empty') if sm.nil?
78
+ end
79
+ if user
80
+ invoice.customer_id = user.id
81
+ invoice.save
82
+ end
83
+ end
70
84
  render :json => { :sucess => true, :redirect => "/admin/invoices/#{invoice.id}" }
71
85
  end
72
86
 
@@ -283,7 +297,7 @@ module Caboose
283
297
  def admin_send_for_authorization
284
298
  return if !user_is_allowed('invoices', 'edit')
285
299
  invoice = Invoice.find(params[:id])
286
- invoice.delay(:queue => 'caboose_store').send_payment_authorization_email
300
+ invoice.delay(:queue => 'caboose_store').send_payment_authorization_email
287
301
  render :json => { :success => true }
288
302
  end
289
303
 
@@ -2,6 +2,33 @@
2
2
 
3
3
  <p>This will create a new invoice that you can populate and then send to the customer for payment.</p>
4
4
 
5
+ <% if defined?(Colonnade::Campus) && Colonnade::Campus.where(:site_id => @site.id).exists? %>
6
+ <form id="colonnade_info">
7
+ <h5>Game</h5>
8
+ <select name="colonnade_game_id" id="colonnade_game_id">
9
+ <option value="">-- Select --</option>
10
+ <% Colonnade::Game.where('date > ?', (DateTime.now - 2.months)).where(:site_id => @site.id).order(:date).all.each do |g| %>
11
+ <option value="<%= g.id %>"><%= g.opponent %> - <%= g.date.strftime('%B %-d, %Y') %></option>
12
+ <% end %>
13
+ </select>
14
+ <h5>Suite</h5>
15
+ <select name="colonnade_suite_id" id="colonnade_suite_id">
16
+ <option value="">-- Select --</option>
17
+ <% Colonnade::Suite.where(:site_id => @site.id).order(:number).all.each do |s| %>
18
+ <option value="<%= s.id %>"><%= s.venue ? s.venue.name : '' %> - <%= s.number %></option>
19
+ <% end %>
20
+ </select>
21
+ <h5>User</h5>
22
+ <select name="colonnade_user_id" id="colonnade_user_id">
23
+ <option value="">-- Select --</option>
24
+ <% Caboose::User.where(:site_id => @site.id).order(:last_name).all.each do |u| %>
25
+ <% next if u.username == 'admin' || u.username == 'elo' || u.username == 'eli' %>
26
+ <option value="<%= u.id %>"><%= u.first_name %> <%= u.last_name %></option>
27
+ <% end %>
28
+ </select>
29
+ </form>
30
+ <% end %>
31
+
5
32
  <p>
6
33
  <input type='button' value='< Back' onclick="window.location='/admin/invoices';" />
7
34
  <input type='button' value='Create Order' onclick='create_invoice();' />
@@ -12,10 +39,18 @@
12
39
 
13
40
  function create_invoice()
14
41
  {
15
- $('#message').empty().append("<p class='loading'>Creating invoice...</p>");
42
+ $('#message').empty().append("<p class='loading'>Creating invoice...</p>");
43
+
16
44
  $.ajax({
17
45
  url: '/admin/invoices',
18
- type: 'post',
46
+ type: 'post',
47
+ <% if defined?(Colonnade::Campus) && Colonnade::Campus.where(:site_id => @site.id).exists? %>
48
+ data: {
49
+ colonnade_game_id: $('#colonnade_game_id').val(),
50
+ colonnade_suite_id: $('#colonnade_suite_id').val(),
51
+ colonnade_user_id: $('#colonnade_user_id').val()
52
+ },
53
+ <% end %>
19
54
  success: function(resp) {
20
55
  if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
21
56
  if (resp.redirect) window.location = resp.redirect;
@@ -24,4 +59,13 @@ function create_invoice()
24
59
  }
25
60
 
26
61
  </script>
62
+ <% end %>
63
+
64
+ <% content_for :caboose_css do %>
65
+ <style>
66
+ h5 {
67
+ margin: 20px 0 5px 0;
68
+ font-size: 16px;
69
+ }
70
+ </style>
27
71
  <% end %>
@@ -7,11 +7,17 @@ logo = logo.gsub('//','https://') if !logo.nil?
7
7
 
8
8
  <h1>Receipt</h1>
9
9
 
10
- <p>
11
- Invoice #<%= @invoice.id %><br />
12
- Status: <% @invoice.status %><br />
13
- Financial status: <% @invoice.financial_status %>
14
- </p>
10
+ <p>Your invoice number #<%= @invoice.id %> has been paid.</p>
11
+
12
+ <% if defined?(Colonnade::SuiteMenu) %>
13
+ <%
14
+ sm = Colonnade::SuiteMenu.where(:invoice_id => @invoice.id).first
15
+ game = sm.menu.game if sm && sm.menu
16
+ %>
17
+ <% if game %>
18
+ <p>Game: <%= game.opponent %> on <%= game.date.strftime('%B %-d, %Y') %></p>
19
+ <% end %>
20
+ <% end %>
15
21
 
16
22
  <table border='1' style='border-collapse: collapse;'>
17
23
  <tr>
@@ -40,41 +46,45 @@ logo = logo.gsub('//','https://') if !logo.nil?
40
46
  <td align='right'><%= number_to_currency(li.subtotal) %></td>
41
47
  </tr>
42
48
  <% end %>
43
- <tr><td colspan="4" align='right'>Subtotal: </td><td align='right'><%= number_to_currency(@invoice.subtotal) %></td></tr>
44
- <tr><td colspan="4" align='right'>Tax: </td><td align='right'><%= number_to_currency(@invoice.tax) %></td></tr>
45
- <tr><td colspan="4" align='right'>Shipping and Handling: </td><td align='right'><%= number_to_currency(@invoice.shipping + @invoice.handling) %></td></tr>
49
+ <tr><td colspan="3" align='right'>Subtotal: </td><td align='right'><%= number_to_currency(@invoice.subtotal) %></td></tr>
50
+ <tr><td colspan="3" align='right'>Tax: </td><td align='right'><%= number_to_currency(@invoice.tax) %></td></tr>
51
+ <tr><td colspan="3" align='right'>Shipping and Handling: </td><td align='right'><%= number_to_currency(@invoice.shipping + @invoice.handling) %></td></tr>
46
52
  <% if @invoice.gift_wrap && @invoice.gift_wrap > 0 %>
47
- <tr><td colspan="4" align='right'>Gift wrap: </td><td align='right'><%= number_to_currency(@invoice.gift_wrap) %></td></tr>
53
+ <tr><td colspan="3" align='right'>Gift wrap: </td><td align='right'><%= number_to_currency(@invoice.gift_wrap) %></td></tr>
48
54
  <% end %>
49
55
  <% if @invoice.discounts %>
50
56
  <% @invoice.discounts.each do |d| %>
51
- <tr><td colspan="4" align='right'>"<%= d.gift_card.code %>" gift card: </td><td align='right'><%= number_to_currency(d.amount) %></td></tr>
57
+ <tr><td colspan="3" align='right'>"<%= d.gift_card.code %>" gift card: </td><td align='right'><%= number_to_currency(d.amount) %></td></tr>
52
58
  <% end %>
53
59
  <% end %>
54
60
  <% if @invoice.custom_discount %>
55
- <tr><td colspan="4" align='right'>Discount: </td><td align='right'><%= number_to_currency(@invoice.custom_discount) %></td></tr>
61
+ <tr><td colspan="3" align='right'>Discount: </td><td align='right'><%= number_to_currency(@invoice.custom_discount) %></td></tr>
56
62
  <% end %>
57
- <tr><td colspan="4" align='right'>Total: </td><td align='right'><%= number_to_currency(@invoice.total) %></td></tr>
63
+ <tr><td colspan="3" align='right'>Total: </td><td align='right'><%= number_to_currency(@invoice.total) %></td></tr>
58
64
  </table>
59
65
 
60
66
  <% if @invoice.shipping_address %>
61
67
  <% sa = @invoice.shipping_address %>
62
- <h2>Shipping Address</h2>
63
- <p>
64
- <%= sa.first_name %> <%= sa.last_name %><br />
65
- <%= sa.address1 %><br />
66
- <% if sa.address2 && sa.address2.strip.length > 0 %><%= sa.address2 %><br /><% end %>
67
- <%= sa.city %>, <%= sa.state %> <%= sa.zip %>
68
- </p>
68
+ <% if !sa.address1.blank? %>
69
+ <h2>Shipping Address</h2>
70
+ <p>
71
+ <%= sa.first_name %> <%= sa.last_name %><br />
72
+ <%= sa.address1 %><br />
73
+ <% if sa.address2 && sa.address2.strip.length > 0 %><%= sa.address2 %><br /><% end %>
74
+ <%= sa.city %>, <%= sa.state %> <%= sa.zip %>
75
+ </p>
76
+ <% end %>
69
77
  <% end %>
70
78
 
71
79
  <% if @invoice.billing_address %>
72
80
  <% ba = @invoice.billing_address %>
73
- <h2>Billing Address</h2>
74
- <p>
75
- <%= ba.first_name %> <%= ba.last_name %><br />
76
- <%= ba.address1 %><br />
77
- <% if ba.address2 && ba.address2.strip.length > 0 %><%= ba.address2 %><br /><% end %>
78
- <%= ba.city %>, <%= ba.state %> <%= ba.zip %>
79
- </p>
80
- <% end %>
81
+ <% if !ba.address1.blank? %>
82
+ <h2>Billing Address</h2>
83
+ <p>
84
+ <%= ba.first_name %> <%= ba.last_name %><br />
85
+ <%= ba.address1 %><br />
86
+ <% if ba.address2 && ba.address2.strip.length > 0 %><%= ba.address2 %><br /><% end %>
87
+ <%= ba.city %>, <%= ba.state %> <%= ba.zip %>
88
+ </p>
89
+ <% end %>
90
+ <% end %>
@@ -24,7 +24,7 @@
24
24
  <url>
25
25
  <loc><%= @protocol %><%= prim %>/<%= p.uri %></loc>
26
26
  <changefreq>weekly</changefreq>
27
- <priority>1.00</priority>
27
+ <priority>0.9</priority>
28
28
  </url>
29
29
  <% p.children.where(:hide => false).order(:sort_order).all.each do |s| %>
30
30
  <% level_2 << s.uri %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.77'
2
+ VERSION = '0.9.78'
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.77
4
+ version: 0.9.78
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-10-09 00:00:00.000000000 Z
11
+ date: 2017-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg