Pull from master

This commit is contained in:
San Wai Lwin
2018-05-14 16:00:31 +06:30
parent 11bae95ac6
commit 916dbf2cd3
14 changed files with 173 additions and 139 deletions

View File

@@ -1373,7 +1373,7 @@ $(function() {
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
fa_plus = '';
add = '';
menu_item_box = 'add_icon';
menu_item_box = 'set_add_icon';
data_target = 'sx_item_set_detailModal';
data_modal = 'modal'
add_icon = "set_item_box"

View File

@@ -19,33 +19,34 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
});
// alert(order_lists);
swal({
title: 'Information',
target: document.getElementById(shop_code+"_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);
// swal({
// title: 'Information',
// target: document.getElementById(shop_code+"_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);
// if($("#notify_new_order").hasClass("hidden")){
// $("#notify_new_order").removeClass("hidden");
$("#notify_new_order").removeClass("hidden");
// }
// $("#notify_new_order").on('show.bs.modal', function(e){
// $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_new_order").focus();
// }).on('hide.bs.modal', function (e) {
// $("#notify_new_order").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
$("#notify_new_order").on('shown.bs.modal', function(e){
$(document).off('focusin.modal');
$("#notify_new_order").focus();
$("#"+shop_code+"_doemal_new_order").addClass("hidden");
$("#notify_order_send_to_kitchen").addClass("hidden");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).on('hide.bs.modal', function (e) {
$("#notify_new_order").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -19,33 +19,34 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
});
// alert(order_lists);
swal({
title: 'Information',
target: document.getElementById(shop_code+"_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);
// swal({
// title: 'Information',
// target: document.getElementById(shop_code+"_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);
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
// $("#notify_order_ready_to_delivery").removeClass("hidden");
$("#notify_order_ready_to_delivery").removeClass("hidden");
// }
// $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_send_to_kitchen").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_order_ready_to_delivery").focus();
// }).on('hide.bs.modal', function (e) {
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
$("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
// $(document).off('focusin.modal');
$("#notify_order_ready_to_delivery").focus();
$("#"+shop_code+"_doemal_new_order").addClass("hidden");
$("#notify_new_order").addClass("hidden");
$("#notify_order_send_to_kitchen").addClass("hidden");
}).on('hide.bs.modal', function (e) {
$("#notify_order_ready_to_delivery").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -19,33 +19,34 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
});
// alert(order_lists);
swal({
title: 'Information',
target: document.getElementById(shop_code+"_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);
// swal({
// title: 'Information',
// target: document.getElementById(shop_code+"_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);
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
// $("#notify_order_send_to_kitchen").removeClass("hidden");
$("#notify_order_send_to_kitchen").removeClass("hidden");
// }
// $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_order_send_to_kitchen").focus();
// }).on('hide.bs.modal', function (e) {
// $("#notify_order_send_to_kitchen").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
$("#notify_order_send_to_kitchen").on('shown.bs.modal', function(e){
// $(document).off('focusin.modal');
$("#notify_order_send_to_kitchen").focus();
$("#"+shop_code+"_doemal_new_order").addClass("hidden");
$("#notify_new_order").addClass("hidden");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).on('hide.bs.modal', function (e) {
$("#notify_order_send_to_kitchen").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -157,6 +157,7 @@ $(function() {
}
});
// $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $(".new_order_close").on("click",function(){
@@ -473,36 +474,36 @@ function showNewOrder(order_reservation,shop_code){
audio.play();
// },10000);
// $("#new_order").text(order_reservation.order_reservation_id);
// $("#new_order_date").text(requested_date);
$("#new_order").text(order_reservation.order_reservation_id);
$("#new_order_date").text(requested_date);
// if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
// $("#"+shop_code+"_doemal_new_order").removeClass("hidden");
$("#"+shop_code+"_doemal_new_order").removeClass("hidden");
// }
// $("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#"+shop_code+"_doemal_new_order").focus();
// }).on('hide.bs.modal', function (e) {
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
swal({
title: 'Information',
target: document.getElementById(shop_code+"_notify_new_order"),
text: "You have new order "+
"<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function (isConfirm) {
if(isConfirm){
audio.pause();
swal.close();
}
});
$("#"+shop_code+"_doemal_new_order").on('shown.bs.modal', function(e){
// $(document).off('focusin.modal');
$("#"+shop_code+"_doemal_new_order").focus();
$("#notify_new_order").addClass("hidden");
$("#notify_order_send_to_kitchen").addClass("hidden");
$("#notify_order_ready_to_delivery").addClass("hidden");
}).on('hide.bs.modal', function (e) {
$("#"+shop_code+"_doemal_new_order").addClass("hidden");
}).modal({show: true, keyboard: false, backdrop: false});
// swal({
// title: 'Information',
// target: document.getElementById(shop_code+"_notify_new_order"),
// text: "You have new order "+
// "<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
// type: 'success',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function (isConfirm) {
// if(isConfirm){
// audio.pause();
// swal.close();
// }
// });
}
}

View File

@@ -270,4 +270,8 @@ i.logout_icon{
.border-left{
border-left:1px solid #fff;
}
.set_add_icon{
display:none;
}

View File

@@ -155,24 +155,28 @@ class Menu < ApplicationRecord
# Menu Item Attributes
item_attrs = []
attributes = row["Attributes"].split(',')
attributes.each do |attr|
attribute = MenuItemAttribute.find_by_name(attr)
if attribute.nil?
attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase })
if !row["Attributes"].nil?
attributes = row["Attributes"].split(',')
attributes.each do |attr|
attribute = MenuItemAttribute.find_by_name(attr)
if attribute.nil?
attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase })
end
item_attrs.push(attribute.id)
end
item_attrs.push(attribute.id)
end
# Menu Item Options
item_opts = []
if !row["Options"].nil?
options = row["Options"].split(',')
options.each do |opt|
option = MenuItemOption.find_by_name(opt)
if option.nil?
option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase })
options.each do |opt|
option = MenuItemOption.find_by_name(opt)
if option.nil?
option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase })
end
item_opts.push(option.id)
end
item_opts.push(option.id)
end
menu_itm = MenuItem.find_by_item_code(row["Item Code"])
@@ -189,7 +193,11 @@ class Menu < ApplicationRecord
menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"])
if !menu_inst
imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: row["Instance Name"], item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"])
instance_name = ''
if !row["Instance Name"].nil?
instance_name = row["Instance Name"]
end
imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: instance_name, item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"])
# else
# status = status + "Instance Code already exists for " + row["Instance Name"] + "."
end

View File

@@ -17,7 +17,7 @@
<span class="main_menu" id="main_menu menu_name" >
<%if @menu.present? %>
<%=menu[0].name%>
<%=@menus[0].name%>
<% end%>
</span>
</a>

View File

@@ -1,4 +1,7 @@
<div class="container-fluid">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
<div class="block-header">
<!-- <h2><%= t :dashboard %></h2> -->
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
@@ -208,23 +211,32 @@
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<script>
$(function() {
$( "#loading_wrapper").show();
$.ajax({
type: "GET",
url: 'get_all_menu',
data: {},
success:function(result){
localStorage.setItem("menus", JSON.stringify(result));
var menu = localStorage.getItem("menus");
if (menu != null ) {
$( "#loading_wrapper").hide();
}
}
});
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
});
$(".qs_view").on('click', function() {
if ($('#server_mode').val() != "cloud") {
if ($('#server_mode').val() != "cloud") {
document.getElementById('second_view').click();
}
}
window.location.href = '/origami/quick_service';
});

View File

@@ -1010,7 +1010,13 @@
$('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>";
var menus = JSON.parse(localStorage.getItem("menus"));
// if (menus != null) {
// console.log("menu");
// menu_cache_append(menus);
// }else{
// $("#menu_data").removeClass("hidden");
// }
window.location.href = '/origami/addorders/' + dining_id;
});

View File

@@ -463,11 +463,10 @@
</div>
</div>
</div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order"></div>
<!-- <div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_new_order"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div> -->
</div>
<p id="ref_no" class="hidden"></p>
@@ -584,7 +583,8 @@
</div>
</div>
<!-- <div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order" tabindex="-1" role="dialog">
<div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order" tabindex="-1" role="dialog">
>>>>>>> 8fda04372d3c2d7255bbd4c14ed3b3c8d9f5937e
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
@@ -598,7 +598,7 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect new_order_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue new_order_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>"data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
@@ -620,7 +620,7 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
@@ -642,7 +642,7 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
@@ -664,11 +664,11 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div> -->
</div>

View File

@@ -633,33 +633,33 @@ var customer_name = "<%= @customer.name %>";
$('#pay').click(function() {
sub_total = $('#sub-total').text();
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(payment_type == "Alipay" && $('#alipaycount').text()==0 && sub_total != 0.0){
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Alipay Payment","warning");
}
else if(payment_type == "JUNCTIONPAY" && $('#junctionpaycount').text()==0 && sub_total != 0.0){
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Credit Payment","warning");
}else if(payment_type == "PAYMAL" && $('#paymalcount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Paymal Payment","warning");
}else if(payment_type == "DINGA" && $('#dingacount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Dinga Payment","warning");
}else{

View File

@@ -55,5 +55,5 @@ Rails.application.configure do
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Set Cable URL
config.action_cable.url = "ws://192.168.1.196:3002/cable"
# config.action_cable.url = "ws://192.168.1.196:3002/cable"
end

BIN
public/AC-beep.mp3 Normal file

Binary file not shown.