caboose-cms 0.4.151 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/admin_products.js +79 -0
- data/app/assets/javascripts/caboose/application.js +2 -1
- data/app/assets/javascripts/caboose/cart.js +168 -0
- data/app/assets/javascripts/caboose/checkout.js +151 -0
- data/app/assets/javascripts/caboose/checkout_module.js +312 -0
- data/app/assets/javascripts/caboose/checkout_step1.js +179 -0
- data/app/assets/javascripts/caboose/checkout_step2.js +39 -0
- data/app/assets/javascripts/caboose/checkout_step3.js +34 -0
- data/app/assets/javascripts/caboose/checkout_step4.js +97 -0
- data/app/assets/javascripts/caboose/main.js +99 -8
- data/app/assets/javascripts/caboose/product.js +284 -0
- data/app/assets/stylesheets/caboose/admin_products.css +86 -0
- data/app/assets/templates/caboose/cart/add_to_cart.jst.ejs +7 -0
- data/app/assets/templates/caboose/cart/line_items.jst.ejs +41 -0
- data/app/assets/templates/caboose/checkout/address.jst.ejs +53 -0
- data/app/assets/templates/caboose/checkout/forms/guest.jst.ejs +8 -0
- data/app/assets/templates/caboose/checkout/forms/register.jst.ejs +11 -0
- data/app/assets/templates/caboose/checkout/forms/signin.jst.ejs +7 -0
- data/app/assets/templates/caboose/checkout/line_items.jst.ejs +31 -0
- data/app/assets/templates/caboose/checkout/login.jst.ejs +21 -0
- data/app/assets/templates/caboose/checkout/payment.jst.ejs +5 -0
- data/app/assets/templates/caboose/checkout/shipping.jst.ejs +18 -0
- data/app/assets/templates/caboose/product/images.jst.ejs +8 -0
- data/app/assets/templates/caboose/product/options.jst.ejs +19 -0
- data/app/controllers/caboose/application_controller.rb +29 -1
- data/app/controllers/caboose/cart_controller.rb +52 -0
- data/app/controllers/caboose/categories_controller.rb +108 -0
- data/app/controllers/caboose/checkout_controller.rb +325 -0
- data/app/controllers/caboose/orders_controller.rb +439 -0
- data/app/controllers/caboose/product_images_controller.rb +38 -0
- data/app/controllers/caboose/products_controller.rb +737 -0
- data/app/controllers/caboose/reviews_controller.rb +15 -0
- data/app/controllers/caboose/variants_controller.rb +218 -0
- data/app/controllers/caboose/vendors_controller.rb +73 -0
- data/app/helpers/caboose/application_helper.rb +4 -0
- data/app/helpers/caboose/categories_helper.rb +82 -0
- data/app/helpers/caboose/checkout_helper.rb +20 -0
- data/app/helpers/caboose/products_helper.rb +8 -0
- data/app/mailers/caboose/orders_mailer.rb +30 -0
- data/app/models/caboose/address.rb +26 -0
- data/app/models/caboose/category.rb +89 -0
- data/app/models/caboose/category_membership.rb +10 -0
- data/app/models/caboose/core_plugin.rb +15 -37
- data/app/models/caboose/customization_membership.rb +10 -0
- data/app/models/caboose/discount.rb +16 -0
- data/app/models/caboose/line_item.rb +81 -0
- data/app/models/caboose/message.rb +20 -0
- data/app/models/caboose/order.rb +191 -0
- data/app/models/caboose/order_discount.rb +10 -0
- data/app/models/caboose/order_pdf.rb +78 -0
- data/app/models/caboose/payment_processors/authorizenet.rb +53 -0
- data/app/models/caboose/payment_processors/base.rb +39 -0
- data/app/models/caboose/payment_processors/payscape.rb +94 -0
- data/app/models/caboose/product.rb +145 -0
- data/app/models/caboose/product_image.rb +62 -0
- data/app/models/caboose/product_image_variant.rb +10 -0
- data/app/models/caboose/review.rb +13 -0
- data/app/models/caboose/schema.rb +205 -1
- data/app/models/caboose/search_filter.rb +191 -0
- data/app/models/caboose/shipping_calculator.rb +81 -0
- data/app/models/caboose/states.rb +61 -52
- data/app/models/caboose/tax_calculator.rb +23 -0
- data/app/models/caboose/tax_line.rb +9 -0
- data/app/models/caboose/variant.rb +99 -0
- data/app/models/caboose/vendor.rb +22 -0
- data/app/views/caboose/cart/index.html.erb +8 -0
- data/app/views/caboose/categories/admin_edit.html.erb +79 -0
- data/app/views/caboose/categories/admin_index.html.erb +11 -0
- data/app/views/caboose/categories/admin_new.html.erb +62 -0
- data/app/views/caboose/checkout/_address_form.html.erb +111 -0
- data/app/views/caboose/checkout/_billing_form.html.erb +47 -0
- data/app/views/caboose/checkout/_cart.html.erb +52 -0
- data/app/views/caboose/checkout/_confirm.html.erb +61 -0
- data/app/views/caboose/checkout/_order_discount.html.erb +40 -0
- data/app/views/caboose/checkout/_shipping_address.html.erb +10 -0
- data/app/views/caboose/checkout/_shipping_method.html.erb +2 -0
- data/app/views/caboose/checkout/_shipping_method_form.html.erb +21 -0
- data/app/views/caboose/checkout/billing.html.erb +11 -0
- data/app/views/caboose/checkout/discount.html.erb +11 -0
- data/app/views/caboose/checkout/empty.html.erb +2 -0
- data/app/views/caboose/checkout/error.html.erb +2 -0
- data/app/views/caboose/checkout/index.html.erb +43 -0
- data/app/views/caboose/checkout/login.html.erb +2 -0
- data/app/views/caboose/checkout/payment.html.erb +79 -0
- data/app/views/caboose/checkout/relay.html.erb +23 -0
- data/app/views/caboose/checkout/relay_old.html.erb +12 -0
- data/app/views/caboose/checkout/relay_postMessage.html.erb +19 -0
- data/app/views/caboose/checkout/shipping.html.erb +15 -0
- data/app/views/caboose/checkout/step_four.html.erb +93 -0
- data/app/views/caboose/checkout/step_one.html.erb +56 -0
- data/app/views/caboose/checkout/step_one_old.html.erb +13 -0
- data/app/views/caboose/checkout/step_three.html.erb +23 -0
- data/app/views/caboose/checkout/step_two.html.erb +52 -0
- data/app/views/caboose/checkout/step_two_old.html.erb +14 -0
- data/app/views/caboose/checkout/thanks.html.erb +5 -0
- data/app/views/caboose/orders/_admin_footer.html.erb +2 -0
- data/app/views/caboose/orders/_admin_header.html.erb +31 -0
- data/app/views/caboose/orders/_quickbooks_order.html.erb +0 -0
- data/app/views/caboose/orders/admin_delete_form.html.erb +21 -0
- data/app/views/caboose/orders/admin_edit.html.erb +271 -0
- data/app/views/caboose/orders/admin_index.html.erb +89 -0
- data/app/views/caboose/orders/admin_new.html.erb +42 -0
- data/app/views/caboose/orders/admin_print.html.erb +72 -0
- data/app/views/caboose/orders_mailer/customer_new_order.html.erb +1 -0
- data/app/views/caboose/orders_mailer/customer_status_updated.html.erb +1 -0
- data/app/views/caboose/orders_mailer/fulfillment_new_order.html.erb +1 -0
- data/app/views/caboose/orders_mailer/shipping_order_ready.html.erb +1 -0
- data/app/views/caboose/products/_admin_footer.html.erb +2 -0
- data/app/views/caboose/products/_admin_header.html.erb +32 -0
- data/app/views/caboose/products/_sort_options.html.erb +19 -0
- data/app/views/caboose/products/admin_add_upcs.html.erb +58 -0
- data/app/views/caboose/products/admin_delete_form.html.erb +21 -0
- data/app/views/caboose/products/admin_edit_categories.html.erb +73 -0
- data/app/views/caboose/products/admin_edit_category_images.html.erb +233 -0
- data/app/views/caboose/products/admin_edit_description.html.erb +38 -0
- data/app/views/caboose/products/admin_edit_general.html.erb +104 -0
- data/app/views/caboose/products/admin_edit_images.html.erb +236 -0
- data/app/views/caboose/products/admin_edit_options.html.erb +51 -0
- data/app/views/caboose/products/admin_edit_seo.html.erb +37 -0
- data/app/views/caboose/products/admin_edit_variant_columns.html.erb +75 -0
- data/app/views/caboose/products/admin_edit_variant_sort_order.html.erb +63 -0
- data/app/views/caboose/products/admin_edit_variants.html.erb +171 -0
- data/app/views/caboose/products/admin_edit_variants_single.html.erb +68 -0
- data/app/views/caboose/products/admin_group_variants.html.erb +433 -0
- data/app/views/caboose/products/admin_index.html.erb +95 -0
- data/app/views/caboose/products/admin_new.html.erb +41 -0
- data/app/views/caboose/products/admin_sort.html copy.erb +155 -0
- data/app/views/caboose/products/admin_sort.html.erb +254 -0
- data/app/views/caboose/products/details.html.erb +438 -0
- data/app/views/caboose/products/index.html.erb +46 -0
- data/app/views/caboose/products/not_available.html.erb +35 -0
- data/app/views/caboose/variants/admin_edit.html.erb +82 -0
- data/app/views/caboose/variants/admin_group.html.erb +184 -0
- data/app/views/caboose/variants/admin_new.html.erb +59 -0
- data/app/views/caboose/vendors/admin_edit.html.erb +24 -0
- data/app/views/caboose/vendors/admin_index.html.erb +30 -0
- data/app/views/caboose/vendors/admin_new.html.erb +34 -0
- data/app/views/layouts/caboose/store/_banner.html.erb +10 -0
- data/app/views/layouts/caboose/store/_banner2.html.erb +10 -0
- data/app/views/layouts/caboose/store/_footer.html.erb +55 -0
- data/app/views/layouts/caboose/store/_header.html.erb +69 -0
- data/app/views/layouts/caboose/store/_sidebar.html.erb +27 -0
- data/app/views/layouts/caboose/store/application.html.erb +33 -0
- data/app/views/layouts/caboose/store/authorize_net.erb +18 -0
- data/app/views/layouts/caboose/store/layout_about.html.erb +42 -0
- data/app/views/layouts/caboose/store/layout_blog.html.erb +159 -0
- data/app/views/layouts/caboose/store/layout_confirm.html.erb +85 -0
- data/app/views/layouts/caboose/store/layout_contact.html.erb +38 -0
- data/app/views/layouts/caboose/store/layout_default.html.erb +10 -0
- data/app/views/layouts/caboose/store/layout_detail.html.erb +114 -0
- data/app/views/layouts/caboose/store/layout_order.html.erb +77 -0
- data/app/views/layouts/caboose/store/layout_pricing.html.erb +182 -0
- data/app/views/layouts/caboose/store/layout_product.html.erb +110 -0
- data/app/views/layouts/caboose/store/layout_profile.html.erb +55 -0
- data/app/views/layouts/caboose/store/layout_single.html.erb +3 -0
- data/app/views/layouts/caboose/store/layout_testimonial.html.erb +110 -0
- data/app/views/layouts/caboose/store/layout_testing.html.erb +4 -0
- data/config/routes.rb +126 -0
- data/lib/caboose.rb +46 -1
- data/lib/caboose/engine.rb +39 -1
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +12 -0
- metadata +151 -4
- data/app/assets/javascripts/caboose/admin_page_edit_content_bak.js +0 -164
- data/app/assets/javascripts/caboose/model/#Untitled-1# +0 -2
@@ -0,0 +1,14 @@
|
|
1
|
+
<div id="checkout" class="loading">
|
2
|
+
<header>Thanks for shopping with us!</header>
|
3
|
+
<h3><span>step 2 of 2</span></h3>
|
4
|
+
<figure class="loading"></figure>
|
5
|
+
<section id="checkout-shipping"></section>
|
6
|
+
<section id="checkout-line-items"></section>
|
7
|
+
<section id="checkout-payment"></section>
|
8
|
+
|
9
|
+
<section id="checkout-complete">
|
10
|
+
<button class="blue">Complete my Purchase</button>
|
11
|
+
<em>or</em>
|
12
|
+
<a href="/">return to the store</a>
|
13
|
+
</section>
|
14
|
+
</div>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<h3>All Finished!</h3>
|
2
|
+
<p>Thank you for your order! Your order has been submitted.</p>
|
3
|
+
<p>Please allow up to 48 hours for your order to be processed. Orders are processed during normal business hours Monday through Friday.</p>
|
4
|
+
<p><a href="/">Continue Shopping</a></p>
|
5
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<% content_for :caboose_css do %>
|
2
|
+
<%= stylesheet_link_tag "caboose/admin_products" %>
|
3
|
+
<% end %>
|
4
|
+
<% content_for :caboose_js do %>
|
5
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
6
|
+
<%= javascript_include_tag "caboose/admin_products" %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<h1>Edit Product - <%= @product.title %></h1>
|
10
|
+
<ul id='modal_tabs'>
|
11
|
+
<%
|
12
|
+
tabs = {
|
13
|
+
"/admin/products/#{@product.id}/general" => 'Product details',
|
14
|
+
"/admin/products/#{@product.id}/description" => 'Long Description',
|
15
|
+
"/admin/products/#{@product.id}/categories" => 'Categories'
|
16
|
+
}
|
17
|
+
if @product.options && @product.options.count > 0
|
18
|
+
tabs["/admin/products/#{@product.id}/options" ] = 'Options <span style="font-size: 65%">(size, color, style, etc.)</span>'
|
19
|
+
end
|
20
|
+
tabs["/admin/products/#{@product.id}/variants" ] = 'Inventory & variants'
|
21
|
+
tabs["/admin/products/#{@product.id}/images" ] = 'Images'
|
22
|
+
#tabs["/admin/products/#{@product.id}/seo" ] = 'SEO'
|
23
|
+
tabs["/admin/products/#{@product.id}/delete" ] = 'Delete Product'
|
24
|
+
|
25
|
+
%>
|
26
|
+
<% tabs.each do |href,text| %>
|
27
|
+
<li<%= raw request.fullpath == href ? " class='selected'" : '' %>><a href='<%= href %>'><%= raw text %></a></li>
|
28
|
+
<% end %>
|
29
|
+
<li class='back'><input type='button' value='< Back' onclick="window.location='/admin/products';" /></li>
|
30
|
+
</ul>
|
31
|
+
<div id='modal_content2'>
|
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'products/admin_header' %>
|
5
|
+
|
6
|
+
<div id='message'>
|
7
|
+
<p><input type='button' value='Delete this product' onclick='delete_product(<%= p.id %>);' /></p>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<%= render :partial => 'products/admin_footer' %>
|
11
|
+
|
12
|
+
<% content_for :caboose_js do %>
|
13
|
+
<script type='text/javascript'>
|
14
|
+
|
15
|
+
var modal = false;
|
16
|
+
$(window).load(function() {
|
17
|
+
modal = new CabooseModal(800);
|
18
|
+
});
|
19
|
+
|
20
|
+
</script>
|
21
|
+
<% end %>
|
@@ -0,0 +1,271 @@
|
|
1
|
+
<%
|
2
|
+
sa = @order.shipping_address
|
3
|
+
shipping_address = sa.address1
|
4
|
+
shipping_address << "<br />#{sa.address2}" if sa.address2 && sa.address2.length > 0
|
5
|
+
shipping_address << "<br />#{sa.city}, #{sa.state} #{sa.zip}"
|
6
|
+
captured = @order.financial_status == 'captured'
|
7
|
+
%>
|
8
|
+
<input type='hidden' name='order_id' id='order_id' value='<%= @order.id %>' />
|
9
|
+
|
10
|
+
<h1>Edit Order #<%= @order.id %></h1>
|
11
|
+
|
12
|
+
<table class='data'>
|
13
|
+
<tr>
|
14
|
+
<th><%= if @order.customer.nil? then 'Guest' else 'Customer' end %></th>
|
15
|
+
<th>Shipping Address</th>
|
16
|
+
<th>Order Status</th>
|
17
|
+
<th>Payment Status</th>
|
18
|
+
<th>Transaction ID</th>
|
19
|
+
</tr>
|
20
|
+
<tr>
|
21
|
+
<td valign='top'>
|
22
|
+
<%= "#{@order.shipping_address.first_name} #{@order.shipping_address.last_name}" %><br />
|
23
|
+
<% if @order.customer %>
|
24
|
+
<a href="mailto:<%= "#{@order.customer.email}" %>"><%= "#{@order.customer.email}" %></a><br />
|
25
|
+
<% elsif @order.email %>
|
26
|
+
<a href="mailto:<%= @order.email %>"><%= @order.email %></a>
|
27
|
+
<% end %>
|
28
|
+
<%= @order.customer ? @order.customer.phone : @order.shipping_address.phone %>
|
29
|
+
</td>
|
30
|
+
<td valign='top'>
|
31
|
+
<%= "#{@order.shipping_address.name}" %><br />
|
32
|
+
<%= raw shipping_address %>
|
33
|
+
</td>
|
34
|
+
<td valign='top'>
|
35
|
+
<div id='order_<%= @order.id %>_status'></div>
|
36
|
+
</td>
|
37
|
+
<td valign='top'>
|
38
|
+
<%= @order.financial_status %>
|
39
|
+
<% if @order.financial_status == 'authorized' %>
|
40
|
+
for <%= number_to_currency(@order.auth_amount) %>
|
41
|
+
<% end %>
|
42
|
+
</td>
|
43
|
+
<td valign="top"><%= @order.transaction_id %></td>
|
44
|
+
</tr>
|
45
|
+
</table><br />
|
46
|
+
|
47
|
+
<table class='data' width='100%'>
|
48
|
+
<tr>
|
49
|
+
<th>Item</th>
|
50
|
+
<th>Status</th>
|
51
|
+
<th>Tracking Number</th>
|
52
|
+
<th>Unit Price</th>
|
53
|
+
<th>Quantity</th>
|
54
|
+
<th>Subtotal</th>
|
55
|
+
</tr>
|
56
|
+
<% @order.line_items.each do |li| %>
|
57
|
+
<tr>
|
58
|
+
<td>
|
59
|
+
<% if li.variant.nil? || li.variant.product.nil? %>
|
60
|
+
<% if li.variant.nil? %>
|
61
|
+
Unknown variant
|
62
|
+
<% else %>
|
63
|
+
<%= li.variant.sku %>
|
64
|
+
<% end %>
|
65
|
+
<% else %>
|
66
|
+
<a href='/admin/products/<%= li.variant.product.id %>/variants?highlight=<%= li.variant.id %>'><%= li.variant.product.title %></a><br />
|
67
|
+
<%= li.variant.sku %><br />
|
68
|
+
<%= li.variant.title %>
|
69
|
+
<% end %>
|
70
|
+
</td>
|
71
|
+
<td ><div id='lineitem_<%= li.id %>_status' ></div></td>
|
72
|
+
<td ><div id='lineitem_<%= li.id %>_tracking_number' ></div></td>
|
73
|
+
<td align='right'><%= number_to_currency(li.variant.price) %></td>
|
74
|
+
<td align='right'><% if captured %><%= li.quantity %><% else %><div id='lineitem_<%= li.id %>_quantity'></div><% end %></td>
|
75
|
+
<td align='right' id='li_<%= li.id %>_subtotal'><%= number_to_currency(li.price) %></td>
|
76
|
+
</tr>
|
77
|
+
<% end %>
|
78
|
+
<tr><td colspan='5' align='right'>Subtotal </td><td align='right' id='subtotal' ><%= number_to_currency(@order.subtotal ) %></td></tr>
|
79
|
+
<tr><td colspan='5' align='right'>Tax </td><td align='right' id='tax' ><%= number_to_currency(@order.tax ) %></td></tr>
|
80
|
+
<tr><td colspan='5' align='right'><%= @order.shipping_method ? @order.shipping_method : '' %> Shipping & Handling </td><td align='right' id='shipping'><%= number_to_currency(@order.shipping + @order.handling) %></td></tr>
|
81
|
+
<tr>
|
82
|
+
<td colspan='5' align='right'>Discount</td>
|
83
|
+
<td align='right'>
|
84
|
+
<% if captured && @order.discounts.any? %>
|
85
|
+
<%= number_to_currency(@order.amount_discounted || 0) %>
|
86
|
+
<% elsif @order.discounts.any? %>
|
87
|
+
<%= number_to_currency(@order.discounts.first.amount_current) %>
|
88
|
+
<% else %>
|
89
|
+
$0.00
|
90
|
+
<% end %>
|
91
|
+
</td>
|
92
|
+
</tr>
|
93
|
+
|
94
|
+
<tr><td colspan='5' align='right'>Total </td><td align='right' id='total' ><%= number_to_currency(@order.total ) %></td></tr>
|
95
|
+
</table>
|
96
|
+
<div id='message'></div>
|
97
|
+
|
98
|
+
<p>
|
99
|
+
<input type='button' value='< Back' onclick="window.location='/admin/orders';" />
|
100
|
+
<% if @order.financial_status == 'authorized' %>
|
101
|
+
<input type='button' value='Capture Funds' onclick="capture_funds(<%= @order.id %>);" />
|
102
|
+
<input type='button' value='Void' onclick="void_order(<%= @order.id %>);" />
|
103
|
+
<% end %>
|
104
|
+
<% if @order.financial_status == 'captured' %>
|
105
|
+
<input type='button' value='Refund' onclick="refund_order(<%= @order.id %>);" />
|
106
|
+
<% end %>
|
107
|
+
<input type='button' value='Resend Confirmation' onclick="resend_confirmation(<%= @order.id %>)" />
|
108
|
+
<input type='button' value='Print Order' onclick="print_order(<%= @order.id %>);" />
|
109
|
+
|
110
|
+
<% str = Caboose.plugin_hook('admin_edit_order_buttons', "", @order) %>
|
111
|
+
<% if str %><%= raw str %><% end %>
|
112
|
+
</p>
|
113
|
+
|
114
|
+
<% content_for :caboose_js do %>
|
115
|
+
<%= javascript_include_tag 'caboose/model/all' %>
|
116
|
+
<script type='text/javascript'>
|
117
|
+
|
118
|
+
function resend_confirmation(order_id)
|
119
|
+
{
|
120
|
+
modal.autosize("<p class='loading'>Resending confirmation..</p>");
|
121
|
+
$.ajax({
|
122
|
+
type: 'post',
|
123
|
+
url: '/admin/orders/' + order_id + '/resend-confirmation',
|
124
|
+
success: function(resp) {
|
125
|
+
if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
126
|
+
if (resp.success) modal.autosize("<p class='note success'>" + resp.success + "</p>");
|
127
|
+
}
|
128
|
+
});
|
129
|
+
}
|
130
|
+
|
131
|
+
function capture_funds(order_id, confirm)
|
132
|
+
{
|
133
|
+
total = $('#total').html();
|
134
|
+
if (!confirm)
|
135
|
+
{
|
136
|
+
var p = $('<p/>').addClass('note confirm')
|
137
|
+
.append("Are you sure you want to charge " + total + " to the customer? ")
|
138
|
+
.append($('<input/>').attr('type','button').val('Yes').click(function() { capture_funds(order_id, true); }))
|
139
|
+
.append(' ')
|
140
|
+
.append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); modal.autosize(); }));
|
141
|
+
modal.autosize(p);
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
modal.autosize("<p class='loading'>Capturing funds...</p>");
|
145
|
+
$.ajax({
|
146
|
+
url: '/admin/orders/' + order_id + '/capture',
|
147
|
+
success: function(resp) {
|
148
|
+
if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
149
|
+
if (resp.success) modal.autosize("<p class='note success'>" + resp.success + "</p>");
|
150
|
+
if (resp.refresh) window.location.reload(true);
|
151
|
+
}
|
152
|
+
});
|
153
|
+
}
|
154
|
+
|
155
|
+
function void_order(order_id, confirm)
|
156
|
+
{
|
157
|
+
if (!confirm)
|
158
|
+
{
|
159
|
+
var p = $('<p/>').addClass('note confirm')
|
160
|
+
.append("Are you sure you want to void this order? ")
|
161
|
+
.append($('<input/>').attr('type','button').val('Yes').click(function() { void_order(order_id, true); }))
|
162
|
+
.append(' ')
|
163
|
+
.append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); modal.autosize(); }));
|
164
|
+
modal.autosize(p);
|
165
|
+
return;
|
166
|
+
}
|
167
|
+
modal.autosize("<p class='loading'>Voiding...</p>");
|
168
|
+
$.ajax({
|
169
|
+
url: '/admin/orders/' + order_id + '/void',
|
170
|
+
success: function(resp) {
|
171
|
+
if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
172
|
+
if (resp.success) modal.autosize("<p class='note success'>" + resp.success + "</p>");
|
173
|
+
if (resp.refresh) window.location.reload(true);
|
174
|
+
}
|
175
|
+
});
|
176
|
+
}
|
177
|
+
|
178
|
+
function refund_order(order_id, confirm)
|
179
|
+
{
|
180
|
+
if (!confirm)
|
181
|
+
{
|
182
|
+
var p = $('<p/>').addClass('note confirm')
|
183
|
+
.append("Are you sure you want to refund this order? ")
|
184
|
+
.append($('<input/>').attr('type','button').val('Yes').click(function() { refund_order(order_id, true); }))
|
185
|
+
.append(' ')
|
186
|
+
.append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); modal.autosize(); }));
|
187
|
+
modal.autosize(p);
|
188
|
+
return;
|
189
|
+
}
|
190
|
+
modal.autosize("<p class='loading'>Refunding...</p>");
|
191
|
+
$.ajax({
|
192
|
+
url: '/admin/orders/' + order_id + '/refund',
|
193
|
+
success: function(resp) {
|
194
|
+
if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
195
|
+
if (resp.success) modal.autosize("<p class='note success'>" + resp.success + "</p>");
|
196
|
+
if (resp.refresh) window.location.reload(true);
|
197
|
+
}
|
198
|
+
});
|
199
|
+
}
|
200
|
+
|
201
|
+
function print_order(order_id)
|
202
|
+
{
|
203
|
+
window.open('/admin/orders/' + order_id + '/print');
|
204
|
+
}
|
205
|
+
|
206
|
+
$(document).ready(function() {
|
207
|
+
<% @order.line_items.each do |li| %>
|
208
|
+
new ModelBinder({
|
209
|
+
name: 'Lineitem',
|
210
|
+
id: <%= li.id %>,
|
211
|
+
update_url: '/admin/orders/<%= @order.id %>/line-items/<%= li.id %>',
|
212
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
213
|
+
attributes: [
|
214
|
+
{ name: 'status' , nice_name: 'Status' , type: 'select' , align: 'left' , value: <%= raw Caboose.json(li.status ) %>, text: <%= raw Caboose.json(li.status ) %>, width: 150, fixed_placeholder: false, options_url: '/admin/orders/line-item-status-options' },
|
215
|
+
{ name: 'tracking_number' , nice_name: 'Tracking Number' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(li.tracking_number ) %>, width: 200, fixed_placeholder: false },
|
216
|
+
{ name: 'quantity' , nice_name: 'Quantity' , type: 'text' , align: 'right', value: <%= raw Caboose.json(li.quantity ) %>, width: 75, fixed_placeholder: false,
|
217
|
+
before_update: function() {
|
218
|
+
modal.autosize("<p class='loading'>Recalculating tax, shipping and handling...</p>");
|
219
|
+
},
|
220
|
+
after_update: function() {
|
221
|
+
var order_id = $('#order_id').val();
|
222
|
+
$.ajax({
|
223
|
+
url: '/admin/orders/' + order_id + '/json',
|
224
|
+
success: function(order) {
|
225
|
+
$.each(order.order_line_items, function(i, li) {
|
226
|
+
$('#li_' + li.id + '_subtotal').html('$' + parseFloat(li.variant.price * li.quantity).toFixed(2));
|
227
|
+
});
|
228
|
+
var sah = parseFloat(order.shipping) + parseFloat(order.handling);
|
229
|
+
$('#subtotal' ).html('$' + parseFloat(order.subtotal ).toFixed(2));
|
230
|
+
$('#subtotal' ).html('$' + parseFloat(order.subtotal ).toFixed(2));
|
231
|
+
$('#tax' ).html('$' + parseFloat(order.tax ).toFixed(2));
|
232
|
+
$('#shipping' ).html('$' + parseFloat(sah ).toFixed(2));
|
233
|
+
$('#total' ).html('$' + parseFloat(order.total ).toFixed(2));
|
234
|
+
$('#order_total').val(parseFloat(order.total).toFixed(2));
|
235
|
+
$('#message').empty();
|
236
|
+
modal.autosize();
|
237
|
+
}
|
238
|
+
});
|
239
|
+
}
|
240
|
+
}
|
241
|
+
]
|
242
|
+
});
|
243
|
+
<% end %>
|
244
|
+
|
245
|
+
new ModelBinder({
|
246
|
+
name: 'Order',
|
247
|
+
id: <%= @order.id %>,
|
248
|
+
update_url: '/admin/orders/<%= @order.id %>',
|
249
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
250
|
+
attributes: [
|
251
|
+
{
|
252
|
+
name: 'status',
|
253
|
+
nice_name: 'Status',
|
254
|
+
type: 'select',
|
255
|
+
value: <%= raw Caboose.json(@order.status) %>,
|
256
|
+
text: <%= raw Caboose.json(@order.status) %>,
|
257
|
+
width: 100,
|
258
|
+
options_url: '/admin/orders/status-options',
|
259
|
+
fixed_placeholder: false
|
260
|
+
}
|
261
|
+
]
|
262
|
+
});
|
263
|
+
});
|
264
|
+
|
265
|
+
var modal = false;
|
266
|
+
$(window).load(function() {
|
267
|
+
modal = new CabooseModal('95%');
|
268
|
+
});
|
269
|
+
|
270
|
+
</script>
|
271
|
+
<% end %>
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<h1>Orders</h1>
|
2
|
+
|
3
|
+
<style type='text/css'>
|
4
|
+
#search_form_wrapper { margin-bottom: 10px; position: absolute; top:0; right: 0; }
|
5
|
+
</style>
|
6
|
+
|
7
|
+
<p>
|
8
|
+
<a href='#' onclick="$('#search_form').toggle(400, function() { modal.autosize(); });">Show/hide search form</a> |
|
9
|
+
<a href='/admin/orders/new'>New Manual Order</a>
|
10
|
+
</p>
|
11
|
+
<form action='/admin/orders' method='get' id='search_form' style='display: none;'>
|
12
|
+
<p><input type='text' name='id' placeholder='Order ID' value="<%= @pager.params['id'] %>" style='width: 100px;' /></p>
|
13
|
+
<p><select name='customer_id'>
|
14
|
+
<optgroup label='Status' style='width: 100px'>
|
15
|
+
<option value=''>-- All customers --</option>
|
16
|
+
<% @customers.each do |c| %>
|
17
|
+
<option value='<%= c.id %>'<%= @pager.params['customer_id'] == c.id ? " selected='true'" : '' %>><%= "#{c.last_name}, #{c.first_name}" %></option>
|
18
|
+
<% end %>
|
19
|
+
</optgroup>
|
20
|
+
</select></p>
|
21
|
+
<p><select name='status'>
|
22
|
+
<optgroup label='Status'>
|
23
|
+
<option value=''>-- All statuses --</option>
|
24
|
+
<% statuses = ['cart', 'pending', 'ready to ship', 'shipped', 'canceled', 'backordered'] %>
|
25
|
+
<% statuses.each do |status| %>
|
26
|
+
<option value='<%= status %>'<%= @pager.params['status'] == status ? " selected='true'" : '' %>><%= status.capitalize %></option>
|
27
|
+
<% end %>
|
28
|
+
</optgroup>
|
29
|
+
</select></p>
|
30
|
+
<p><select name='shipping_method_code'>
|
31
|
+
<optgroup label='Shipping Method'>
|
32
|
+
<option value=''>-- All shipping methods --</option>
|
33
|
+
<option value='03'<%= @pager.params['shipping_method_code'] == '02' ? " selected='true'" : '' %>>UPS Ground</option>
|
34
|
+
<option value='02'<%= @pager.params['shipping_method_code'] == '02' ? " selected='true'" : '' %>>UPS 2nd Day</option>
|
35
|
+
</optgroup>
|
36
|
+
</select></p>
|
37
|
+
<p>
|
38
|
+
<input type='submit' value='Search' />
|
39
|
+
<input type='button' value='Clear' onclick="window.location='/admin/orders';" />
|
40
|
+
</p>
|
41
|
+
</form>
|
42
|
+
|
43
|
+
<% if @orders.count > 0 %>
|
44
|
+
<table class='data' id='orders_table'>
|
45
|
+
<tr>
|
46
|
+
<%= raw @pager.sortable_table_headings({
|
47
|
+
'id' => 'ID',
|
48
|
+
'customer_id' => 'Customer',
|
49
|
+
'date_created' => 'Date Created',
|
50
|
+
'total' => 'Total',
|
51
|
+
'status' => 'Status',
|
52
|
+
'shipping_method' => 'Shipping Method'
|
53
|
+
})
|
54
|
+
%>
|
55
|
+
</tr>
|
56
|
+
<% @orders.each do |order| %>
|
57
|
+
<tr onclick="window.location='/admin/orders/<%= order.id %>';">
|
58
|
+
<td><%= raw order.id %></td>
|
59
|
+
<td>
|
60
|
+
<% if order.customer.nil? %>
|
61
|
+
Unknown
|
62
|
+
<% else %>
|
63
|
+
<% if order.customer.first_name && order.customer.first_name.strip.length > 0 %>
|
64
|
+
<%= order.customer.first_name %> <%= order.customer.last_name %>
|
65
|
+
<% else %>
|
66
|
+
<%= order.customer.email %>
|
67
|
+
<% end %>
|
68
|
+
<% end %>
|
69
|
+
</td>
|
70
|
+
<td><%= raw order.date_created %></td>
|
71
|
+
<td align='right'><%= number_to_currency(order.total) %></td>
|
72
|
+
<td><%= raw order.status %></td>
|
73
|
+
<td><%= raw order.shipping_method %></td>
|
74
|
+
</tr>
|
75
|
+
<% end %>
|
76
|
+
</table>
|
77
|
+
<p><%= raw @pager.generate %></p>
|
78
|
+
<% else %>
|
79
|
+
<p>There are no orders right now.</p>
|
80
|
+
<% end %>
|
81
|
+
|
82
|
+
<% content_for :caboose_js do %>
|
83
|
+
<script type='text/javascript'>
|
84
|
+
var modal = false;
|
85
|
+
$(window).load(function() {
|
86
|
+
modal = new CabooseModal('95%');
|
87
|
+
});
|
88
|
+
</script>
|
89
|
+
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<h1>New Manual Order</h1>
|
2
|
+
|
3
|
+
<p><select name='product_id' id='product_id' onchange='populate_variants();'>
|
4
|
+
<option value=''>-- Select a product --</option>
|
5
|
+
<% @products.each do |p| %>
|
6
|
+
<option value='<%= p.id %>'><%= p.title %></option>
|
7
|
+
<% end %>
|
8
|
+
</select>
|
9
|
+
<span id='variant_id_container'></span>
|
10
|
+
</p>
|
11
|
+
|
12
|
+
<p>
|
13
|
+
<input type='button' value='< Back' onclick="window.location='/admin/orders';" />
|
14
|
+
<input type='button' value='Create Order' onclick='create_order();' />
|
15
|
+
</p>
|
16
|
+
|
17
|
+
<% content_for :caboose_js do %>
|
18
|
+
<script type='text/javascript'>
|
19
|
+
|
20
|
+
var modal = false;
|
21
|
+
$(window).load(function() {
|
22
|
+
modal = new CabooseModal('95%');
|
23
|
+
});
|
24
|
+
|
25
|
+
function populate_variants()
|
26
|
+
{
|
27
|
+
$('#variant_id_container').empty().append("<p class='loading'>Getting variants...</p>");
|
28
|
+
var product_id = $('#product_id').val();
|
29
|
+
$.ajax({
|
30
|
+
url: '/admin/products/' + product_id + '/variants/json',
|
31
|
+
success: function(variants) {
|
32
|
+
var select = $('<select/>').attr('id', 'variant_id');
|
33
|
+
$.each(variants, function(i, v) {
|
34
|
+
select.append($('<option/>').val(v.id).html(v.title));
|
35
|
+
});
|
36
|
+
$('#variant_id_container').empty().append(select);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
</script>
|
42
|
+
<% end %>
|