camaleon_ecommerce 0.0.4 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/plugins/ecommerce/admin.js +0 -33
  3. data/app/assets/javascripts/plugins/ecommerce/cart.js +83 -200
  4. data/app/assets/javascripts/plugins/ecommerce/fix_form.js +1 -4
  5. data/app/assets/stylesheets/plugins/ecommerce/checkout.css.scss +46 -0
  6. data/app/assets/stylesheets/plugins/ecommerce/front.scss +2 -30
  7. data/app/controllers/plugins/ecommerce/admin/coupons_controller.rb +2 -2
  8. data/app/controllers/plugins/ecommerce/admin/orders_controller.rb +45 -34
  9. data/app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb +4 -3
  10. data/app/controllers/plugins/ecommerce/admin/prices_controller.rb +5 -5
  11. data/app/controllers/plugins/ecommerce/admin/settings_controller.rb +0 -2
  12. data/app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb +3 -3
  13. data/app/controllers/plugins/ecommerce/admin/tax_rates_controller.rb +2 -2
  14. data/app/controllers/plugins/ecommerce/admin_controller.rb +1 -1
  15. data/app/controllers/plugins/ecommerce/front/checkout_controller.rb +162 -110
  16. data/app/controllers/plugins/ecommerce/front/orders_controller.rb +7 -234
  17. data/app/controllers/plugins/ecommerce/front_controller.rb +42 -3
  18. data/app/decorators/plugins/ecommerce/cart_decorator.rb +27 -0
  19. data/app/{models → decorators}/plugins/ecommerce/coupon_decorator.rb +1 -1
  20. data/app/decorators/plugins/ecommerce/order_decorator.rb +22 -0
  21. data/app/decorators/plugins/ecommerce/product_decorator.rb +88 -0
  22. data/app/decorators/plugins/ecommerce/product_item_decorator.rb +18 -0
  23. data/app/helpers/plugins/ecommerce/ecommerce_email_helper.rb +91 -28
  24. data/app/helpers/plugins/ecommerce/ecommerce_helper.rb +30 -136
  25. data/app/helpers/plugins/ecommerce/ecommerce_payment_helper.rb +14 -20
  26. data/app/models/plugins/ecommerce/cart.rb +139 -15
  27. data/app/models/plugins/ecommerce/coupon.rb +33 -7
  28. data/app/models/plugins/ecommerce/order.rb +47 -31
  29. data/app/models/plugins/ecommerce/{product.rb → product_item.rb} +11 -5
  30. data/app/views/camaleon_cms/html_mailer/order_canceled.html.erb +2 -0
  31. data/app/views/camaleon_cms/html_mailer/order_confirmed.html.erb +2 -0
  32. data/app/views/camaleon_cms/html_mailer/order_received_admin.html.erb +1 -1
  33. data/app/views/camaleon_cms/html_mailer/order_shipped.html.erb +2 -0
  34. data/app/views/plugins/ecommerce/admin/coupons/form.html.erb +10 -10
  35. data/app/views/plugins/ecommerce/admin/coupons/index.html.erb +1 -1
  36. data/app/views/plugins/ecommerce/admin/orders/form.html.erb +5 -49
  37. data/app/views/plugins/ecommerce/admin/orders/index.html.erb +140 -80
  38. data/app/views/plugins/ecommerce/admin/orders/show.html.erb +7 -169
  39. data/app/views/plugins/ecommerce/admin/payment_methods/form.html.erb +30 -3
  40. data/app/views/plugins/ecommerce/admin/payment_methods/index.html.erb +1 -3
  41. data/app/views/plugins/ecommerce/admin/prices/index.html.erb +0 -2
  42. data/app/views/plugins/ecommerce/admin/prices/show.html.erb +0 -2
  43. data/app/views/plugins/ecommerce/admin/products/index.html.erb +1 -1
  44. data/app/views/plugins/ecommerce/admin/settings/index.html.erb +0 -1
  45. data/app/views/plugins/ecommerce/admin/tax_rates/form.html.erb +1 -1
  46. data/app/views/plugins/ecommerce/front/checkout/cart_index.html.erb +46 -57
  47. data/app/views/plugins/ecommerce/front/checkout/index.html.erb +34 -158
  48. data/app/views/plugins/ecommerce/front/login.html.erb +67 -0
  49. data/app/views/plugins/ecommerce/front/orders/index.html.erb +36 -44
  50. data/app/views/plugins/ecommerce/front/orders/show.html.erb +121 -67
  51. data/app/views/plugins/ecommerce/partials/_cart_widget.html.erb +38 -0
  52. data/app/views/plugins/ecommerce/partials/checkout/_details.html.erb +35 -0
  53. data/app/views/plugins/ecommerce/partials/checkout/_payments.html.erb +123 -0
  54. data/app/views/plugins/ecommerce/partials/checkout/_products_detail.html.erb +49 -0
  55. data/app/views/plugins/ecommerce/partials/checkout/_user_info.html.erb +93 -0
  56. data/app/views/post_types/commerce.html.erb +22 -0
  57. data/app/views/post_types/commerce/_product_widget.html.erb +13 -0
  58. data/app/views/post_types/commerce/category.html.erb +23 -0
  59. data/app/views/post_types/commerce/single.html.erb +91 -0
  60. data/config/custom_models.rb +24 -57
  61. data/config/locales/en.yml +192 -0
  62. data/config/locales/es.yml +405 -0
  63. data/config/routes.rb +26 -16
  64. data/db/migrate/20160502221327_add_cama_ecommerce_structure_plugin.rb +12 -0
  65. data/db/migrate/20160504162311_move_featured_attribute_of_products.rb +15 -0
  66. data/db/migrate/20160527184747_add_new_cart_structure.rb +21 -0
  67. data/lib/ecommerce/version.rb +1 -1
  68. metadata +42 -19
  69. data/app/models/plugins/ecommerce/order_decorator.rb +0 -54
  70. data/app/views/layouts/plugins/ecommerce/mailer.html.erb +0 -22
  71. data/app/views/plugins/ecommerce/admin/index.html.erb +0 -2
  72. data/app/views/plugins/ecommerce/front/_post_list_item.html.erb +0 -18
  73. data/app/views/plugins/ecommerce/front/index.html.erb +0 -2
  74. data/app/views/plugins/ecommerce/front/list_products.html.erb +0 -34
  75. data/app/views/plugins/ecommerce/front/orders/pay_by_bank_transfer.html.erb +0 -67
  76. data/app/views/plugins/ecommerce/front/orders/pay_by_credit_card.html.erb +0 -131
  77. data/app/views/plugins/ecommerce/front/orders/pay_by_credit_card_authorize_net.erb +0 -150
  78. data/app/views/plugins/ecommerce/front/orders/select_payment.html.erb +0 -70
  79. data/app/views/plugins/ecommerce/front/product.html.erb +0 -105
  80. data/app/views/plugins/ecommerce/layouts/_ecommerce.html.erb +0 -41
  81. data/app/views/plugins/ecommerce/partials/_form_address.html.erb +0 -84
  82. data/app/views/plugins/ecommerce/partials/_table_order_products.html.erb +0 -85
  83. data/config/locales/translation.yml +0 -371
