payment_settup/app/views/admin/sites/payment.html.erb

108 lines
3.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "payment/payment" %>
<% end %>
<script type="text/javascript">
$('.payment-page').ready(function (){
$('.wrap-inner a').click(function(){
var ele = $(this)
$('.wrap-inner a').each(function(i,v){
if (ele.index('.wrap-inner a')!=i){
$(v).removeClass('active_in')
}
})
ele.addClass('active_in')
})
$('.payment-selector').change(function(){
console.log($(this).val())
var value = $(this).val()
$.ajax({
type : "post",
url : "/admin/sites/<%= @current_site.to_param %>/payment_detail",
dataType : "text",
data:{select_option: value},
async: false,
global:false,
success: function(data)
{
$('#payment-detail').html(data)
},
error : function(data){
alert('init upload process failed, please try again later.')
}
});
})
}
)
</script>
<style type="text/css">
.fade-in{
display: none;
}
.fade-in.active{
display: block;
}
a:focus{
outline: 0;
}
a.active_in{
color: #9431f8;
}
input[type="button"],button,input[type="submit"] {
outline: 0;
border-radius: 1.3em;
background: #d9e4f7;
font-weight: bold;
outline: 0;
}
input[type="button"]:hover,button:hover,input[type="submit"]:hover {
background: #be8a8a;
}
select{
background: linear-gradient(0deg, #515fff, #ff3e3e);
color: white;
box-shadow: none;
border-radius: 1.3em;
}
select:focus{
outline: 0;
}
option, option:checked, option:hover {
color: #515fff;
font-weight: bold;
}
</style>
<form target="_blank" action="<%= form_admin_site_payment_path(@current_site)%>" class='payment-page' method="get">
<%= csrf_meta_tags %>
<%= t('payment') %>
<br>
<div style="padding-bottom: 2em;border-bottom: 0.1em solid #002bff;">
<% prompt = '------Select a payment-----' %>
bank: <%= select_tag "payment_type", options_for_select(@payment_options.unshift(prompt),selected: prompt,disabled: prompt), :class => "payment-selector" %>
<div id="payment-detail">
<%#  用js新增 %>
</div>
<input type="submit" value="<%= t('payment_settup.add') %>">
<button type="button" onclick="window.location='<%= pay_admin_site_payment_path(@current_site) %>'"><%= t('payment_settup.test_all') %></button>
</div>
</form>
<% index1 = 0 %>
<% PaymentSetupList.all.asc(:created_at).each do |payment_setup_list| %>
<% if !payment_setup_list.payment_type.nil? %>
<% index1+=1 %>
<%= '|' if index1 != 1 %>
<% name1 = payment_setup_list.name.to_s %>
<a href="#<%= payment_setup_list.id.to_s %>" data-toggle="tab" class="<%= 'active_in' if index1== 1 %>"><%= t("payment_settup.#{payment_setup_list.payment_type}")+ (name1.blank? ? '' : "-#{name1}" ) %></a>
<% end %>
<% end %>
<% PaymentSetupList.all.asc(:created_at).each_with_index do |payment_setup_list,index1| %>
<% if !payment_setup_list.payment_type.nil? %>
<form action="<%= form_admin_site_payment_path(@current_site)%>" method="get" id='<%= payment_setup_list.id.to_s %>' class="fade-in <%= 'active' if index1==0 %>">
<%= render partial: 'payment_detail', locals: {select_option: payment_setup_list.payment_type,option_id: payment_setup_list.id,key_index: index1+1} %>
<input type="submit" value="<%= t('payment_settup.modify') %>">
<button type="button" onclick="window.location='<%= admin_site_payment_delete_path(@current_site,payment_setup_list.id) %>'"><%= t('payment_settup.delete') %></button>
<button type="button" onclick="window.location='<%= admin_site_payment_test_path(@current_site,payment_setup_list.id) %>'"><%= t('payment_settup.test') %></button>
</form>
<% end %>
<% end %>