camaleon_ecommerce 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/javascripts/plugins/ecommerce/admin.js +33 -0
  6. data/app/assets/javascripts/plugins/ecommerce/cart.js +207 -0
  7. data/app/assets/javascripts/plugins/ecommerce/fix_form.js +10 -0
  8. data/app/assets/javascripts/plugins/ecommerce/jquery.creditCardValidator.js +208 -0
  9. data/app/assets/stylesheets/plugins/ecommerce/admin.scss +122 -0
  10. data/app/assets/stylesheets/plugins/ecommerce/front.scss +36 -0
  11. data/app/controllers/plugins/ecommerce/admin/coupons_controller.rb +61 -0
  12. data/app/controllers/plugins/ecommerce/admin/orders_controller.rb +96 -0
  13. data/app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb +90 -0
  14. data/app/controllers/plugins/ecommerce/admin/prices_controller.rb +70 -0
  15. data/app/controllers/plugins/ecommerce/admin/settings_controller.rb +22 -0
  16. data/app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb +62 -0
  17. data/app/controllers/plugins/ecommerce/admin/tax_rates_controller.rb +61 -0
  18. data/app/controllers/plugins/ecommerce/admin_controller.rb +20 -0
  19. data/app/controllers/plugins/ecommerce/front/checkout_controller.rb +166 -0
  20. data/app/controllers/plugins/ecommerce/front/orders_controller.rb +255 -0
  21. data/app/controllers/plugins/ecommerce/front_controller.rb +18 -0
  22. data/app/helpers/plugins/ecommerce/ecommerce_email_helper.rb +46 -0
  23. data/app/helpers/plugins/ecommerce/ecommerce_functions_helper.rb +49 -0
  24. data/app/helpers/plugins/ecommerce/ecommerce_helper.rb +240 -0
  25. data/app/helpers/plugins/ecommerce/ecommerce_payment_helper.rb +67 -0
  26. data/app/models/plugins/ecommerce/cart.rb +40 -0
  27. data/app/models/plugins/ecommerce/coupon.rb +25 -0
  28. data/app/models/plugins/ecommerce/coupon_decorator.rb +60 -0
  29. data/app/models/plugins/ecommerce/order.rb +65 -0
  30. data/app/models/plugins/ecommerce/order_decorator.rb +54 -0
  31. data/app/models/plugins/ecommerce/order_detail.rb +13 -0
  32. data/app/models/plugins/ecommerce/payment_method.rb +29 -0
  33. data/app/models/plugins/ecommerce/product.rb +14 -0
  34. data/app/models/plugins/ecommerce/shipping_method.rb +26 -0
  35. data/app/models/plugins/ecommerce/tax_rate.rb +18 -0
  36. data/app/views/camaleon_cms/html_mailer/order_received.html.erb +3 -0
  37. data/app/views/camaleon_cms/html_mailer/order_received_admin.html.erb +3 -0
  38. data/app/views/camaleon_cms/html_mailer/recovery_cart.html.erb +4 -0
  39. data/app/views/layouts/plugins/ecommerce/mailer.html.erb +22 -0
  40. data/app/views/plugins/ecommerce/admin/coupons/form.html.erb +73 -0
  41. data/app/views/plugins/ecommerce/admin/coupons/index.html.erb +50 -0
  42. data/app/views/plugins/ecommerce/admin/index.html.erb +2 -0
  43. data/app/views/plugins/ecommerce/admin/orders/form.html.erb +64 -0
  44. data/app/views/plugins/ecommerce/admin/orders/index.html.erb +90 -0
  45. data/app/views/plugins/ecommerce/admin/orders/show.html.erb +173 -0
  46. data/app/views/plugins/ecommerce/admin/payment_methods/form.html.erb +115 -0
  47. data/app/views/plugins/ecommerce/admin/payment_methods/index.html.erb +43 -0
  48. data/app/views/plugins/ecommerce/admin/payment_methods/show.html.erb +70 -0
  49. data/app/views/plugins/ecommerce/admin/prices/form.html.erb +49 -0
  50. data/app/views/plugins/ecommerce/admin/prices/index.html.erb +39 -0
  51. data/app/views/plugins/ecommerce/admin/prices/show.html.erb +19 -0
  52. data/app/views/plugins/ecommerce/admin/products/index.html.erb +114 -0
  53. data/app/views/plugins/ecommerce/admin/settings/index.html.erb +25 -0
  54. data/app/views/plugins/ecommerce/admin/shipping_methods/form.html.erb +39 -0
  55. data/app/views/plugins/ecommerce/admin/shipping_methods/index.html.erb +41 -0
  56. data/app/views/plugins/ecommerce/admin/shipping_methods/show.html.erb +22 -0
  57. data/app/views/plugins/ecommerce/admin/tax_rates/form.html.erb +36 -0
  58. data/app/views/plugins/ecommerce/admin/tax_rates/index.html.erb +41 -0
  59. data/app/views/plugins/ecommerce/front/_post_list_item.html.erb +18 -0
  60. data/app/views/plugins/ecommerce/front/checkout/cart_index.html.erb +59 -0
  61. data/app/views/plugins/ecommerce/front/checkout/index.html.erb +166 -0
  62. data/app/views/plugins/ecommerce/front/index.html.erb +2 -0
  63. data/app/views/plugins/ecommerce/front/list_products.html.erb +34 -0
  64. data/app/views/plugins/ecommerce/front/orders/index.html.erb +46 -0
  65. data/app/views/plugins/ecommerce/front/orders/pay_by_bank_transfer.html.erb +67 -0
  66. data/app/views/plugins/ecommerce/front/orders/pay_by_credit_card.html.erb +131 -0
  67. data/app/views/plugins/ecommerce/front/orders/pay_by_credit_card_authorize_net.erb +150 -0
  68. data/app/views/plugins/ecommerce/front/orders/select_payment.html.erb +70 -0
  69. data/app/views/plugins/ecommerce/front/orders/show.html.erb +76 -0
  70. data/app/views/plugins/ecommerce/front/product.html.erb +105 -0
  71. data/app/views/plugins/ecommerce/layouts/_ecommerce.html.erb +41 -0
  72. data/app/views/plugins/ecommerce/partials/_form_address.html.erb +84 -0
  73. data/app/views/plugins/ecommerce/partials/_table_order_products.html.erb +85 -0
  74. data/config/camaleon_plugin.json +48 -0
  75. data/config/currency.json +154 -0
  76. data/config/currency_en.json +154 -0
  77. data/config/currency_es.json +154 -0
  78. data/config/custom_models.rb +64 -0
  79. data/config/locales/readme.txt +1 -0
  80. data/config/locales/translation.yml +371 -0
  81. data/config/routes.rb +57 -0
  82. data/lib/camaleon_ecommerce.rb +4 -0
  83. data/lib/ecommerce.rb +4 -0
  84. data/lib/ecommerce/engine.rb +6 -0
  85. data/lib/ecommerce/version.rb +3 -0
  86. data/lib/tasks/ecommerce_tasks.rake +4 -0
  87. metadata +185 -0
