114 lines
3.1 KiB
Plaintext
114 lines
3.1 KiB
Plaintext
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js">
|
|
</script>
|
|
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
|
|
<%= javascript_include_tag "jspdf.min" %>
|
|
<style type="text/css">
|
|
.recieve_result table{
|
|
margin-bottom: 1em;
|
|
color: white;
|
|
}
|
|
.recieve_result tr td:nth-child(1){
|
|
padding-right: 1em;
|
|
}
|
|
.recieve_result span{
|
|
color: #ff642b;
|
|
}
|
|
body, div.recieve_result{
|
|
background: #014b86;
|
|
}
|
|
div.recieve_result {
|
|
padding: 2em;
|
|
display: inline-block;
|
|
}
|
|
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;
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
function close_window(){
|
|
if (confirm("<%= I18n.t('payment_settup.confirm_close_window') %>")){
|
|
closeWP()
|
|
}
|
|
}
|
|
function closeWP() {
|
|
var Browser = navigator.appName;
|
|
var indexB = Browser.indexOf('Explorer');
|
|
if (indexB > 0) {
|
|
var indexV = navigator.userAgent.indexOf('MSIE') + 5;
|
|
var Version = navigator.userAgent.substring(indexV, indexV + 1);
|
|
if (Version >= 7) {
|
|
window.open('', '_self', '');
|
|
window.close();
|
|
}
|
|
else if (Version == 6) {
|
|
window.opener = null;
|
|
window.close();
|
|
}
|
|
else {
|
|
window.opener = '';
|
|
window.close();
|
|
}
|
|
}
|
|
else {
|
|
window.close();
|
|
}
|
|
alert("<%= t('payment_settup.not_support_auto_close')%>")
|
|
}
|
|
function save_data(){
|
|
var filename = 'result_<%= @html['orderNumber'] rescue nil %>.pdf';
|
|
$('div.recieve_result').find('input[type=button]').hide()
|
|
html2canvas($('div.recieve_result')[0]).then(canvas => {
|
|
var pdf = new jsPDF('p', 'mm', 'a4');
|
|
var width = pdf.internal.pageSize.getWidth();
|
|
var height = pdf.internal.pageSize.getHeight();
|
|
var h = width / $('div.recieve_result').width() * $('div.recieve_result').height()
|
|
pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0,width ,h );
|
|
pdf.save(filename);
|
|
});
|
|
$('div.recieve_result').find('input[type=button]').show()
|
|
}
|
|
</script>
|
|
<div class="recieve_result">
|
|
<% if @html.class == String %>
|
|
<%= @html %>
|
|
<% elsif @html.class == Hash %>
|
|
<table>
|
|
<thead>
|
|
|
|
</thead>
|
|
<tbody>
|
|
<% @html.each do |key,value| %>
|
|
<tr>
|
|
<td>
|
|
<label>
|
|
<%= (I18n.t("payment_settup.#{key}") + ' :').html_safe %>
|
|
</label>
|
|
</td>
|
|
<td>
|
|
<label>
|
|
<%= value %>
|
|
</label>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% end %>
|
|
<span>
|
|
<%= I18n.t('payment_settup.note') %>
|
|
</span>
|
|
<br>
|
|
<br>
|
|
<br>
|
|
<% if @html.class == Hash %>
|
|
<input onclick="save_data()" value="<%= I18n.t('payment_settup.save_data') %>" type="button">
|
|
<% end %>
|
|
<input onclick="close_window()" value="<%= I18n.t('payment_settup.close_window') %>" type="button">
|
|
</div> |