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)!='[]') { if (JSON.stringify(menu_items[field].item_sets)!='[]') {
fa_plus = ''; fa_plus = '';
add = ''; add = '';
menu_item_box = 'add_icon'; menu_item_box = 'set_add_icon';
data_target = 'sx_item_set_detailModal'; data_target = 'sx_item_set_detailModal';
data_modal = 'modal' data_modal = 'modal'
add_icon = "set_item_box" add_icon = "set_item_box"

View File

@@ -19,33 +19,34 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
}); });
// alert(order_lists); // alert(order_lists);
swal({ // swal({
title: 'Information', // title: 'Information',
target: document.getElementById(shop_code+"_notify_new_order"), // target: document.getElementById(shop_code+"_notify_new_order"),
text: "You have new orders <br/>"+ // text: "You have new orders <br/>"+
"Are you accept or reject for these orders <b>"+order_lists+"</b>?", // "Are you accept or reject for these orders <b>"+order_lists+"</b>?",
type: 'success', // type: 'success',
html: true, // html: true,
closeOnConfirm: false, // closeOnConfirm: false,
closeOnCancel: false, // closeOnCancel: false,
allowOutsideClick: false // allowOutsideClick: false
}, function (isConfirm) { // }, function (isConfirm) {
if(isConfirm){ // if(isConfirm){
swal.close(); // swal.close();
}
});
// $("#notify_new_order_lists").text(order_lists);
// if($("#notify_new_order").hasClass("hidden")){
// $("#notify_new_order").removeClass("hidden");
// } // }
// $("#notify_new_order").on('show.bs.modal', function(e){ // });
// $("#notify_order_send_to_kitchen").addClass("hidden"); $("#notify_new_order_lists").text(order_lists);
// $("#notify_order_ready_to_delivery").addClass("hidden"); // if($("#notify_new_order").hasClass("hidden")){
// }).on('shown.bs.modal', function(e){ $("#notify_new_order").removeClass("hidden");
// $("#notify_new_order").focus(); // }
// }).on('hide.bs.modal', function (e) { $("#notify_new_order").on('shown.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden"); $(document).off('focusin.modal');
// }).modal({show: true, keyboard: false, backdrop: false}); $("#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); // alert(order_lists);
swal({ // swal({
title: 'Information', // title: 'Information',
target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"), // target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"),
text: "You have orders that are ready to deliver <br/>"+ // text: "You have orders that are ready to deliver <br/>"+
"Could you ready these orders <b>"+order_lists+"</b> to deliver?", // "Could you ready these orders <b>"+order_lists+"</b> to deliver?",
type: 'success', // type: 'success',
html: true, // html: true,
closeOnConfirm: false, // closeOnConfirm: false,
closeOnCancel: false, // closeOnCancel: false,
allowOutsideClick: false // allowOutsideClick: false
}, function (isConfirm) { // }, function (isConfirm) {
if(isConfirm){ // if(isConfirm){
swal.close(); // 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").on('shown.bs.modal', function(e){ // });
// $("#notify_new_order").addClass("hidden"); $("#notify_order_ready_to_delivery_lists").text(order_lists);
// $("#notify_order_send_to_kitchen").addClass("hidden"); // if($("#notify_order_ready_to_delivery").hasClass("hidden")){
// }).on('shown.bs.modal', function(e){ $("#notify_order_ready_to_delivery").removeClass("hidden");
// $("#notify_order_ready_to_delivery").focus(); // }
// }).on('hide.bs.modal', function (e) { $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
// $("#notify_order_ready_to_delivery").addClass("hidden"); // $(document).off('focusin.modal');
// }).modal({show: true, keyboard: false, backdrop: false}); $("#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); // alert(order_lists);
swal({ // swal({
title: 'Information', // title: 'Information',
target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"), // target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"),
text: "You have to send order to kitchen <br/>"+ // text: "You have to send order to kitchen <br/>"+
"Could you send these orders <b>"+order_lists+"</b> to kitchen?", // "Could you send these orders <b>"+order_lists+"</b> to kitchen?",
type: 'success', // type: 'success',
html: true, // html: true,
closeOnConfirm: false, // closeOnConfirm: false,
closeOnCancel: false, // closeOnCancel: false,
allowOutsideClick: false // allowOutsideClick: false
}, function (isConfirm) { // }, function (isConfirm) {
if(isConfirm){ // if(isConfirm){
swal.close(); // 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").on('show.bs.modal', function(e){ // });
// $("#notify_new_order").addClass("hidden"); $("#notify_order_send_to_kitchen_lists").text(order_lists);
// $("#notify_order_ready_to_delivery").addClass("hidden"); // if($("#notify_order_send_to_kitchen").hasClass("hidden")){
// }).on('shown.bs.modal', function(e){ $("#notify_order_send_to_kitchen").removeClass("hidden");
// $("#notify_order_send_to_kitchen").focus(); // }
// }).on('hide.bs.modal', function (e) { $("#notify_order_send_to_kitchen").on('shown.bs.modal', function(e){
// $("#notify_order_send_to_kitchen").addClass("hidden"); // $(document).off('focusin.modal');
// }).modal({show: true, keyboard: false, backdrop: false}); $("#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'); }); // $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $(".new_order_close").on("click",function(){ // $(".new_order_close").on("click",function(){
@@ -473,36 +474,36 @@ function showNewOrder(order_reservation,shop_code){
audio.play(); audio.play();
// },10000); // },10000);
// $("#new_order").text(order_reservation.order_reservation_id); $("#new_order").text(order_reservation.order_reservation_id);
// $("#new_order_date").text(requested_date); $("#new_order_date").text(requested_date);
// if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){ // 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){ $("#"+shop_code+"_doemal_new_order").on('shown.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden"); // $(document).off('focusin.modal');
// $("#notify_order_send_to_kitchen").addClass("hidden"); $("#"+shop_code+"_doemal_new_order").focus();
// $("#notify_order_ready_to_delivery").addClass("hidden"); $("#notify_new_order").addClass("hidden");
// }).on('shown.bs.modal', function(e){ $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#"+shop_code+"_doemal_new_order").focus(); $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('hide.bs.modal', function (e) { }).on('hide.bs.modal', function (e) {
// $("#"+shop_code+"_doemal_new_order").addClass("hidden"); $("#"+shop_code+"_doemal_new_order").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false}); }).modal({show: true, keyboard: false, backdrop: false});
swal({ // swal({
title: 'Information', // title: 'Information',
target: document.getElementById(shop_code+"_notify_new_order"), // target: document.getElementById(shop_code+"_notify_new_order"),
text: "You have new order "+ // text: "You have new order "+
"<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?", // "<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
type: 'success', // type: 'success',
html: true, // html: true,
closeOnConfirm: false, // closeOnConfirm: false,
closeOnCancel: false, // closeOnCancel: false,
allowOutsideClick: false // allowOutsideClick: false
}, function (isConfirm) { // }, function (isConfirm) {
if(isConfirm){ // if(isConfirm){
audio.pause(); // audio.pause();
swal.close(); // swal.close();
} // }
}); // });
} }
} }

View File

@@ -271,3 +271,7 @@ i.logout_icon{
.border-left{ .border-left{
border-left:1px solid #fff; border-left:1px solid #fff;
} }
.set_add_icon{
display:none;
}

View File

@@ -155,6 +155,7 @@ class Menu < ApplicationRecord
# Menu Item Attributes # Menu Item Attributes
item_attrs = [] item_attrs = []
if !row["Attributes"].nil?
attributes = row["Attributes"].split(',') attributes = row["Attributes"].split(',')
attributes.each do |attr| attributes.each do |attr|
attribute = MenuItemAttribute.find_by_name(attr) attribute = MenuItemAttribute.find_by_name(attr)
@@ -163,9 +164,11 @@ class Menu < ApplicationRecord
end end
item_attrs.push(attribute.id) item_attrs.push(attribute.id)
end end
end
# Menu Item Options # Menu Item Options
item_opts = [] item_opts = []
if !row["Options"].nil?
options = row["Options"].split(',') options = row["Options"].split(',')
options.each do |opt| options.each do |opt|
option = MenuItemOption.find_by_name(opt) option = MenuItemOption.find_by_name(opt)
@@ -174,6 +177,7 @@ class Menu < ApplicationRecord
end end
item_opts.push(option.id) item_opts.push(option.id)
end end
end
menu_itm = MenuItem.find_by_item_code(row["Item Code"]) menu_itm = MenuItem.find_by_item_code(row["Item Code"])
if !menu_itm if !menu_itm
@@ -189,7 +193,11 @@ class Menu < ApplicationRecord
menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"]) menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"])
if !menu_inst 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 # else
# status = status + "Instance Code already exists for " + row["Instance Name"] + "." # status = status + "Instance Code already exists for " + row["Instance Name"] + "."
end end

