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
@@ -1,90 +1,150 @@
1
- <div class="panel panel-default">
2
- <div class="panel-heading">
3
- <h4><span class="fa fa-cog"></span> <%= t('plugin.ecommerce.orders') %></h4>
4
- </div>
5
-
6
- <div class="panel-body">
7
- <div class="box-adv-search pull-right">
1
+ <div class="panel panel-default" id="commerce-orders-list">
2
+ <div class="panel-heading">
3
+ <h4><span class="fa fa-cog"></span> <%= t('plugin.ecommerce.orders') %></h4>
4
+ </div>
8
5
 
9
- <div class="input-group" id="adv-search">
10
- <input type="text" class="form-control" placeholder="<%= t('plugin.ecommerce.search_order_number') %>" name="q" value="<%= params[:q] %>"/>
6
+ <div class="panel-body">
7
+ <div class="box-adv-search pull-right" id="orders-box-adv-search">
8
+ <div class="input-group" id="adv-search">
9
+ <input type="text" class="form-control" placeholder="<%= t('plugin.ecommerce.search_order_number') %>" name="q" value="<%= params[:q] %>"/>
11
10
 
12
- <div class="input-group-btn">
13
- <div class="btn-group" role="group">
14
- <div class="dropdown dropdown-lg">
15
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><span class="caret"></span></button>
16
- <div class="dropdown-menu dropdown-menu-right" role="menu">
17
- <form action="<%= url_for(action: :index) %>" method="get" class="form-horizontal" role="form">
18
- <div class="form-group">
19
- <label for="contain"><%= t('plugin.ecommerce.table.customer') %> </label>
20
- <input class="form-control" type="text" name="c" value="<%= params[:c] %>"/>
21
- </div>
22
- <div class="form-group">
23
- <label for="contain"><%= t('plugin.ecommerce.e_mail_address') %></label>
24
- <input class="form-control" type="email" name="e" value="<%= params[:e] %>"/>
25
- </div>
26
- <div class="form-group">
27
- <label for="contain"><%= t('plugin.ecommerce.phone_number') %></label>
28
- <input class="form-control" type="text" name="p" value="<%= params[:p] %>"/>
29
- </div>
30
- <div class="form-group">
31
- <label for="contain"><%= t('plugin.ecommerce.table.status') %></label>
32
- <%= select_tag "s", options_for_select([[""], [t('plugin.ecommerce.select.received'), "received"], [t('plugin.ecommerce.select.unpaid'), "unpaid"], [t('plugin.ecommerce.select.accepted'), "accepted"], [t('plugin.ecommerce.select.shipped'), "shipped"], [t('plugin.ecommerce.select.closed'), "closed"], [t('plugin.ecommerce.select.canceled'), "canceled"]], params[:s]), class: 'form-control' %>
33
- </div>
11
+ <div class="input-group-btn">
12
+ <div class="btn-group" role="group">
13
+ <div class="dropdown dropdown-lg">
14
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
15
+ <span class="caret"></span></button>
16
+ <div class="dropdown-menu dropdown-menu-right" role="menu">
17
+ <form action="<%= url_for(action: :index) %>" method="get" class="form-horizontal" role="form">
18
+ <div class="form-group">
19
+ <label for="contain"><%= t('plugin.ecommerce.table.customer') %> </label>
20
+ <input class="form-control" type="text" name="c" value="<%= params[:c] %>"/>
21
+ </div>
22
+ <div class="form-group">
23
+ <label for="contain"><%= t('plugin.ecommerce.e_mail_address') %></label>
24
+ <input class="form-control" type="email" name="e" value="<%= params[:e] %>"/>
25
+ </div>
26
+ <div class="form-group">
27
+ <label for="contain"><%= t('plugin.ecommerce.phone_number') %></label>
28
+ <input class="form-control" type="text" name="p" value="<%= params[:p] %>"/>
29
+ </div>
30
+ <div class="form-group">
31
+ <label for="contain"><%= t('plugin.ecommerce.table.status') %></label>
32
+ <%= select_tag "s", options_for_select([[""], [t('plugin.ecommerce.select.received'), "received"], [t('plugin.ecommerce.select.unpaid'), "unpaid"], [t('plugin.ecommerce.select.accepted'), "accepted"], [t('plugin.ecommerce.select.shipped'), "shipped"], [t('plugin.ecommerce.select.closed'), "closed"], [t('plugin.ecommerce.select.canceled'), "canceled"]], params[:s]), class: 'form-control' %>
33
+ </div>
34
34
 
