Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into ui_design
This commit is contained in:
@@ -10,6 +10,7 @@ $(function(){
|
|||||||
|
|
||||||
//show menu item list when click menu category
|
//show menu item list when click menu category
|
||||||
function show_menu_item_list(url_item){
|
function show_menu_item_list(url_item){
|
||||||
|
|
||||||
var menu_list = $('.menu_items_list');
|
var menu_list = $('.menu_items_list');
|
||||||
menu_list.empty();
|
menu_list.empty();
|
||||||
//Start Ajax
|
//Start Ajax
|
||||||
@@ -22,9 +23,31 @@ $(function(){
|
|||||||
var menu_items_list = $('.menu_items_list');
|
var menu_items_list = $('.menu_items_list');
|
||||||
menu_items_list.empty();
|
menu_items_list.empty();
|
||||||
menu_items = data.menu_items;
|
menu_items = data.menu_items;
|
||||||
|
|
||||||
|
|
||||||
for(var field in menu_items) {
|
for(var field in menu_items) {
|
||||||
if (menu_items[field].is_sub_item == false) {
|
if (menu_items[field].is_sub_item == false) {
|
||||||
instances = menu_items[field].instances ;
|
instances = menu_items[field].instances ;
|
||||||
|
qty = 1;
|
||||||
|
options = [];
|
||||||
|
|
||||||
|
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||||
|
fa_plus = '';
|
||||||
|
menu_item_box = 'set_item_box';
|
||||||
|
data_target = 'sx_item_set_detailModal';
|
||||||
|
|
||||||
|
code = menu_items[field].code;
|
||||||
|
name = menu_items[field].name;
|
||||||
|
price = 0;//parseFloat( menu_items[field].price).toFixed(2);
|
||||||
|
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 = 'fa-plus';
|
||||||
|
menu_item_box = 'menu_item_box';
|
||||||
|
data_target = 'sx_item_detailModal';
|
||||||
|
|
||||||
$(instances).each(function(i){
|
$(instances).each(function(i){
|
||||||
if (instances[i].is_default === true) {
|
if (instances[i].is_default === true) {
|
||||||
code = instances[i].code;
|
code = instances[i].code;
|
||||||
@@ -38,17 +61,6 @@ $(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
qty = 1;
|
|
||||||
options = [];
|
|
||||||
|
|
||||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
|
||||||
fa_plus = '';
|
|
||||||
menu_item_box = 'set_item_box';
|
|
||||||
data_target = 'sx_item_set_detailModal';
|
|
||||||
}else{
|
|
||||||
fa_plus = 'fa-plus';
|
|
||||||
menu_item_box = 'menu_item_box';
|
|
||||||
data_target = 'sx_item_detailModal'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_items[field].image) {
|
if (menu_items[field].image) {
|
||||||
@@ -108,6 +120,9 @@ $(function(){
|
|||||||
item_sets = $(this).data('item-sets');
|
item_sets = $(this).data('item-sets');
|
||||||
|
|
||||||
for(var field in item_sets) {
|
for(var field in item_sets) {
|
||||||
|
|
||||||
|
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||||
|
|
||||||
value = item_sets[field]["instances"];
|
value = item_sets[field]["instances"];
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -121,6 +136,8 @@ $(function(){
|
|||||||
+"' data-code='"+result["code"]
|
+"' data-code='"+result["code"]
|
||||||
+"' data-price='"+result["price"]
|
+"' data-price='"+result["price"]
|
||||||
+"' data-option='"+JSON.stringify(result["options"])
|
+"' data-option='"+JSON.stringify(result["options"])
|
||||||
|
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
|
||||||
|
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
|
||||||
+"'>"
|
+"'>"
|
||||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||||
+'<small class="">'+result["name"]+'</small>'
|
+'<small class="">'+result["name"]+'</small>'
|
||||||
@@ -156,9 +173,15 @@ $(function(){
|
|||||||
|
|
||||||
$(".options-list").empty();
|
$(".options-list").empty();
|
||||||
|
|
||||||
|
rowCount = $('.selected-instance');
|
||||||
item_options = $(this).data('option');
|
item_options = $(this).data('option');
|
||||||
|
|
||||||
|
min_qty = $(this).data('min-qty');
|
||||||
|
max_qty = $(this).data('max-qty');
|
||||||
|
|
||||||
code = $(this).data('code');
|
code = $(this).data('code');
|
||||||
|
|
||||||
|
if (rowCount.length+1 <= max_qty) {
|
||||||
for(var field in item_options) {
|
for(var field in item_options) {
|
||||||
value = item_options[field]["values"];
|
value = item_options[field]["values"];
|
||||||
type = item_options[field]["type"];
|
type = item_options[field]["type"];
|
||||||
@@ -170,7 +193,7 @@ $(function(){
|
|||||||
});
|
});
|
||||||
$(".options-list").append(row);
|
$(".options-list").append(row);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if($(this).hasClass('selected-instance') == true){
|
if($(this).hasClass('selected-instance') == true){
|
||||||
sub_total = $('#set_total_price').text();
|
sub_total = $('#set_total_price').text();
|
||||||
name = $(this).data('name');
|
name = $(this).data('name');
|
||||||
@@ -184,7 +207,7 @@ $(function(){
|
|||||||
$(this).removeAttr('data-options');
|
$(this).removeAttr('data-options');
|
||||||
$('#instance_option').text('')
|
$('#instance_option').text('')
|
||||||
}else {
|
}else {
|
||||||
|
if (rowCount.length+1 <= max_qty) {
|
||||||
sub_total = $('#set_total_price').text();
|
sub_total = $('#set_total_price').text();
|
||||||
name = $(this).data('name');
|
name = $(this).data('name');
|
||||||
price = $(this).data('price');
|
price = $(this).data('price');
|
||||||
@@ -194,8 +217,10 @@ $(function(){
|
|||||||
var total_price = +sub_total + +total;
|
var total_price = +sub_total + +total;
|
||||||
$(this).addClass('selected-instance');
|
$(this).addClass('selected-instance');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$('#set_unit_price').text(price);
|
$('#set_unit_price').text(price);
|
||||||
$('#set_total_price').text(total_price);
|
$('#set_total_price').text(total_price);
|
||||||
|
|
||||||
}); //End selecct attribute buttom
|
}); //End selecct attribute buttom
|
||||||
|
|
||||||
// click add order
|
// click add order
|
||||||
@@ -204,9 +229,11 @@ $(function(){
|
|||||||
qty = parseInt($('#set_count').val());
|
qty = parseInt($('#set_count').val());
|
||||||
item_code = $('#set_item_code').text();
|
item_code = $('#set_item_code').text();
|
||||||
item_name = $('#set_name').text();
|
item_name = $('#set_name').text();
|
||||||
|
min_qty = $(this).data('min-qty');
|
||||||
|
|
||||||
var items = $('.selected-instance');
|
var items = $('.selected-instance');
|
||||||
|
|
||||||
|
if (items.length >= min_qty) {
|
||||||
attribute_arr = []
|
attribute_arr = []
|
||||||
option_arr = []
|
option_arr = []
|
||||||
var rowCount = $('.summary-items tbody tr').length+1;
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
@@ -234,6 +261,17 @@ $(function(){
|
|||||||
rowCount = rowCount + 1;
|
rowCount = rowCount + 1;
|
||||||
});
|
});
|
||||||
calculate_sub_total();
|
calculate_sub_total();
|
||||||
|
$(".sx_item_set_detailModal").css({ 'display': "none" });
|
||||||
|
}else{
|
||||||
|
$(".sx_item_set_detailModal").css({ 'display': "block" });
|
||||||
|
$.alert({
|
||||||
|
title: 'Alert!',
|
||||||
|
content: 'Please Select Minimum ' + min_qty + " items",
|
||||||
|
type: 'red',
|
||||||
|
typeAnimated: true,
|
||||||
|
btnClass: 'btn-danger',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}); //End add order Click
|
}); //End add order Click
|
||||||
|
|
||||||
@@ -596,6 +634,9 @@ $(function(){
|
|||||||
$(".item_box").removeAttr("data-active");
|
$(".item_box").removeAttr("data-active");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#sx_item_set_detailModal').on('click','#close', function(){
|
||||||
|
$("#sx_item_set_detailModal").css({ 'display': "none" });
|
||||||
|
});
|
||||||
//click save buttom after change qty
|
//click save buttom after change qty
|
||||||
$('#sx_itemModal').on('click','#save', function(){
|
$('#sx_itemModal').on('click','#save', function(){
|
||||||
summary_items_filter();
|
summary_items_filter();
|
||||||
|
|||||||
@@ -82,3 +82,15 @@
|
|||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
z-index: 1101;
|
z-index: 1101;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
margin: 0px auto;
|
||||||
|
width: 480px;
|
||||||
|
height: 375px;
|
||||||
|
|
||||||
|
}
|
||||||
|
#videoElement {
|
||||||
|
width: 480px;
|
||||||
|
height: 375px;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def detail
|
def detail
|
||||||
@menu = MenuCategory.all
|
@menu = MenuCategory.all.active
|
||||||
@table_id = params[:id]
|
@table_id = params[:id]
|
||||||
@table = DiningFacility.find(@table_id)
|
@table = DiningFacility.find(@table_id)
|
||||||
@booking = @table.get_booking
|
@booking = @table.get_booking
|
||||||
@@ -36,6 +36,7 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
if (params[:id])
|
if (params[:id])
|
||||||
#Pull this menu
|
#Pull this menu
|
||||||
@menu = MenuCategory.find_by_id(params[:id])
|
@menu = MenuCategory.find_by_id(params[:id])
|
||||||
|
puts @menu.menu_items[1].item_attributes.to_json
|
||||||
return @menu
|
return @menu
|
||||||
else
|
else
|
||||||
MenuCategory.current_menu
|
MenuCategory.current_menu
|
||||||
|
|||||||
@@ -125,7 +125,8 @@ class Settings::SetMenuItemsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_settings_item_attribute
|
def set_settings_item_attribute
|
||||||
@item_attributes = MenuItemAttribute.all.order("id asc").map{|a| [a.name, a.value]}
|
@item_attributes = MenuItemAttribute.all.order("id asc")#.map{|a| [a.name, a.value]}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_settings_item_option
|
def set_settings_item_option
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class MenuCategory < ApplicationRecord
|
|||||||
validates_presence_of :name, :menu, :order_by
|
validates_presence_of :name, :menu, :order_by
|
||||||
|
|
||||||
default_scope { order('order_by asc') }
|
default_scope { order('order_by asc') }
|
||||||
|
scope :active, -> {where("is_available = 1")}
|
||||||
|
|
||||||
def self.destroyCategory(menu_category)
|
def self.destroyCategory(menu_category)
|
||||||
# find the sub menu item of current item
|
# find the sub menu item of current item
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Promotion < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.is_between_promo_datetime(current_day,current_time) #database is not local time
|
def self.is_between_promo_datetime(current_day,current_time) #database is not local time
|
||||||
promoList = Promotion.where("(Date_Format(promo_start_date, 'YYYY-MM-DD') <=? AND Date_Format(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
|
promoList = Promotion.where("(Date_Format(promo_start_date, '%Y-%m-%d') <=? AND Date_Format(promo_end_date, '%Y-%m-%d') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
|
||||||
return promoList
|
return promoList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -92,9 +92,12 @@ json.options opt_format
|
|||||||
json.instances item.menu_item_instances do |is|
|
json.instances item.menu_item_instances do |is|
|
||||||
# Convert id to name for attributes
|
# Convert id to name for attributes
|
||||||
instance_attr = []
|
instance_attr = []
|
||||||
|
|
||||||
is.item_attributes.each do |ia|
|
is.item_attributes.each do |ia|
|
||||||
# mItemAttr = MenuItemAttribute.find(is)
|
# mItemAttr = MenuItemAttribute.find(is)
|
||||||
instance_attr.push(ia)
|
# instance_attr.push(ia)
|
||||||
|
mItemAttr = MenuItemAttribute.find(ia).name
|
||||||
|
instance_attr.push(mItemAttr)
|
||||||
end
|
end
|
||||||
|
|
||||||
json.id is.id
|
json.id is.id
|
||||||
|
|||||||
@@ -138,7 +138,29 @@
|
|||||||
<div id="sxModal">
|
<div id="sxModal">
|
||||||
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- The modal -->
|
||||||
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modalLabelLarge" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" style="margin-left:-380px">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<!-- <div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title" id="modalLabelLarge">Large Shoes</h4>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
<div id="container">
|
||||||
|
<video autoplay="true" id="videoElement">
|
||||||
|
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
// Read Card Reader
|
// Read Card Reader
|
||||||
|
|||||||
@@ -33,6 +33,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<button id="member_acc_no" class="btn btn-success btn-md"><span class="fa fa-credit-card"></span> Member Card</button>
|
<button id="member_acc_no" class="btn btn-success btn-md"><span class="fa fa-credit-card"></span> Member Card</button>
|
||||||
|
<button id="qr_code" class="btn btn-danger btn-md">
|
||||||
|
<span class="fa fa-credit-card"></span> QR CODE
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -91,6 +96,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
$('.datepicker').datepicker({
|
$('.datepicker').datepicker({
|
||||||
format : 'dd-mm-yyyy',
|
format : 'dd-mm-yyyy',
|
||||||
autoclose: true
|
autoclose: true
|
||||||
@@ -108,6 +114,27 @@ $(function() {
|
|||||||
$("#filter_form").submit();
|
$("#filter_form").submit();
|
||||||
},100);
|
},100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// QR Code Reader
|
||||||
|
$("#qr_code").on('click', function(e){
|
||||||
|
var code = "";
|
||||||
|
setTimeout(function(){
|
||||||
|
var hi=getQRCode();
|
||||||
|
alert(hi);
|
||||||
|
},100);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Read qrcode from java
|
||||||
|
function getQRCode(){
|
||||||
|
return code2lab.readQRCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get QRCode from Java
|
||||||
|
function setQRCode(code){
|
||||||
|
$("#qr_code").text(code);
|
||||||
|
$("#search").val(code);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click',".customer_tr",function(){
|
$(document).on('click',".customer_tr",function(){
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<div class="modal-dialog custom-modal-dialog" role="document">
|
<div class="modal-dialog custom-modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h4 class="modal-title"></h4>
|
<h4 class="modal-title"></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -97,12 +97,12 @@
|
|||||||
|
|
||||||
<!-- Menu Item modal -->
|
<!-- Menu Item modal -->
|
||||||
|
|
||||||
<div class="item-modal modal sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
<div class="item-modal modal sx_item_detailModal" id="sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog custom-modal-dialog modal-lg">
|
<div class="modal-dialog custom-modal-dialog modal-lg">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" style="background-color: #54A5AF;">
|
<div class="modal-header" style="background-color: #54A5AF;">
|
||||||
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
|
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -159,12 +159,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Large modal -->
|
<!-- Large modal -->
|
||||||
<div class=" modal sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
|
<div class=" modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
|
||||||
<div class="modal-dialog custom-modal-dialog modal-lg">
|
<div class="modal-dialog custom-modal-dialog modal-lg">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" style="background-color: #54A5AF;">
|
<div class="modal-header" style="background-color: #54A5AF;">
|
||||||
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
|
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -197,7 +197,7 @@
|
|||||||
<p class="hidden" id="set_item_instances"></p>
|
<p class="hidden" id="set_item_instances"></p>
|
||||||
<p class="hidden" id="set_item_code"></p>
|
<p class="hidden" id="set_item_code"></p>
|
||||||
<p></p>
|
<p></p>
|
||||||
<br><br><br><br>
|
|
||||||
<div class="options-list">
|
<div class="options-list">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
if @menu.menu_items
|
if @menu.menu_items
|
||||||
json.menu_items @menu.menu_items do |item|
|
json.menu_items @menu.menu_items do |item|
|
||||||
|
if item.is_available
|
||||||
json.partial! 'origami/addorders/menu_item', item: item
|
json.partial! 'origami/addorders/menu_item', item: item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#redeem").click(function(){
|
$("#redeem").click(function(){
|
||||||
valid_amount = $("#valid_amount").val();
|
valid_amount = $("#valid_amount").val();
|
||||||
sale_id = $("#valid_amount").attr('data-value');
|
sale_id = $("#valid_amount").attr('data-value');
|
||||||
|
|||||||
Reference in New Issue
Block a user