@@ -26,15 +26,13 @@
26
26
  <td><%= row.name %></td>
27
27
  <td><%= row.method_text %></td>
28
28
  <td><%= raw row.the_status %></td>
29
- <td><%= row.description %></td>
29
+ <td><%= row.description.translate %></td>
30
30
  <td>
31
31
  <%= link_to raw('<i class="fa fa-eye"></i>'), {action: :show, id: row.id}, class: "btn btn-info btn-xs", title: "#{t('camaleon_cms.admin.button.preview')}" %>
32
32
  <%= link_to raw('<i class="fa fa-edit"></i>'), {action: :edit, id: row.id}, class: "btn btn-default btn-xs", title: "#{t('camaleon_cms.admin.button.edit')}" %>
33
33
  </td>
34
34
  </tr>
35
35
  <% end %>
36
-
37
-
38
36
  </tbody>
39
37
  </table>
40
38
  <%= content_tag("div", raw(t('camaleon_cms.admin.message.data_found_list')), class: "alert alert-warning") if @payment_methods.empty? %>
@@ -30,8 +30,6 @@
30
30
  </td>
31
31
  </tr>
32
32
  <% end %>
33
-
34
-
35
33
  </tbody>
36
34
  </table>
37
35
  <%= content_tag("div", raw(t('camaleon_cms.admin.message.data_found_list')), class: "alert alert-warning") if @prices.empty? %>
