update waiter view add order
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
$(function() {
|
||||
|
||||
var role = $('#role').val();
|
||||
type = $('#type').val();
|
||||
modify_order = $('#modify_order').val();
|
||||
//click menu sidebar menu category
|
||||
@@ -758,7 +758,11 @@ $(function() {
|
||||
|
||||
type = $('#type').val();
|
||||
if (type == 'true') {
|
||||
type = 'cashier'
|
||||
// if (role == 'waiter') {
|
||||
type = 'quick_service'
|
||||
// }else{
|
||||
// type = 'cashier'
|
||||
// }
|
||||
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').val();
|
||||
@@ -773,42 +777,45 @@ $(function() {
|
||||
var booking_id = $('#booking_id').text();
|
||||
var ajax_url = '../addorders/create';
|
||||
}
|
||||
if (!booking_id.length > 0) {
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
if (booking_id.length > 0) {
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
}
|
||||
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
}else{
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
if (table_id.length>0) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$(this).removeAttr('disabled', '');
|
||||
$("#oqs_loading_wrapper").hide();
|
||||
|
||||
swal("Opps","Please Select Table or Room","warning");
|
||||
}
|
||||
|
||||
if (table_id.length>0 || role == 'waiter') {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (type == "quick_service") {
|
||||
window.location.href = "/origami/quick_service"
|
||||
}else{
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$(this).removeAttr('disabled', '');
|
||||
$("#oqs_loading_wrapper").hide();
|
||||
|
||||
swal("Opps","Please Select Table or Room","warning");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -835,21 +842,20 @@ $(function() {
|
||||
var booking_id = $('#booking_id').text();
|
||||
var sale_id = ""
|
||||
}
|
||||
|
||||
if (!booking_id.length > 0) {
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
if (booking_id.length > 0) {
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
}
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'order_items': order_items,'sale_id': sale_id };
|
||||
}else{
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items,'sale_id': sale_id };
|
||||
console.log(params)
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
@@ -858,7 +864,11 @@ $(function() {
|
||||
success:function(result){
|
||||
console.log(result)
|
||||
if (result.status) {
|
||||
if (result.data == null){
|
||||
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
|
||||
}else{
|
||||
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user