35
- <button type="submit" class="btn btn-primary"><span class="fa fa-search" aria-hidden="true"></span></button>
36
- </form>
37
- </div>
35
+ <button type="submit" class="btn btn-primary">
36
+ <span class="fa fa-search" aria-hidden="true"></span></button>
37
+ </form>
38
+ </div>
39
+ </div>
40
+ <button type="button" class="btn btn-primary">
41
+ <span class="fa fa-search" aria-hidden="true"></span></button>
42
+ </div>
43
+ </div>
38
44
  </div>
39
- <button type="button" class="btn btn-primary"><span class="fa fa-search" aria-hidden="true"></span></button>
40
- </div>
41
45
  </div>
42
- </div>
43
- </div>
46
+ <div class="hidden" id="commerce_cancel_modal">
47
+ <%= form_tag '#' do %>
48
+ <div class="form-group">
49
+ <%= label_tag nil, t('plugin.ecommerce.table.description', default: 'Description') %>
50
+ <%= text_area_tag 'description', '', class: 'form-control required' %>
51
+ </div>
52
+ <div class="">
53
+ <span class="input-group-btn"><button class="btn btn-default" type="submit"><%= t('plugin.ecommerce.table.make_canceled', default: 'Mark as Canceled') %></button></span>
54
+ </div>
55
+ <% end %>
56
+ </div>
44
57
 
45
- <table class="table">
46
- <thead>
47
- <tr>
48
- <th id=""><%= t('plugin.ecommerce.table.id') %></th>
49
- <th id=""><%= t('plugin.ecommerce.table.customer') %></th>
50
- <th id=""><%= t('plugin.ecommerce.table.status') %></th>
51
- <th id=""><%= t('plugin.ecommerce.table.paid') %></th>
52
- <th id=""><%= t('plugin.ecommerce.table.products') %></th>
53
- <th id=""><%= t('plugin.ecommerce.table.amount') %></th>
54
- <th id=""><%= t('plugin.ecommerce.table.received_time') %></th>
55
- <th id=""><%= t('plugin.ecommerce.table.payment_method') %></th>
56
- <th><%= t('camaleon_cms.admin.table.actions') %></th>
57
- </tr>
58
- </thead>
59
- <tbody>
60
- <%
61
- @orders.each do |order|
62
- order = order.decorate
63
- %>
58
+ <div class="hidden" id="commerce_shipped_modal">
59
+ <%= form_tag '#' do %>
60
+ <div>
61
+ <%= label_tag nil, t('plugin.ecommerce.show_order.consignment_number', default: 'Consignment Number') %>
62
+ </div>
63
+ <div class="input-group">
64
+ <%= text_field_tag 'consignment_number', '', class: 'form-control' %>
65
+ <span class="input-group-btn"><button class="btn btn-default" type="submit"><%= t('plugin.ecommerce.table.make_shipped', default: 'Mark as Shipped') %></button></span>
66
+ </div>
67
+ <% end %>
68
+ </div>
69
+
70
+ <table class="table">
71
+ <thead>
64
72
  <tr>
