Merge branch 'sqa-1804-001' of bitbucket.org:code2lab/sxrestaurant into r-1804001-01

This commit is contained in:
phyusin
2018-05-14 17:05:23 +06:30
25 changed files with 328 additions and 183 deletions

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>
@@ -650,11 +650,58 @@
$(document).on('click', '.menu_click', function(event){
var menu_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var url = "get_menu/"+menu_id;
show_menu_cat_list(name, url);
var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
menu_click_cache_append(name,menus,menu_id);
}else{
var url = "get_menu/"+menu_id;
show_menu_cat_list(name, url);
}
});
//End menu category Click
function menu_click_cache_append(name,menus,menu_id) {
var menu_list = $('.menu_items_list');
menu_list.empty();
var menu_cat = $('.category_list');
menu_cat.empty();
$(".main_menu").text(name);
for(var i in menus) {
console.log(menus)
console.log(menus[i]["id"]);
console.log(menus[i]["is_active"]);
console.log(menu_id);
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
// menu_list_template(menus[i]);
var category = menus[i]["categories"];
for(var ii in category) {
if (category[ii]["is_available"]== true){
if (category[ii]["valid_time"]== true){
if (category[ii]["parent_id"] == null ){
if(type){
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}
}else{
if ($("#table_get_current").text()) {
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}else {
category_list_template(category[ii]);
}
}
}
}
}
}
}
}
}
}
//show menu item list when click menu category
function show_menu_cat_list(name, url_item){
var menu_list = $('.menu_items_list');
@@ -663,15 +710,18 @@
var menu_cat = $('.category_list');
menu_cat.empty();
$(".main_menu").text(name)
if (modify_order=="true" && type =="true") {
$(".main_menu").text(name);
cashier_type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
if (cashier_type != -1 && modify_order != -1) {
url_item = '../../../addorders/'+url_item;
}if(modify_order=="false" && type =="true"){
url_item = 'addorders/'+url_item
}else{
url_item = url_item;
}
if(modify_order == -1 && cashier_type != -1){
url_item = 'addorders/'+url_item
}
if (cashier_type ==-1 && modify_order == -1){
url_item = url_item;
}
//Start Ajax
$.ajax({
type: "GET",
@@ -679,10 +729,8 @@
data: {},
dataType: "json",
success: function(data) {
for(var i in data) {
if (data[i].is_available == true) {
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
+' <div class="card-block custom-card-block">'
+' <p>'+ data[i].name +'<p>'

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,7 @@
</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">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
@@ -598,7 +597,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>
@@ -606,7 +605,7 @@
</div>
</div>
<div class="modal fade text-center" id="notify_new_order" tabindex="-1" role="dialog">
<div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
@@ -620,7 +619,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 notify_new_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
@@ -628,7 +627,7 @@
</div>
</div>
<div class="modal fade text-center" id="notify_order_send_to_kitchen" tabindex="-1" role="dialog">
<div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
@@ -642,7 +641,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 notify_order_send_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
@@ -650,7 +649,7 @@
</div>
</div>
<div class="modal fade text-center" id="notify_order_ready_to_delivery" tabindex="-1" role="dialog">
<div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
@@ -664,11 +663,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 notify_order_ready_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" 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

@@ -24,7 +24,7 @@
<span style='font-size:20px;'><b><%= t :closing_balance %></b></span>
</div>
<div class='col-md-6'>
<span style='font-size:20px;'><b><input type='text' class="form-control" id='closing_balance_amount' value=''></b></span>
<span style='font-size:20px;'><b><input type='number' class="form-control" id='closing_balance_amount' value='' onkeypress="return isNumberKey(event);" onkeyup="notNegative(this.value);"></b></span>
</div>
</div>
</div>
@@ -58,6 +58,20 @@
</div>
</div>
<script>
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
} else {
return true;
}
}
function greaterThanOne(val){
if(parseInt(val)==0) $("#closing_balance_amount").val(1);
}
var cashier_type = '<%= @cashier_type %>';
$('#close_cashier').on('click',function(){
var amount = $('#closing_balance_amount').val();