add req bill and payment #left order and sale

This commit is contained in:
phyusin
2018-09-24 10:29:08 +06:30
parent e7ef645200
commit f4b85ad4cc
13 changed files with 311 additions and 55 deletions

View File

@@ -23,6 +23,7 @@
<a class="nav-link" data-toggle="tab" href="#sale" role="tab"><%= t :sale_details %></a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px;">
<div class="tab-pane active" id="booking" role="tabpanel">
@@ -39,13 +40,18 @@
<th> <%= t("views.right_panel.detail.checkout_by") %></th>
<th><%= t("views.right_panel.detail.booking_status") %></th>
<th><%= t("views.right_panel.detail.booking_date") %></th>
<%if (@booking.sale_id.nil?) && (current_login_employee.role == "administrator") && (!@order.nil?) %>
<th>
<button id="request_bill" class="btn bg-blue btn-md waves-effect">Req. Bill</button>
</th>
<% end %>
</tr>
</thead>
<tbody>
<tr>
<td><%= @booking.booking_id%></td>
<td><%= link_to @booking.sale_id, transactions_sale_path(booking.sale_id) rescue '-' %></td>
<td><%= link_to @booking.sale_id, transactions_sale_path(@booking.sale_id) rescue '-' %></td>
<td><%= @booking.dining_facility.name rescue '' %></td>
<td><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></td>
<td><%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") rescue '-' %></td>
@@ -53,6 +59,9 @@
<td><%= @booking.checkout_by rescue '-' %></td>
<td><%= @booking.booking_status %> </td>
<td><%= @booking.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> </td>
<%if (@booking.sale_id.nil?) && (current_login_employee.role == "administrator") && (!@order.nil?) %>
<td></td>
<% end %>
</tr>
</tbody>
</table>
@@ -135,6 +144,37 @@
<script type="text/javascript">
$(document).ready(function(){
$("#request_bill").on('click', function(){
var order_id = '';
<%if !@order.nil? %>
order_id ='<%= @order.order_id %>';
<% end %>
var ajax_url = "/origami/" + order_id + "/request_bills";
localStorage.setItem("tax_type", "all");
if(order_id!=undefined && order_id!=null && order_id!=""){
if($('#request_bill').is(":visible")) {
$('#request_bill').prop("disabled",true);
}
$.ajax({
type: "GET",
url: ajax_url,
success: function (result) {
if (!result.status) {
$('#request_bill').prop("disabled",false);
swal("Information!", result.error_message);
}
else {
location.reload();
}
}
});
}else{
swal("Opps","There is no orders!","warning");
}
});
});
</script>