View File

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

View File

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

View File

@@ -1010,7 +1010,13 @@
$('#add_order').on('click', function () { $('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>"; 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; window.location.href = '/origami/addorders/' + dining_id;
}); });

View File

@@ -463,11 +463,10 @@
</div> </div>
</div> </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_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_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> </div>
<p id="ref_no" class="hidden"></p> <p id="ref_no" class="hidden"></p>
@@ -584,7 +583,8 @@
</div> </div>
</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-dialog modal-md" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@@ -598,7 +598,7 @@
<div class="modal-footer "> <div class="modal-footer ">
<div class="row p-r-20"> <div class="row p-r-20">
<div class="col-md-5"> <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> </div>
</div> </div>
@@ -620,7 +620,7 @@
<div class="modal-footer "> <div class="modal-footer ">
<div class="row p-r-20"> <div class="row p-r-20">
<div class="col-md-5"> <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>
@@ -642,7 +642,7 @@
<div class="modal-footer "> <div class="modal-footer ">
<div class="row p-r-20"> <div class="row p-r-20">
<div class="col-md-5"> <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>
@@ -664,11 +664,11 @@
<div class="modal-footer "> <div class="modal-footer ">
<div class="row p-r-20"> <div class="row p-r-20">
<div class="col-md-5"> <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>
</div> </div>
</div> </div>
</div> --> </div>

View File

@@ -633,33 +633,33 @@ var customer_name = "<%= @customer.name %>";
$('#pay').click(function() { $('#pay').click(function() {
sub_total = $('#sub-total').text(); 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"); 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"); 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"); 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"); 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"); swal("Oops","Please Pay with Master Payment","warning");
} }
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){ else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with UNIONPAY Payment","warning"); 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"); 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"); swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
} }
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){ else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Credit Payment","warning"); 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"); 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"); swal("Oops","Please Pay with Dinga Payment","warning");
}else{ }else{

View File

@@ -55,5 +55,5 @@ Rails.application.configure do
config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Set Cable URL # 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 end

BIN
public/AC-beep.mp3 Normal file

Binary file not shown.