update waiter view add order

This commit is contained in:
Aung Myo
2018-02-26 09:19:14 +06:30
parent ac47501e01
commit f4f5915532
12 changed files with 259 additions and 160 deletions

View File

@@ -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"
}
}
}
});