@@ -12,8 +12,6 @@
12
12
  <li><strong>Description:</strong> <span> <%= @shipping_method.description %></span></li>
13
13
  </ul>
14
14
  </div>
15
-
16
15
  </div>
17
-
18
16
  </div>
19
17
  </div>
@@ -77,7 +77,7 @@
77
77
  <button class="btn btn-info btn-xs dropdown-toggle e-co" data-toggle="dropdown" aria-expanded="false" title="<%= t('camaleon_cms.admin.button.preview') %>"><i class="fa fa-eye"></i> </button>
78
78
  <ul class="dropdown-menu" style="min-width: 50px;">
79
79
  <% f.slug.to_s.translations.each do |locale, slug| %>
80
- <li><a href="<%= url_to_fixed("post_path", slug: slug, locale: locale) %>" target="_blank"><%= locale.to_s.upcase %></a></li>
80
+ <li><a href="<%= f.the_url(locale: locale) %>" target="_blank"><%= locale.to_s.upcase %></a></li>
81
81
  <% end %>
82
82
  </ul>
83
83
  </div>
@@ -2,7 +2,6 @@
2
2
  <div class="panel-heading ui-draggable-handle">
3
3
  <h4><span class="fa fa-cogs"></span> <%= t('plugin.ecommerce.e_commerce_settings') %></h4>
4
4
  </div>
5
- <%#= form_tag ({url:{action: @price.blank? ? :create : :update}}, :method => "post", :class => "form" ) do %>
6
5
  <%= form_tag(action: :saved, :method => "post", :class => "validate-settings") do %>
7
6
  <div class="panel-body">
8
7
 
@@ -30,7 +30,7 @@
30
30
  </div>
31
31
 
32
32
  <script>