@@ -0,0 +1,2 @@
1
+ <!--<script src="<%#= plugin_asset_path("<my_plugin>", "js/front.js") %>"></script>-->
2
+ Plugin ready to use in admin panel!.
@@ -0,0 +1,64 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ <h4><span class="fa fa-cog"></span> <%= t('plugin.ecommerce.edit_order') %>: <%= @order.slug %></h4>
4
+ </div>
5
+ <%= form_for @order, url: {action: @order.new_record? ? :create : :update}, html: {class: 'form-order', id: 'form-order'} do |f| %>
6
+ <div class="panel-body">
7
+ <div class="row">
8
+ <div class="col-md-12">
9
+ <div id="user_details" class="row">
10
+ <h3 class="col-md-12"><%= t('plugin.ecommerce.details_user') %></h3>
11
+
12
+ <div class="form-group col-md-4">
13
+ <label for=""><%= t('plugin.ecommerce.table.customer') %></label>
14
+ <input class="form-control" type="text" name="order[details][customer]" value="<%= @order.details.customer rescue '' %>">
15
+ </div>
16
+ <div class="form-group col-md-4">
17
+ <label for=""><%= t('plugin.ecommerce.table.email') %></label>
18
+ <input class="form-control" type="text" name="order[details][email]" value="<%= @order.details.email rescue '' %>">
19
+ </div>
20
+ <div class="form-group col-md-4">
21
+ <label for=""><%= t('plugin.ecommerce.table.phone') %></label>
22
+ <input class="form-control" type="text" name="order[details][phone]" value="<%= @order.details.phone rescue '' %>">
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <div class="col-md-12">
27
+ <%= render partial: 'plugins/ecommerce/partials/form_address', locals: {billing_address: @order.get_meta("billing_address"), shipping_address: @order.get_meta("shipping_address")} %>
28
+ </div>
29
+ </div>
30
+ <hr/>
31
+ <div class="row">
32
+ <div class="col-md-12">
33
+ <h3 class=""> <%= t('plugin.ecommerce.products') %></h3>
34
+ <table class="table">
35
+ <thead>
36
+ <tr>
37
+ <td><%= t('plugin.ecommerce.products').singularize %></td>
38
+ <td><%= t('plugin.ecommerce.product.qty') %></td>
39
+ <td><%= t('plugin.ecommerce.product.price') %></td>
40
+ <td><%= t('plugin.ecommerce.product.tax') %></td>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <% @order.get_meta("products", {}).each do |key, product| %>
45
+ <tr>
46
+ <td><%= product[:product_title] %></td>
47
+ <td><%= product[:qty] %></td>
48
+ <td><%= e_symbol_by_code(product[:currency_code]) %> <%= product[:price] %></td>
49
+ <td><%= e_symbol_by_code(product[:currency_code]) %> <%= product[:tax] %></td>
50
+ </tr>
51
+ <% end %>
52
+ </tbody>
53
+ </table>
54
+ <%#= debug @order.get_meta("products") %>
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <div class="panel-footer">
60
+ <button class="btn btn-default" onclick="history.back()"><%= t('camaleon_cms.admin.button.back') %></button>
61
+ <button class="btn btn-primary pull-right"><%= t('camaleon_cms.admin.button.update') %></button>
62
+ </div>
63
+ <% end %>
64
+ </div>
@@ -0,0 +1,90 @@
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">
8
+
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] %>"/>
11
+
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>
34
+
35
+ <button type="submit" class="btn btn-primary"><span class="fa fa-search" aria-hidden="true"></span></button>
36
+ </form>
37
+ </div>
38
+ </div>
39
+ <button type="button" class="btn btn-primary"><span class="fa fa-search" aria-hidden="true"></span></button>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+
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
+ %>
64
+ <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>
81
+ </tr>
82
+ <% end %>
83
+
84
+
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>
@@ -0,0 +1,173 @@
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
+
36
+ </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>
101
+ </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
+
109
+ </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
+ </div>
@@ -0,0 +1,115 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading ui-draggable-handle">
3
+ <h4><span class="fa fa-credit-card"></span> <%= @payment_method.new_record? ? "#{t('plugin.ecommerce.new_payment_methods')}" : "#{t('plugin.ecommerce.edit_payment_methods')}: #{@payment_method.name}" %></h4>
4
+ </div>
5
+ <%= form_for @payment_method, url:{action: @payment_method.new_record? ? :create : :update}, html: {class: 'validate-payment_method', id: 'form-payment_method'} do |f| %>
6
+ <div class="panel-body">
7
+ <%= render partial: 'layouts/camaleon_cms/admin/form_error', locals: {data: @payment_method} %>
8
+ <div class="form-group">
9
+ <%= f.label t('plugin.ecommerce.table.name') %><br>
10
+ <%= f.text_field :name, :class => "form-control required" %>
11
+ </div>
12
+ <div class="form-group">
13
+ <%= f.label t('camaleon_cms.admin.table.slug') %><br>
14
+ <%= f.text_field :slug, :class => "form-control slug", "data-parent" => 'plugins_ecommerce_payment_method_name' %>
15
+ </div>
16
+ <div class="form-group">
17
+ <%= f.label t('plugin.ecommerce.table.description') %><br>
18
+ <%= f.text_area :description, :class => "form-control", :rows => 4 %>
19
+ </div>
20
+ <div class="form-group">
21
+ <label><%= f.check_box :status %> &nbsp; <%= t('plugin.ecommerce.active') %> </label>
22
+ </div>
23
+
24
+ <% options = @payment_method.options rescue {type: 'bank_transfer'}
25
+ options = params[:options] if params[:options].present?
26
+ %>
27
+ <h4><%= t('plugin.ecommerce.options_payment_methods') %></h4>
28
+ <hr/>
29
+ <div id="tab-select-payment-method" class="panel panel-default tabs">
30
+ <ul class="nav nav-tabs nav-justified">
31
+ <li class="<%= 'active' if options[:type] == 'bank_transfer' %>"><a href="#tab8" data-toggle="tab"><%= t('plugin.ecommerce.by_bank_transfer') %></a></li>
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>
34
+ <li class="<%= 'active' if options[:type] == 'authorize_net' %>"><a href="#tab10" data-toggle="tab"><%= t('plugin.ecommerce.by_authorize_net') %></a></li>
35
+ </ul>
36
+ <div class="panel-body tab-content">
37
+
38
+ <div class="tab-pane <%= 'active' if options[:type] == 'bank_transfer' %>" id="tab8">
39
+ <%= hidden_field_tag( "options[type]", 'bank_transfer') %>
40
+ <div class="form-group">
41
+ <label><%= t('plugin.ecommerce.table.number_account_bank') %></label><br>
42
+ <%= text_field_tag( "options[bank_transfer_number_account]", options[:bank_transfer_number_account], class: "form-control required") %>
43
+ </div>
44
+ <div class="form-group">
45
+ <label><%= t('plugin.ecommerce.table.details') %></label><br>
46
+ <%= text_area_tag( "options[bank_transfer_detail]", options[:bank_transfer_detail], class: "form-control required") %>
47
+ </div>
48
+ </div>
49
+
50
+ <div class="tab-pane <%= 'active' if options[:type] == 'paypal' %>" id="tab9">
51
+ <%= hidden_field_tag( "options[type]", 'paypal') %>
52
+ <div class="form-group">
53
+ <label><%= t('plugin.ecommerce.table.username_login') %></label><br>
54
+ <%= text_field_tag( "options[paypal_login]", options[:paypal_login], class: "form-control required") %>
55
+ </div>
56
+ <div class="form-group">
57
+ <label><%= t('plugin.ecommerce.table.password') %></label><br>
58
+ <%= text_field_tag( "options[paypal_password]", options[:paypal_password], class: "form-control required") %>
59
+ </div>
60
+ <div class="form-group">
61
+ <label><%= t('plugin.ecommerce.table.signature') %></label><br>
62
+ <%= text_field_tag( "options[paypal_signature]", options[:paypal_signature], class: "form-control required") %>
63
+ </div>
64
+ <div class="form-group">
65
+ <div class="checkbox"><label><input type="checkbox" name="options[paypal_sandbox]" value="1" <%= 'checked' if options[:paypal_sandbox] %>> <%= t('plugin.ecommerce.table.sandbox') %> </label></div>
66
+ </div>
67
+ </div>
68
+
69
+ <div class="tab-pane <%= 'active' if options[:type] == 'credit_card' %>" id="tab7">
70
+ <%= hidden_field_tag( "options[type]", 'credit_card') %>
71
+ <div class="form-group">
72
+ <label><%= t('plugin.ecommerce.table.username_login') %></label><br>
73
+ <%= text_field_tag( "options[cc_paypal_login]", options[:cc_paypal_login], class: "form-control required") %>
74
+ </div>
75
+ <div class="form-group">
76
+ <label><%= t('plugin.ecommerce.table.password') %></label><br>
77
+ <%= text_field_tag( "options[cc_paypal_password]", options[:cc_paypal_password], class: "form-control required") %>
78
+ </div>
79
+ <div class="form-group">
80
+ <label><%= t('plugin.ecommerce.table.signature') %></label><br>
81
+ <%= text_field_tag( "options[cc_paypal_signature]", options[:cc_paypal_signature], class: "form-control required") %>
82
+ </div>
83
+ <div class="form-group">
84
+ <div class="checkbox"><label><input type="checkbox" name="options[cc_paypal_sandbox]" value="1" <%= 'checked' if options[:cc_paypal_sandbox] %>> <%= t('plugin.ecommerce.table.sandbox') %> </label></div>
85
+ </div>
86
+ </div>
87
+
88
+ <div class="tab-pane <%= 'active' if options[:type] == 'authorize_net' %>" id="tab10">
89
+ <%= hidden_field_tag('options[type]', 'authorize_net') %>
90
+ <div class="form-group">
91
+ <label><%= t('plugin.ecommerce.table.login_id') %></label><br>
92
+ <%= text_field_tag('options[authorize_net_login_id]', options[:authorize_net_login_id], class: 'form-control required') %>
93
+ </div>
94
+ <div class="form-group">
95
+ <label><%= t('plugin.ecommerce.table.transaction_key') %></label><br>
96
+ <%= text_field_tag('options[authorize_net_transaction_key]', options[:authorize_net_transaction_key], class: 'form-control required') %>
97
+ </div>
98
+ <div class="form-group">
99
+ <div class="checkbox">
100
+ <label>
101
+ <input type="checkbox" name="options[authorize_net_sandbox]" value="1" <%= 'checked' if options[:authorize_net_sandbox] %>> <%= t('plugin.ecommerce.table.sandbox') %>
102
+ </label>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ </div>
107
+ </div>
108
+
109
+ </div>
110
+ <div class="panel-footer">
111
+ <a class="btn btn-default" href="<%= url_for action: :index %>" role="back"><%= t('camaleon_cms.admin.button.back')%></a>
112
+ <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit')%></button>
113
+ </div>
114
+ <% end %>
115
+ </div>