65
- <td><%= order.slug %></td>
66
- <td><%= order.details.customer %></td>
67
- <td><%= raw order.the_status %></td>
68
- <td><%= order.paid? ? 'Yes' : 'No' %></td>
69
- <td>
70
- <% order.get_meta("products", {}).each do |key, product| %>
71
- <%= product[:qty] %> x <%= product[:product_title] %> (<%= "#{current_site.current_unit} #{product[:price]}" %>) <br>
72
- <% end %>
73
- </td>
74
- <td><%= current_site.current_unit %> <%= order.get_meta("payment", {})[:amount] %></td>
75
- <td><%= order.details.received_at %></td>
76
- <td><%= order.payment_method.name rescue "" %></td>
77
- <td>
78
- <%= link_to raw('<i class="fa fa-eye"></i>'), {action: :show, id: order.slug}, class: "btn btn-info btn-xs", title: "#{t('camaleon_cms.admin.button.preview')}" %>
79
- <%= link_to raw('<i class="fa fa-edit"></i>'), {action: :edit, id: order.slug}, class: "btn btn-default btn-xs", title: "#{t('camaleon_cms.admin.button.edit')}" %>
80
- </td>
73
+ <th id=""><%= t('plugin.ecommerce.table.id') %></th>
74
+ <th id=""><%= t('plugin.ecommerce.table.customer') %></th>
75
+ <th id=""><%= t('plugin.ecommerce.table.status') %></th>
76
+ <th id=""><%= t('plugin.ecommerce.table.paid') %></th>
77
+ <th id=""><%= t('plugin.ecommerce.table.products') %></th>
78
+ <th id=""><%= t('plugin.ecommerce.table.amount') %></th>
79
+ <th id=""><%= t('plugin.ecommerce.table.received_time') %></th>
80
+ <th id=""><%= t('plugin.ecommerce.table.payment_method') %></th>
81
+ <th><%= t('camaleon_cms.admin.table.actions') %></th>
81
82
  </tr>
