- <% @menu.each do |menu| %>
- <% if !menu.valid_time.nil? %>
- <% if menu.menu_category_id.nil? %>
-
- <% if type %>
- <% if !menu.code.include? "SPL" %>
-
+ <% @menu.each do |menu| %>
+ <% if !menu.valid_time.nil? %>
+ <% if menu.menu_category_id.nil? %>
+
+ <% if type %>
+ <% if !menu.code.include? "SPL" %>
+
+ <% end%>
+
+ <% end %>
+ <% end%>
+ <% end %>
+ <%end %>
+
+
+
+
+
+
+
+
+
+
+
+
+ <% @menu.each do |menu| %>
+ <% if !menu.valid_time.nil? %>
+ <% if menu.menu_category_id.nil? %>
+
+ <% if type %>
+ <% if !menu.code.include? "SPL" %>
+
+
+
<%=menu.name%>
+
<%=menu.code%>
+
+
+ <% end%>
+
+ <% else %>
+ <% if @table.get_current_checkout_booking.nil? %>
+ <% if !menu.code.include? "SPL" %>
+
+
+
<%=menu.name%>
+
<%=menu.code%>
+
+
+ <% end%>
+ <% else %>
+
+
+
<%=menu.name%>
+
<%=menu.code%>
+
+
<% end%>
- <% end %>
- <% end%>
- <% end %>
- <%end %>
-
-
-
-
-
-
-
-
-
-
-
-
- <% @menu.each do |menu| %>
- <% if !menu.valid_time.nil? %>
- <% if menu.menu_category_id.nil? %>
-
- <% if type %>
- <% if !menu.code.include? "SPL" %>
-
-
-
<%=menu.name%>
-
<%=menu.code%>
-
-
- <% end%>
-
- <% else %>
- <% if @table.get_current_checkout_booking.nil? %>
- <% if !menu.code.include? "SPL" %>
-
-
-
<%=menu.name%>
-
<%=menu.code%>
-
-
- <% end%>
- <% else %>
-
-
-
<%=menu.name%>
-
<%=menu.code%>
-
-
- <% end%>
-
- <% end %>
- <% end%>
<% end %>
- <%end %>
+ <% end%>
+ <% end %>
+ <%end %>
+
+
+
-
-
-
-
-
- <% if type && modify_order%>
-
-
-
-
- <%elsif !modify_order && type%>
-
+
+
+
+
+
+
Enter Access Code
+ ×
+
+
+
+
+
1
+
2
+
3
+
4
+
+
+
5
+
6
+
7
+
8
+
+
+
9
+
0
+
Clr
+
OK
+
+
+
+
+
+
@@ -730,44 +767,7 @@ var customer_name = "<%= @customer.name %>";
// swal("Opps","You are not authorized for void","warning")
// }
// });
- $('#void').on('click', function () {
- if ($(this).attr('active')=== "true") {
- swal({
- title: "Alert",
- text: "Are you sure want to Void?",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "Yes, void it!",
- closeOnConfirm: false
- }, function (isConfirm) {
- if (isConfirm) {
- var sale_id = $('#sale_id').text();
- var remark = $("#remark").val();
- var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
- $.ajax({
- type: 'POST',
- url: ajax_url,
- data: "remark="+ remark + "&sale_id=" + sale_id,
- success: function (result) {result
- customer_display_view(null,"reload");
- // 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';
- }
- }
- })
- }
- });
- }else{
- swal("Oops","You are not authorized for void","warning")
- }
- });
+
});
// bind survey to order or sale
@@ -940,59 +940,6 @@ var customer_name = "<%= @customer.name %>";
$('#balance').text(parseFloat(result));
<% end %>
}
-
- $('#foc').click(function() {
- //$( "#loading_wrapper" ).show();
- // payment
- var remark = $("#foc_remark").val();
- var cash = $('#grand_total').text();
- var sub_total = $('#sub-total').text();
- var sale_id = $('#sale_id').text();
- var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type };
-
- if ($(this).attr('active')=== "true") {
- swal({
- title: "Alert",
- text: "Are you sure want to FOC This Receipt?",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "Yes, FOC it!",
- closeOnConfirm: false
- }, function (isConfirm) {
- if (isConfirm) {
- $.ajax({
- type: "POST",
- url: "/origami/payment/"+cashier_type+"/foc",
- data: params,
- success:function(result){
- customer_display_view(null,"reload");
- if (cash >= 0) {
- swal({
- title: "Information!",
- text: 'Thank You !',
- }, function () {
- // 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';
- }
- });
- }
- }
- });
- }
- });
-
- }else{
- swal("Oops","You are not authorized for foc","warning")
- }
- });
-
function customer_display_view(data,status) {
$.ajax({
type: "POST",
@@ -1220,28 +1167,157 @@ var customer_name = "<%= @customer.name %>";
update_sale("", customer_id, customer_name, sale_id);
});
- function waste_and_spoilage(remark) {
+ $(document).on('click', '.access_modal', function(event){
+ type = $(this).data("type");
+ $(".ok").attr("data-action",type)
+ $('#AccessCodeModal').modal('show');
+ });
+
+ function check_emp_access_code(access_code,type) {
+ var url = "/origami/check_emp_access_code/" + access_code ;
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: {},
+ success: function (result) {
+ console.log(result)
+ if (result.status == true) {
+ createAccessCode(code);
+ if (type == "edit") {
+ var dining_id = $('#dining').text();
+ var sale_id = $('#sale_id').text();
+ if (dining_id) {
+ window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
+ }else{
+ window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
+ }
+ }else if(type == "void"){
+ $('#AccessCodeModal').modal('hide');
+ $('#voidModal').modal('show');
+ // overall_void();
+ }else if(type == "waste") {
+ // $('#AccessCodeModal').modal('hide');
+ // $('#focModal').modal('show');
+ waste_and_spoilage("waste")
+ }else if(type == "spoile") {
+ // $('#AccessCodeModal').modal('hide');
+ // $('#voidModal').modal('show');
+ waste_and_spoilage("spoile")
+ }else if(type == "foc"){
+ $('#AccessCodeModal').modal('hide');
+ $('#focModal').modal('show');
+ // overall_foc();
+ }
+ }else{
+ swal("Opps",result.message,"warning")
+ }
+ }
+ });
+ }
+
+ $('#foc').on('click', function () {
+ var access_code = localStorage.getItem("access_code");
+ var remark = $("#foc_remark").val();
+ var cash = $('#grand_total').text();
+ var sub_total = $('#sub-total').text();
+ var sale_id = $('#sale_id').text();
+ var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
+ swal({
+ title: "Alert",
+ text: "Are you sure want to FOC This Receipt?",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "Yes, FOC it!",
+ closeOnConfirm: false
+ }, function (isConfirm) {
+ if (isConfirm) {
+ $.ajax({
+ type: "POST",
+ url: "/origami/payment/"+cashier_type+"/foc",
+ data: params,
+ success:function(result){
+ customer_display_view(null,"reload");
+ if (cash >= 0) {
+ swal({
+ title: "Information!",
+ text: 'Thank You !',
+ }, function () {
+ // 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';
+ }
+ });
+ }
+ }
+ });
+ }
+ });
+ });
+
+ $('#void').on('click', function () {
+ var access_code = localStorage.getItem("access_code");
+ swal({
+ title: "Alert",
+ text: "Are you sure want to Void?",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "Yes, void it!",
+ closeOnConfirm: false
+ }, function (isConfirm) {
+ if (isConfirm) {
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)
+ var remark = $("#remark").val();
+ var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
+ $.ajax({
+ type: 'POST',
+ url: ajax_url,
+ data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
+ success: function (result) {result
+ customer_display_view(null,"reload");
+ // 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';
+ }
+ }
+ })
+ }
+ });
+ });
+
+ function waste_and_spoilage(remark) {
+ var access_code = localStorage.getItem("access_code");
+ var sale_id = $('#sale_id').text();
+ 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+ "&access_code=" + access_code,
+ success: function (result) {
+ console.log(result)
// For Server Print - from jade
- if ($("#server_mode").val() == "cloud") {
+ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
@@ -1251,8 +1327,8 @@ var customer_name = "<%= @customer.name %>";
customer_display_view(null,"reload");
}
}
- });
- }
- });
- }
+ });
+ }
+ });
+ }
\ No newline at end of file
diff --git a/app/views/origami/pending_order/completed_sale.html.erb b/app/views/origami/pending_order/completed_sale.html.erb
new file mode 100644
index 00000000..f67be2d6
--- /dev/null
+++ b/app/views/origami/pending_order/completed_sale.html.erb
@@ -0,0 +1,207 @@
+