update waste and spoile
This commit is contained in:
@@ -488,11 +488,6 @@
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
<% end %>
|
||||
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||
<% end %>
|
||||
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
|
||||
@@ -511,6 +506,10 @@
|
||||
<%end%>
|
||||
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
@@ -340,6 +340,8 @@
|
||||
</button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
|
||||
<% if @cashier_type=="quick_service" %>
|
||||
<hr>
|
||||
|
||||
@@ -1160,4 +1162,40 @@ var customer_name = "<%= @customer.name %>";
|
||||
var sale_id = $("#sale_id").text() || 0;
|
||||
update_sale("", customer_id, customer_name, sale_id);
|
||||
});
|
||||
|
||||
function waste_and_spoilage(remark) {
|
||||
var sale_id = $('#sale_id').text();
|
||||
console.log(sale_id)
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to " + remark +" ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, " +remark+ " it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
console.log(result)
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user