102 lines
3.5 KiB
Plaintext
102 lines
3.5 KiB
Plaintext
<% content_for :page_specific_css do %>
|
|
<%= stylesheet_link_tag "payment/payment" %>
|
|
<% end %>
|
|
<% if !@helper1.nil? %>
|
|
<% user = User.find(session[:user_id]) if session[:user_id] rescue nil
|
|
member = user.member_profile.id if !user.nil?
|
|
%>
|
|
<% get_data = @helper1.get_test_form(@payment_setup) %>
|
|
<form target="_blank" action="<%= get_data['form_url'] %>" method="POST">
|
|
<% get_data['readonly_data'].each do |k,v| %>
|
|
<input type='hidden' name='<%= k %>' value='<%= v %>'>
|
|
<% end %>
|
|
<table>
|
|
<tbody>
|
|
<% get_data['data'].each do |child| %>
|
|
<tr>
|
|
<% if child[1]!= 'recieve_url' %>
|
|
<% if (!child[2].blank? && child[1]=='select') || child[1]!='select'%>
|
|
<td>
|
|
<label><%= t("#{@select_option}.#{child[0]}") %>:</label>
|
|
</td>
|
|
<% end %>
|
|
<% end %>
|
|
<% if child[1]=='text' %>
|
|
<td>
|
|
<input class="payment_setup<%= " #{child[3]}" if !child[3].nil? %>" type="text" name="<%= child[0] %>" value="<%= child[2] %>">
|
|
</td>
|
|
<% elsif 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 %>
|
|
<% elsif child[1]=='number' %>
|
|
<td>
|
|
<input class="payment_setup<%= " #{child[3]}" if !child[3].nil? %>" type="number" name="<%= child[0] %>" value="<%= child[2] %>">
|
|
</td>
|
|
<% elsif child[1]=='recieve_url' %>
|
|
<input type="hidden" id="recieve_url" name="<%= child[0] %>" value="<%= payment_recieve_result_path(@payment_setup.id,member) %>">
|
|
<% elsif child[1]=='check' %>
|
|
<td>
|
|
<input class="payment_setup" type="text" readonly id="check" name="<%= child[0] %>" value="<%= child[2] %>">
|
|
<button type="button" id="get_check"><%= t('payment_settup.get_check') %></button>
|
|
</td>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
<tr><td></td>
|
|
<td style="padding-top: 1em;">
|
|
<input type="submit" value="<%= t('payment_settup.submit') %>">
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
<script type="text/javascript">
|
|
$('form').ready(function(){
|
|
href = $('input#recieve_url').val()
|
|
root_url = window.location.href.split('/').slice(0,3).join('/')
|
|
$('input#recieve_url').val(root_url+href)
|
|
$.fn.get_dic = function(){
|
|
dic = {}
|
|
console.log(this)
|
|
this.each(function(){
|
|
console.log(this)
|
|
dic[$(this).attr('name')] = $(this).val()
|
|
})
|
|
return dic
|
|
}
|
|
$('form').submit(function() {
|
|
$("tr:hidden").remove()
|
|
})
|
|
$('.pay_mask').change(function(){
|
|
if ($(this)[0].selectedIndex==0){
|
|
$('.numofpay').parents('tr').show();
|
|
}else{
|
|
$('.numofpay').parents('tr').hide();
|
|
}
|
|
})
|
|
$('#get_check').click(function(){
|
|
$.ajax({
|
|
type : "post",
|
|
url : "<%= admin_site_payment_get_checkValue_path(@current_site.to_param,@payment_setup.id) %>",
|
|
data:{data: $('.param').get_dic()},
|
|
dataType : "text",
|
|
async: false,
|
|
global:false,
|
|
success: function(data)
|
|
{
|
|
$('#check').val(data)
|
|
},
|
|
error : function(data){
|
|
alert('init upload process failed, please try again later.')
|
|
}
|
|
});
|
|
})
|
|
})
|
|
</script>
|
|
<% else %>
|
|
no content to test
|
|
<% end %> |