33
- run.push(function(){
33
+ jQuery(function(){
34
34
  jQuery( '#form-tax_rate' ).on( "change", '#options_rate', function() {setTimeout(function(){jQuery(this).val(Math.abs(jQuery(this).val()) || 0);}.bind(this), 60)});
35
35
  })
36
36
  </script>
@@ -1,59 +1,48 @@
1
- <%= render layout: 'plugins/ecommerce/layouts/ecommerce', locals: {} do %>
2
- <h2>Shopping Cart</h2>
3
- <%= form_tag(plugins_ecommerce_checkout_cart_update_path, :method => "post", :class => "form") do %>
4
- <table id="table-shopping-cart" class="table">
5
- <thead>
6
- <tr>
7
- <th id="item_col">Item</th>
8
- <th id="price_col">Price</th>
9
- <th id="price_col">Tax</th>
10
- <th id="quantity_col">Quantity</th>
11
- <th id="subtotal_col">Subtotal</th>
12
- <th></th>
13
- </tr>
14
- </thead>
15
- <tbody>
16
- <%
17
- total = 0
18
- @products.each do |product|
19
- product = product.decorate
20
- product_options = @cart.get_option("product_#{product.id}")
21
- price = product_options[:price].to_f
22
- tax = product_options[:tax].to_f
23
- qty = product_options[:qty].to_f
24
- sub_total = (price + tax) * qty
25
- total += sub_total
26
- %>
1
+ <div class="cart_view">
2
+ <%= render plugin_view('partials/cart_widget') %>
3
+ <h1><%= t('.title', default: 'Shopping Cart') %></h1>
4
+ <%= form_tag(plugins_ecommerce_checkout_cart_update_path, :method => "post", :class => "form") do %>
5
+ <table id="table-shopping-cart" class="table table-bordered">
6
+ <thead>
27
7
  <tr>
28
- <td><a href="<%= product.the_url %>"><%= product.the_title %></a></td>
29
- <td data-price="<%= price %>"><%= current_site.current_unit %> <%= price %></td>
30
- <td data-tax="<%= tax %>"><%= current_site.current_unit %> <%= tax %></td>
31
- <td data-qty="<%= qty %>">
32
- <input name="products[][product_id]" type="hidden" value="<%= product.id %>"/>
33
- <input class="text-qty" type="number" name="products[][qty]" value="<%= qty %>">
34
- </td>
35
- <td data-subtotal="<%= sub_total %>"><%= current_site.current_unit %> <%= sub_total.to_f.round(2) %></td>
36
- <td>
37
- <a rel="nofollow" data-method="delete" href="<%= plugins_ecommerce_checkout_cart_remove_path(product_id: product.id) %>">Remove</a>
38
- </td>
8
+ <th id="item_col"><%= t('.item', default: 'Item') %></th>
9
+ <th id="price_col"><%= t('.price', default: 'Price') %></th>
10
+ <th id="price_col"><%= t('.tax', default: 'Tax') %></th>
11
+ <th id="quantity_col"><%= t('.quantity', default: 'Quantity') %></th>
12
+ <th id="subtotal_col"><%= t('.subtotal', default: 'Subtotal') %></th>
13
+ <th></th>
39
14
  </tr>
40
- <% end %>
41
- </tbody>
42
- <tfoot>
43
- <tr>
44
- <td colspan="4"></td>
45
- <td>Subtotal</td>
46
- <td id="total" ><%= current_site.current_unit %> <%= total.to_f.round(2) %></td>
47
- </tr>
48
- </tfoot>
49
- </table>
50
- <% if @products.size > 0 %>
51
- <div class="text-right">
52
- <button type="submit" class="btn btn-default"> Update </button>
53
- <a class="btn btn-info" href="<%= plugins_ecommerce_checkout_path %>"><i class="fa fa-shopping-cart"></i> Proceed to Checkout</a>
54
- </div>
55
- <% end %>
56
-
57
- <% end %>
58
-
59
- <% end %>
15
+ </thead>
16
+ <tbody>
17
+ <% @products.each do |item| product = item.product.decorate %>
18
+ <tr>
19
+ <td><a href="<%= product.the_url %>"><%= product.the_title %></a></td>
20
+ <td><%= item.the_price %></td>
21
+ <td><%= product.the_tax %></td>
22
+ <td>
23
+ <input name="products[][product_id]" type="hidden" value="<%= product.id %>"/>
24
+ <input class="text-qty" type="number" name="products[][qty]" value="<%= item.qty %>">
25
+ </td>
26
+ <td><%= item.the_sub_total %></td>
27
+ <td>
28
+ <a rel="nofollow" data-method="delete" href="<%= plugins_ecommerce_checkout_cart_remove_path(product_id: product.id) %>"><%= t('.delete', default: 'Remove') %></a>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ <tfoot>
34
+ <tr>
35
+ <td colspan="4"></td>
36
+ <td><%= t('.subtotal', default: 'Subtotal') %></td>
37
+ <td><%= @cart.the_total_amount %></td>
38
+ </tr>
39
+ </tfoot>
40
+ </table>
41
+ <% if @products.size > 0 %>
42
+ <div class="text-right">
43
+ <button type="submit" class="btn btn-default"> <%= t('.update', default: 'Update') %> </button>
44
+ <a class="btn btn-info" href="<%= plugins_ecommerce_checkout_path %>"><i class="fa fa-shopping-cart"></i> <%= t('.proceed', default: 'Proceed to Checkout') %></a>
45
+ </div>
46
+ <% end %>
47
+ <% end %>
48
+ </div>
@@ -1,166 +1,42 @@
1
- <%= render layout: 'plugins/ecommerce/layouts/ecommerce', locals: {} do %>
2
- <%
3
- warning = []
4
- warning << "Not Found Product" if @products.size == 0
5
-
6
- %>
7
- <div id="checkout" class="row">
8
- <h1 class="col-md-12">Checkout</h1>
9
-
10
- <%= form_tag(plugins_ecommerce_checkout_processing_path, :method => "post", :class => "form form-validate-ec") do %>
11
-
12
- <div id="user_details" class="col-md-12">
13
- <h3>User Details</h3>
14
- <p><strong>Name: </strong> <%= current_user.fullname %></p>
15
- <input class="form-control" type="hidden" name="order[details][customer]" value="<%= current_user.fullname %>">
16
- <div class="form-group">
17
- <label for="">Email</label>
18
- <input class="form-control required" type="email" name="order[details][email]" id="">
19
- </div>
20
- <div class="form-group">
21
- <label for="">Phone</label>
22
- <input class="form-control required" type="text" name="order[details][phone]" id="">
23
- </div>
1
+ <% cama_load_custom_assets({"plugin_ecommerce"=>{css: [plugin_asset("checkout")] } }) %>
2
+ <% if warning.present? %>
3
+ <div class="alert alert-danger"><%= raw warning.join("<br>") %></div>
4
+ <% end %>
5
+ <div id="cama_checkout_view" class="row checkout_view">
6
+ <%= render plugin_view('partials/cart_widget') %>
7
+ <h1>Checkout Process</h1>
8
+ <div class="stepwizard col-md-offset-3 col-sm-offset-3">
9
+ <div class="stepwizard-row setup-panel">
10
+ <div class="stepwizard-step">
11
+ <a href="#step-1" type="button" class="btn btn-default btn-circle" disabled="disabled">1</a>
12
+ <p>Step 1</p>
13
+ </div>
14
+ <div class="stepwizard-step">
15
+ <a href="#step-2" type="button" class="btn btn-default btn-circle" disabled="disabled">2</a>
16
+ <p>Step 2</p>
17
+ </div>
18
+ <div class="stepwizard-step">
19
+ <a href="#step-3" type="button" class="btn btn-default btn-circle" disabled="disabled">3</a>
20
+ <p>Step 3</p>
21
+ </div>
22
+ </div>
24
23
  </div>
25
24
 
26
- <%= render partial: 'plugins/ecommerce/partials/form_address' %>
27
-
28
- <div class="clearfix"></div>
29
-
30
- <div id="add_details" class="col-md-6">
31
- <div id="coupon">
32
- <h3>Coupon</h3>
33
- <div id="e_coupon_apply_box" data-href="<%= plugins_ecommerce_res_coupon_path %>" data-token="<%= form_authenticity_token %>">
34
- <div class="input-group">
35
- <input type="text" class="form-control coupon-text" >
36
- <span class="input-group-btn">
37
- <button class="btn btn-default" type="button">Apply</button>
38
- </span>
39
- </div><!-- /input-group -->
40
- <input type="hidden" name="order[payment][coupon_code]" id="coupon_code" value="">
41
-
25
+ <div class="steps_content">
26
+ <div class="row setup-content" id="step-1">
27
+ <%= form_tag(plugins_ecommerce_checkout_step_address_path, :method => "post", :class => "col-md-12", id: 'checkout_address_form') do %>
28
+ <%= render plugin_view('partials/checkout/user_info') %>
29
+ <div class="clearfix"></div>
30
+ <% end %>
42
31
  </div>
43
-
44
-
45
- </div>
46
- <div id="shipping" data-no-turbolink="">
47
- <h3>Shipping Option</h3>
48
-
49
- <div class="form-group">
50
- <label for="">Shipping method</label>
51
- <%
52
- total_weight = 0
53
- weight_price = 0
54
- exist_shipping_method = false
55
- @products.each do |product|
56
- product_options = @cart.get_option("product_#{product.id}")
57
- total_weight += product_options[:weight].to_f * product_options[:qty].to_f
58
- end %>
59
- <select class="form-control" name="order[payment][shipping_method]" id="shipping_methods" >
60
- <% current_site.shipping_methods.each do |m|
61
- price = m.get_price_from_weight(total_weight)
62
- if price.to_i >= 0
63
- exist_shipping_method = true
64
- weight_price = price unless weight_price.to_i > 0
65
- %>
66
- <option value="<%= m.id %>" data-price="<%= price %>"><%= m.name %> <%= current_site.current_unit %> <%= price %></option>
67
- <% end
68
- end %>
69
- </select>
70
- <% warning << "Not Found Shipping Methods by Products" unless exist_shipping_method %>
71
-
32
+ <div class="row setup-content" id="step-2">
33
+ <%= form_tag(plugins_ecommerce_checkout_step_shipping_path, :method => "post", :class => "col-md-12", id: 'checkout_shipping_form') do %>
34
+ <%= render plugin_view('partials/checkout/details') %>
35
+ <% end %>
72
36
  </div>
73
- </div>
37
+ <div class="row setup-content" id="step-3">
74
38
 
75
- <% if warning.present? %>
76
- <div class="alert alert-danger"><%= raw warning.join("<br>") %></div>
77
- <% else %>
78
- <div id="submit" class="text-right">
79
- <input type="submit" name="commit" value="Create Order" class="btn btn-default">
80
39
  </div>
81
- <% end %>
82
40
  </div>
83
- <div id="totals_section" class="col-md-6">
84
- <h3>Total</h3>
85
- <table class="table table-bordered">
86
- <tbody>
87
- <tr>
88
- <th id="quantity_col">Quantity</th>
89
- <th id="item_col">Item</th>
90
- <th id="price_col">Price</th>
91
-
92
- <th id="tax_col">Tax</th>
93
- <th id="subtotal_col">Subtotal</th>
94
- </tr>
95
-
96
- <%
97
- total = 0
98
- tax_total = 0
99
-
100
- @products.each do |product|
101
- product = product.decorate
102
- product_options = @cart.get_option("product_#{product.id}")
103
- price = product_options[:price].to_f
104
- qty = product_options[:qty].to_f
105
- tax_product = product_options[:tax].to_f
106
- tax_total_product = tax_product * qty
107
- tax_total += tax_total_product
108
- sub_total = price * qty
109
- total += sub_total
110
- %>
111
- <tr>
112
- <td><%= qty.to_i %></td>
113
- <td><%= product.the_title %></td>
114
- <td><%= current_site.current_unit %> <%= price %></td>
115
-
116
- <td><%= current_site.current_unit %> <%= tax_product %></td>
117
- <td><%= current_site.current_unit %> <%= sub_total + tax_total_product %></td>
118
- </tr>
119
- <% end
120
-
121
- %>
122
-
123
-
124
-
125
- <tr>
126
- <td colspan="2"></td>
127
- <td colspan="2" class="text-right">Total (excluding Tax)</td>
128
- <td id="subtotal_total" data-subtotal="<%= total %>">
129
- <%= current_site.current_unit %> <%= total %>
130
- </td>
131
- </tr>
132
- <tr >
133
- <td colspan="2"></td>
134
- <td colspan="2" class="text-right">Tax</td>
135
- <td id="tax_total">
136
- <%= current_site.current_unit %> <%= tax_total %>
137
- </td>
138
- </tr>
139
- <% total += tax_total %>
140
-
141
- <tr id="coupon_application_row" style="display:none;">
142
- <td colspan="2"></td>
143
- <td colspan="2" class="text-right">Discount</td>
144
- <td class="extra_totals reduce_tax_subtotal" id="coupon_application_total" data-amount="0">
145
- <span></span>
146
- </td>
147
- </tr>
148
- <tr>
149
- <td colspan="2"></td>
150
- <td colspan="2" class="text-right">Shipping</td>
151
- <td id="shipping_total"><%= current_site.current_unit %> <span><%= weight_price %></span></td>
152
- </tr>
153
- <tr>
154
- <td colspan="2"></td>
155
- <td colspan="2" class="text-right">Total</td>
156
- <td id="order_total" data-total="<%= total %>">
157
- <% total += weight_price %>
158
- <%= current_site.current_unit %> <span><%= total %></span></td>
159
- </tr>
160
- </tbody>
161
- </table>
162
-
163
- </div>
164
- <% end %>
165
41
  </div>
166
- <% end %>
42
+ <script>jQuery(function(){ cama_checkout_actions(); <% if flash[:payment_error].present? %> setTimeout(function(){ $('#cama_checkout_view #checkout_shipping_form').submit(); }, 200); <% end %> })</script>
@@ -0,0 +1,67 @@
1
+ <div class="container" id="ecommerce_login_panel">
2
+ <%= render 'camaleon_cms/flash_messages' %>
3
+ <div class="row">
4
+ <div class="col-md-6 col-md-offset-3">
5
+ <ul class="nav nav-tabs" role="tablist">
6
+ <li role="presentation" class="active"><a href="#login-form" role="tab" data-toggle="tab"><%= t('.login', default: 'Login') %></a></li>
7
+ <li role="presentation"><a href="#register-form" role="tab" data-toggle="tab"><%= t('.register', default: 'Register') %></a></li>
8
+ </ul>
9
+ <div class="tab-content">
10
+ <%= form_tag plugins_ecommerce_login_path, id: 'login-form', class: 'tab-pane active', role: 'tabpanel' do %>
11
+ <%= hidden_field_tag :kind_form, 'login-form' %>
12
+ <div class="form-group">
13
+ <input type="text" name="username" id="username" tabindex="1" class="form-control required" placeholder="<%= t('.username', default: 'Username') %>" value="">
14
+ </div>
15
+ <div class="form-group">
16
+ <input type="password" name="password" id="password" tabindex="2" class="form-control required" placeholder="<%= t('.password', default: 'Password') %>">
17
+ </div>
18
+ <div class="form-group">
19
+ <%= button_tag t('.login', default: 'Login'), class: 'btn btn-default col-md-3', type: 'submit' %>
20
+ <a href="<%= cama_admin_forgot_url(return_to: site_current_url) %>" tabindex="5" class="pull-right"><%= t('.forgot', default: 'Forgot Password?') %></a>
21
+ </div>
22
+ <div class="clearfix"></div>
23
+ <% end %>
24
+
25
+ <%= form_for @user, url: plugins_ecommerce_register_path, html: { id: 'register-form', class: 'tab-pane', role: 'tabpanel' } do |f| %>
26
+ <%= render partial: 'layouts/camaleon_cms/admin/form_error', locals: {data: @user} %>
27
+ <%= hidden_field_tag :kind_form, 'register-form' %>
28
+ <div class="form-group">
29
+ <%= f.text_field :first_name, class: 'form-control required', tabindex: 1, placeholder: t('.full_name', default: 'Full Name') %>
30
+ </div>
31
+ <div class="form-group">
32
+ <%= f.text_field :username, class: 'form-control required', tabindex: 2, placeholder: t('.username', default: 'User name') %>
33
+ </div>
34
+ <div class="form-group">
35
+ <%= f.text_field :email, class: 'form-control email required', tabindex: 3, placeholder: t('.email', default: 'Email address') %>
36
+ </div>
37
+ <div class="form-group">
38
+ <%= f.password_field :password, class: 'form-control required', tabindex: 4, placeholder: t('.password', default: 'Password') %>
39
+ </div>
40
+ <div class="form-group">
41
+ <%= f.password_field :password_confirmation, class: 'form-control required', equalTo: '#camaleon_cms_user_password', tabindex: 5, placeholder: t('.confirm_pass', default: 'Confirm Password') %>
42
+ </div>
43
+ <div class="form-group">
44
+ <%= submit_tag t('.create_account', default: 'Create account'), class: 'btn btn-default col-md-3' %>
45
+ </div>
46
+ <div class="clearfix"></div>
47
+ <% end %>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <script>
53
+ $(function() {
54
+ var panel = $('#ecommerce_login_panel');
55
+ <% if params[:kind_form].present? %>
56
+ $('#<%= params[:kind_form] %>-link', panel).click();
57
+ <% end %>
58
+
59
+ function do_validation(){
60
+ $("#register-form", panel).validate();
61
+ $("#login-form", panel).validate();
62
+ }
63
+
64
+ if(!$.fn.validator) $.getScript('<%= asset_url('camaleon_cms/admin/jquery.validate') %>', function(){ do_validation(); });
65
+ else do_validation();
66
+ });
67
+ </script>
@@ -1,46 +1,38 @@
1
- <%= render layout: 'plugins/ecommerce/layouts/ecommerce', locals: {} do %>
2
- <h2>Orders</h2>
3
- <table id="table-shopping-cart" class="table">
4
- <thead>
1
+ <%= render plugin_view('partials/cart_widget') %>
2
+ <h2><%= t('.title', default: 'My Orders') %></h2>
3
+ <table id="table-shopping-cart" class="table">
4
+ <thead>
5
+ <tr>
6
+ <th><%= t('.id', default: 'ID') %></th>
7
+ <th><%= t('.status', default: 'Status') %></th>
8
+ <th><%= t('.products', default: 'Products') %></th>
9
+ <th><%= t('.total_amount', default: 'Total Amount') %></th>
10
+ <th><%= t('.coupon', default: 'Coupon') %></th>
11
+ <th><%= t('.paid_amount', default: 'Paid Amount') %></th>
12
+ <th><%= t('.order_date', default: 'Order Date') %></th>
13
+ <th><%= t('.method', default: 'Payment Method') %></th>
14
+ <th style="width: 90px"></th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @orders.each do |order| %>
5
19
  <tr>
6
- <th id="">ID</th>
7
- <th id="">Status</th>
8
- <th id="">Products</th>
9
- <th id="">Total Amount</th>
10
- <th id="">Coupon</th>
11
- <th id="">Pay Amount</th>
12
- <th id="">Order Time</th>
13
- <th>Payment Method</th>
14
- <th style="width: 90px"></th>
20
+ <td><%= order.slug %></td>
21
+ <td><%= raw order.the_status %></td>
22
+ <td>
23
+ <% order.product_items.each do |item| %>
24
+ <%= item.qty %> x <%= item.cache_the_title %> (<%= item.cache_the_price %>) <br>
25
+ <% end %>
26
+ </td>
27
+ <td><%= order.cache_the_sub_total %></td>
28
+ <td><%= order.cache_the_discounts %></td>
29
+ <td><%= order.cache_the_total %></td>
30
+ <td><%= order.paid_at %></td>
31
+ <td><%= order.payment_method.name rescue '' %></td>
32
+ <td>
33
+ <a href="<%= plugins_ecommerce_order_show_path(order: order.slug) %>" class="btn btn-default btn-xs"><%= t('.view', default: 'View') %></a>
34
+ </td>
15
35
  </tr>
16
- </thead>
17
- <tbody>
18
- <%
19
- @orders.each do |order|
20
- order = order.decorate
21
- payment = order.get_meta("payment")
22
- %>
23
- <tr>
24
- <td><%= order.slug %></td>
25
- <td><%= raw order.the_status %></td>
26
- <td>
27
- <% order.get_meta("products").each do |key, product| %>
28
- <%= product[:qty] %> x <%= product[:product_title] %> (<%= current_site.current_unit %> <%= product[:price] %>) <br>
29
- <% end %>
30
- </td>
31
- <td><%= current_site.current_unit %> <%= payment[:total] %></td>
32
- <td><%= payment[:coupon] %></td>
33
- <td><%= current_site.current_unit %> <%= payment[:amount].to_f.round(2) %></td>
34
- <td><%= order.details.received_at %></td>
35
- <td><%= order.payment_method.name rescue '' %></td>
36
- <td>
37
- <a href="<%= plugins_ecommerce_order_show_path(order: order.slug) %>" class="btn btn-info btn-xs">View</a>
38
- <% if payment[:amount].to_f > 0 && order.unpaid? %>
39
- <a href="<%= plugins_ecommerce_order_select_payment_path(order: order.slug) %>" class="btn btn-warning btn-xs">Pay</a>
40
- <% end %>
41
- </td>
42
- </tr>
43
- <% end %>
44
- </tbody>
45
- </table>
46
- <% end %>
36
+ <% end %>
37
+ </tbody>
38
+ </table>