82
- <% end %>
83
+ </thead>
84
+ <tbody>
85
+ <%
86
+ @orders.each do |order|
87
+ order = order.decorate
88
+ %>
89
+ <tr>
90
+ <td><%= order.slug %></td>
91
+ <td><%= order.user.fullname %></td>
92
+ <td><%= raw order.the_status %></td>
93
+ <td><%= order.paid? ? 'Yes' : 'No' %></td>
94
+ <td>
95
+ <% order.product_items.each do |item| %>
96
+ <%= item.qty %> x <%= item.cache_the_title %> (<%= item.cache_the_price %>) <br>
97
+ <% end %>
98
+ </td>
99
+ <td><%= order.cache_the_total %></td>
100
+ <td><%= order.received_at %></td>
101
+ <td><%= order.payment_method.name rescue "" %></td>
102
+ <td>
103
+ <%= link_to raw('<i class="fa fa-eye"></i>'), {action: :show, id: order.slug}, class: "btn btn-info btn-xs", title: "#{t('camaleon_cms.admin.button.preview')}" %>
104
+ <%= link_to raw('<i class="fa fa-edit"></i>'), {action: :edit, id: order.slug}, class: "btn btn-default btn-xs", title: "#{t('camaleon_cms.admin.button.edit')}" %>
105
+ <%= link_to raw('<i class="fa fa-trash"></i>'), {action: :destroy, id: order.slug}, class: "btn btn-danger btn-xs", title: "#{t('camaleon_cms.admin.button.delete', default: 'Delete Order')}", method: :delete, 'data-confirm'=> t('plugin.ecommerce.table.confirm_delete', default: 'Are you sure to delete this order?') %>
106
+ <div class="btn-group">
107
+ <button class="btn btn-info btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="<%= t('camaleon_cms.admin.button.settings') %>"><i class="fa fa-cog"></i></button>
108
+ <ul class="dropdown-menu pull-right" style="min-width: 50px;">
109
+ <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_accepted', default: 'Mark as Accepted'), url_for(action: :mark_accepted, order_id: order.slug), class: 'btn btn-xs') if order.paid? %>
110
+ <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_shipped', default: 'Mark as Shipped'), url_for(action: :mark_shipped, order_id: order.slug), class: 'btn btn-xs mark_shipped_btn') if order.accepted? || order.paid? %>
111
+ <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_canceled', default: 'Mark as Canceled'), url_for(action: :mark_canceled, order_id: order.slug), class: 'btn btn-xs mark_canceled_btn', 'data-confirm_msg'=> t('plugin.ecommerce.table.confirm_mark_as_cancel', default: 'Are you sure to mark as Canceled?')) if order.bank_pending? || order.paid? %>
112
+ <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_bank_confirmed', default: 'Mark as Paid'), url_for(action: :mark_bank_confirmed, order_id: order.slug), class: 'btn btn-xs', 'data-confirm'=> t('plugin.ecommerce.table.confirm_mark_as_paid', default: 'Are you sure to mark as Paid?')) if order.bank_pending? %>
113
+ </ul>
114
+ </div>
115
+ </td>
116
+ </tr>
117
+ <% end %>
118
+ </tbody>
119
+ </table>
120
+ <%= content_tag("div", raw(t('camaleon_cms.admin.message.data_found_list')), class: "alert alert-warning") if @orders.empty? %>
121
+ <%= will_paginate @orders %>
122
+ </div>
123
+ </div>
124
+ <script>
125
+ jQuery(function () {
126
+ var panel = $('#commerce-orders-list');
127
+ panel.find('.mark_shipped_btn').click(function(e){
128
+ var link = $(this);
129
+ e.preventDefault();
130
+ open_modal({title: link.text(), content: panel.find('#commerce_shipped_modal').html(), callback: function(modal){ modal.find('form').attr('action', link.attr('href')).validate(); }});
131
+ });
83
132
 
133
+ panel.find('.mark_canceled_btn').click(function(e){
134
+ var link = $(this);
135
+ e.preventDefault();
136
+ open_modal({title: link.text(), content: panel.find('#commerce_cancel_modal').html(), callback: function(modal){
137
+ modal.find('form').attr('action', link.attr('href')).validate({submitHandler: function(){ return confirm(link.attr('data-confirm_msg')); }});
138
+ }});
139
+ });
84
140
 
85
- </tbody>
86
- </table>
87
- <%= content_tag("div", raw(t('camaleon_cms.admin.message.data_found_list')), class: "alert alert-warning") if @orders.empty? %>
88
- <%= will_paginate @orders, renderer: BootstrapPagination::Rails %>
89
- </div>
90
- </div>
141
+ var cont = $('#orders-box-adv-search');
142
+ var rnd = "input_" + Math.floor((Math.random() * 1000000) + 1);
143
+ cont.find('#adv-search > input').change(function () {
144
+ cont.find('form .' + rnd).val($(this).val());
145
+ }).clone().attr('type', 'hidden').addClass(rnd).appendTo(cont.find('form'));
146
+ cont.find('#adv-search .btn-group > button').click(function () {
147
+ cont.find('form').submit();
148
+ });
149
+ });
150
+ </script>
@@ -1,173 +1,11 @@
1
- <div id="order_view" class="panel panel-default">
2
- <div class="panel-heading">
3
- <h4><%= t('plugin.ecommerce.details_order') %>: <%= @order.slug %></h4>
4
- <%= link_to raw("<i class='fa fa-edit'></i> #{t('plugin.ecommerce.edit_order')}"), {action: :edit, id: @order.slug}, class: "btn btn-primary pull-right" %>
5
- </div>
6
- <div class="panel-body">
7
-
8
- <div class="row">
9
- <div class="col-md-4">
10
- <h3><%= t('plugin.ecommerce.table.customer_info') %></h3>
11
- <ul class="ec-list-orders-address">
12
- <li><strong><%= t('plugin.ecommerce.table.name') %>:</strong> <span> <%= @order.details.customer %></span></li>
13
- <li><strong><%= t('plugin.ecommerce.table.email') %>:</strong> <span> <%= @order.details.email %></span></li>
14
- <li><strong><%= t('plugin.ecommerce.table.phone') %>:</strong> <span> <%= @order.details.phone %></span></li>
15
- </ul>
16
- </div>
17
- <div class="col-md-4">
18
- <h3><%= t('plugin.ecommerce.billing_address') %></h3>
19
-
20
- <% detail = @order.get_meta("billing_address") %>
21
- <ul class="ec-list-orders-address">
22
- <li><strong><%= t('plugin.ecommerce.table.name') %>:</strong> <span><%= detail[:first_name] %> <%= detail[:last_name] %></span></li>
23
- <li><strong><%= t('plugin.ecommerce.table.address') %>:</strong> <span><%= detail[:address1] %> <br/> <%= detail[:address2] %> <br/> <%= detail[:city] %> <br/> <%= detail[:state] %> <br/> <%= detail[:zip] %> <br/> <%= detail[:country] %></span></li>
24
- </ul>
25
- </div>
26
-
27
- <div class="col-md-4">
28
- <h3><%= t('plugin.ecommerce.shipping_address') %></h3>
29
- <% detail = @order.get_meta("shipping_address") %>
30
- <ul class="ec-list-orders-address">
31
- <li><strong><%= t('plugin.ecommerce.table.name') %>:</strong> <span><%= detail[:first_name] %> <%= detail[:last_name] %></span></li>
32
- <li><strong><%= t('plugin.ecommerce.table.address') %>:</strong> <span><%= detail[:address1] %> <br/> <%= detail[:address2] %> <br/> <%= detail[:city] %> <br/> <%= detail[:state] %> <br/> <%= detail[:zip] %> <br/> <%= detail[:country] %></span></li>
33
- </ul>
34
- </div>
35
-
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ <h4><%= t('.title', default: 'Order Details') %>: <%= @order.slug %></h4>
36
4
  </div>
