Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into ui_ux_changes
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
$(function() {
|
||||
var role = $('#role').val();
|
||||
|
||||
type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
|
||||
//click menu sidebar menu category
|
||||
$(".product").on("click", function(){
|
||||
var url = $(this).attr('data-ref');
|
||||
@@ -62,8 +64,8 @@ $(function() {
|
||||
+JSON.stringify(item_attributes)+"' data-id = '"
|
||||
+JSON.stringify(item_attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(product[field].options)+"'data-opt = '"
|
||||
+JSON.stringify(product[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
|
||||
+"<i class='fa fa-bars material-icons'>"
|
||||
+'view_list</i>'
|
||||
@@ -76,8 +78,8 @@ $(function() {
|
||||
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
|
||||
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"'>"
|
||||
+ JSON.stringify(product[field].options) +"' data-opt = '"
|
||||
+ JSON.stringify(product[field].options) +"' data-image='"+image_path+"'>"
|
||||
|
||||
// +"<div class='card-block custom-card-block'>"
|
||||
// +"<img id='logo' height='125px' src='"+image_path+"'>"
|
||||
@@ -96,162 +98,78 @@ $(function() {
|
||||
}
|
||||
//end show list function
|
||||
//click menu sidebar menu category
|
||||
$(document).on('click', '.menu_category', function(event){
|
||||
event.preventDefault();
|
||||
$(document).on('click', '.menu_category', function(e){
|
||||
e.preventDefault();
|
||||
$('.sub_category_list').addClass("hidden");
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var url = "get_menu_category/"+menu_id;
|
||||
show_menu_item_list(url);
|
||||
|
||||
var url = "get_menu_category/"+menu_id;
|
||||
show_menu_item_list(url,menu_id);
|
||||
var sub_id = $(this).attr("data-sub-id");
|
||||
if (sub_id == "true") {
|
||||
var sub_url = "get_menu_sub_category/"+menu_id;
|
||||
sub_category = $(this).find('.sub_category_list');
|
||||
show_sub_category_list(sub_url,sub_category);
|
||||
sub_category = $(this).siblings('.sub_category_list');
|
||||
show_sub_category_list(sub_url,sub_category,menu_id);
|
||||
}
|
||||
});
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
//click menu sidebar menu category
|
||||
$(document).on('click', '.menu_sub_category', function(event){
|
||||
// event.preventDefault();
|
||||
// $(".menu_sub_category").on("click", function(){
|
||||
$('.sub_category_list').addClass("hidden");
|
||||
var menu_id = $(this).attr("data-id");
|
||||
console.log(menu_id);
|
||||
var url = "get_menu_category/"+menu_id;
|
||||
show_menu_item_list(url,menu_id);
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_item_list(url_item){
|
||||
function show_menu_item_list(url_item,menu_id){
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
if (type != -1 && modify_order != -1) {
|
||||
url_item = '../../../addorders/'+url_item;
|
||||
}if(modify_order == -1 && type != -1){
|
||||
url_item = 'addorders/'+url_item;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
url_item = url_item
|
||||
}
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var menu_items_list = $('.menu_items_list');
|
||||
menu_items_list.empty();
|
||||
menu_items = data.menu_items;
|
||||
|
||||
for(var field in menu_items) {
|
||||
if (menu_items[field].is_sub_item == false) {
|
||||
instances = menu_items[field].instances ;
|
||||
|
||||
if (!instances.length > 0) {
|
||||
swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
|
||||
}
|
||||
if (instances.length > 0) {
|
||||
qty = 1;
|
||||
options = [];
|
||||
price = 0;
|
||||
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||
fa_plus = '';
|
||||
add = '';
|
||||
menu_item_box = 'add_icon';
|
||||
data_target = 'sx_item_set_detailModal';
|
||||
data_modal = 'modal'
|
||||
add_icon = "set_item_box"
|
||||
code = menu_items[field].code;
|
||||
name = menu_items[field].name;
|
||||
instances = menu_items[field].instances;
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default == true) {
|
||||
price = parseFloat(instances[i].price).toFixed(2);
|
||||
}else{
|
||||
price = 0;
|
||||
}
|
||||
});
|
||||
is_available = menu_items[field].is_available ;
|
||||
is_on_promotion = 0;
|
||||
item_attributes = menu_items[field].attributes;
|
||||
promotion_price = menu_items[field].promotion_price;
|
||||
}else{
|
||||
fa_plus = 'material-icons';
|
||||
add = 'view_list'
|
||||
menu_item_box = 'menu_item_box';
|
||||
data_target = 'sx_item_detailModal';
|
||||
data_modal = ''
|
||||
add_icon = "add_icon"
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default === true) {
|
||||
code = instances[i].code;
|
||||
name = instances[i].name;
|
||||
price = parseFloat(instances[i].price).toFixed(2);
|
||||
is_available = instances[i].is_available ;
|
||||
is_on_promotion = instances[i].is_on_promotion;
|
||||
item_attributes = instances[i].values;
|
||||
promotion_price = instances[i].promotion_price;
|
||||
code = instances[i].code;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (menu_items[field].image) {
|
||||
if (modify_order) {
|
||||
image_path = "../../"+menu_items[field].image;
|
||||
}else{
|
||||
image_path = menu_items[field].image;
|
||||
}
|
||||
|
||||
}else{
|
||||
if (modify_order) {
|
||||
image_path = "../../image/logo.png";
|
||||
}else{
|
||||
image_path = "image/logo.png";
|
||||
}
|
||||
}
|
||||
|
||||
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
||||
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
|
||||
+"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
|
||||
+ menu_items[field].code +"' data-instance = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
|
||||
+"<i class='fa "+fa_plus+" '>"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
|
||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
|
||||
// +"<div class='card-block custom-card-block'>"
|
||||
// +"<img id='logo' height='' src='"+image_path+"'>"
|
||||
// +"</div>"
|
||||
|
||||
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
|
||||
+'<span>'+ price +'</span>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('.menu_items_list').append(row);
|
||||
}
|
||||
//end instances in menu-items alest 1 instance
|
||||
menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
for(var i in menus) {
|
||||
var categories = menus[i]["categories"];
|
||||
for(var ii in categories) {
|
||||
if (categories[ii]["id"] == menu_id) {
|
||||
var menu_items = categories[ii]["items"];
|
||||
show_menu_list(menu_items);
|
||||
}
|
||||
//end is_sub_item false
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}else{
|
||||
|
||||
type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
|
||||
if (type != -1 && modify_order != -1) {
|
||||
url_item = '../../../addorders/'+url_item;
|
||||
}if(modify_order == -1 && type != -1){
|
||||
url_item = 'addorders/'+url_item;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
url_item = url_item
|
||||
}
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var menu_items_list = $('.menu_items_list');
|
||||
menu_items_list.empty();
|
||||
menu_items = data.menu_items;
|
||||
show_menu_list(menu_items);
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
}
|
||||
//end show list function
|
||||
//click item row for item set
|
||||
@@ -269,60 +187,106 @@ $(function() {
|
||||
item_options = $(this).data('options');
|
||||
|
||||
for(var field in item_sets) {
|
||||
|
||||
|
||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||
|
||||
value = item_sets[field]["instances"];
|
||||
|
||||
$(value).each(function(i){
|
||||
if (type != -1 && modify_order != -1) {
|
||||
menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
for(var j in menus) {
|
||||
var categories = menus[j]["categories"];
|
||||
for(var ii in categories) {
|
||||
var items = categories[ii]["items"];
|
||||
for(var iii in items) {
|
||||
var result = items[iii]["instances"];
|
||||
for(var v in result) {
|
||||
|
||||
url = '../../../addorders/get_item_instance/'+value[i]["id"];
|
||||
console.log("ssssssss")
|
||||
}
|
||||
if(modify_order == -1 && type != -1){
|
||||
if (value[i]["id"] == result[v]["id"]) {
|
||||
|
||||
console.log("ssssssss")
|
||||
|
||||
url = 'addorders/get_item_instance/'+value[i]["id"] ;
|
||||
console.log("aaaaaa")
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
|
||||
url = '../addorders/get_item_instance/'+value[i]["id"];
|
||||
console.log("cccccccccc")
|
||||
}
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
// data: {id:value[i]},
|
||||
success:function(result){
|
||||
|
||||
row = '<div class="col-md-4 " >'
|
||||
+"<div class='card custom-card instance_box' data-name='"+result["name"]
|
||||
+"' data-code='"+result["code"]
|
||||
+"' data-price='"+result["price"]
|
||||
+"' data-option='"+JSON.stringify(result["options"])
|
||||
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
|
||||
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
|
||||
+"' data-parent-code='"+instances[0]['code']
|
||||
+"' data-parent-id='"+instances[0]['id']
|
||||
+"' data-sub-item='true"
|
||||
+"'>"
|
||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||
+'<span class="">'+result["name"]+'</span>'
|
||||
row = '<div class="col-md-4 " >'
|
||||
+"<div class='card custom-card instance_box' data-name='"+result[v]["name"]
|
||||
+"' data-code='"+result[v]["code"]
|
||||
+"' data-price='"+result[v]["price"]
|
||||
+"' data-option='"+JSON.stringify(items[iii]["options"])
|
||||
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
|
||||
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
|
||||
+"' data-parent-code='"+instances[0]['code']
|
||||
+"' data-parent-id='"+instances[0]['id']
|
||||
+"' data-sub-item='true"
|
||||
+"'>"
|
||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||
+'<span class="">'+result[v]["name"]+'</span>'
|
||||
+'</div>'
|
||||
+'<div class="card-block custom-card-block">'
|
||||
+'<img id="" src="/image/logo.png" height="40px">'
|
||||
+' <small style="float:" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+' <span>'+result[v]["price"]+'</span>'
|
||||
// +' <small style="float:right" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="card-block custom-card-block">'
|
||||
+'<img id="" src="/image/logo.png" height="40px">'
|
||||
+' <small style="float:" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+' <span>'+result["price"]+'</span>'
|
||||
// +' <small style="float:right" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+' </div>'
|
||||
|
||||
$(".instance-list").append(row);
|
||||
+' </div>'
|
||||
$(".instance-list").append(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
if (type != -1 && modify_order != -1) {
|
||||
url = '../../../addorders/get_item_instance/'+value[i]["id"];
|
||||
console.log("ssssssss")
|
||||
}
|
||||
if(modify_order == -1 && type != -1){
|
||||
url = 'addorders/get_item_instance/'+value[i]["id"] ;
|
||||
console.log("aaaaaa")
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
url = '../addorders/get_item_instance/'+value[i]["id"];
|
||||
console.log("cccccccccc")
|
||||
}
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
// data: {id:value[i]},
|
||||
success:function(result){
|
||||
|
||||
row = '<div class="col-md-4 " >'
|
||||
+"<div class='card custom-card instance_box' data-name='"+result["name"]
|
||||
+"' data-code='"+result["code"]
|
||||
+"' data-price='"+result["price"]
|
||||
+"' data-option='"+JSON.stringify(result["options"])
|
||||
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
|
||||
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
|
||||
+"' data-parent-code='"+instances[0]['code']
|
||||
+"' data-parent-id='"+instances[0]['id']
|
||||
+"' data-sub-item='true"
|
||||
+"'>"
|
||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||
+'<span class="">'+result["name"]+'</span>'
|
||||
+'</div>'
|
||||
+'<div class="card-block custom-card-block">'
|
||||
+'<img id="" src="/image/logo.png" height="40px">'
|
||||
+' <small style="float:" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+' <span>'+result["price"]+'</span>'
|
||||
// +' <small style="float:right" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+' </div>'
|
||||
|
||||
$(".instance-list").append(row);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -442,10 +406,8 @@ $(function() {
|
||||
$(document).on('click', '#remove_set', function(event){
|
||||
code = $(this).parent().parent('.selected-set').attr('data-code');
|
||||
instance = $(".selected-instance");
|
||||
console.log(code)
|
||||
$(instance).each(function(i){
|
||||
if ($(instance[i]).attr('data-code')==code){
|
||||
console.log($(instance[i]))
|
||||
$(instance[i]).removeClass("selected-instance")
|
||||
}
|
||||
});
|
||||
@@ -496,7 +458,6 @@ $(function() {
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
var set_option = []
|
||||
$(items).each(function(i){
|
||||
console.log($(items[0]).attr('data-name'))
|
||||
code = $(items[i]).attr('data-code');
|
||||
name = $(items[i]).attr('data-name');
|
||||
price = $(items[i]).attr('data-price');
|
||||
@@ -754,7 +715,6 @@ $(function() {
|
||||
|
||||
attribute_arr = get_selected_attributes('selected-attribute');
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
console.log(option_arr)
|
||||
if (item_row.length>0) {
|
||||
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
|
||||
|
||||
@@ -990,7 +950,6 @@ $(function() {
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (result.status) {
|
||||
console.log(result)
|
||||
if (result.data == null){
|
||||
swal({
|
||||
title: "Please Open Shift !",
|
||||
@@ -1205,7 +1164,6 @@ $(function() {
|
||||
|
||||
$(".keypress_qty").on('keyup change', function (){
|
||||
// $('.keypress_qty').keyup(function(e){
|
||||
|
||||
id = $(this).attr('id');
|
||||
value = $(this).val();
|
||||
|
||||
@@ -1243,54 +1201,68 @@ $(function() {
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var url = "get_menu_sub_category/"+menu_id;
|
||||
sub_category = $(this).find('.sub_category_list');
|
||||
show_sub_category_list(url,sub_category);
|
||||
show_sub_category_list(url,sub_category,menu_id);
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_sub_category_list(url,sub_category){
|
||||
function show_sub_category_list(url,sub_category,menu_id){
|
||||
|
||||
if (type != -1 && modify_order != -1) {
|
||||
var url = "../../../addorders/"+url;
|
||||
}if(modify_order== -1 && type != -1){
|
||||
var url = 'addorders/'+url;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
var url = url;
|
||||
}
|
||||
var sub_category_list = $('.sub_category_list');
|
||||
sub_category_list.empty();
|
||||
|
||||
var menu_list = $('.sub_category_list');
|
||||
menu_list.empty();
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var sub_category_list = $('.sub_category_list');
|
||||
sub_category_list.empty();
|
||||
data = data.sub_category;
|
||||
|
||||
if (data.length>0) {
|
||||
// if ((sub_category.hasClass('hidden'))) {
|
||||
menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
for(var j in menus) {
|
||||
var categories = menus[j]["categories"];
|
||||
for(var ii in categories) {
|
||||
if (menu_id == categories[ii]["parent_id"]) {
|
||||
$(sub_category).removeClass('hidden');
|
||||
// }else{
|
||||
// $(sub_category).addClass('hidden');
|
||||
// }
|
||||
|
||||
for(var i in data) {
|
||||
|
||||
row = '<li class="menu_category fadeInTop" data-id="'+data[i].id+'">'
|
||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
||||
+'</li>' ;
|
||||
$(sub_category).append(row);
|
||||
//end is_sub_item false
|
||||
}
|
||||
row = '<li class="menu_sub_category fadeInTop" data-id="'+categories[ii].id+'">'
|
||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ categories[ii].name+'</a>'
|
||||
+'</li>' ;
|
||||
$(sub_category).append(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}else{
|
||||
if (type != -1 && modify_order != -1) {
|
||||
var url = "../../../addorders/"+url;
|
||||
}if(modify_order== -1 && type != -1){
|
||||
var url = 'addorders/'+url;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
var url = url;
|
||||
}
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var sub_category_list = $('.sub_category_list');
|
||||
sub_category_list.empty();
|
||||
data = data.sub_category;
|
||||
if (data.length > 0) {
|
||||
// if ((sub_category.hasClass('hidden'))) {
|
||||
$(sub_category).removeClass('hidden');
|
||||
// }else{
|
||||
// $(sub_category).addClass('hidden');
|
||||
// }
|
||||
for(var i in data) {
|
||||
|
||||
row = '<li class="menu_sub_category fadeInTop" data-id="'+data[i].id+'">'
|
||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
||||
+'</li>' ;
|
||||
$(sub_category).append(row);
|
||||
//end is_sub_item false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
}
|
||||
|
||||
/* Get Item rows */
|
||||
@@ -1378,5 +1350,119 @@ $(function() {
|
||||
// price = $("#unit_price").text();
|
||||
// $("#total_price").text(qty*price);
|
||||
// });
|
||||
function show_menu_list(menu_items) {
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
for(var field in menu_items) {
|
||||
if (menu_items[field].is_sub_item == false) {
|
||||
instances = menu_items[field].instances ;
|
||||
|
||||
if (!instances.length > 0) {
|
||||
swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
|
||||
}
|
||||
if (instances.length > 0) {
|
||||
qty = 1;
|
||||
options = [];
|
||||
price = 0;
|
||||
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||
fa_plus = '';
|
||||
add = '';
|
||||
menu_item_box = 'add_icon';
|
||||
data_target = 'sx_item_set_detailModal';
|
||||
data_modal = 'modal'
|
||||
add_icon = "set_item_box"
|
||||
code = menu_items[field].code;
|
||||
name = menu_items[field].name;
|
||||
instances = menu_items[field].instances;
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default == true) {
|
||||
price = parseFloat(instances[i].price).toFixed(2);
|
||||
}else{
|
||||
price = 0;
|
||||
}
|
||||
});
|
||||
is_available = menu_items[field].is_available ;
|
||||
is_on_promotion = 0;
|
||||
item_attributes = menu_items[field].attributes;
|
||||
promotion_price = menu_items[field].promotion_price;
|
||||
}else{
|
||||
fa_plus = 'material-icons';
|
||||
add = 'view_list'
|
||||
menu_item_box = 'menu_item_box';
|
||||
data_target = 'sx_item_detailModal';
|
||||
data_modal = ''
|
||||
add_icon = "add_icon"
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default === true) {
|
||||
code = instances[i].code;
|
||||
name = instances[i].name;
|
||||
price = parseFloat(instances[i].price).toFixed(2);
|
||||
is_available = instances[i].is_available ;
|
||||
is_on_promotion = instances[i].is_on_promotion;
|
||||
item_attributes = instances[i].values;
|
||||
promotion_price = instances[i].promotion_price;
|
||||
code = instances[i].code;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (menu_items[field].image) {
|
||||
if (modify_order) {
|
||||
image_path = "../../"+menu_items[field].image;
|
||||
}else{
|
||||
image_path = menu_items[field].image;
|
||||
}
|
||||
|
||||
}else{
|
||||
if (modify_order) {
|
||||
image_path = "../../image/logo.png";
|
||||
}else{
|
||||
image_path = "image/logo.png";
|
||||
}
|
||||
}
|
||||
|
||||
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
||||
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
|
||||
+"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
|
||||
+ menu_items[field].code +"' data-instance = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
|
||||
+"<i class='fa "+fa_plus+" '>"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
|
||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
|
||||
// +"<div class='card-block custom-card-block'>"
|
||||
// +"<img id='logo' height='' src='"+image_path+"'>"
|
||||
// +"</div>"
|
||||
|
||||
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
|
||||
+'<span>'+ price +'</span>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('.menu_items_list').append(row);
|
||||
}
|
||||
//end instances in menu-items alest 1 instance
|
||||
}
|
||||
//end is_sub_item false
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -18,22 +18,30 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_new_order'),
|
||||
text: "You have new orders. <br/>"+
|
||||
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// swal({
|
||||
// title: 'Information',
|
||||
// target: document.getElementById("notify_new_order"),
|
||||
// text: "You have new orders <br/>"+
|
||||
// "Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||
// type: 'success',
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function (isConfirm) {
|
||||
// if(isConfirm){
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
$("#notify_new_order_lists").text(order_lists);
|
||||
$("#notify_new_order").on('show.bs.modal', function(e){
|
||||
$("#notify_order_send_to_kitchen").modal('hide');
|
||||
$("#notify_order_ready_to_delivery").modal('hide');
|
||||
}).on('shown.bs.modal', function(e){
|
||||
$("#notify_new_order").focus();
|
||||
}).on('hide.bs.modal', function (e) {
|
||||
$("#notify_new_order").modal("hide");
|
||||
}).modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,22 +18,30 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_order_ready_to_delivery'),
|
||||
text: "You have orders that are ready to deliver. <br/>"+
|
||||
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// swal({
|
||||
// title: 'Information',
|
||||
// target: document.getElementById("notify_order_ready_to_delivery"),
|
||||
// text: "You have orders that are ready to deliver <br/>"+
|
||||
// "Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||
// type: 'success',
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function (isConfirm) {
|
||||
// if(isConfirm){
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
$("#notify_order_ready_to_delivery_lists").text(order_lists);
|
||||
$("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
|
||||
$("#notify_new_order").modal('hide');
|
||||
$("#notify_order_send_to_kitchen").modal('hide');
|
||||
}).on('shown.bs.modal', function(e){
|
||||
$("#notify_order_ready_to_delivery").focus();
|
||||
}).on('hide.bs.modal', function (e) {
|
||||
$("#notify_order_ready_to_delivery").modal("hide");
|
||||
}).modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,22 +18,30 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_order_send_to_kitchen'),
|
||||
text: "You have to send order to kitchen. <br/>"+
|
||||
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// swal({
|
||||
// title: 'Information',
|
||||
// target: document.getElementById("notify_order_send_to_kitchen"),
|
||||
// text: "You have to send order to kitchen <br/>"+
|
||||
// "Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||
// type: 'success',
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function (isConfirm) {
|
||||
// if(isConfirm){
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
$("#notify_order_send_to_kitchen_lists").text(order_lists);
|
||||
$("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
|
||||
$("#notify_new_order").modal('hide');
|
||||
$("#notify_order_ready_to_delivery").modal('hide');
|
||||
}).on('shown.bs.modal', function(e){
|
||||
$("#notify_order_send_to_kitchen").focus();
|
||||
}).on('hide.bs.modal', function (e) {
|
||||
$("#notify_order_send_to_kitchen").modal("hide");
|
||||
}).modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
|
||||
var rowCount = key+1;
|
||||
var date = new Date(value.created_at);
|
||||
var time = timeFormat(date);
|
||||
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate()>10?date.getDate() : '0'+date.getDate());
|
||||
var created_at = date.getFullYear() +'-'+ (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >=10?date.getDate() : '0'+date.getDate());
|
||||
|
||||
var delivery_type = "";
|
||||
if(value.delivery_type == "service"){
|
||||
|
||||
@@ -62,6 +62,7 @@ $(document).ready(function() {
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 45
|
||||
});
|
||||
|
||||
|
||||
// $('.delete').click(function(){
|
||||
// var method = $(this).attr('data-method');
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
$(function() {
|
||||
$("#discount").hide();
|
||||
$(".expected_time").hide();
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
$(".tbl_customer").hide();
|
||||
$(function() {
|
||||
$('.first-1').click();
|
||||
});
|
||||
@@ -11,6 +14,9 @@ $(function() {
|
||||
$(".nav-item").on("click", function(){
|
||||
type = $(this).attr("data-type");
|
||||
refreshDetailData();
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
$(".tbl_customer").hide();
|
||||
if (type == "pending") {
|
||||
$(".first-1").click();
|
||||
$('#accepted').text("ACCEPT");
|
||||
@@ -24,19 +30,23 @@ $(function() {
|
||||
$('#accepted').text("READY TO DELIVERY");
|
||||
$('#accepted').attr("data-value","delivery");
|
||||
}else if(type == "completed"){
|
||||
// $('#cancel').hide();
|
||||
$(".fourth-1").click();
|
||||
$('#accepted').text("PICK-UP");
|
||||
$('#accepted').text("COMPLETE");
|
||||
$('#accepted').attr("data-value","completed");
|
||||
}
|
||||
}else if(type == "processed"){
|
||||
$(".fifth-1").click();
|
||||
// $('#accepted').hide();
|
||||
// $('#cancel').hide();
|
||||
}
|
||||
// console.log(type);
|
||||
});
|
||||
|
||||
$("#accepted").on("click", function(){
|
||||
if($(this).text().trim() == "ACCEPT"){
|
||||
$("#status").text($(this).attr("data-value"));
|
||||
var requested_time = $("#requested_date_time").text();
|
||||
var requested_time = $("#requested_time").text();
|
||||
$("#requested_order_time").text(requested_time);
|
||||
showTimePicker(requested_time);
|
||||
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
|
||||
}else{
|
||||
var status = $(this).attr("data-value");
|
||||
@@ -48,38 +58,117 @@ $(function() {
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
var order_status = $("#order_status").text();
|
||||
$("#status").text($(this).attr("data-value"));
|
||||
if(order_status!="new" && order_status!= "accepted" && order_status!="send_to_kitchen"){
|
||||
$("#AccessCodeModal").modal({show: true, backdrop: false, keyboard: false});
|
||||
}else{
|
||||
$("#rejected_reasonModal").modal({show: true, backdrop: false, keyboard: false});
|
||||
}
|
||||
});
|
||||
|
||||
$("#save").on("click",function(){
|
||||
$("#waiting_timeErr").text("");
|
||||
$(".send_status").on("click",function(){
|
||||
$("#reject_reasonErr").html("");
|
||||
if($('#reject_reason').val() != ""){
|
||||
var order_status = $("#order_status").text();
|
||||
var status = $("#status").text();
|
||||
var order_id = $('#order_id').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
var reason = "";
|
||||
var approved_code = $("#approved_code").text();
|
||||
if(order_status == 'ready_to_delivery'){
|
||||
reason = "VOID || " + $('#reject_reason').val();
|
||||
}else{
|
||||
reason = $('#reject_reason').val();
|
||||
}
|
||||
callback_url(callback,ref_no,order_id,status,"","","",reason,approved_code);
|
||||
}else{
|
||||
$("#reject_reasonErr").html("This is required field");
|
||||
}
|
||||
});
|
||||
|
||||
$(".timer_type").on("click",function(){
|
||||
if($(this).hasClass("selected-item")){
|
||||
$(this).removeClass("selected-item");
|
||||
}else{
|
||||
$(this).addClass("selected-item");
|
||||
}
|
||||
});
|
||||
|
||||
$(".time_interval").on("click",function(){
|
||||
var type = '';
|
||||
if($(".timer_type").hasClass("selected-item")){
|
||||
type = 'after';
|
||||
}
|
||||
var minutes = $(this).attr("data-value");
|
||||
// console.log(type);
|
||||
// console.log($(this).attr("data-value"));
|
||||
|
||||
var status = $("#status").text();
|
||||
var order_id = $('#order_id').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var requested_time = new Date($("#requested_date_time").text());
|
||||
var date_time = requested_time.getFullYear()+'-'+(requested_time.getMonth() > 10? requested_time.getMonth() : '0'+ (requested_time.getMonth() + 1))+'-'+(requested_time.getDate()> 10? requested_time.getDate() : '0' + requested_time.getDate());
|
||||
var waiting_time = new Date(date_time+' '+$("#waiting_time").val());
|
||||
// requested_time.setHours(requested_time.getHours() - 1);
|
||||
// var requested_time = new Date($("#requested_date_time").text());
|
||||
// if(type == 'after'){
|
||||
// requested_time.setMinutes(requested_time.getMinutes() + minutes);
|
||||
// }else{
|
||||
// requested_time.setMinutes(requested_time.getMinutes() - minutes);
|
||||
// }
|
||||
// console.log(requested_time);
|
||||
// console.log(date_time);
|
||||
if(waiting_time.getTime() < requested_time.getTime()){
|
||||
var time_diff = (requested_time.getTime() - waiting_time.getTime());
|
||||
var expected_time = (Math.floor(time_diff) / 1000) / 60;
|
||||
}else{
|
||||
var time_diff = (waiting_time.getTime() - requested_time.getTime());
|
||||
var expected_time = (Math.floor(time_diff) / 1000) / 60;
|
||||
// $("#waiting_time").val("");
|
||||
// $("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
|
||||
callback_url(callback,ref_no,order_id,status,type,minutes);
|
||||
});
|
||||
|
||||
$(document).on('click','.access_number', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value = $('#access_code').val();
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value){
|
||||
$('#access_code').val(original_value + input_value);
|
||||
}else{
|
||||
$('#access_code').val(original_value + input_value);
|
||||
}
|
||||
break;
|
||||
case 'ok':
|
||||
var type = $(this).attr("data-action");
|
||||
code = $('#access_code').val();
|
||||
check_emp_access_code(code,type)
|
||||
break;
|
||||
case 'clr':
|
||||
$('#access_code').val("");
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
$("#approved_code").text(code);
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
$("#rejected_reasonModal").modal({show: true, backdrop: false, keyboard: false});
|
||||
}else{
|
||||
swal("Opps",result.message,"warning")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function customTableClick(){
|
||||
$(".custom-table .custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
@@ -96,6 +185,7 @@ function refreshDetailData(){
|
||||
$("#sr_number").text("");
|
||||
$("#delivery_info").text("");
|
||||
$("#contact_info").text("");
|
||||
$("#invoice_no").text("");
|
||||
$('.summary-items').html("");
|
||||
$('#sub_total').text("0.00");
|
||||
$('#delivery_fee').text("0.00");
|
||||
@@ -116,20 +206,31 @@ function show_order_detail(url,sr_no){
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
$(".tbl_customer").show();
|
||||
if(data.status != "delivered"){
|
||||
$('#accepted').show();
|
||||
if(data.status != "ready_to_delivery" && data.status != "send_to_kitchen"){
|
||||
$('#cancel').show();
|
||||
}
|
||||
}else{
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
}
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
var item_list = $('.summary-items');
|
||||
|
||||
var newDate = new Date(data.requested_time);
|
||||
var time = timeFormat(newDate);
|
||||
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() > 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
|
||||
// var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
|
||||
var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time;
|
||||
|
||||
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
|
||||
var expDate = new Date(data.expected_waiting_time);
|
||||
var exptime = timeFormat(expDate);
|
||||
var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() > 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() > 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
|
||||
// var expDate = new Date(data.expected_waiting_time);
|
||||
// var exptime = timeFormat(expDate);
|
||||
// var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() >= 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() >= 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
|
||||
$('.expected_time').show();
|
||||
$('#expected_time').text(expected_time? expected_time : '');
|
||||
$('#expected_time').text(data.expected_waiting_time? data.expected_waiting_time : '');
|
||||
}else{
|
||||
$('.expected_time').hide();
|
||||
$('#expected_time').text('');
|
||||
@@ -160,7 +261,8 @@ function show_order_detail(url,sr_no){
|
||||
$("#discount").show();
|
||||
}
|
||||
|
||||
$('#requested_date_time').text(requested_date);
|
||||
//customer info detail
|
||||
// $('#requested_date_time').text(requested_date);
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text((parseFloat(delivery.delivery_fee) > 0)? delivery.delivery_fee : '0.0');
|
||||
$('#total_charges').text((parseFloat(data.convenience_charge) > 0)? data.convenience_charge : '0.0');
|
||||
@@ -184,6 +286,7 @@ function show_order_detail(url,sr_no){
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
$("#trans_ref").text(data.transaction_ref);
|
||||
if(delivery.delivery_type == "service"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}else if(delivery.delivery_type == "pick_up"){
|
||||
@@ -197,11 +300,22 @@ function show_order_detail(url,sr_no){
|
||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||
$("#order_remark").text(data.reservation_remark);
|
||||
}
|
||||
$("#sr_number").text("NO."+sr_no);
|
||||
if (data["receipt_no"]) {
|
||||
$("#contact_info").text(data["receipt_no"]);
|
||||
|
||||
if(data.remark!=null && data.remark!=""){
|
||||
var doemal_remark = data.remark.split("||");
|
||||
var remark = doemal_remark[0] +", "+ doemal_remark[1];
|
||||
$("#remark").text(remark);
|
||||
}else{
|
||||
$("#contact_info").text(data["order_reservation_id"]);
|
||||
$("#remark").text("");
|
||||
}
|
||||
|
||||
//no and order id info
|
||||
$("#sr_number").text("NO."+sr_no);
|
||||
$("#order_status").text(data.status);
|
||||
if (data["receipt_no"]) {
|
||||
$("#invoice_no").text(data["receipt_no"]);
|
||||
}else{
|
||||
$("#invoice_no").text(data["order_reservation_id"]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -211,40 +325,42 @@ function show_order_detail(url,sr_no){
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
function showTimePicker(requested_time){
|
||||
// var date = new Date(requested_time);
|
||||
// var time = timeFormat(date);
|
||||
// console.log(time);
|
||||
$('.timepicker').bootstrapMaterialDatePicker({
|
||||
format: 'HH:mm',
|
||||
useSeconds: false,
|
||||
clearButton: true,
|
||||
date: false
|
||||
});
|
||||
}
|
||||
|
||||
function callback_url(callback,ref_no,order_id,status,time,exptime){
|
||||
function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reason,approved_code){
|
||||
var url = 'order_reservation/update';
|
||||
var post_url = "order_reservation/send_status";
|
||||
var waiting_time = "";
|
||||
var expected_time = "";
|
||||
var type = "";
|
||||
var reject_reason = "";
|
||||
var access_code = "";
|
||||
if(time!=undefined && time!=""){
|
||||
waiting_time = time;
|
||||
}
|
||||
var expected_time = "";
|
||||
if(exptime!=undefined && exptime!=""){
|
||||
expected_time = exptime;
|
||||
}
|
||||
if(min_type!=undefined && min_type!=""){
|
||||
type = min_type;
|
||||
}
|
||||
if(reason!=undefined && reason!=""){
|
||||
reject_reason = reason;
|
||||
}
|
||||
if(approved_code!=undefined && approved_code!=""){
|
||||
access_code = approved_code;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: post_url,
|
||||
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time},
|
||||
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time, min_type: type, reason: reject_reason},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
|
||||
data: {order_id: order_id, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status) {
|
||||
@@ -293,7 +409,14 @@ function showNewOrder(order_reservation){
|
||||
if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){
|
||||
var date = new Date(order_reservation.requested_time);
|
||||
var time = timeFormat(date);
|
||||
var requested_date = date.getFullYear() + '-' + (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() > 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||
//audio play
|
||||
var audio = new Audio('/beep.wav'); // define your audio
|
||||
// setTimeout(function(){
|
||||
// audio.loop = true;
|
||||
audio.play();
|
||||
// },10000);
|
||||
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
@@ -304,4 +427,14 @@ function showNewOrder(order_reservation){
|
||||
allowOutsideClick: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getOrderMonth(month){
|
||||
var MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"];
|
||||
return MONTHS[month];
|
||||
}
|
||||
|
||||
function getOrderDay(day){
|
||||
var DAYS = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
|
||||
return DAYS[day];
|
||||
}
|
||||
@@ -453,6 +453,10 @@ iframe {
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#receipt_pdf {
|
||||
height: 400px;
|
||||
}
|
||||
/* End iframe */
|
||||
|
||||
/* section class for webview */
|
||||
|
||||
Reference in New Issue
Block a user