payment_settup/app/views/payment/_pay_html.html.erb

91 lines
2.8 KiB
Plaintext

<style type="text/css">
div[class^="pay-"]{
display: none;
}
div[class^="pay-"].active{
display: block;
margin-top: 0.5em;
}
.pay_opt{
font-size: 1.3em;
}
.pay_opt select{
font-size: 1em;
height: auto;
width: auto;
}
.pay_opt label{
display: inline-block;
font-weight: bold;
font-size: 1em;
}
.pay_opt input[type="submit"] {
border-radius: 1.1em 1.1em;
background: #d9e4f7;
font-weight: bold;
outline: 0;
}
.pay_opt input[type="submit"]:hover{
background: #be8a8a;
}
</style>
<div class="pay_opt">
<% lists = PaymentSetupList.all.asc(:created_at).map{|v| v} %>
<noscript>
<p><%= t('payment_settup.need_script') %></p>
</noscript>
<label style="margin-right: 2.5em;"><%= t('payment_settup.pay_options') %>&nbsp;:</label>
<%= select_tag "pay_options", options_for_select(lists.map{|v| t("payment_settup.#{v.payment_type}")}), :class => "pay_options" %>
<br>
<% lists.each_with_index do |list,index1| %>
<div class="pay-<%= index1.to_s + (index1 == 0 ? ' active' : '' )%>">
<form target = "_blank" action="<%= url_helpers.payment_pay_path(I18n.locale,list.id,payment_pay) %>" method="post">
<table>
<tbody>
<tr>
<td><label><%= t('payment_settup.amount') %>&nbsp;:</label></td>
<td style="text-align: center;"><label><%= payment_pay.amount %></label></td>
</tr>
<% list.get_pay_array.each do |child| %>
<tr>
<% if (!child[2].blank? && child[1]=='select') || child[1]!='select'%>
<td>
<label><%= t("#{list.payment_type}.#{child[0]}") %>&nbsp;:</label>
</td>
<% end %>
<% if child[1]=='select' %>
<% if !child[2].blank? %>
<td>
<% class_par = " #{child[4]}" if !child[4].nil? %>
<%= select_tag("#{child[0]}",options_for_select(child[2],:selected => [child[3]]),:class => "payment_setup#{class_par}") %>
</td>
<% end %>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<input type="hidden" name="recieve_url" value="">
<input type="submit" value="<%= t('payment_settup.pay') %>">
</form>
</div>
<% end %>
<script type="text/javascript">
$('.pay').ready(function(){
root_url = window.location.href.split('/').slice(0,3).join('/')
$('input[name=recieve_url]').val(root_url)
$('.pay_options').change(function(){
var index1 = this.selectedIndex
$('div[class^="pay-"]').removeClass('active')
$('.pay-'+index1).addClass('active')
})
$('.pay_mask').change(function(){
if ($(this)[0].selectedIndex==0){
$(this).parents('table').find('.numofpay').parents('tr').show();
}else{
$(this).parents('table').find('.numofpay').parents('tr').hide();
}
})
})
</script>
</div>