37
-
38
-
39
- <div class="row">
40
- <div class="col-md-12">
41
-
42
- <div class="status-bar">
43
- <div class="bg-bar"></div>
44
- <ul>
45
- <%
46
- approved_accepted = @order.paid?
47
- approved_shipped = false
48
- %>
49
- <li class="received">
50
- <div class="icon"><i class="fa fa-inbox"></i></div>
51
- <h4><%= t('plugin.ecommerce.order_received') %>
52
- <br/><%= raw @order.the_pay_status %>
53
- </h4>
54
-
55
- <p> on <%= @order.details.received_at %></p>
56
- </li>
57
- <% if approved_accepted %>
58
- <li class="accepted">
59
- <%
60
- if @order.details.accepted_at.present?
61
- approved_shipped = true
62
- %>
63
- <div class="icon"><i class="fa fa-thumbs-up"></i></div>
64
- <h4><%= t('plugin.ecommerce.order_accepted') %></h4>
65
-
66
- <p>
67
- on <%= @order.details.accepted_at %>
68
- </p>
69
- <% else %>
70
- <%= form_tag(admin_plugins_ecommerce_order_accepted_path(order_id: @order.slug), :method => "post", :class => "form") do %>
71
- <button class="btn btn-success" type="submit"><%= t('plugin.ecommerce.accepted') %> &nbsp;&nbsp; <i class="fa fa-arrow-right"></i></button>
72
- <% end %>
73
- <% end %>
74
- </li>
75
- <% end %>
76
- <% if approved_shipped %>
77
- <li class="shipped">
78
- <% if @order.details.shipped_at.present? %>
79
- <div class="icon"><i class="fa fa-taxi"></i></div>
80
- <h4><%= t('plugin.ecommerce.order_shipped') %></h4>
81
-
82
- <p>on <%= @order.details.shipped_at %></p>
83
-
84
- <p>
85
- <a href="<%= @order.the_url_tracking %>"><%= t('plugin.ecommerce.url_tracking') %></a>
86
- </p>
87
- <% else %>
88
- <%= form_tag(admin_plugins_ecommerce_order_shipped_path(order_id: @order.slug), :method => "post", :class => "form") do %>
89
- <div class="form-group">
90
- <input type="text" class="form-control" name="payment[consignment_number]" placeholder="Consignment Number"/>
91
- </div>
92
- <button class="btn btn-info" type="submit"><%= t('plugin.ecommerce.mark_shipped') %></button>
93
- <% end %>
94
- <% end %>
95
- </li>
96
- <% end %>
97
- </ul>
98
- </div>
99
-
100
- </div>
5
+ <div class="panel-body">
6
+ <%= render file: plugin_view('front/orders/show'), as_partial: true %>
101
7
  </div>
