app/views/plugins/ecommerce/partials/checkout/_payments.html.erb in camaleon_ecommerce-1.2 vs app/views/plugins/ecommerce/partials/checkout/_payments.html.erb in camaleon_ecommerce-1.2.1

- old
+ new

@@ -2,124 +2,125 @@ <div class="free_order text-center col-md-12"> <%= link_to(t('.complete_order', default: 'Complete Order'), plugins_ecommerce_checkout_complete_free_order_url, class: 'btn btn-primary col-md-4 col-md-offset-4') %> </div> <% else %> <div id="e-payments-types" role="tabpanel"> - <ul class="nav nav-tabs nav-justified" role="tablist"> + <div class="panel-group" id="e_accordion_payments" role="tablist" aria-multiselectable="true"> <% (payment_methods = current_site.payment_methods.actives.all).each_with_index do |payment, index| %> - <li role="presentation" class="<%= "active" if index == 0 %>"> - <a href="#<%= payment.slug %>" aria-controls="<%= payment.slug %>" role="tab" data-toggle="tab"><%= t(".#{payment.options[:type]}", default: payment.options[:type].titleize) %></a> - </li> - <% end %> - </ul> - - <!-- Tab panes --> - <div class="tab-content"> - <% payment_methods.each_with_index do |payment, index| %> <% inputs = content_tag :div do %> <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>"> <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>"> <div class="form-group text-center"> <button class="btn btn-primary col-md-4" type="submit"><i class="fa fa-money"></i> <%= t('.order_now', default: 'Buy') %></button> </div> <% end %> + <div class="panel panel-default"> + <div class="panel-heading" role="tab" id="heading<%= payment.slug %>"> + <a role="button" data-toggle="collapse" data-parent="#e_accordion_payments" href="#<%= payment.slug %>" aria-expanded="true" aria-controls="collapseOne"><%= t(".#{payment.options[:type]}", default: payment.options[:type].titleize) %></a> + </div> + <div id="<%= payment.slug %>" class="panel-collapse collapse <%= "in" if index == 0 %>" role="tabpanel" aria-labelledby="heading<%= payment.slug %>"> + <div class="panel-body"> + <p><%= payment.description.translate %></p> + <% if payment.options[:type] == 'paypal' %> + <div class="type-paypal"> + <img src="https://www.paypalobjects.com/webstatic/mktg/logo/bdg_payments_by_pp_2line.png" alt="Buy now with PayPal"/> + <%= form_tag(plugins_ecommerce_checkout_pay_by_paypal_path(order: @cart.slug), :method => "post") do %> + <%= inputs %> + <% end %> + </div> + <% end %> - <div role="tabpanel" class="tab-pane <%= "active" if index == 0 %>" id="<%= payment.slug %>"> - <p><%= payment.description.translate %></p> - <% if payment.options[:type] == 'paypal' %> - <div class="type-paypal"> - <img src="https://www.paypalobjects.com/webstatic/mktg/logo/bdg_payments_by_pp_2line.png" alt="Buy now with PayPal"/> - <%= form_tag(plugins_ecommerce_checkout_pay_by_paypal_path(order: @cart.slug), :method => "post") do %> - <%= inputs %> + <% if payment.options[:type] == 'bank_transfer' %> + <%= form_tag(plugins_ecommerce_checkout_pay_by_bank_transfer_path(order: @cart.slug), :method => "post") do %> + <ul class="ec-list-orders-address"> + <li><strong><%= t('.account_number', default: 'Account Number') %>: </strong><span> <%= payment.options[:bank_transfer_number_account] %></span></li> + <li><strong><%= t('.details_transfer', default: 'Details') %>: </strong><span> <%= payment.options[:bank_transfer_detail] %></span></li> + </ul> + <div class="form-group"> + <label><%= t('.bank_name', default: 'Bank name') %></label> + <input class="form-control required" type="text" name="details[bank_name]"> + </div> + <div class="form-group"> + <label><%= t('.bank_owner', default: 'Owner name of bank account') %></label> + <input class="form-control required" type="text" name="details[owner_name]"> + </div> + <div class="form-group"> + <label><%= t('.cod_key', default: 'CODE / ID / KEY / TICKET') %></label> + <input class="form-control required" type="text" name="details[code]"> + </div> + <div class="form-group"> + <label><%= t('.descr', default: 'Description') %></label> + <textarea name="details[description]" rows="4" class="form-control required" ></textarea> + </div> + <%= inputs %> + <% end %> <% end %> - </div> - <% end %> + <% if payment.options[:type] == 'on_delivery' %> + <%= form_tag(plugins_ecommerce_checkout_pay_by_on_delivery_path(order: @cart.slug), :method => "post") do %> + <%= inputs %> + <% end %> + <% end %> - <% if payment.options[:type] == 'bank_transfer' %> - <%= form_tag(plugins_ecommerce_checkout_pay_by_bank_transfer_path(order: @cart.slug), :method => "post") do %> - <ul class="ec-list-orders-address"> - <li><strong><%= t('.account_number', default: 'Account Number') %>: </strong><span> <%= payment.options[:bank_transfer_number_account] %></span></li> - <li><strong><%= t('.details_transfer', default: 'Details') %>: </strong><span> <%= payment.options[:bank_transfer_detail] %></span></li> - </ul> - <div class="form-group"> - <label><%= t('.bank_name', default: 'Bank name') %></label> - <input class="form-control required" type="text" name="details[bank_name]"> - </div> - <div class="form-group"> - <label><%= t('.bank_owner', default: 'Owner name of bank account') %></label> - <input class="form-control required" type="text" name="details[owner_name]"> - </div> - <div class="form-group"> - <label><%= t('.cod_key', default: 'CODE / ID / KEY / TICKET') %></label> - <input class="form-control required" type="text" name="details[code]"> - </div> - <div class="form-group"> - <label><%= t('.descr', default: 'Description') %></label> - <textarea name="details[description]" rows="4" class="form-control required" ></textarea> - </div> - <%= inputs %> - <% end %> - <% end %> + <% if payment.options[:type] == 'credit_card' %> + <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Credit Card"/> + <% end %> - <% if payment.options[:type] == 'credit_card' %> - <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Credit Card"/> - <% end %> - - <% if payment.options[:type] == 'authorize_net' %> - <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/> - <%= form_tag(plugins_ecommerce_checkout_pay_by_authorize_net_path(order: @cart.slug), :method => "post") do %> - <div class="form-group"> - <label for="firstName"><%= t('.first_name', default: 'First Name') %></label> - <input type="text" class="form-control required" name="firstName" value="<%= @cart.user.first_name %>" required autocomplete="off"/> - </div> - <div class="form-group"> - <label for="lastName"><%= t('.last_name', default: 'Last Name') %></label> - <input type="text" class="form-control required" name="lastName" value="<%= @cart.user.last_name %>" autocomplete="off"/> - </div> - <div class="form-group"> - <label><%= t('.card_number', default: 'Card Number') %></label> - <div class="input-group"> - <input type="text" class="form-control required" name="cardNumber" autocomplete="off"/> - <span class="input-group-addon"><i class="fa fa-credit-card"></i></span> - </div> - </div> - <div class="form-group"> - <label for="expMonth"><%= t('.exp_date', default: 'EXPIRATION DATE') %></label> - <div class="row"> - <div class="col-xs-6 col-lg-6"> - <input type="text" class="form-control required" name="expMonth" placeholder="MM" autocomplete="off"/> + <% if payment.options[:type] == 'authorize_net' %> + <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/> + <%= form_tag(plugins_ecommerce_checkout_pay_by_authorize_net_path(order: @cart.slug), :method => "post") do %> + <div class="form-group"> + <label for="firstName"><%= t('.first_name', default: 'First Name') %></label> + <input type="text" class="form-control required" name="firstName" value="<%= @cart.user.first_name %>" required autocomplete="off"/> </div> - <div class="col-xs-6 col-lg-6"> - <input type="text" class="form-control required" name="expYear" placeholder="YY" autocomplete="off"/> + <div class="form-group"> + <label for="lastName"><%= t('.last_name', default: 'Last Name') %></label> + <input type="text" class="form-control required" name="lastName" value="<%= @cart.user.last_name %>" autocomplete="off"/> </div> - </div> - </div> - <div class="form-group"> - <label for="cvCode"><%= t('.cvv', default: 'Cvv CODE') %></label> - <input type="text" class="form-control required" name="cvCode" placeholder="cvv" autocomplete="off"/> - </div> - <%= inputs %> - <% end %> - <% end %> + <div class="form-group"> + <label><%= t('.card_number', default: 'Card Number') %></label> + <div class="input-group"> + <input type="text" class="form-control required" name="cardNumber" autocomplete="off"/> + <span class="input-group-addon"><i class="fa fa-credit-card"></i></span> + </div> + </div> + <div class="form-group"> + <label for="expMonth"><%= t('.exp_date', default: 'EXPIRATION DATE') %></label> + <div class="row"> + <div class="col-xs-6 col-lg-6"> + <input type="text" class="form-control required" name="expMonth" placeholder="MM" autocomplete="off"/> + </div> + <div class="col-xs-6 col-lg-6"> + <input type="text" class="form-control required" name="expYear" placeholder="YY" autocomplete="off"/> + </div> + </div> + </div> + <div class="form-group"> + <label for="cvCode"><%= t('.cvv', default: 'Cvv CODE') %></label> + <input type="text" class="form-control required" name="cvCode" placeholder="cvv" autocomplete="off"/> + </div> + <%= inputs %> + <% end %> + <% end %> - <% if payment.options[:type] == 'stripe' %> - <%= form_tag(plugins_ecommerce_checkout_pay_by_stripe_path(order: @cart.slug), :method => "post") do %> - <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>"> - <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>"> - <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/><br> - <hr> - <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" - data-key="<%= payment.options[:stripe_key] %>" - data-description="Payment Products: <%= @cart.products_title %>" - data-amount="<%= commerce_to_cents(@cart.total_amount) %>" - data-locale="<%= I18n.locale %>"></script> - <% end %> - <% end %> + <% if payment.options[:type] == 'stripe' %> + <%= form_tag(plugins_ecommerce_checkout_pay_by_stripe_path(order: @cart.slug), :method => "post") do %> + <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>"> + <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>"> + <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/><br> + <hr> + <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" + data-key="<%= payment.options[:stripe_key] %>" + data-description="Payment Products: <%= @cart.products_title %>" + data-amount="<%= Plugins::Ecommerce::UtilService.ecommerce_money_to_cents(@cart.total_amount) %>" + data-locale="<%= I18n.locale %>"></script> + <% end %> + <% end %> - <% if(custom_method = ecommerce_custom_payment_methods[payment.options[:type].to_sym]).present? %> - <%= render custom_method[:payment_form_view_path], payment: payment, options: payment.options, cart: @cart %> - <% end %> - + <% if(custom_method = ecommerce_custom_payment_methods[payment.options[:type].to_sym]).present? %> + <%= render custom_method[:payment_form_view_path], payment: payment, options: payment.options, cart: @cart %> + <% end %> + </div> + </div> </div> <% end %> <%= content_tag(:div, 'No Payment Methods Defined', class: 'alert alert-danger') unless payment_methods.any? %> </div> </div>