102
-
103
- <div class="row">
104
- <div class="col-md-12">
105
- <h3><%= t('plugin.ecommerce.table.products') %></h3>
106
- <%= render partial: 'plugins/ecommerce/partials/table_order_products', locals: {order: @order} %>
107
- </div>
108
-
8
+ <div class="panel-footer">
9
+ <button class="btn btn-default" onclick="history.back()"><%= t('camaleon_cms.admin.button.back') %></button>
109
10
  </div>
110
-
111
-
112
- <div class="row">
113
- <div class="col-md-12">
114
- <h3><%= t('plugin.ecommerce.method_shipped') %></h3>
115
- <table class="table">
116
- <tbody>
117
- <tr>
118
- <th id=""><%= t('plugin.ecommerce.order_shipped') %></th>
119
- <th id=""><%= t('plugin.ecommerce.shipped_date') %></th>
120
- <th id=""><%= t('plugin.ecommerce.table.url_tracking') %></th>
121
- </tr>
122
- <tr>
123
- <td><%= @order.shipping_method.name rescue "#{t('plugin.ecommerce.message.not_shipped_assigned')}" %></td>
124
- <td> <%= @order.details.shipped_at || "#{t('plugin.ecommerce.message.not_shipped')}" %> </td>
125
- <td> <%= @order.the_url_tracking %> </td>
126
- </tr>
127
- </tbody>
128
- </table>
129
- <%#= debug payment %>
130
- </div>
131
-
132
- </div>
133
-
134
- <div class="row">
135
- <div class="col-md-12">
136
- <h3><%= t('plugin.ecommerce.payments') %></h3>
137
- <table class="table">
138
- <tbody>
139
- <tr>
140
- <th id=""><%= t('plugin.ecommerce.table.method') %></th>
141
- <th id=""><%= t('plugin.ecommerce.table.amount') %></th>
142
- <th id=""><%= t('plugin.ecommerce.table.details') %></th>
143
- </tr>
144
- <% payment = @order.get_meta("payment")
145
- details = @order.get_meta("pay_#{payment[:type]}".to_sym)
146
- %>
147
- <tr>
148
- <td><%= @order.payment_method.name rescue "" %></td>
149
- <td><%= current_site.current_unit %> <%= payment[:amount] %></td>
150
- <td><%= raw details.present? ? details.map { |key, value| "<strong>#{key}: </strong> #{value}" }.join("<br>") : "#{t('plugin.ecommerce.table.not_paid')}" %></td>
151
- </tr>
152
- <tr class="bg-primary">
153
- <td><%= t('plugin.ecommerce.table.total') %></td>
154
- <td><%= current_site.current_unit %> <%= payment[:amount] %></td>
155
- <td></td>
156
- </tr>
157
- </tbody>
158
- </table>
159
- <%#= debug payment %>
160
- </div>
161
-
162
- </div>
163
-
164
- <%#= debug @order.meta %>
165
- <% unless @order.closed? %>
166
- <div class="row">
167
- <div class="col-md-12 text-center">
168
- <%= link_to raw('<i class="fa fa-lock"></i> Close order'), admin_plugins_ecommerce_order_closed_path(order_id: @order.slug), method: :post, data: {confirm: t('plugin.ecommerce.message.modal_close_order')}, class: "btn btn-danger cama_ajax_request", title: "#{t('plugin.ecommerce.buttons.close_order')}" unless @order.closed? %>
169
- </div>
170
- </div>
171
- <% end %>
172
- </div>
173
11
  </div>
@@ -9,13 +9,13 @@
9
9
  <%= f.label t('plugin.ecommerce.table.name') %><br>
10
10
  <%= f.text_field :name, :class => "form-control required" %>
11
11
  </div>
12
- <div class="form-group">
12
+ <div class="form-group hidden">
13
13
  <%= f.label t('camaleon_cms.admin.table.slug') %><br>
14
14
  <%= f.text_field :slug, :class => "form-control slug", "data-parent" => 'plugins_ecommerce_payment_method_name' %>
15
15
  </div>
16
16
  <div class="form-group">
17
17
  <%= f.label t('plugin.ecommerce.table.description') %><br>
18
- <%= f.text_area :description, :class => "form-control", :rows => 4 %>
18
+ <%= f.text_area :description, :class => "form-control translatable", :rows => 4 %>
19
19
  </div>
20
20
  <div class="form-group">
21
21
  <label><%= f.check_box :status %> &nbsp; <%= t('plugin.ecommerce.active') %> </label>
@@ -30,8 +30,9 @@
30
30
  <ul class="nav nav-tabs nav-justified">
31
31
  <li class="<%= 'active' if options[:type] == 'bank_transfer' %>"><a href="#tab8" data-toggle="tab"><%= t('plugin.ecommerce.by_bank_transfer') %></a></li>
32
32
  <li class="<%= 'active' if options[:type] == 'paypal' %>"><a href="#tab9" data-toggle="tab"><%= t('plugin.ecommerce.by_paypal') %></a></li>
33
- <li class="<%= 'active' if options[:type] == 'credit_card' %>"><a href="#tab7" data-toggle="tab"><%= t('plugin.ecommerce.by_credit_card') %></a></li>
33
+ <!--<li class="<%= 'active' if options[:type] == 'credit_card' %>"><a href="#tab7" data-toggle="tab"><%= t('plugin.ecommerce.by_credit_card') %></a></li>-->
34
34
  <li class="<%= 'active' if options[:type] == 'authorize_net' %>"><a href="#tab10" data-toggle="tab"><%= t('plugin.ecommerce.by_authorize_net') %></a></li>
35
+ <li class="<%= 'active' if options[:type] == 'stripe' %>"><a href="#tab11" data-toggle="tab"><%= t('plugin.ecommerce.by_stripe', default: 'Stripe') %></a></li>
35
36
  </ul>
36
37
  <div class="panel-body tab-content">
37
38
 
@@ -103,6 +104,17 @@
103
104
  </div>
104
105
  </div>
105
106
  </div>
107
+ <div class="tab-pane <%= 'active' if options[:type] == 'stripe' %>" id="tab11">
108
+ <%= hidden_field_tag('options[type]', 'stripe') %>
109
+ <div class="form-group">
110
+ <label><%= t('plugin.ecommerce.stripe_scret_key', default: 'Secret Key') %></label><br>
111
+ <%= text_field_tag('options[stripe_id]', options[:stripe_id], class: 'form-control required') %>
112
+ </div>
113
+ <div class="form-group">
114
+ <label><%= t('plugin.ecommerce.stripe_publish_key', default: 'Publishable Key') %></label><br>
115
+ <%= text_field_tag('options[stripe_key]', options[:stripe_key], class: 'form-control required') %>
116
+ </div>
117
+ </div>
106
118
  </div>
107
119
  </div>
108
120
 
@@ -113,3 +125,18 @@
113
125
  </div>
114
126
  <% end %>
115
127
  </div>
128
+ <script>
129
+ jQuery(function(){
130
+ $('#tab-select-payment-method > ul a').click(function (e) {
131
+ e.preventDefault();
132
+ disabled_inputs(this)
133
+ });
134
+
135
+ function disabled_inputs(dom_a){
136
+ var attr_id = $(dom_a).attr('href')
137
+ $('#tab-select-payment-method .tab-content .tab-pane').find('input, select, textarea').attr('disabled', 'disabled');
138
+ $(attr_id).find('input, select, textarea').removeAttr('disabled');
139
+ }
140
+ disabled_inputs($('#tab-select-payment-method > ul li.active a')[0]);
141
+ });
142
+ </script>