remove confilct data

This commit is contained in:
phyusin
2018-05-14 10:17:26 +06:30
115 changed files with 5075 additions and 2409 deletions

View File

@@ -8,5 +8,7 @@ COPY Gemfile /sxrestaurant/Gemfile
COPY Gemfile.lock /sxrestaurant/Gemfile.lock COPY Gemfile.lock /sxrestaurant/Gemfile.lock
RUN bundle install --without development test RUN bundle install --without development test
RUN bundle exec rails assets:precompile RUN bundle exec rails assets:precompile
RUN echo "Asia/Rangoon" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
COPY . /sxrestaurant COPY . /sxrestaurant

View File

@@ -188,6 +188,10 @@ Add Base URL for DOEMAL
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' } 1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' } 2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
Add Feature for Dine-in Cashier
** '0' means can not use dine-in cashier and '1' means can use dine-in cashier **
=> settings/lookups => { type:dinein_cashier, name: DineInCashier, value:'{0 or 1}' }
Add Feature for Quick Service Add Feature for Quick Service
** '0' means can not use quick service and '1' means can use quick service ** ** '0' means can not use quick service and '1' means can use quick service **
=> settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' } => settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' }

View File

@@ -33,9 +33,25 @@ $(document).on('turbolinks:load', function() {
$(".tables").on("click", function(){ $(".tables").on("click", function(){
var table_id = $(this).val(); active = $(this).hasClass('selected-table');
$('#table_id').val(table_id); if (active) {
oqs_id = $("#oqs_id").val(); $(this).removeClass('bg-blue');
$(this).addClass('green');
$(this).removeClass('selected-table');
}else{
$(this).removeClass('green');
$(this).addClass('bg-blue');
$(this).addClass('selected-table');
}
var list = document.getElementsByClassName('selected-table');
var i;
var table_id =[];
for (i = 0; i < list.length; i++) {
table_id.push(list[i].value);
}
$('#table_id').val(table_id);
oqs_id = $("#oqs_id").val();
if (table_id){ if (table_id){
var table = table_id var table = table_id
}else{ }else{

View File

@@ -1,7 +1,9 @@
$(function() { $(function() {
var role = $('#role').val(); var role = $('#role').val();
type = window.location.href.indexOf("quick_service"); type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order"); modify_order = window.location.href.indexOf("modify_order");
//click menu sidebar menu category //click menu sidebar menu category
$(".product").on("click", function(){ $(".product").on("click", function(){
var url = $(this).attr('data-ref'); var url = $(this).attr('data-ref');
@@ -62,8 +64,8 @@ $(function() {
+JSON.stringify(item_attributes)+"' data-id = '" +JSON.stringify(item_attributes)+"' data-id = '"
+JSON.stringify(item_attributes)+"' data-item = '" +JSON.stringify(item_attributes)+"' data-item = '"
+JSON.stringify(item_attributes)+"' data-option = '" +JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(menu_items[field].options)+"'data-opt = '" +JSON.stringify(product[field].options)+"'data-opt = '"
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '" +JSON.stringify(product[field].options)+"' data-item-sets = '"
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>" +JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
+"<i class='fa fa-bars material-icons'>" +"<i class='fa fa-bars material-icons'>"
+'view_list</i>' +'view_list</i>'
@@ -76,8 +78,8 @@ $(function() {
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '" + product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '" + product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '" + JSON.stringify(item_attributes) +"' data-options = '"
+ JSON.stringify(menu_items[field].options) +"' data-opt = '" + JSON.stringify(product[field].options) +"' data-opt = '"
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"'>" + JSON.stringify(product[field].options) +"' data-image='"+image_path+"'>"
// +"<div class='card-block custom-card-block'>" // +"<div class='card-block custom-card-block'>"
// +"<img id='logo' height='125px' src='"+image_path+"'>" // +"<img id='logo' height='125px' src='"+image_path+"'>"
@@ -96,162 +98,78 @@ $(function() {
} }
//end show list function //end show list function
//click menu sidebar menu category //click menu sidebar menu category
$(document).on('click', '.menu_category', function(event){ $(document).on('click', '.menu_category', function(e){
event.preventDefault(); e.preventDefault();
$('.sub_category_list').addClass("hidden");
var menu_id = $(this).attr("data-id"); var menu_id = $(this).attr("data-id");
var url = "get_menu_category/"+menu_id; var url = "get_menu_category/"+menu_id;
show_menu_item_list(url); show_menu_item_list(url,menu_id);
var sub_id = $(this).attr("data-sub-id"); var sub_id = $(this).attr("data-sub-id");
if (sub_id == "true") { if (sub_id == "true") {
var sub_url = "get_menu_sub_category/"+menu_id; var sub_url = "get_menu_sub_category/"+menu_id;
sub_category = $(this).find('.sub_category_list'); sub_category = $(this).siblings('.sub_category_list');
show_sub_category_list(sub_url,sub_category); 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 //End menu category Click
//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,menu_id){
var menu_list = $('.menu_items_list'); var menu_list = $('.menu_items_list');
menu_list.empty(); menu_list.empty();
type = window.location.href.indexOf("quick_service"); menus = JSON.parse(localStorage.getItem("menus"));
modify_order = window.location.href.indexOf("modify_order"); if (menus != null) {
if (type != -1 && modify_order != -1) { for(var i in menus) {
url_item = '../../../addorders/'+url_item; var categories = menus[i]["categories"];
}if(modify_order == -1 && type != -1){ for(var ii in categories) {
url_item = 'addorders/'+url_item; if (categories[ii]["id"] == menu_id) {
} var menu_items = categories[ii]["items"];
if (type ==-1 && modify_order == -1){ show_menu_list(menu_items);
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
} }
//end is_sub_item false
} }
} }
}); }else{
//end Ajax
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 //end show list function
//click item row for item set //click item row for item set
@@ -269,61 +187,106 @@ $(function() {
item_options = $(this).data('options'); item_options = $(this).data('options');
for(var field in item_sets) { for(var field in item_sets) {
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]); $('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
value = item_sets[field]["instances"]; value = item_sets[field]["instances"];
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
$(value).each(function(i){ $(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"]; if (value[i]["id"] == result[v]["id"]) {
console.log("ssssssss")
} console.log("ssssssss")
if(modify_order == -1 && type != -1){
url = 'addorders/get_item_instance/'+value[i]["id"] ; row = '<div class="col-md-4 " >'
console.log("aaaaaa") +"<div class='card custom-card instance_box' data-name='"+result[v]["name"]
} +"' data-code='"+result[v]["code"]
if (type ==-1 && modify_order == -1){ +"' data-price='"+result[v]["price"]
+"' data-option='"+JSON.stringify(items[iii]["options"])
url = '../addorders/get_item_instance/'+value[i]["id"]; +"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
console.log("cccccccccc") +"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
} +"' data-parent-code='"+instances[0]['code']
$.ajax({ +"' data-parent-id='"+instances[0]['id']
type: "GET", +"' data-sub-item='true"
url: url, +"'>"
// data: {id:value[i]}, +'<div class="custom-card-head card-head" style="line-height:14px;">'
success:function(result){ +'<span class="">'+result[v]["name"]+'</span>'
row = '<div class="col-md-4 " >' +'</div>'
+"<div class='card custom-card instance_box' data-name='"+result["name"] +'<div class="card-block custom-card-block">'
+"' data-code='"+result["code"] +'<img id="" src="/image/logo.png" height="40px">'
+"' data-price='"+result["price"] +' <small style="float:" id="instance_option"></small>'
+"' data-option='"+JSON.stringify(result["options"]) +'</div>'
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"] +'<div class="card-footer custom-card-footer">'
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"] +' <span>'+result[v]["price"]+'</span>'
+"' data-parent-code='"+instances[0]['code'] // +' <small style="float:right" id="instance_option"></small>'
+"' data-parent-id='"+instances[0]['id'] +'</div>'
+"' data-sub-item='true"
+"'>"
+'<div class="custom-card-head card-head" style="line-height:14px;">'
+'<span class="">'+result["name"]+'</span>'
+'</div>' +'</div>'
+'<div class="card-block custom-card-block">' +' </div>'
+'<img id="" src="/image/logo.png" height="40px">' $(".instance-list").append(row);
+' <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);
} }
}); }
}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);
}
});
}
}); });
} }
@@ -443,10 +406,8 @@ $(function() {
$(document).on('click', '#remove_set', function(event){ $(document).on('click', '#remove_set', function(event){
code = $(this).parent().parent('.selected-set').attr('data-code'); code = $(this).parent().parent('.selected-set').attr('data-code');
instance = $(".selected-instance"); instance = $(".selected-instance");
console.log(code)
$(instance).each(function(i){ $(instance).each(function(i){
if ($(instance[i]).attr('data-code')==code){ if ($(instance[i]).attr('data-code')==code){
console.log($(instance[i]))
$(instance[i]).removeClass("selected-instance") $(instance[i]).removeClass("selected-instance")
} }
}); });
@@ -497,7 +458,6 @@ $(function() {
var rowCount = $('.summary-items tbody tr').length+1; var rowCount = $('.summary-items tbody tr').length+1;
var set_option = [] var set_option = []
$(items).each(function(i){ $(items).each(function(i){
console.log($(items[0]).attr('data-name'))
code = $(items[i]).attr('data-code'); code = $(items[i]).attr('data-code');
name = $(items[i]).attr('data-name'); name = $(items[i]).attr('data-name');
price = $(items[i]).attr('data-price'); price = $(items[i]).attr('data-price');
@@ -755,7 +715,6 @@ $(function() {
attribute_arr = get_selected_attributes('selected-attribute'); attribute_arr = get_selected_attributes('selected-attribute');
option_arr = get_selected_attributes('selected-option'); option_arr = get_selected_attributes('selected-option');
console.log(option_arr)
if (item_row.length>0) { if (item_row.length>0) {
var instances = jQuery.parseJSON(item_row.attr('data-instances')); var instances = jQuery.parseJSON(item_row.attr('data-instances'));
@@ -835,7 +794,6 @@ $(function() {
option_name = ' '; option_name = ' ';
data_option = '[]'; data_option = '[]';
} }
console.log(d_option)
var rowCount = $('.summary-items tbody tr').length+1; var rowCount = $('.summary-items tbody tr').length+1;
var item_row = $('.summary-items tbody tr'); var item_row = $('.summary-items tbody tr');
@@ -843,7 +801,7 @@ console.log(d_option)
item_code = $(item_row[i]).attr('data-code'); item_code = $(item_row[i]).attr('data-code');
instance_code = $(item_row[i]).attr('data-instance-code'); instance_code = $(item_row[i]).attr('data-instance-code');
r_option = $(item_row[i]).attr('data-opt'); r_option = $(item_row[i]).attr('data-opt');
console.log(r_option)
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) { if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) {
if (qty > 1) { if (qty > 1) {
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty; qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
@@ -992,7 +950,6 @@ console.log(d_option)
dataType: "json", dataType: "json",
success:function(result){ success:function(result){
if (result.status) { if (result.status) {
console.log(result)
if (result.data == null){ if (result.data == null){
swal({ swal({
title: "Please Open Shift !", title: "Please Open Shift !",
@@ -1044,8 +1001,13 @@ console.log(d_option)
}); });
//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(); if ($('#modal-qty').val()>0) {
calculate_sub_total(); summary_items_filter();
calculate_sub_total();
}else{
swal("Opps", "Please enter number for qty ","warning");
}
}); });
//calculate subtotal //calculate subtotal
@@ -1207,7 +1169,6 @@ console.log(d_option)
$(".keypress_qty").on('keyup change', function (){ $(".keypress_qty").on('keyup change', function (){
// $('.keypress_qty').keyup(function(e){ // $('.keypress_qty').keyup(function(e){
id = $(this).attr('id'); id = $(this).attr('id');
value = $(this).val(); value = $(this).val();
@@ -1245,54 +1206,68 @@ console.log(d_option)
var menu_id = $(this).attr("data-id"); var menu_id = $(this).attr("data-id");
var url = "get_menu_sub_category/"+menu_id; var url = "get_menu_sub_category/"+menu_id;
sub_category = $(this).find('.sub_category_list'); 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 //End menu category Click
//show menu item list when click menu category //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 sub_category_list = $('.sub_category_list');
var url = "../../../addorders/"+url; sub_category_list.empty();
}if(modify_order== -1 && type != -1){
var url = 'addorders/'+url;
}
if (type ==-1 && modify_order == -1){
var url = url;
}
var menu_list = $('.sub_category_list'); menus = JSON.parse(localStorage.getItem("menus"));
menu_list.empty(); if (menus != null) {
//Start Ajax for(var j in menus) {
$.ajax({ var categories = menus[j]["categories"];
type: "GET", for(var ii in categories) {
url: url, if (menu_id == categories[ii]["parent_id"]) {
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'); $(sub_category).removeClass('hidden');
// }else{ row = '<li class="menu_sub_category fadeInTop" data-id="'+categories[ii].id+'">'
// $(sub_category).addClass('hidden'); +'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ categories[ii].name+'</a>'
// } +'</li>' ;
$(sub_category).append(row);
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
}
} }
} }
}); }else{
//end Ajax 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 */ /* Get Item rows */
@@ -1380,5 +1355,119 @@ console.log(d_option)
// price = $("#unit_price").text(); // price = $("#unit_price").text();
// $("#total_price").text(qty*price); // $("#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
}
}
}); });

View File

@@ -0,0 +1,52 @@
App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
connected: function() {},
disconnected: function() {},
received: function(data) {
var order = data.data;
var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
if(key==0){
order_lists = value.order_reservation_id;
}else if(key == (order.length - 1)){
order_lists += ' and ' + value.order_reservation_id;
}else{
order_lists += ', ' + value.order_reservation_id;
}
});
// 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);
// 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_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});
}
}
});

View File

@@ -0,0 +1,52 @@
App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderReadyToDeliveryChannel', {
connected: function() {},
disconnected: function() {},
received: function(data) {
var order = data.data;
var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
if(key==0){
order_lists = value.order_reservation_id;
}else if(key == (order.length - 1)){
order_lists += ' and ' + value.order_reservation_id;
}else{
order_lists += ', ' + value.order_reservation_id;
}
});
// 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);
// 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_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});
}
}
});

View File

@@ -0,0 +1,52 @@
App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSendToKitchenChannel', {
connected: function() {},
disconnected: function() {},
received: function(data) {
var order = data.data;
var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
if(key==0){
order_lists = value.order_reservation_id;
}else if(key == (order.length - 1)){
order_lists += ' and ' + value.order_reservation_id;
}else{
order_lists += ', ' + value.order_reservation_id;
}
});
// 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);
// 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_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});
}
}
});

View File

@@ -29,18 +29,21 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
//end count //end count
var date = new Date(items[field]["created_at"]); var date = new Date(items[field]["created_at"]);
var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); // var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM');
if (oqs_id == items[field]["order_queue_station_id"]) { if (oqs_id == items[field]["order_queue_station_id"]) {
var table_type = (items[field]["table_type"] != null) ? items[field]["table_type"]:"";
var zone = (items[field]["zone"] != null) ? "-"+items[field]["zone"]:"No Table";
(name === 'true') ? 'Y' :'N';
row ='<div class="card queue_station animated shake queue_station_box" data-order-no="'+items[field]["order_id"]+'">' row ='<div class="card queue_station animated shake queue_station_box" data-order-no="'+items[field]["order_id"]+'">'
+'<strong class="hidden">'+items[field]["order_id"]+'</strong>' +'<strong class="hidden">'+items[field]["order_id"]+'</strong>'
+'<div class="card-block">' +'<div class="card-block">'
+'<div class="row">' +'<div class="row">'
+'<span class="col-md-4 order-zone-type font-13">'+items[field]["table_type"]+'-'+ items[field]["zone"] +'</span>' +'<span class="col-md-4 order-zone-type font-13">'+table_type+''+ zone+'</span>'
+'<span class="order-zone hidden font-14">'+ items[field]["zone"] +'</span>' +'<span class="order-zone hidden font-14">'+ zone +'</span>'
+'<span class="col-md-8"><small class="float-right font-13">'+items[field]["order_id"]+'</small></span>' +'<span class="col-md-8"><small class="float-right font-13">'+items[field]["order_id"]+'</small></span>'
+'</div>' +'</div>'
+'<p class="m-b--10">' +'<p class="m-b--10">'

View File

@@ -1,35 +1,35 @@
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', { App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel', {
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
connected: function() {}, connected: function() {},
disconnected: function() {}, disconnected: function() {},
received: function(data) { received: function(data) {
var shop_code = data.shop_code;
var order = data.data; var order = data.data;
if(order.length > 0){ if(order.length > 0){
$('.order_reserve_cable tbody').html(""); $('.custom-table.'+shop_code+'_order_reserve_cable tbody').html("");
$("."+shop_code+" > .nav-item.red > a > p.num").text(order.length);
$.each(order, function(key,value){ $.each(order, function(key,value){
var active_class = "";
if(key==0){
active_class = "tr-active";
showNewOrder(order[key],shop_code);
}
var rowCount = key+1; var rowCount = key+1;
var date = new Date(value.created_at); var date = new Date(value.created_at);
var deliveries = value["delivery"]; var time = timeFormat(date);
var isPM = date.getHours() >= 12; var created_at = date.getFullYear() +'-'+ (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >=10?date.getDate() : '0'+date.getDate());
var isMidday = date.getHours() == 12;
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
date.getMinutes() || '00'].join(':') +
(isPM ? ' PM' : 'AM');
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ date.getDate();
var delivery_type = ""; var delivery_type = "";
if(deliveries.delivery_type == "service"){ if(value.provider == "food2u" || value.provider == "yangondoor2door"){
delivery_type = "DELIVERY"; delivery_type = "DELIVERY";
}else if(deliveries.delivery_type == "pick_up"){ }else if(value.provider == "pick_up"){
delivery_type = "PICK-UP"; delivery_type = "PICK-UP";
}else{ }else{
delivery_type = "DIRECT DELIVERY"; delivery_type = "DIRECT DELIVERY";
} }
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">' row = '<tr class="custom-tr first-'+rowCount+' '+active_class+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">'
+'<td width ="5%" class="align-left">'+rowCount +'<td width ="5%" class="align-left">'+rowCount
+'</td>' +'</td>'
+'<td width ="20%" class="align-center">'+created_at +'<td width ="20%" class="align-center">'+created_at
@@ -41,13 +41,13 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
+'<td width ="30%" class="align-center">' +'<td width ="30%" class="align-center">'
+'<span class="font-10 col-blue">'+ delivery_type +'</span>' +'<span class="font-10 col-blue">'+ delivery_type +'</span>'
+'</td>' +'</td>'
+' </tr>' +' </tr>';
$('.order_reserve_cable tbody').append(row); $('.custom-table.'+shop_code+'_order_reserve_cable tbody').append(row);
}); });
} }
customTableClick();
} }
}); });

View File

@@ -13,6 +13,16 @@ $(document).ready(function() {
touchScrollStep : 50 touchScrollStep : 50
}); });
$('#table-slimscroll').slimScroll({
height: height,
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
$('#order-detail-slimscroll').slimScroll({ $('#order-detail-slimscroll').slimScroll({
height: height-$('#order-detail-slimscroll').attr('data-height'), height: height-$('#order-detail-slimscroll').attr('data-height'),
size: '5px', size: '5px',
@@ -44,7 +54,7 @@ $(document).ready(function() {
}); });
$('#modal-set-slimscroll').slimScroll({ $('#modal-set-slimscroll').slimScroll({
height: height-$('#modal-slimscroll').attr('data-height'), height: height-$('#modal-set-slimscroll').attr('data-height'),
size: '5px', size: '5px',
color: 'rgba(0,0,0,0.5)', color: 'rgba(0,0,0,0.5)',
alwaysVisible: false, alwaysVisible: false,
@@ -52,6 +62,17 @@ $(document).ready(function() {
railBorderRadius: '0', railBorderRadius: '0',
touchScrollStep : 45 touchScrollStep : 45
}); });
$('#customer-info-slimscroll').slimScroll({
height: height-$('#customer-info-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 45
});
// $('.delete').click(function(){ // $('.delete').click(function(){
// var method = $(this).attr('data-method'); // var method = $(this).attr('data-method');

View File

@@ -1,12 +1,27 @@
$(function() { $(function() {
$("#discount").hide();
$(".expected_time").hide();
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
$(function() {
$('.first-1').click();
});
customTableClick();
$(".nav-item").on("click", function(){ $(".nav-item").on("click", function(){
type = $(this).attr("data-type"); type = $(this).attr("data-type");
refreshDetailData(); refreshDetailData();
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
if (type == "pending") { if (type == "pending") {
$(".first-1").click(); $(".first-1").click();
$('#accepted').text("Accepted"); $('#accepted').text("ACCEPT");
$('#accepted').attr("data-value","accepted"); $('#accepted').attr("data-value","accepted");
}else if(type == "processing"){ }else if(type == "processing"){
$(".second-1").click(); $(".second-1").click();
@@ -17,261 +32,486 @@ $(function() {
$('#accepted').text("READY TO DELIVERY"); $('#accepted').text("READY TO DELIVERY");
$('#accepted').attr("data-value","delivery"); $('#accepted').attr("data-value","delivery");
}else if(type == "completed"){ }else if(type == "completed"){
// $('#cancel').hide();
$(".fourth-1").click(); $(".fourth-1").click();
$('#accepted').text("PICK-UP"); $('#accepted').text("COMPLETE");
$('#accepted').attr("data-value","completed"); $('#accepted').attr("data-value","completed");
} }else if(type == "processed"){
$(".fifth-1").click();
$(".order_close_cashier").show();
// $('#accepted').hide();
// $('#cancel').hide();
}
// console.log(type); // console.log(type);
}); });
$(function(){ $("#accepted").on("click", function(){
$('.first-1').click(); if($(this).text().trim() == "ACCEPT"){
$("#status").text($(this).attr("data-value"));
var requested_time = $("#requested_time").text();
$("#requested_order_time").text(requested_time);
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
}else{
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);
}
}); });
$(".custom-tr").on("click", function(){ $("#cancel").on("click", function(){
$(".custom-tr").removeClass("tr-active"); var order_status = $("#order_status").text();
$(this).addClass("tr-active"); $("#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});
}
});
$(".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());
// if(type == 'after'){
// requested_time.setMinutes(requested_time.getMinutes() + minutes);
// }else{
// requested_time.setMinutes(requested_time.getMinutes() - minutes);
// }
// console.log(requested_time);
callback_url(callback,ref_no,order_id,status,type,minutes);
});
$('#order_close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/ordering/close';
warnBeforeRedirect(linkURL);
});
$(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;
}
});
// $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $(".new_order_close").on("click",function(){
// var code = $(this).attr("data-value");
// $("#"+code+"_doemal_new_order").modal("hide");
// });
// $("[data-dismiss='modal']").on('click', function() {
// $('body').addClass('modal-open-fix');
// if($('body').css("padding-right") == '15px') {
// $('body').addClass('modal-open-fix-pad');
// }
// setTimeout(function() {
// if($('body').hasClass('modal-open-fix-pad')) {
// $('body').css('padding-right', '15px');
// }
// $('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
// }, 1000);
// });
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
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");
$(this).addClass("tr-active");
var order_id = $(this).attr("data-id"); var order_id = $(this).attr("data-id");
var sr_no = $(this).attr("data-sr-no"); var sr_no = $(this).attr("data-sr-no");
var url = "order_reservation/get_order/"+order_id; var url = "order_reservation/get_order/"+order_id;
show_order_detail(url,sr_no); show_order_detail(url,sr_no);
}); });
}
function refreshDetailData(){ function refreshDetailData(){
$('#requested_date_time').text(""); $('#requested_date_time').text("");
$("#sr_number").text(""); $("#sr_number").text("");
$("#delivery_info").text(""); $("#delivery_info").text("");
$("#contact_info").text(""); $("#contact_info").text("");
$('.summary-items').html(""); $("#invoice_no").text("");
$('#sub_total').text("0.00"); $('.summary-items').html("");
$('#delivery_fee').text("0.00"); $('#sub_total').text("0.00");
$('#total_charges').text("0.00"); $('#delivery_fee').text("0.00");
$('#discount_amount').text("0.00"); $('#total_charges').text("0.00");
$('#total_tax').text("0.00"); $('#discount_amount').text("0.00");
$('#grand_total').text("0.00"); $('#total_tax').text("0.00");
} $('#grand_total').text("0.00");
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
}
//show order list //show order list
function show_order_detail(url,sr_no){ function show_order_detail(url,sr_no){
$('.summary-items').html(""); $('.summary-items').html("");
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: url, url: url,
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
// console.log(data); // console.log(data);
var delivery = data["delivery"]; $(".tbl_customer").show();
var items = data["order_items"]; if(data.status != "delivered"){
var item_list = $('.summary-items'); $('#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 newDate = new Date(data.requested_time);
var isPM = newDate.getHours() >= 12; var time = timeFormat(newDate);
var isMidday = newDate.getHours() == 12; // var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
var time = [newDate.getHours() - (isPM && !isMidday ? 12 : 0), var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time;
newDate.getMinutes() || '00'].join(':') +
(isPM ? ' PM' : 'AM'); if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() > 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time; // var expDate = new Date(data.expected_waiting_time);
// var exptime = timeFormat(expDate);
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){ // 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); $('.expected_time').show();
var isPM = expDate.getHours() >= 12; $('#expected_time').text(data.expected_waiting_time? data.expected_waiting_time : '');
var isMidday = expDate.getHours() == 12; }else{
var exptime = [expDate.getHours() - (isPM && !isMidday ? 12 : 0), $('.expected_time').hide();
expDate.getMinutes() || '00'].join(':') + $('#expected_time').text('');
(isPM ? ' PM' : 'AM'); }
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 : '');
}else{
$('.expected_time').hide();
$('#expected_time').text('');
}
item_list.empty(); item_list.empty();
if(items!=undefined && items!=""){ if(items!=undefined && items!=""){
if(items.length > 0){ if(items.length > 0){
for(var i in items) { for(var i in items) {
var item_price = 0; var item_price = 0;
if(items[i].price > 0){ if(items[i].price > 0){
item_price = items[i].price; item_price = items[i].price;
}else{
item_price = items[i].unit_price;
}
var total = items[i].qty * item_price;
row = '<tr>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
+'</td>'
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
+'</tr>';
$('.summary-items').append(row);
}
if(data.discount_amount > 0){
$("#discount").show();
}
$('#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');
$('#discount_amount').text((parseFloat(data.discount_amount) > 0)? data.discount_amount : '0.0');
$('#total_tax').text(data.total_tax);
$('#grand_total').text(data.grand_total);
var address = delivery.address;
if(delivery.township != null && delivery.township!=""){
address += ', ' +delivery.township;
}else if(delivery.direction_address!=null && delivery.direction_address!=""){
address += ", (" +delivery.direction_address+")";
}
$('#requested_time').text(requested_date);
$('#customer_name').text(data.customer_name);
$('#phone').text(data.phone);
$('#address').text(address);
$('#delivery_to').text(delivery.provider);
$('#ref_no').text(data.transaction_ref);
$('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id);
if(delivery.delivery_type == "service"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.delivery_type == "pick_up"){
$("#delivery_info").text("(PICK-UP)");
}else{ }else{
$("#delivery_info").text("(DIRECT DELIVERY)"); item_price = items[i].unit_price;
} }
var total = items[i].qty * item_price;
if(data.order_remark!=null && data.order_remark!=""){ row = '<tr>'
$("#order_remark").text(data.order_remark); +'<td width ="70%" class="body-td align-left">'+items[i].item_name
}else if(data.reservation_remark!=null && data.reservation_remark!=""){ +' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
$("#order_remark").text(data.reservation_remark); +'</td>'
} +'<td width ="30%" class="body-td align-right">'+ total +'</td>'
$("#sr_number").text("NO."+sr_no); +'</tr>';
if (data["receipt_no"]) { $('.summary-items').append(row);
$("#contact_info").text(data["receipt_no"]);
}else{
$("#contact_info").text(data["order_reservation_id"]);
}
} }
if(data.discount_amount > 0){
$("#discount").show();
}
//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');
$('#discount_amount').text((parseFloat(data.discount_amount) > 0)? data.discount_amount : '0.0');
$('#total_tax').text(data.total_tax);
$('#grand_total').text(data.grand_total);
var address = delivery.address;
if(delivery.township != null && delivery.township!=""){
address += ', ' +delivery.township;
}else if(delivery.direction_address!=null && delivery.direction_address!=""){
address += ", (" +delivery.direction_address+")";
}
$('#requested_time').text(requested_date);
$('#customer_name').text(data.customer_name);
$('#phone').text(data.phone);
$('#address').text(address);
$('#ref_no').text(data.transaction_ref);
$('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id);
$("#trans_ref").text(data.transaction_ref);
if(delivery.provider == "food2u" || delivery.provider == "yangondoor2door"){
$("#delivery_info").text("(DELIVERY)");
$("#delivery_to").text("DELIVERY");
}else if(delivery.provider == "pick_up"){
$("#delivery_info").text("(PICK-UP)");
$("#delivery_to").text("PICK-UP");
}else{
$("#delivery_info").text("(DIRECT DELIVERY)");
$("#delivery_to").text("DIRECT DELIVERY");
}
if(data.order_remark!=null && data.order_remark!=""){
$("#order_remark").text(data.order_remark);
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
$("#order_remark").text(data.reservation_remark);
}
if(data.remark!=null && data.remark!=""){
var doemal_remark = data.remark.split("||");
var remark = doemal_remark[0] +", "+ doemal_remark[1];
$("#remark").text(remark);
}else{
$("#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"]);
}
} }
} }
}); }
//end Ajax });
//end Ajax
}
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;
}
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;
} }
$("#accepted").on("click", function(){ $.ajax({
var requested_time = $("#requested_date_time").text(); type: "POST",
$("#requested_order_time").text(requested_time); url: post_url,
showTimePicker(requested_time); data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time, min_type: type, reason: reject_reason},
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false}); dataType: "json",
}); success: function(data) {
if(data.status){
$("#cancel").on("click", function(){ $.ajax({
var status = $(this).attr("data-value"); type: "POST",
var order_id = $('#order_id').text(); url: url,
var callback = $('#callback_url').text(); data: {order_id: order_id, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code},
var ref_no = $('#ref_no').text(); dataType: "json",
callback_url(callback,ref_no,order_id,status); success: function(data) {
}); if (data.status) {
swal({
function showTimePicker(requested_time){ title: 'Information',
// var date = new Date(requested_time); text: "Order has been "+data.message,
// var isPM = date.getHours() >= 12; type: 'success',
// var isMidday = date.getHours() == 12; html: true,
// var time = [date.getHours() - (isPM && !isMidday ? 12 : 0), closeOnConfirm: false,
// date.getMinutes() || '00'].join(':') + closeOnCancel: false,
// (isPM ? 'pm' : 'am'); allowOutsideClick: false
// console.log(time); }, function () {
$('.timepicker').bootstrapMaterialDatePicker({ window.location.href = '/origami/order_reservation';
format: 'HH:mm', });
useSeconds: false, }else{
clearButton: true, swal({
date: false title: 'Oops',
}); text: data.message,
} type: 'error',
html: true,
function callback_url(callback,ref_no,order_id,status,time,exptime){ closeOnConfirm: false,
var url = 'order_reservation/update'; closeOnCancel: false,
var post_url = "order_reservation/send_status"; allowOutsideClick: false
var waiting_time = ""; }, function () {
if(time!=undefined && time!=""){ window.location.href = '/origami/order_reservation';
waiting_time = time; });
}
var expected_time = "";
if(exptime!=undefined && exptime!=""){
expected_time = exptime;
}
$.ajax({
type: "POST",
url: post_url,
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time},
dataType: "json",
success: function(data) {
if(data.status){
$.ajax({
type: "POST",
url: url,
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
dataType: "json",
success: function(data) {
if (data.status) {
swal({
title: 'Information',
text: "Order has been "+data.message,
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/order_reservation';
});
}
} }
}); }
}else{ });
swal({ }else{
title: 'Oops', swal({
text: data.message, title: 'Oops',
type: 'error', text: data.message,
html: true, type: 'error',
closeOnConfirm: false, html: true,
closeOnCancel: false, closeOnConfirm: false,
allowOutsideClick: false closeOnCancel: false,
}, function () { allowOutsideClick: false
window.location.href = '/origami/order_reservation'; }, function () {
}); window.location.href = '/origami/order_reservation';
} });
}
}
});
}
function timeFormat(date){
var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12;
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
(date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') +
(isPM ? ' PM' : ' AM');
return time;
}
function showNewOrder(order_reservation,shop_code){
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;
//audio play
var audio = new Audio('/beep.mp3'); // define your audio
// setTimeout(function(){
// audio.loop = true;
audio.play();
// },10000);
// $("#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").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();
} }
}); });
} }
}
$("#save").on("click",function(){ function getOrderMonth(month){
$("#waiting_timeErr").text(""); var MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"];
var status = $("#status").text(); return MONTHS[month];
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);
// console.log(requested_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;
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
}else{
$("#waiting_time").val("");
$("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
}
});
});
function getOrderDay(day){
var DAYS = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
return DAYS[day];
}

View File

@@ -192,6 +192,41 @@ $(document).on('turbolinks:load', function() {
return false; return false;
}); });
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
$(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;
}
});
}); });
/* start check first bill or not funs: */ /* start check first bill or not funs: */
@@ -361,6 +396,7 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo
function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type) { function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type) {
$("#loading_wrapper").hide(); $("#loading_wrapper").hide();
var jobj = $.parseJSON(resMsg); var jobj = $.parseJSON(resMsg);
$("#reference_no").val(jobj.REFNUM);
if(jobj.STATUS == "Approved"){ if(jobj.STATUS == "Approved"){
$.ajax({type: "POST", $.ajax({type: "POST",
url: "/origami/payment/"+payment_type, url: "/origami/payment/"+payment_type,
@@ -423,3 +459,8 @@ function showHideNavbar(webview,page){
} }
} }
} }
function createAccessCode(code) {
localStorage.setItem("access_code",code);
}

View File

@@ -87,7 +87,7 @@ select.form-control {
} }
.green{ .green{
background-color: #009900; background-color: #009900 !important;
} }
.left{ .left{
margin-left:1px; margin-left:1px;
@@ -104,4 +104,20 @@ select.form-control {
i.logout_icon{ i.logout_icon{
position: relative; position: relative;
top: 5px; top: 5px;
}
.table-block{
padding: 24px 8px 0 0;
}
.label-align{
padding-left: 10px;
}
.table-float{
float: left;
}
.table-width{
width: 100%;
} }

View File

@@ -247,4 +247,27 @@ i.logout_icon{
} }
.list-menu > a:hover{ .list-menu > a:hover{
text-decoration: none; text-decoration: none;
}
.cashier_number{
width: 33%;
height:58px;
line-height:58px;
text-align:center;
background:#54A5AF;
// float:left;
// margin:2px;
font-size:20px;
color:white;
// cursor:pointer;
}
.border-top{
border-top:1px solid #fff;
}
.border-right{
border-right:1px solid #fff;
}
.border-left{
border-left:1px solid #fff;
} }

View File

@@ -10,6 +10,7 @@
@import "BSBMaterial/style"; @import "BSBMaterial/style";
@import "BSBMaterial/themes/all-themes"; @import "BSBMaterial/themes/all-themes";
@import "reset"; @import "reset";
@import "fileinput.min";
/* Reset */ /* Reset */
@@ -93,6 +94,19 @@ select.form-control {
// cursor:pointer; // cursor:pointer;
} }
.access_number{
width: 33%;
height:58px;
line-height:58px;
text-align:center;
background:#54A5AF;
// float:left;
// margin:2px;
font-size:20px;
color:white;
// cursor:pointer;
}
.del_cashier_number{ .del_cashier_number{
opacity:0.6, opacity:0.6,
} }
@@ -439,6 +453,10 @@ iframe {
width: 150%; width: 150%;
height: 100%; height: 100%;
} }
#receipt_pdf {
height: 400px;
}
/* End iframe */ /* End iframe */
/* section class for webview */ /* section class for webview */

View File

@@ -0,0 +1,10 @@
class CheckNewOrderChannel < ApplicationCable::Channel
def subscribed
stream_from "check_new_order_channel"
end
def unsubscribed
stop_all_streams
# Any cleanup needed when channel is unsubscribed
end
end

View File

@@ -0,0 +1,10 @@
class CheckOrderReadyToDeliveryChannel < ApplicationCable::Channel
def subscribed
stream_from "check_order_ready_to_delivery_channel"
end
def unsubscribed
stop_all_streams
# Any cleanup needed when channel is unsubscribed
end
end

View File

@@ -0,0 +1,10 @@
class CheckOrderSendToKitchenChannel < ApplicationCable::Channel
def subscribed
stream_from "check_order_send_to_kitchen_channel"
end
def unsubscribed
stop_all_streams
# Any cleanup needed when channel is unsubscribed
end
end

View File

@@ -6,70 +6,122 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
def check_customer def check_customer
customer_id = 0 customer_id = 0
status = false
if !params[:name] if !params[:name]
render :json => { :status => false, :message => "name is required!" } render :json => { :status => false, :message => "name is required!" }
elsif !params[:email] elsif !params[:email]
render :json => { :status => false, :message => "email is required!" } render :json => { :status => false, :message => "email is required!" }
elsif !params[:membership_id] elsif !params[:membership_id]
render :json => { :status => false, :message => "membership_id is required!" } render :json => { :status => false, :message => "membership_id is required!" }
end
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
if !check_customer.nil?
customer_id = check_customer.customer_id
else else
customer = Customer.addCustomer(params) status = true
customer_id = customer.id
end end
render :json => { :status => true, :data => { :customer_id => customer_id} } if status
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
if !check_customer.nil?
customer_id = check_customer.customer_id
else
customer = OrderReservation.addCustomer(params)
customer_id = customer.id
end
render :json => { :status => true, :data => { :customer_id => customer_id} }
end
end end
def create def create
status = false status = false
if !params[:cus_info] if !params[:cus_info]
render :json => { :status => false, :message => "cus_info is required!" } result = { :status => false, :message => "cus_info is required!" }
elsif !params[:requested_time] elsif !params[:requested_time]
render :json => { :status => false, :message => "requested_time is required!" } result = { :status => false, :message => "requested_time is required!" }
elsif !params[:callback_url] elsif !params[:callback_url]
render :json => { :status => false, :message => "callback_url is required!" } result = { :status => false, :message => "callback_url is required!" }
elsif !params[:reference] elsif !params[:reference]
render :json => { :status => false, :message => "reference is required!" } result = { :status => false, :message => "reference is required!" }
elsif !params[:order_type] elsif !params[:order_type]
render :json => { :status => false, :message => "order_type is required!" } result = { :status => false, :message => "order_type is required!" }
elsif params[:order_type] == ORDER || params[:order_type] == ORDER_RESERVATION elsif params[:order_type] == ORDER || params[:order_type] == ORDER_RESERVATION
if !params[:order_info] if !params[:order_info]
render :json => { :status => false, :message => "order_info is required!" } result = { :status => false, :message => "order_info is required!" }
else else
status = true status = true
end end
elsif params[:order_type] == RESERVATION || params[:order_type] == ORDER_RESERVATION elsif params[:order_type] == RESERVATION || params[:order_type] == ORDER_RESERVATION
if !params[:reservation_info] if !params[:reservation_info]
render :json => { :status => false, :message => "reservation_info is required!" } result = { :status => false, :message => "reservation_info is required!" }
else else
status = true status = true
end end
elsif !params[:payment_info] elsif !params[:payment_info]
render :json => { :status => false, :message => "payment_info is required!" } result = { :status => false, :message => "payment_info is required!" }
elsif !params[:delivery_info] elsif !params[:delivery_info]
render :json => { :status => false, :message => "delivery_info is required!" } result = { :status => false, :message => "delivery_info is required!" }
end end
if status == true if status == true
order_reservation = params order_reservation = params
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation) order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
if flag #&& ENV["SERVER_MODE"] != 'cloud' if flag #&& ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation shop = Shop.find_by_id(1)
end if !shop.shop_code.nil?
shop_code = shop.shop_code
if flag else
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" } shop_code = ''
end
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation,shop_code: shop_code
else else
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" } result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
end end
end end
puts "!!! send doemal ::"
puts result
Rails.logger.debug "send status to doemal"
Rails.logger.debug result
render :json => result
end
def update_status
order_reservation_id = params[:id]
status = params[:status]
remark = params[:remark]
if params[:status] && params[:remark]
reason = status +"||"+remark
order_reservation = OrderReservation.find(order_reservation_id)
if status == 'REMOVE'
if order_reservation.status == "new" || order_reservation.status == "accepted"
OrderReservation.update_order_reservation(order_reservation_id, nil, "rejected",nil,remark)
result = {:status=> true, :message => "rejected" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't remove!" }
end
elsif status == 'FOC'
if order_reservation.status == "new" || order_reservation.status == "accepted" || order_reservation.status == "send_to_kitchen"
OrderReservation.update_order_reservation(order_reservation_id, nil, nil,nil,reason)
result = {:status=> true, :message => "FOC successfully" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't get FOC!" }
end
elsif status == 'VOID'
if order_reservation.status == "ready_to_delivery"
OrderReservation.update_order_reservation(order_reservation_id, nil, nil,nil,reason)
result = {:status=> true, :message => "VOID successfully" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't VOID!" }
end
end
else
result = { :status => false, :order_reservation_id => order_reservation_id, :message => "status and remark is required!" }
end
render :json => result
end end
end end

View File

@@ -220,33 +220,39 @@ class Api::OrdersController < Api::ApiController
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# print # print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
# order queue stations assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
oqs = assigned_item.order_queue_station
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf if !assigned_items.nil?
assigned_items.each do |assign_item|
unique_code="OrderItemPdf" # order queue stations
if !order_slim_pdf.empty? oqs = assign_item.order_queue_station
order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf' order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
if order_item_slim[1] == '1'
unique_code="OrderItemSlimPdf" unique_code="OrderItemPdf"
else if !order_slim_pdf.empty?
unique_code="OrderItemPdf" order_slim_pdf.each do |order_item_slim|
end if order_item_slim[0] == 'OrderSlimPdf'
elsif order_item_slim[0] == 'OrderSetPdf' if order_item_slim[1] == '1'
if order_item_slim[1] == '1' unique_code="OrderItemSlimPdf"
unique_code="OrderSetItemPdf" else
else unique_code="OrderItemPdf"
unique_code="OrderItemPdf" end
elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1'
unique_code="OrderSetItemPdf"
else
unique_code="OrderItemPdf"
end
end
end end
end end
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end end
end end
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end end
return return_json_status_with_code(200, "updated successfully!") return return_json_status_with_code(200, "updated successfully!")

View File

@@ -11,7 +11,10 @@ class Api::Restaurant::MenuController < Api::ApiController
# to hash # to hash
menu_array = [] menu_array = []
all_menu.each do |m| all_menu.each do |m|
menu_array.push(m.to_json(:include => {:menu_categories => { :include => { :menu_items => { :include => [:menu_item_sets, :menu_item_instances => {:include => :menu_instance_item_sets}]} } }})) menu_array.push(m.to_json(:include => {:menu_categories =>
{ :include => { :menu_items =>
{ :include => [:menu_item_sets, :menu_item_instances =>
{ :include => :menu_instance_item_sets}]} } }}))
end end
#export Checksum file generate by md5 #export Checksum file generate by md5

View File

@@ -5,7 +5,7 @@ class BaseOrigamiController < ActionController::Base
before_action :check_user before_action :check_user
#before_action :check_installation #before_action :check_installation
protect_from_forgery with: :exception protect_from_forgery with: :exception
helper_method :shop_detail, :current_token helper_method :shop_detail, :current_token
@@ -15,14 +15,14 @@ class BaseOrigamiController < ActionController::Base
redirect_to origami_dashboard_path redirect_to origami_dashboard_path
end end
def check_user def check_user
if check_mobile if check_mobile
if current_user.nil? if current_user.nil?
return render status: 401, json: { return render status: 401, json: {
message: "User using other device!" message: "User using other device!"
}.to_json }.to_json
end end
else else
if current_user.nil? if current_user.nil?
redirect_to root_path redirect_to root_path
end end

View File

@@ -18,7 +18,7 @@ module TokenVerification
# Rails.logger.debug "token - " + token.to_s # Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL") if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud") if(ENV["SERVER_MODE"] === "cloud")
from = "local" #request.subdomain.downcase + "." + request.domain.downcase from = request.subdomain.downcase + "." + request.domain.downcase #"local"
aes = MyAesCrypt.new aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token) return aes.checkKeyForAuth(from, token)
end end

View File

@@ -96,7 +96,7 @@ class Crm::CustomersController < BaseCrmController
# POST /crm/customers # POST /crm/customers
# POST /crm/customers.json # POST /crm/customers.json
def create def create
# Remove "" default first # Remove "" default first
params[:customer][:tax_profiles].delete_at(0) params[:customer][:tax_profiles].delete_at(0)
@crm_customers = Customer.new(customer_params) @crm_customers = Customer.new(customer_params)

View File

@@ -89,6 +89,7 @@ class Oqs::HomeController < BaseOqsController
# Query for OQS with delivery status # Query for OQS with delivery status
def queue_items_query(status) def queue_items_query(status)
byebug
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at") AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id

View File

@@ -27,49 +27,55 @@ class Oqs::EditController < BaseOqsController
remarks = params[:remarks] remarks = params[:remarks]
order_item = OrderItem.find(order_items_id) order_item = OrderItem.find(order_items_id)
before_updated_qty = order_item.qty order = Order.find(order_item.order_id)
if qty_weight.to_i <= order_item.qty.to_i
before_updated_qty = order_item.qty
order_item.item_order_by = current_user.name order_item.item_order_by = current_user.name
order_item.qty = qty_weight order_item.qty = qty_weight
order_item.remark = remarks order_item.remark = remarks
order_item.save order_item.save
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server if ENV["SERVER_MODE"] != "cloud" && order.source == 'cashier' #no print in cloud server
# print # print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'") assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
if !assigned_items.nil? if !assigned_items.nil?
assigned_items.each do |assign_item| assigned_items.each do |assign_item|
# order queue stations # order queue stations
oqs = assign_item.order_queue_station oqs = assign_item.order_queue_station
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf" unique_code="OrderItemPdf"
if !order_slim_pdf.empty? if !order_slim_pdf.empty?
order_slim_pdf.each do |order_item_slim| order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf' if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
unique_code="OrderItemSlimPdf" unique_code="OrderItemSlimPdf"
else else
unique_code="OrderItemPdf" unique_code="OrderItemPdf"
end end
elsif order_item_slim[0] == 'OrderSetPdf' elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
unique_code="OrderSetItemPdf" unique_code="OrderSetItemPdf"
else else
unique_code="OrderItemPdf" unique_code="OrderItemPdf"
end
end end
end end
end end
end
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty ) order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end
end end
end end
render :json => {:status=> true }
else
render :json => {:status=> false, :message => "Not allowed over quantity!" }
end end
end end

View File

@@ -5,7 +5,8 @@ class Oqs::HomeController < BaseOqsController
# @queue_items_details = queue_items_query(false) # @queue_items_details = queue_items_query(false)
# Query for OQS with delivery status true # Query for OQS with delivery status true
@tables = DiningFacility.all.active.order('status desc') # @tables = DiningFacility.all.active.order('status desc')
@tables = DiningFacility.where(:type => 'Table').order('status desc')
@rooms = Room.all.active.order('status desc') @rooms = Room.all.active.order('status desc')
@filter = params[:filter] @filter = params[:filter]
@@ -161,9 +162,9 @@ class Oqs::HomeController < BaseOqsController
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' " oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
end end
if table_id.to_i>0 if !table_id.empty?
table = "and df.id = '#{table_id}' " tableId = table_id.to_a.map{|h| h}.join(",")
table = "and df.id IN (#{tableId})"
else else
table = '' table = ''
end end

View File

@@ -18,11 +18,15 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile if check_mobile
@webview = true @webview = true
end end
today = DateTime.now # if params[:menu] == "true"
day = Date.today.wday @menus = []
@menus = Menu.all @menu = []
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') # else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@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
@@ -59,7 +63,7 @@ class Origami::AddordersController < BaseOrigamiController
end end
def get_item_instance def get_item_instance
@id = MenuItemInstance.find(params[:id]) @instance = MenuItemInstance.find(params[:id])
end end
def get_menu() def get_menu()
@@ -115,8 +119,6 @@ class Origami::AddordersController < BaseOrigamiController
end end
items_arr.push(items) items_arr.push(items)
} }
puts items_arr.to_json
puts "sssssssssssssssssssssss"
# begin # begin
# if params[:order_source] == "quick_service" # if params[:order_source] == "quick_service"
# customer_id = "CUS-000000000002" # for no customer id from mobile # customer_id = "CUS-000000000002" # for no customer id from mobile

View File

@@ -3,6 +3,8 @@ class Origami::DashboardController < BaseOrigamiController
def index def index
@shop = Shop.first @shop = Shop.first
today = DateTime.now.strftime('%Y-%m-%d') today = DateTime.now.strftime('%Y-%m-%d')
# @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() # @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() # @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
@@ -56,6 +58,13 @@ class Origami::DashboardController < BaseOrigamiController
# get printer info # get printer info
@print_settings = PrintSetting.get_precision_delimiter() @print_settings = PrintSetting.get_precision_delimiter()
@current_user = current_user @current_user = current_user
#dine-in cashier
dinein_cashier = Lookup.collection_of('dinein_cashier')
@dinein_cashier = 0
if !dinein_cashier[0].nil?
@dinein_cashier = dinein_cashier[0][1]
end
#quick service #quick service
quick_service = Lookup.collection_of('quick_service') quick_service = Lookup.collection_of('quick_service')
@quick_service = 0 @quick_service = 0
@@ -74,4 +83,8 @@ class Origami::DashboardController < BaseOrigamiController
end end
end end
def get_all_menu
@menus = Menu.all
end
end end

View File

@@ -30,9 +30,9 @@ class Origami::HomeController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
bookings = Booking.all # bookings = Booking.all
if !bookings.today.nil? # if !bookings.today.nil?
@order_items_count = Hash.new # @order_items_count = Hash.new
# bookings.each do |booking| # bookings.each do |booking|
# if booking.sale_id.nil? && booking.booking_status != 'moved' # if booking.sale_id.nil? && booking.booking_status != 'moved'
# if !booking.booking_orders.empty? # if !booking.booking_orders.empty?
@@ -60,7 +60,7 @@ class Origami::HomeController < BaseOrigamiController
# end # end
# end # end
# end # end
end # end
@dining.bookings.active.each do |booking| @dining.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved' if booking.sale_id.nil? && booking.booking_status != 'moved'
@@ -129,6 +129,18 @@ class Origami::HomeController < BaseOrigamiController
end end
end end
def check_emp_access_code
pin_code = params[:code]
employee = Employee.find_by_emp_id(pin_code)
if employee && (employee.role == "manager" || employee.role == "supervisor")
result = {:status=> true, :message=>"Success" }
else
result = {:status=> false, :message=>"Invalid Access Code" }
end
render :json => result.to_json
end
private private
def set_dining def set_dining

View File

@@ -3,12 +3,16 @@ class Origami::MoveroomController < BaseOrigamiController
authorize_resource :class => false authorize_resource :class => false
def move_dining def move_dining
@webview = check_mobile
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc') @rooms = Room.all.active.order('status desc')
@complete = Sale.all @complete = Sale.all
@orders = Order.all.order('date desc') @orders = Order.all.order('date desc')
@status_order = "" @status_order = ""
@status_sale = ""
@sale_array = Array.new
@dining = DiningFacility.find(params[:dining_id]) @dining = DiningFacility.find(params[:dining_id])
@dining.bookings.each do |booking| @dining.bookings.each do |booking|
if booking.sale_id.nil? if booking.sale_id.nil?
@@ -16,21 +20,38 @@ class Origami::MoveroomController < BaseOrigamiController
booking.booking_orders.each do |booking_order| booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id) order = Order.find(booking_order.order_id)
@obj_order = order @obj_order = order
@customer = order.customer
@date = order.created_at @date = order.created_at
@booking= booking
order.order_items.each do |item| order.order_items.each do |item|
@order_items.push(item) @order_items.push(item)
end end
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end end
@status_order = 'order' @status_order = 'order'
else else
sale = Sale.find(booking.sale_id) sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale)
if @status_order == 'order' if @status_order == 'order'
@status_order = 'sale' @status_order = 'sale'
end end
@booking= booking
@date = sale.created_at @date = sale.created_at
@status_sale = 'sale' @status_sale = 'sale'
@obj_sale = sale @obj_sale = sale
@customer = sale.customer
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end end
end end
end end

View File

@@ -3,6 +3,8 @@ class Origami::MovetableController < BaseOrigamiController
authorize_resource :class => false authorize_resource :class => false
def move_dining def move_dining
@webview = check_mobile
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc') @rooms = Room.all.active.order('status desc')
@complete = Sale.all @complete = Sale.all
@@ -16,7 +18,6 @@ class Origami::MovetableController < BaseOrigamiController
if booking.sale_id.nil? if booking.sale_id.nil?
@order_items = Array.new @order_items = Array.new
booking.booking_orders.each do |booking_order| booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id) order = Order.find(booking_order.order_id)
@obj_order = order @obj_order = order
@customer = order.customer @customer = order.customer
@@ -35,7 +36,7 @@ class Origami::MovetableController < BaseOrigamiController
@status_order = 'order' @status_order = 'order'
else else
sale = Sale.find(booking.sale_id) sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale) @sale_array.push(sale)
if @status_order == 'order' if @status_order == 'order'
@status_order = 'sale' @status_order = 'sale'

View File

@@ -1,41 +1,43 @@
class Origami::OrderReservationController < BaseOrigamiController class Origami::OrderReservationController < BaseOrigamiController
def index def index
@order = OrderReservation.latest_order @order = OrderReservation.latest_order #.active
@count_on_order = OrderReservation.get_count_on_order @count_on_order = OrderReservation.get_count_on_order
@count_on_completed = OrderReservation.get_count_on_completed
@shop = Shop.find_by_id(1)
end end
def update def update
@id = params[:order_id] @id = params[:order_id]
@status = params[:status] @status = params[:status]
expected_waiting_time = params[:expected_time] min_type = params[:min_type]
if min_type != ""
expected_waiting_time = params[:expected_time]
else
expected_waiting_time = min_type + " " +params[:expected_time]
end
remark = params[:remark]
access_code = params[:access_code]
@order_reservation = OrderReservation.find(@id) @order_reservation = OrderReservation.find(@id)
status = true if @status == "processed"
result = OrderReservation.create_doemal_order(@order_reservation,current_user)
if status elsif @status == "delivery"
if @status == "processed" OrderReservation.update_order_reservation(@id, nil, "ready_to_delivery")
result = OrderReservation.create_doemal_order(@order_reservation,current_user) response = OrderReservation.send_status_to_ordering(@order_reservation.callback_url,@order_reservation.transaction_ref,"ready_to_delivery")
elsif @status == "delivery" result = {:status=> true, :message => "ready for delivery" }
OrderReservation.update_order_reservation(@id, nil, "ready_to_delivery") elsif @status == "completed"
response = OrderReservation.send_status_to_ordering(@order_reservation.callback_url,@order_reservation.transaction_ref,"ready_to_delivery") result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
result = {:status=> true, :message => "ready for delivery" }
elsif @status == "completed"
result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
else
if @status == "cancel"
OrderReservation.update_order_reservation(@id, nil, "cancelled")
result = {:status=> true, :message => "rejected" }
else
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
result = {:status=> true, :message => "accepted" }
end
end
render :json => result.to_json
else else
result = {:status=> false, :message => "Order not accepted !" } if @status == "rejected"
render :json => result.to_json OrderReservation.update_order_reservation(@id, nil, "rejected",nil,remark,access_code,current_user)
end result = {:status=> true, :message => "rejected" }
else
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
result = {:status=> true, :message => "accepted" }
end
end
render :json => result.to_json
end end
def get_order def get_order
@@ -46,13 +48,7 @@ class Origami::OrderReservationController < BaseOrigamiController
end end
def send_status def send_status
if params[:status] == "cancel" response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason])
status = "rejected"
else
status = params[:status]
end
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status,params[:waiting_time])
render :json => response render :json => response
end end

View File

@@ -15,12 +15,11 @@ class Origami::OtherChargesController < BaseOrigamiController
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id) @table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
else else
@table = nil @table = nil
end end
end end
end end
def create def create
sale_id = params[:sale_id] sale_id = params[:sale_id]
other_charges_items = JSON.parse(params[:other_charges_items]) other_charges_items = JSON.parse(params[:other_charges_items])
sub_total = params[:sub_total] sub_total = params[:sub_total]
@@ -79,8 +78,6 @@ class Origami::OtherChargesController < BaseOrigamiController
if !table.nil? if !table.nil?
dining = {:table_id => table_id, :table_type => table.type } dining = {:table_id => table_id, :table_type => table.type }
render :json => dining.to_json render :json => dining.to_json
end end
end
end
end end

View File

@@ -279,6 +279,9 @@ class Origami::PaymentsController < BaseOrigamiController
new_total = Sale.get_rounding_adjustment(saleObj.grand_total) new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@rounding_adj = new_total-saleObj.grand_total @rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj) saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
@sale_data.grand_total = new_total
@sale_data.old_grand_total = saleObj.grand_total
@sale_data.rounding_adjustment = @rounding_adj
else else
@rounding_adj = @sale_data.rounding_adjustment @rounding_adj = @sale_data.rounding_adjustment
end end
@@ -446,8 +449,7 @@ class Origami::PaymentsController < BaseOrigamiController
end end
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0) saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
puts "FOC"
puts saleObj.to_json
sale_payment = SalePayment.new sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark) sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
# For Cashier by Zone # For Cashier by Zone

View File

@@ -4,11 +4,12 @@ class Origami::PendingOrderController < BaseOrigamiController
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d')) # @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
@sale = Sale.pending_sale @sale = Sale.pending_sale
@order = Sale.pending_order @order = Sale.pending_order
@completed = Sale.completed_sale
end end
def show def show
@sales = Sale.pending_sale @sales = Sale.pending_sale
@orders = Sale.pending_order @orders = Sale.pending_order
@completed = Sale.completed_sale
@id = params[:sale_id] @id = params[:sale_id]
if(@id[0,3] == "SAL") if(@id[0,3] == "SAL")
@sale = Sale.find(@id) @sale = Sale.find(@id)
@@ -41,4 +42,27 @@ class Origami::PendingOrderController < BaseOrigamiController
end end
end end
def completed_sale
@sales = Sale.pending_sale
@orders = Sale.pending_order
@completed = Sale.completed_sale
@id = params[:sale_id]
@sale = Sale.find(@id)
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
@booking = BookingOrder.find_by_order_id(@order).booking_id
@bookings = Booking.find(@booking)
@status = "sale"
if @bookings.dining_facility_id.to_i > 0
@table_id = Booking.find(@bookings.booking_id).dining_facility_id
@dining = DiningFacility.find(@table_id)
else
@table_id = nil
@dining = nil
end
end
end end

View File

@@ -10,24 +10,30 @@ class Origami::QuickServiceController < ApplicationController
def index def index
today = DateTime.now today = DateTime.now
day = Date.today.wday day = Date.today.wday
@menus = Menu.all # if params[:menu] == "true"
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') @menus = []
@menu = []
# else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@zone = Zone.all @zone = Zone.all
@customer = Customer.all @customer = Customer.all
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc') @rooms = Room.all.active.order('status desc')
# @tables = Table.all.active.order('zone_id asc').group("zone_id") render "origami/addorders/detail"
# @rooms = Room.all.active.order('zone_id asc').group("zone_id")
# @all_table = Table.all.active.order('status desc')
# @all_room = Room.all.active.order('status desc')
render "origami/addorders/detail"
end end
def modify_order def modify_order
today = DateTime.now today = DateTime.now
day = Date.today.wday day = Date.today.wday
@menus = Menu.all # if params[:menu] == "true"
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') @menus = []
@menu = []
# else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
if(params[:id][0,3] == "BKI") if(params[:id][0,3] == "BKI")
@table_id = nil @table_id = nil
@table = nil @table = nil

View File

@@ -5,8 +5,10 @@ class Origami::SaleEditController < BaseOrigamiController
sale_id = params[:sale_id] sale_id = params[:sale_id]
if params[:table_id] if params[:table_id]
@table_id = params[:table_id] @table_id = params[:table_id]
@table_type = DiningFacility.find(@table_id).type
else else
@table_id = nil @table_id = nil
@table_type = nil
end end
@cashier_type = params[:type] @cashier_type = params[:type]
@@ -17,6 +19,7 @@ class Origami::SaleEditController < BaseOrigamiController
def item_void def item_void
saleitemId = params[:sale_item_id] saleitemId = params[:sale_item_id]
remark = params[:remark] remark = params[:remark]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId) saleitemObj = SaleItem.find(saleitemId)
saleitemObj.status = 'void' saleitemObj.status = 'void'
saleitemObj.remark = remark saleitemObj.remark = remark
@@ -47,7 +50,11 @@ class Origami::SaleEditController < BaseOrigamiController
end end
end end
end end
action_by = current_user.id # FOr Sale Audit
action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Void Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}" remark = "Void Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMVOID" ) sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMVOID" )
@@ -58,6 +65,7 @@ class Origami::SaleEditController < BaseOrigamiController
def item_foc def item_foc
saleitemId = params[:sale_item_id] saleitemId = params[:sale_item_id]
remark = params[:remark] remark = params[:remark]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId) saleitemObj = SaleItem.find(saleitemId)
saleitemObj.status = 'foc' saleitemObj.status = 'foc'
saleitemObj.remark = remark saleitemObj.remark = remark
@@ -79,7 +87,10 @@ class Origami::SaleEditController < BaseOrigamiController
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
order = Order.find(order_id) order = Order.find(order_id)
action_by = current_user.id action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}" remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" ) sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" )
@@ -111,6 +122,7 @@ class Origami::SaleEditController < BaseOrigamiController
saleitemId = params[:sale_item_id] saleitemId = params[:sale_item_id]
update_qty = params[:update_qty] update_qty = params[:update_qty]
update_price = params[:update_price] update_price = params[:update_price]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId) saleitemObj = SaleItem.find(saleitemId)
sale = Sale.find(saleitemObj.sale_id) sale = Sale.find(saleitemObj.sale_id)
@@ -119,7 +131,10 @@ class Origami::SaleEditController < BaseOrigamiController
saleitemObj.unit_price = update_price saleitemObj.unit_price = update_price
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
action_by = current_user.id action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Update Qty #{update_qty} Price [#{saleitemObj.price}]| Receipt No #{sale.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}" remark = "Update Qty #{update_qty} Price [#{saleitemObj.price}]| Receipt No #{sale.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, action_by,remark,"SALEITEMEDIT" ) sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, action_by,remark,"SALEITEMEDIT" )
# saleitemObj.remark = 'edit' # saleitemObj.remark = 'edit'
@@ -152,6 +167,7 @@ class Origami::SaleEditController < BaseOrigamiController
# make cancel void item # make cancel void item
def item_void_cancel def item_void_cancel
saleitemId = params[:sale_item_id] saleitemId = params[:sale_item_id]
access_code = params[:access_code]
saleitemObj = SaleItem.find(saleitemId) saleitemObj = SaleItem.find(saleitemId)
both = SaleItem.where('product_code=?', saleitemObj.product_code) both = SaleItem.where('product_code=?', saleitemObj.product_code)
both.each do |item| both.each do |item|
@@ -168,7 +184,10 @@ class Origami::SaleEditController < BaseOrigamiController
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
order = Order.find(order_id) order = Order.find(order_id)
action_by = current_user.id action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}" remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" ) sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" )

View File

@@ -19,7 +19,9 @@ class Origami::SplitBillController < BaseOrigamiController
table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL") table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL")
if !table_bookings.nil? if !table_bookings.nil?
table_bookings.each do |table_booking| table_bookings.each do |table_booking|
@sale_data.push(table_booking.sale) if table_booking.sale.sale_status != 'waste' && table_booking.sale.sale_status != 'spoile'
@sale_data.push(table_booking.sale)
end
end end
end end

View File

@@ -22,7 +22,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
end end
end end
#end rounding adjustment #end rounding adjustment
if sale.sale_status != "completed" if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale) @sale_array.push(sale)
end end
end end
@@ -52,7 +52,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
end end
end end
#end rounding adjustment #end rounding adjustment
if sale.sale_status != "completed" && sale.sale_status != 'void' if sale.sale_status != "completed" && sale.sale_status != 'void' && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale) @sale_array.push(sale)
end end
end end

View File

@@ -5,6 +5,7 @@ class Origami::VoidController < BaseOrigamiController
sale_id = params[:sale_id] sale_id = params[:sale_id]
remark = params[:remark] remark = params[:remark]
order_source = params[:type] #tax profile source order_source = params[:type] #tax profile source
access_code = params[:access_code]
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id) sale = Sale.find_by_sale_id(sale_id)
@@ -71,6 +72,10 @@ class Origami::VoidController < BaseOrigamiController
# FOr Sale Audit # FOr Sale Audit
action_by = current_user.name action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}" # remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" ) sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )

View File

@@ -3,7 +3,8 @@ class Origami::WasteSpoileController < BaseOrigamiController
sale_id = params[:sale_id] sale_id = params[:sale_id]
remark = params[:remark] remark = params[:remark]
order_source = params[:type] #tax profile source order_source = params[:type]
access_code = params[:access_code] #tax profile source
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id) sale = Sale.find_by_sale_id(sale_id)
SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax| SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax|
@@ -54,6 +55,9 @@ class Origami::WasteSpoileController < BaseOrigamiController
# FOr Sale Audit # FOr Sale Audit
action_by = current_user.name action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}" # remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,remark ) sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,remark )

View File

@@ -1,7 +1,7 @@
class Reports::OrderReservationController < BaseReportController class Reports::OrderReservationController < BaseReportController
# authorize_resource :class => false # authorize_resource :class => false
def index def index
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]] @providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]]
from, to = get_date_range_from_params from, to = get_date_range_from_params
@@ -17,8 +17,9 @@ class Reports::OrderReservationController < BaseReportController
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at) @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
end end
end end
payment_type = params[:payment_type]
@sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type) provider = params[:provider]
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider)
@from = from @from = from
@to = to @to = to
# get printer info # get printer info
@@ -40,7 +41,7 @@ class Reports::OrderReservationController < BaseReportController
def show def show
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new date_arr = Array.new
@sale_data.each do |sale| @sale_data.each do |sale|

View File

@@ -20,7 +20,7 @@ authorize_resource :class => false
payment_type = params[:payment_type] payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type) @sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type) @sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@tax_profiles = TaxProfile.order('order_by asc').limit(2) @tax_profiles = TaxProfile.where('group_type = "cashier"').order('order_by asc').limit(2)
@from = from @from = from
@to = to @to = to
# get printer info # get printer info

View File

@@ -16,10 +16,12 @@ class Settings::CashierTerminalsController < ApplicationController
# GET /settings/cashier_terminals/new # GET /settings/cashier_terminals/new
def new def new
@settings_cashier_terminal = CashierTerminal.new @settings_cashier_terminal = CashierTerminal.new
@server_mode = ENV["SERVER_MODE"]
end end
# GET /settings/cashier_terminals/1/edit # GET /settings/cashier_terminals/1/edit
def edit def edit
@server_mode = ENV["SERVER_MODE"]
end end
# POST /settings/cashier_terminals # POST /settings/cashier_terminals

View File

@@ -195,7 +195,9 @@ class Settings::MenusController < ApplicationController
# end # end
end end
file_path = "public/menus/" + menu.name + ".xlsx" directory_name = "public/menus"
Dir.mkdir(directory_name) unless File.exists?(directory_name)
file_path = directory_name +"/" + menu.name + ".xlsx"
p.serialize(file_path) p.serialize(file_path)
render :json => { status: true, path: file_path } render :json => { status: true, path: file_path }
end end

View File

@@ -18,10 +18,12 @@ class Settings::OrderQueueStationsController < ApplicationController
# GET /settings/order_queue_stations/new # GET /settings/order_queue_stations/new
def new def new
@settings_order_queue_station = OrderQueueStation.new @settings_order_queue_station = OrderQueueStation.new
@server_mode = ENV["SERVER_MODE"]
end end
# GET /settings/order_queue_stations/1/edit # GET /settings/order_queue_stations/1/edit
def edit def edit
@server_mode = ENV["SERVER_MODE"]
end end
# POST /settings/order_queue_stations # POST /settings/order_queue_stations

View File

@@ -126,6 +126,7 @@ class Ability
# can :overall_void, :void # can :overall_void, :void
can :index, :home can :index, :home
can :show, :home can :show, :home
can :check_emp_access_code, :home
can :read, Order can :read, Order
can :update, Order can :update, Order
can :manage, Booking can :manage, Booking
@@ -151,6 +152,7 @@ class Ability
can :create, :payment can :create, :payment
can :reprint, :payment can :reprint, :payment
can :rounding_adj, :payment can :rounding_adj, :payment
can :foc, :payment
can :print, :payment can :print, :payment
can :move_dining, :movetable can :move_dining, :movetable
@@ -183,6 +185,16 @@ class Ability
can :print, :print can :print, :print
can :print_order_summary, :print can :print_order_summary, :print
can :edit, :sale_edit
can :item_void, :sale_edit
can :item_void_cancel, :sale_edit
can :cancel_all_void, :sale_edit
can :apply_void, :sale_edit
can :item_foc, :sale_edit
can :item_edit, :sale_edit
can :overall_void, :void
elsif user.role == "account" elsif user.role == "account"
@@ -236,6 +248,7 @@ class Ability
can :reprint, :payment can :reprint, :payment
can :rounding_adj, :payment can :rounding_adj, :payment
can :print, :payment can :print, :payment
can :foc, :payment
can :manage, Commission can :manage, Commission
can :manage, Commissioner can :manage, Commissioner

View File

@@ -352,28 +352,6 @@ class Customer < ApplicationRecord
end end
#new customer for doemal
def self.addCustomer(params)
if params[:gender] == "female"
gender = "Female"
else
gender = "Male"
end
customer = Customer.new
customer.name = params[:name]
customer.email = params[:email]
customer.contact_no = params[:contact_no]
customer.gender = params[:gender]
customer.address = params[:address]
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
customer.membership_id = params[:membership_id]
customer.customer_type = "Takeaway"
customer.tax_profiles = ["2"]
customer.save
return customer
end
WALKIN = "CUS-000000000001" WALKIN = "CUS-000000000001"
TAKEAWAY = "CUS-000000000002" TAKEAWAY = "CUS-000000000002"

View File

@@ -45,16 +45,21 @@ class MenuCategory < ApplicationRecord
from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S")) from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S"))
to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S")) to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S"))
current_t = Time.parse(Time.now.utc.getlocal.strftime("%H:%M:%S")) current_t = Time.parse(Time.now.utc.getlocal.strftime("%H:%M:%S"))
from = from_t.hour * 3600 + from_t.min*60 + from_t.sec from = from_t.hour * 3600 + from_t.min*60 + from_t.sec
to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec
current = current_t.hour * 3600 + current_t.min*60+current_t.sec current = current_t.hour * 3600 + current_t.min*60+current_t.sec
if from > to if from > to
h = to_t.hour h = to_t.hour
if h < 12 # before noon if h < 12 # before noon
if h == 0 if h == 0
to = 24 to = 24
to = to * 3600 + to_t.min* 60 + to_t.sec to = to * 3600 + to_t.min* 60 + to_t.sec
else
h += 24
to = h*3600 + to_t.min* 60 + to_t.sec
end end
else # (after) noon else # (after) noon
if h > 12 if h > 12
@@ -64,13 +69,9 @@ class MenuCategory < ApplicationRecord
end end
end end
# from = from.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
# to = to.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
# current = current.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
day = Date.today.wday day = Date.today.wday
dayresult = menu.valid_days.include?(day.to_s) dayresult = menu.valid_days.include?(day.to_s)
if current.between?(from, to) && menu.valid_days.include?(day.to_s) if current.between?(from, to) && menu.valid_days.include?(day.to_s)
return true return true
else else
@@ -80,7 +81,7 @@ class MenuCategory < ApplicationRecord
def get_sub_category def get_sub_category
menu_category = MenuCategory.find_by_menu_category_id(self.id) menu_category = MenuCategory.find_by_menu_category_id(self.id)
if menu_category if !menu_category.nil?
return true return true
end end
return false return false

View File

@@ -64,7 +64,7 @@ class MyAesCrypt
shop_json["data"].each do |j| shop_json["data"].each do |j|
if j["lookup"] == from if j["lookup"] == from
# add [0...44] for production cloud for remove \n # add [0...44] for production cloud for remove \n
if(j["value"]["key"] == token) if(j["value"]["key"].gsub(/\s+/, "") == token)
return true return true
end end
end end

View File

@@ -57,7 +57,11 @@ class OrderQueueStation < ApplicationRecord
if oqs.auto_print && order_source != "quick_service" if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0 if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items) if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true is_auto_printed = true
end end
end end
@@ -91,8 +95,12 @@ class OrderQueueStation < ApplicationRecord
end end
if oqs.auto_print && order_source != "quick_service" if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0 if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items) if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true is_auto_printed = true
end end
end end
@@ -137,8 +145,12 @@ class OrderQueueStation < ApplicationRecord
end end
if oqs.auto_print if oqs.auto_print
if oqs_order_items.length > 0 if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items) if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true is_auto_printed = true
end end
end end
@@ -165,8 +177,12 @@ class OrderQueueStation < ApplicationRecord
end end
if oqs.auto_print if oqs.auto_print
if oqs_order_items.length > 0 if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items) if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true is_auto_printed = true
end end
end end
@@ -211,7 +227,7 @@ class OrderQueueStation < ApplicationRecord
end end
#Print order_item in 1 slip per item #Print order_item in 1 slip per item
def print_slip_item(oqs, assigned_item) def print_slip_item(oqs, order, assigned_items)
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf" unique_code="OrderItemPdf"
if !order_slim_pdf.empty? if !order_slim_pdf.empty?
@@ -232,14 +248,17 @@ class OrderQueueStation < ApplicationRecord
end end
end end
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() # order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
# print when complete click # print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" ) if !assigned_items.nil?
assigned_items.each do |order_item|
order_queue_printer.print_order_item(print_settings, oqs,order_item.order_id, order_item.order_items_id, print_status="" )
end
end
# update print status for completed same order items # update print status for completed same order items
assigned_order_item.each do |ai| AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
ai.print_status=true ai.print_status=true
ai.save ai.save
end end

View File

@@ -7,6 +7,7 @@ class OrderReservation < ApplicationRecord
has_many :order_reservation_items has_many :order_reservation_items
has_one :delivery has_one :delivery
scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }
scope :latest_order, -> { order("order_reservation_id desc, created_at desc") } scope :latest_order, -> { order("order_reservation_id desc, created_at desc") }
SEND_TO_KITCHEN = "send_to_kitchen" SEND_TO_KITCHEN = "send_to_kitchen"
@@ -14,6 +15,28 @@ class OrderReservation < ApplicationRecord
DELIVERED = "delivered" DELIVERED = "delivered"
COMPLETED = "completed" COMPLETED = "completed"
#new customer for doemal
def self.addCustomer(params)
if params[:gender] == "female"
gender = "Female"
else
gender = "Male"
end
customer = Customer.new
customer.name = params[:name]
customer.email = params[:email]
customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
customer.gender = gender
customer.address = params[:address] ? params[:address] : ''
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
customer.membership_id = params[:membership_id]
customer.customer_type = "Takeaway"
customer.tax_profiles = ["2"]
customer.save
return customer
end
def self.addOrderReservationInfo(order_reserve) def self.addOrderReservationInfo(order_reserve)
Rails.logger.debug order_reserve.to_s Rails.logger.debug order_reserve.to_s
check_order_reservation = OrderReservation.where("transaction_ref = ?",order_reserve[:reference]) check_order_reservation = OrderReservation.where("transaction_ref = ?",order_reserve[:reference])
@@ -29,7 +52,7 @@ class OrderReservation < ApplicationRecord
order_reservation.payment_type = order_reserve[:payment_info][:payment_type] order_reservation.payment_type = order_reserve[:payment_info][:payment_type]
order_reservation.payment_status = order_reserve[:payment_info][:payment_status] order_reservation.payment_status = order_reserve[:payment_info][:payment_status]
order_reservation.payment_ref = order_reserve[:payment_info][:payment_ref] order_reservation.payment_ref = order_reserve[:payment_info][:payment_ref]
order_reservation.taxes = order_reserve[:payment_info][:taxes] order_reservation.taxes = order_reserve[:payment_info][:taxes].to_json
order_reservation.total_amount = order_reserve[:payment_info][:sub_total] order_reservation.total_amount = order_reserve[:payment_info][:sub_total]
order_reservation.total_tax = order_reserve[:payment_info][:total_tax] order_reservation.total_tax = order_reserve[:payment_info][:total_tax]
order_reservation.discount_amount = order_reserve[:payment_info][:discount_amount] order_reservation.discount_amount = order_reserve[:payment_info][:discount_amount]
@@ -39,7 +62,7 @@ class OrderReservation < ApplicationRecord
end end
if order_reserve[:reservation_info] if order_reserve[:reservation_info]
order_reservation.total_customer = order_reserve[:reservation_info][:total_user] order_reservation.total_customer = order_reserve[:reservation_info][:total_user]
order_reservation.reservation_remark = order_reserve[:reservation_info][:reservation_note] order_reservation.order_remark = order_reserve[:reservation_info][:reservation_note]
end end
order_reservation.save! order_reservation.save!
if order_reserve[:order_info][:items] if order_reserve[:order_info][:items]
@@ -70,9 +93,6 @@ class OrderReservation < ApplicationRecord
count += 1 count += 1
items_arr.push(items) items_arr.push(items)
} }
puts items_arr.to_json
puts "sssssssssssssssssssssss"
customer_id = order.customer_id customer_id = order.customer_id
@order = Order.new @order = Order.new
@@ -101,9 +121,12 @@ class OrderReservation < ApplicationRecord
#order reservation status updated #order reservation status updated
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN) update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
result = {:status=> @status, :data => @sale, :message => "created" } result = {:status=> @status, :data => @sale, :message => "send to kitchen" }
return result else
result = {:status=> @status, :message => "No current shift open for this employee!" }
end end
return result
end end
def self.update_doemal_payment(order,current_user) def self.update_doemal_payment(order,current_user)
@@ -137,7 +160,7 @@ class OrderReservation < ApplicationRecord
end end
end end
def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil) def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil,min_type=nil,reason=nil)
base_url = 'https://api.doemal.com' base_url = 'https://api.doemal.com'
token = '3T-tnlYtFJ-5Z1vY6XQqxQ' token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
order_reservation = Lookup.collection_of("order_reservation") order_reservation = Lookup.collection_of("order_reservation")
@@ -155,9 +178,10 @@ class OrderReservation < ApplicationRecord
end end
Rails.logger.debug "Doemal URL" + base_url Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url post_url = base_url + url
if waiting_time != ""
if !waiting_time.nil? send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
send_params = {id: ref_no, waiting_time: waiting_time, status: status} elsif reason != ""
send_params = {id: ref_no, status: status, reason: reason}
else else
send_params = {id: ref_no, status: status} send_params = {id: ref_no, status: status}
end end
@@ -184,29 +208,161 @@ class OrderReservation < ApplicationRecord
return response return response
end end
def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil) def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil, remark=nil, access_code=nil, current_user=nil)
order_reservation = OrderReservation.find(id) order_reservation = OrderReservation.find(id)
if sale_id.present? if sale_id.present?
order_reservation.sale_id = sale_id order_reservation.sale_id = sale_id
end end
if !expected_waiting_time.nil? if !expected_waiting_time.nil?
order_reservation.expected_waiting_time = DateTime.parse(expected_waiting_time).utc order_reservation.expected_waiting_time = expected_waiting_time
end
if !status.nil?
order_reservation.status = status
end
if !remark.nil?
order_reservation.order_remark = remark
end
if status == "delivered"
order_reservation.payment_status = "paid"
end end
order_reservation.status = status
order_reservation.save order_reservation.save
# if !order_reservation.sale_id.nil? && status == "rejected"
# void_doemal_payment(order_reservation.sale_id, remark, access_code, current_user)
# end
end
def self.void_doemal_payment(sale_id, remark, access_code, current_user)
if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id)
# update count for shift sale
if(sale.sale_status == "completed")
if sale.shift_sale_id != nil
shift = ShiftSale.find(sale.shift_sale_id)
shift.calculate(sale_id, "void")
end
else
# void before sale payment complete
if sale.shift_sale_id != nil
shift = ShiftSale.find(sale.shift_sale_id)
shift.total_void = shift.total_void + sale.grand_total
shift.save
end
end
sale.payment_status = 'void'
sale.sale_status = 'void'
sale.save
# FOr Sale Audit
action_by = current_user.name
approved_by = Employee.find_by_emp_id(access_code)
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,"SALEVOID" )
# update complete order items in oqs
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
aoi.delivery_status = 1
aoi.save
end
end
end
end end
def self.get_count_on_order def self.get_count_on_order
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status").group("status") order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status")
.where("status != 'delivered'")
.group("status")
end
def self.get_count_on_completed
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count")
.where("created_at BETWEEN '#{DateTime.now.beginning_of_day}' AND '#{DateTime.now.end_of_day}' AND status = 'delivered'").first()
end end
def self.get_pending_orders def self.get_pending_orders
order_reservation = OrderReservation.select("order_reservations.*,deliveries.provider,deliveries.delivery_type") order_reservation = OrderReservation.select("order_reservations.*,del.provider,del.delivery_type")
.joins(" JOIN deliveries as del on del.order_reservation_id=order_reservations.order_reservation_id") .joins(" JOIN deliveries as del on del.order_reservation_id=order_reservations.order_reservation_id")
.where("order_reservations.status='new'") .where("order_reservations.status='new'")
.order("order_reservations.order_reservation_id desc, order_reservations.created_at desc") .order("order_reservations.order_reservation_id desc, order_reservations.created_at desc")
end end
def self.check_new_order
shop = Shop.find_by_id(1)
if !shop.shop_code.nil?
shop_code = shop.shop_code
else
shop_code = ''
end
order_reservation = OrderReservation.where("status='new'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
end
end
end
def self.check_order_send_to_kitchen
shop = Shop.find_by_id(1)
if !shop.shop_code.nil?
shop_code = shop.shop_code
else
shop_code = ''
end
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
end
end
end
def self.check_order_ready_to_delivery
shop = Shop.find_by_id(1)
if !shop.shop_code.nil?
shop_code = shop.shop_code
else
shop_code = ''
end
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code
end
end
end
def self.get_order_reservation_by_shift(shift_sale_range,shift,from,to,provider)
## => left join -> show all sales although no orders
if provider.blank?
provider = ''
else
if provider.present?
provider = " and deliveries.provider = '#{provider}'"
end
end
query = OrderReservation.select("order_reservations.*, deliveries.provider, deliveries.delivery_fee, customers.name, customers.email")
.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
.joins(" JOIN customers on customers.customer_id = order_reservations.customer_id")
.joins(" JOIN sales on sales.sale_id = order_reservations.sale_id")
if shift.present?
query = query.where("sales.shift_sale_id in (?) #{provider} and sales.sale_status= 'completed' and sale_payments.payment_amount != 0", shift.to_a)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
elsif shift_sale_range.present?
query = query.where("sales.sale_status='completed' #{provider} and sale_payments.payment_amount != 0 and sales.shift_sale_id in (?)",shift_sale_range.to_a)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
else
query = query.where("sales.sale_status='completed' and sales.receipt_date between ? and ? #{provider} and sale_payments.payment_amount != 0",from,to)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
end
return query
end
private private
def generate_custom_id def generate_custom_id
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS") self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")

View File

@@ -475,11 +475,9 @@ class Sale < ApplicationRecord
if shop.calc_tax_order if shop.calc_tax_order
total_taxable = total_taxable + sale_tax.tax_payable_amount total_taxable = total_taxable + sale_tax.tax_payable_amount
end end
sale_tax.inclusive = tax.inclusive sale_tax.inclusive = tax.inclusive
sale_tax.save sale_tax.save
end end
end end
# end # end
# end # end
@@ -1195,8 +1193,14 @@ def self.get_wastes_and_spoilages(from,to,status)
else else
type = "and sales.sale_status = 'waste'" type = "and sales.sale_status = 'waste'"
end end
query = Sale.all.where("sales.receipt_date between ? and ? #{type}",from,to) query = Sale.select("sales.sale_id,sales.receipt_no,sales.created_at,sales.total_amount,sales.grand_total,sales.rounding_adjustment,sales.shift_sale_id,sale_items.product_name,sale_items.product_code,sale_items.item_instance_code,sale_items.qty,sale_items.price,sale_items.unit_price,menu_categories.name")
.group("sales.receipt_no") .joins("JOIN sale_items ON sales.sale_id = sale_items.sale_id" +
" JOIN menu_item_instances ON sale_items.item_instance_code = menu_item_instances.item_instance_code" +
" JOIN menu_items ON menu_item_instances.menu_item_id = menu_items.id" +
" JOIN menu_categories ON menu_items.menu_category_id = menu_categories.id")
.where("sales.receipt_date between ? and ? #{type}",from,to)
.group("sales.receipt_no,menu_categories.id,sale_items.item_instance_code")
.order("sales.sale_id,menu_categories.name,sale_items.product_name")
end end
# def self.get_separate_tax(from,to,payment_method=nil) # def self.get_separate_tax(from,to,payment_method=nil)
@@ -2660,6 +2664,13 @@ end
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service") query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service")
.group("bookings.booking_id") .group("bookings.booking_id")
end end
def self.completed_sale
query = Sale.all
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
query = query.where("sales.sale_status != 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
.group("sales.sale_id")
end
def self.all_receipts def self.all_receipts
query = Sale.select("sales.*,sale_payments.created_at as receipt_close_time, query = Sale.select("sales.*,sale_payments.created_at as receipt_close_time,

View File

@@ -98,7 +98,6 @@ class SaleItem < ApplicationRecord
discount_accounts = [] discount_accounts = []
Account.all.each do |a| Account.all.each do |a|
discount_account = {:name => a.title, :price => 0} discount_account = {:name => a.title, :price => 0}
# Check for actual sale items # Check for actual sale items
sale_items.where("status = 'Discount'").each do |si| sale_items.where("status = 'Discount'").each do |si|
if si.account_id == a.id if si.account_id == a.id

View File

@@ -207,7 +207,6 @@ class ReceiptBillPdf < Prawn::Document
price = item.unit_price price = item.unit_price
product_name = item.product_name product_name = item.product_name
y_position = cursor y_position = cursor
pad_top(15) { pad_top(15) {

View File

@@ -19,6 +19,14 @@ class CommissionerImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
def filename
if Shop.find(1).shop_code.nil?
"#{original_filename}" if original_filename.present?
else
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
end
# def cache_dir # def cache_dir
# '/tmp/images' # '/tmp/images'
# end # end

View File

@@ -19,6 +19,14 @@ class CustomerImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
def filename
if Shop.find(1).shop_code.nil?
"#{original_filename}" if original_filename.present?
else
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
end
# def cache_dir # def cache_dir
# '/tmp/images' # '/tmp/images'
# end # end

View File

@@ -19,6 +19,14 @@ class EmployeeImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
def filename
if Shop.find(1).shop_code.nil?
"#{original_filename}" if original_filename.present?
else
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
end
# def cache_dir # def cache_dir
# '/tmp/images' # '/tmp/images'
# end # end

View File

@@ -19,6 +19,14 @@ class MenuItemImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
def filename
if Shop.find(1).shop_code.nil?
"#{original_filename}" if original_filename.present?
else
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
end
# def cache_dir # def cache_dir
# '/tmp/images' # '/tmp/images'
# end # end

View File

@@ -19,6 +19,14 @@ class ProductImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
def filename
if Shop.find(1).shop_code.nil?
"#{original_filename}" if original_filename.present?
else
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
end
# def cache_dir # def cache_dir
# '/tmp/images' # '/tmp/images'
# end # end

View File

@@ -19,6 +19,14 @@ class ShopImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
def filename
if Shop.find(1).shop_code.nil?
"#{original_filename}" if original_filename.present?
else
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
end
# def cache_dir # def cache_dir
# '/tmp/images' # '/tmp/images'
# end # end

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code, :membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles :salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json) json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -185,7 +185,7 @@ $(document).on('click',".customer_tr",function(){
url: url, url: url,
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
// Selected for Taxes // Selected for Taxes
var taxes = JSON.stringify(data.tax_profiles); var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes); var parse_taxes = JSON.parse(taxes);
@@ -193,7 +193,7 @@ $(document).on('click',".customer_tr",function(){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'}); $("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
}); });
$('#customer_id').val(data.id); $('#customer_id').val(data.id);
$('#customer_name').val(data.name); $('#customer_name').val(data.name);
$('#customer_company').val(data.company); $('#customer_company').val(data.company);
$('#customer_contact_no').val(data.contact_no); $('#customer_contact_no').val(data.contact_no);
@@ -205,6 +205,9 @@ $(document).on('click',".customer_tr",function(){
$('#paypar_account_no').val(data.paypar_account_no); $('#paypar_account_no').val(data.paypar_account_no);
$('#customer_address').val(data.address); $('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth); $('#customer_date_of_birth').val(data.date_of_birth);
if(data.image_path.url!=undefined && data.image_path.url!=null){
$('.menu-item-img .img-thumbnail').attr('src',data.image_path.url);
}
$('#customer_membership_type').val(data.membership_type); $('#customer_membership_type').val(data.membership_type);
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected'); $('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
if (data.gender == 'Male') { if (data.gender == 'Male') {

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code, :membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles :salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json) json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -11,8 +11,8 @@
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%> <%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%>
<%= f.hidden_field :customer_id %> <%= f.hidden_field :customer_id %>
<%= f.input :name %> <%= f.input :name %>
<%= f.input :contact_no %> <%= f.input :contact_no , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notChar(this.value);" } %>
<%= f.input :seater %> <%= f.input :seater , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notNegative(this.value);" } %>
<%= f.input :remark %> <%= f.input :remark %>
</div> </div>
<br> <br>
@@ -111,11 +111,29 @@
<script type="text/javascript"> <script type="text/javascript">
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 notNegative(val){
if(parseInt(val)< 1) $("#dining_queue_seater").val(0);
}
function notNegative(val){
if(typeof val == "string") $("#dining_queue_seater").val(0);
}
$(document).ready(function(){ $(document).ready(function(){
if($('form').attr('id') == "new_dining_queue"){ if($('form').attr('id') == "new_dining_queue"){
var queue_no = $('.generate_no').text(); var queue_no = $('.generate_no').text();
$('#dining_queue_queue_no').val(queue_no); $('#dining_queue_queue_no').val(queue_no);
} }
$( "input" ).focusin(function() { $( "input" ).focusin(function() {

View File

@@ -132,6 +132,9 @@
<li> <li>
<a href="<%= reports_product_sale_index_path %>">Product Sale</a> <a href="<%= reports_product_sale_index_path %>">Product Sale</a>
</li> </li>
<li>
<a href="<%= reports_order_reservation_index_path %>">Order Reservation</a>
</li>
<li> <li>
<a href="<%= reports_receipt_no_index_path %>">Receipt</a> <a href="<%= reports_receipt_no_index_path %>">Receipt</a>
</li> </li>

View File

@@ -123,25 +123,29 @@ $(document).ready(function(){
data: params, data: params,
success: function(result){ success: function(result){
// alert("Updated!"); // alert("Updated!");
<% if !@link_type.nil? %> if(result.status){
<% if @link_type == 'oqs' %> <% if !@link_type.nil? %>
window.location.href = '/oqs'; <% if @link_type == 'oqs' %>
<% elsif @link_type == 'pending' %> window.location.href = '/oqs';
window.location.href = '/origami/quick_service/pending_order/'+booking_id; <% elsif @link_type == 'pending' %>
<% else %> window.location.href = '/origami/quick_service/pending_order/'+booking_id;
<% if !@dining_type.nil? %> <% else %>
<% if @dining_type == 'Table' %> <% if !@dining_type.nil? %>
<% if @dining_type == 'Table' %>
window.location.href = '/origami/table/'+<%=@link_type%>;
<% else %>
window.location.href = '/origami/room/'+<%=@link_type%>;
<% end %>
<% else %>
window.location.href = '/origami/table/'+<%=@link_type%>; window.location.href = '/origami/table/'+<%=@link_type%>;
<% else %> <% end %>
window.location.href = '/origami/room/'+<%=@link_type%>; <% end %>
<% end %> <% else %>
<% else %> window.location.href = '/oqs';
window.location.href = '/origami/table/'+<%=@link_type%>;
<% end %>
<% end %> <% end %>
<% else %> }else{
window.location.href = '/oqs'; swal("Alert!", result.message, "warning");
<% end %> }
} }
}); });
}); });

View File

@@ -1,9 +1,10 @@
<!-- Column One --> <!-- Column One -->
<div class="row clearfix" style=""> <div class="row clearfix" style="">
<div class="col-lg-11 col-md-11 col-sm-11"> <div class="col-lg-8 col-md-8 col-sm-8">
<div class="body p-l-10"> <div class="body p-l-10">
<div class="row clearfix"> <div class="row clearfix">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12"> <div class="form-group col-lg-2 col-md-2 col-sm-2">
<label class="label-align">Select Station</label>
<span class="hidden" id="oqs_active"></span> <span class="hidden" id="oqs_active"></span>
<select class="form-control select oqs_click" name="oqs_id" id="oqs_id"> <select class="form-control select oqs_click" name="oqs_id" id="oqs_id">
<option value="0" data-id="0">Processed</option> <option value="0" data-id="0">Processed</option>
@@ -15,16 +16,6 @@
<% end %> <% end %>
</select> </select>
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="table_id"></span>
<select class="form-control select tables" name="table_id" id="tables">
<option value="">Select Table</option>
<% @tables.each do |table| %>
<option value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></option>
<% end %>
</select>
</div>
<!-- <!--
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12"> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="room_id"></span> <span class="hidden" id="room_id"></span>
@@ -44,67 +35,64 @@
<div class="card"> <div class="card">
<div class="card-block"> <div class="card-block">
<div class="tab-content" id="custom-slimscroll" style=""> <div class="tab-content" id="custom-slimscroll" style="">
<div class="tab-pane in active" id="completed" role="tabpanel"> <div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<% <%
@queue_completed_item.each do |qid| @queue_completed_item.each do |qid|
%> %>
<div class="card queue_station" data-order-no="<%= qid.order_id %>"> <div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block"> <div class="card-block">
<div class="row"> <div class="row">
<%if qid.type.present?%> <%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span> <span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%> <%else%>
<span class="col-md-4 order-zone-type font-13"></span> <span class="col-md-4 order-zone-type font-13"></span>
<%end%> <%end%>
<span class="order-zone hidden font-13"><%= qid.zone %></span> <span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span> <span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div> </div>
<p class="m-b--10"> <p class="m-b--10">
<span class="order-item font-16"> <span class="order-item font-16">
<%= qid.item_name %> <%= qid.item_name %>
</span> [x </span> [x
<span class="order-qty"> <span class="order-qty">
<%= qid.qty %> <%= qid.qty %>
</span> ] </span> ]
<% if !qid.set_menu_items.nil? %> <% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%> <% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12"> <br><span class="font-12">
<%= item_instance %> <%= item_instance %>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span> </span>
<% end %> </span>
<% end %> <p class="hidden order-status">completed</p>
</p> <p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p> </div>
</div>
<span class="card-text"> <% end %>
<span class="text-muted">Order at - </div>
<span class="order-at font-13"> </div>
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> <div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<% end %>
</div>
</div>
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Column Two --> <!-- Column Two -->
@@ -151,6 +139,35 @@
</div> </div>
--> -->
<!-- Column Three --> <!-- Column Three -->
<div class="col-lg-3 col-md-3 col-sm-3 table-block">
<p class="hidden filter"><%= @filter %></p>
<div class="card">
<div class="card-block">
<div class="tab-content" id="table-slimscroll" style="">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#table" id="defaultOpen">Table</a></li>
<li><a data-toggle="tab" href="#room">Room</a></li>
</ul>
<div class="tab-content">
<div id="table" class="tab-pane fade">
<% @tables.each do |table| %>
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></button>
</div>
<% end %>
</div>
<div id="room" class="tab-pane fade">
<% @rooms.each do |room| %>
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= room.id %>" data-id="<%= room.id %>"> <%= room.name %></button>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons --> <!-- OQS Buttons -->
<br> <br>
@@ -168,4 +185,6 @@
window.location.href = '/dashboard'; window.location.href = '/dashboard';
}); });
}); });
document.getElementById("defaultOpen").click();
</script> </script>

965
app/views/origami/addorders/detail.html.erb Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
if(@id) if(@instance)
menu_item = MenuItem.find(@id.menu_item_id) menu_item = MenuItem.find(@instance.menu_item_id)
# Format for option json # Format for option json
opt_format = [] opt_format = []
# Format for attributes json # Format for attributes json
@@ -24,14 +24,14 @@ if(@id)
end end
json.success true json.success true
json.id @id.id json.id @instance.id
json.name @id.item_instance_name json.name @instance.item_instance_name
json.code @id.item_instance_code json.code @instance.item_instance_code
json.item_id @id.menu_item_id json.item_id @instance.menu_item_id
json.attributes @id.item_attributes json.attributes @instance.item_attributes
json.price @id.price json.price @instance.price
json.is_default @id.is_default json.is_default @instance.is_default
json.options opt_format json.options opt_format
else else

View File

@@ -204,8 +204,7 @@
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>"; var cashier_type = "<%= @cashier_type %>";
$("#reference_no_Err").html(""); $("#reference_no_Err").html("");
if(reference_no.length > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click"); $(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
// var sub_total = $('#sub-total').text(); // var sub_total = $('#sub-total').text();
@@ -244,15 +243,12 @@
}); });
} }
}else{ }else{
if (amount>0) { if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" ); swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{ }else{
swal ( "Oops" , "Enter Amount!" , "error" ); swal ( "Oops" , "Enter Amount!" , "error" );
} }
}
}else{
$("#reference_no_Err").html("can't be blank");
} }
}) })
</script> </script>

View File

@@ -207,6 +207,21 @@
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%> <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
</div> </div>
<div class="form-group">
<label><%= t("views.right_panel.detail.customer_photo") %></label>
<div class="panel padding-10">
<div class="menu-item-img">
<% if f.object.image_path? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
</div>
<%= f.file_field :image_path, :class => "img-thumbnail" %>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label><%= t("views.right_panel.detail.select_customer_type") %></label> <label><%= t("views.right_panel.detail.select_customer_type") %></label>
<select class="form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" > <select class="form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >

View File

@@ -0,0 +1,36 @@
json.id menu.id
json.name menu.name
json.is_active menu.is_active
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories)
json.categories menu.menu_categories do |category|
menu_category = MenuCategory.find_by_menu_category_id(category.id)
if !menu_category.nil?
json.sub_category "true"
else
json.sub_category "false"
end
valid_time = category.valid_time
json.valid_time valid_time
json.id category.id
json.code category.code
json.order_by category.order_by
json.name category.name
json.alt_name category.alt_name
json.order_by category.order_by
json.parent_id category.menu_category_id
json.is_available category.is_available
if category.menu_items
json.items category.menu_items do |item|
json.partial! 'origami/addorders/menu_item', item: item
end
end
end
end

View File

@@ -0,0 +1,15 @@
menu_json = json.array! @menus do |menu|
json.id menu.id
json.name menu.name
json.valid_days menu.valid_days
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
json.partial! 'origami/dashboard/menu', menu: menu
# if (@current_menu)
# json.current_menu do
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
# end
# end
end

View File

@@ -28,6 +28,7 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<% if @dinein_cashier == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view"> <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
<div class="info-box bg-green"> <div class="info-box bg-green">
<div class="icon" > <div class="icon" >
@@ -36,6 +37,7 @@
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div> <div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
</div> </div>
</div> </div>
<% end %>
<% if @order_reservation == '1' %> <% if @order_reservation == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation"> <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation">
<div class="info-box bg-blue"> <div class="info-box bg-blue">
@@ -205,6 +207,15 @@
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button> <button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
<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() {
$.ajax({
type: "GET",
url: 'get_all_menu',
data: {},
success:function(result){
localStorage.setItem("menus", JSON.stringify(result));
}
});
$(".cashier_view").on('click', function() { $(".cashier_view").on('click', function() {
window.location.href = '/origami'; window.location.href = '/origami';
@@ -221,9 +232,9 @@
window.location.href = '/origami/order_reservation'; window.location.href = '/origami/order_reservation';
}); });
$("#second_view").on('click', function () { $("#second_view").on('click', function () {
var url = $(this).attr("data-href"); var url = $(this).attr("data-href");
window.open(url,'_blank'); window.open(url,'_blank');
}); });
});
</script> </script>

View File

@@ -142,7 +142,6 @@ $(document).ready(function(){
var webview = <%= @webview %>; var webview = <%= @webview %>;
showHideNavbar(webview,"index"); showHideNavbar(webview,"index");
$(".tables").on('click', function(){ $(".tables").on('click', function(){
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id; window.location.href = '/origami/table/' + dining_id;

View File

@@ -485,8 +485,15 @@
<% end %> <% end %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button> <button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
<% if current_login_employee.role != "waiter" %> <% if current_login_employee.role != "waiter" %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button> <!-- <button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> -->
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<% end %> <% end %>
<% if current_login_employee.role != "waiter" %> <% if current_login_employee.role != "waiter" %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button> <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
@@ -579,26 +586,35 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4> <h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div> </div>
<div class="modal-body"> <div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<div class="row p-r-20"> <input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="col-md-3"> <div class="row bottom p-l-15 p-r-15 m-t-10">
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button> <div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
</div> <div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3"> <div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button> <div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div> </div>
<div class="col-md-3"> <div class="row bottom p-l-15 p-r-15">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button> <div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
</div> <div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
</div> <div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
</div> <div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
<div class="modal-footer "> </div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -957,6 +973,7 @@
}); });
$('#void').on('click', function () { $('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") { if ($(this).attr('active')=== "true") {
swal({ swal({
title: "Alert", title: "Alert",
@@ -975,7 +992,7 @@
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: ajax_url, url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
// For Server Print - from jade // For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
@@ -993,6 +1010,7 @@
$('#add_order').on('click', function () { $('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>"; var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/addorders/' + dining_id; window.location.href = '/origami/addorders/' + dining_id;
}); });
@@ -1052,6 +1070,12 @@
return attribute_arr; return attribute_arr;
} }
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
function waste_and_spoilage(remark) { function waste_and_spoilage(remark) {
swal({ swal({
title: "Alert", title: "Alert",
@@ -1081,4 +1105,34 @@
} }
}); });
} }
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);
if (type == "edit") {
var dining_id = "<%= @dining.id rescue "" %> ";
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste_and_spoilage"){
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script> </script>

View File

@@ -200,8 +200,7 @@ $('#jcb_pay').on('click',function(){
var receipt_no = "<%= @receipt_no %>"; var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
$("#reference_no_Err").html(""); $("#reference_no_Err").html("");
if(reference_no.length > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click"); $(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
// var sub_total = $('#sub-total').text(); // var sub_total = $('#sub-total').text();
@@ -247,8 +246,5 @@ $('#jcb_pay').on('click',function(){
swal ( "Oops" , "Enter Amount!" , "error" ); swal ( "Oops" , "Enter Amount!" , "error" );
} }
} }
}else{
$("#reference_no_Err").html("can't be blank");
}
}) })
</script> </script>

View File

@@ -198,7 +198,6 @@
var receipt_no = "<%= @receipt_no %>"; var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
$("#reference_no_Err").html(""); $("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click"); $(this).off("click");
@@ -245,8 +244,5 @@
swal ( "Oops" , "Enter Amount!" , "error" ); swal ( "Oops" , "Enter Amount!" , "error" );
} }
} }
}else{
$("#reference_no_Err").html("can't be blank");
}
}) })
</script> </script>

View File

@@ -1,211 +1,376 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<!-- Column One --> <!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab"> <ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a> <a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a> <a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
</li> </li>
</ul> </ul>
<!-- Nav tabs - End --> <!-- Nav tabs - End -->
<div id="order-detail-slimscroll" data-height="130"> <div id="custom-slimscroll">
<div class="tab-content" style=""> <div class="tab-content" style="">
<!--- Panel 0 - Completed Orders --> <!--- Panel 0 - Completed Orders -->
<!--- Panel 1 - Table Orders --> <!--- Panel 1 - Table Orders -->
<div class="tab-pane " id="tables" role="tabpanel"> <div class="tab-pane" id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %> <% @tables.each do |table| %>
<% if table.status == 'occupied' %> <% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>"> <% if table.get_booking.nil? %>
<div class="card-block"> <% if table.get_checkout_booking.nil? %>
<%= table.name %> <div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
</div> <% else %>
</div> <div class="card tables orange text-white" data-id="<%= table.id %>">
<% else %> <% end %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>"> <div class="card-block">
<div class="card-block"> <%= table.name %>
<%= table.name %> </div>
</div> </div>
</div> <% else %>
<% end %> <% if table.get_checkout_booking.nil? %>
<% end %> <div class="card tables blue text-white" data-id="<%= table.id %>">
</div> <% else %>
</div> <div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 2 - Room Orders --> <!--- Panel 2 - Room Orders -->
<div class="tab-pane active" id="rooms" role="tabpanel"> <div class="tab-pane active" id="rooms" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" > <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %> <% @rooms.each do |room| %>
<% if room.status == 'occupied' %> <% if room.status == 'occupied' %>
<% if room.get_booking.nil? %> <% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>"> <div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %> <% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>"> <div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %> <%= room.name %>
</div> </div>
</div> </div>
<% end %> <% else %>
<% end %> <div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
</div> <div class="card-block">
</div> <%= room.name %>
<!--- Panel 3 - s --> </div>
</div> </div>
</div> <% end %>
<!-- tabs - End --> <% end %>
</div> </div>
<!-- Column One --> </div>
<!--- Panel 3 - s -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'>' <%= @dining.name %>' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
</div>
<div class="card-block">
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p class="m-l-10"> Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @obj_sale.receipt_no rescue '' %>
<% end %>
</span></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p class="m-r-10">Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<%
sub_total = 0
if @status_sale == "sale"
@obj_sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
<% unless sale_item.price <= 0 %>
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
if @status_order == 'order'
unless @order_items.nil?
@order_items.each do |order_item |
sub_total = sub_total + order_item.price
unless order_item.price <= 0 %>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
end
end
end
%>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="move_table purple" id="move_table">MOVE TABLE</div>
</div>
</div>
</div>
</div>
</div> </div>
</div>
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column Three --> <!-- Column Two -->
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-5 col-md-5 col-sm-5">
<!-- Waiter Buttons --> <div class="card" >
<button type="button" class="btn bg-default btn-block" id='back'> <i class="material-icons">reply</i>Back</button> <div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
<br>
</div>
<% end %>
</div>
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<% unless sale_item.price <= 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil? || @order_items.empty?
count = 0
@order_items.each do |order_item |
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
#unless order_item.price <= 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
#end
end
end
end
%>
</tbody>
</table>
</div>
</div>
<%
if @status_sale == 'sale'
unless @order_items.nil?
%>
Pending New Order
<table class="table table-striped">
<%
@order_items.each do |order_item |
%>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
%>
</table>
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice </button>
<%
else
@sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
Pending Payment
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td><button class='btn btn-lg btn-blue '>Show Detail </button></td>
</tr>
</table>
<%
end
end
end
end
end
%>
<div class="row">
<div class="col-md-12">
<div class="move_table purple" id="move_table">MOVE ROOM</div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn bg-default btn-block" id='back'> <i class="material-icons">reply</i>Back</button>
</div>
</div>
</div>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$(".tables").on('click', function(){ /* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item'); $('.tables').removeClass('selected-item');
$(this).addClass('selected-item'); $(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if ((dining_id == change_from) || (dining_name==undefined)) {
swal({
title: "Alert!!",
text: 'Please select another table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
})
$(".rooms").on('click', function(){
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name"); var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
$('#moved').text(" ' " + dining_name + " ' ") var change_from = "<%= @dining.id %>";
$('#change_table_value').val(dining_id); if (dining_id == change_from) {
}) swal({
title: "Alert!!",
text: 'Please select another room !',
type: 'warning',
});
}else{
$('#moved').text(dining_name)
$('#change_table_value').val(dining_id);
}
})
$(".rooms").on('click', function(){ $('#move_table').on('click',function(){
$('.rooms').removeClass('selected-item'); change_to = $('#change_table_value').val();
$(this).addClass('selected-item'); change_from = "<%= @dining.id %>";
var dining_name = $(this).attr("data-name"); if (change_to == ""){
var dining_id = $(this).attr("data-id"); alert("Please Select Room")
$('#moved').text(dining_name) }else{
$('#change_table_value').val(dining_id); $.ajax({type: "POST",
}) url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to,
$('#move_table').on('click',function(){ success:function(result){
change_to = $('#change_table_value').val(); alert("Moving Success")
change_from = "<%= @dining.id %>"; if (result.get_type == 'Table'){
if (change_to == ""){ window.location.href = '/origami/table/' + change_to;
alert("Please Select Room") }else{
}else{ window.location.href = '/origami/room/' + change_to;
$.ajax({type: "POST", }
url: "<%= origami_moving_path %>", }
data: "change_from="+ change_from + "&change_to=" + change_to, });
success:function(result){
alert("Moving Success")
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to;
}else{
window.location.href = '/origami/room/' + change_to;
}
} }
}); });
}
$('#add_invoice').on('click', function () {
var dining_id = "<%= @dining.id %>";
var sale_id = $("#sale_id").val();
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
}
});
});
});
$('#back').on('click',function(){
window.location.href = '/origami/room/'+ "<%= @dining.id %>";
}) })
});
$('#back').on('click',function(){
window.location.href = '/origami/room/'+ "<%= @dining.id %>";
})
</script> </script>

View File

@@ -22,27 +22,27 @@
<div class="card-columns" style="padding-top:10px;" > <div class="card-columns" style="padding-top:10px;" >
<% @tables.each do |table| %> <% @tables.each do |table| %>
<% if table.status == 'occupied' %> <% if table.status == 'occupied' %>
<% if table.get_booking.nil? %> <% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>"> <div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<% else %> <% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>"> <div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
</div> </div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div> </div>
</div> <% else %>
<% end %> <% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% else %> <% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>"> <div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block"> <div class="card-block">
@@ -54,119 +54,120 @@
</div> </div>
</div> </div>
<!--- Panel 2 - Room Orders --> <!--- Panel 2 - Room Orders -->
<div class="tab-pane" id="rooms" role="tabpanel"> <div class="tab-pane" id="rooms" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" > <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %> <% @rooms.each do |room| %>
<% if room.status == 'occupied' %> <% if room.status == 'occupied' %>
<% if room.get_booking.nil? %> <% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>"> <div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %> <% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>"> <div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
</div>
</div> </div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div> </div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div> </div>
<% end %> </div>
<% end %>
<!--- Panel 3 - s -->
</div> </div>
</div> </div>
<!-- tabs - End -->
<!--- Panel 3 - s -->
</div> </div>
</div> <!-- Column One -->
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column Two --> <!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5"> <div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" > <div class="card" >
<div class="card-header"> <div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div> <div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" /> <input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %> <% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"> <div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %> <% else %>
<div id="save_order_id" data-order=""> <div id="save_order_id" data-order="">
<% end %> <% end %>
<% if !@booking.nil? %> <% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %> <strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span> <span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %> <% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span> <span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<% elsif @status_sale == 'sale' %> <% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %> <div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %> <% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span> <span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %> <% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span> <span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %> <% end %>
</div> </div>
<% else %> <% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %> <strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %> <% end %>
</div> </div>
<div class="card-block"> <div class="card-block">
<div class="card-title"> <div class="card-title">
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %> <% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no"> &nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %> <% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %> <%= @sale_array[0].receipt_no rescue '' %>
<% end %> <% end %>
</span> </span>
<br> <br>
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right"> <div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span> Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br> <br>
</div> </div>
<% elsif !@date.nil? %> <% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7"> <div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no"> &nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %> <% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %> <%= @obj_order.order_id rescue '' %>
<% end %> <% end %>
</span> </span>
<br> <br>
</div> </div>
<div class="col-lg-5 col-md-5 col-sm-5 text-right"> <div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span> Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
<br> <br>
</div> </div>
<% end %> <% end %>
</div>
</div> </div>
</div> <div class="row p-l-5 p-r-5">
<div class="row p-l-5 p-r-5"> <div class="col-lg-6 col-md-6 col-sm-6">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<% if @status_sale == 'sale' && !@sale_array.empty? %> <p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p> &nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %> <% elsif @status_order == 'order' && !@customer.nil?
<% elsif @status_order == 'order' && !@customer.nil? %>
%> <p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p> &nbsp; Customer : <%= @customer.name rescue "" %>
&nbsp; Customer : <%= @customer.name rescue "" %> <% end %>
<% end %>
</div>
</div> </div>
</div> <div id="order-detail-slimscroll" data-height="130">
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" > <div class="card-text" style="" >
<table class="table table-striped" id="order-items-table"> <table class="table table-striped" id="order-items-table">
<thead> <thead>
@@ -243,7 +244,7 @@ if @status_sale == 'sale'
end end
%> %>
</table> </table>
<button class='btn btn-blue'> Add to existing invoice </button> <button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice </button>
<% <%
else else
@sale_array.each do |sale| @sale_array.each do |sale|
@@ -284,31 +285,27 @@ end
</div> </div>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$(".tables").on('click', function(){ /* check webview loaded*/
$('.tables').removeClass('selected-item'); var webview = <%= @webview %>;
$(this).addClass('selected-item'); showHideNavbar(webview);
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if (dining_id == change_from) {
/*$.alert({
title: 'Alert!',
content: 'Please Select Another Table',
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});*/
swal({
title: "Alert!!",
text: 'Please Select Another Table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
}) $(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if ((dining_id == change_from) || (dining_name==undefined)) {
swal({
title: "Alert!!",
text: 'Please select another table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
});
$(".rooms").on('click', function(){ $(".rooms").on('click', function(){
$('.rooms').removeClass('selected-item'); $('.rooms').removeClass('selected-item');
@@ -319,14 +316,14 @@ end
if (dining_id == change_from) { if (dining_id == change_from) {
swal({ swal({
title: "Alert!!", title: "Alert!!",
text: 'Please Select Another Table !', text: 'Please select another room !',
type: 'warning', type: 'warning',
}); });
}else{ }else{
$('#moved').text(dining_name) $('#moved').text(dining_name)
$('#change_table_value').val(dining_id); $('#change_table_value').val(dining_id);
} }
}) });
$('#move_table').on('click',function(){ $('#move_table').on('click',function(){
change_to = $('#change_table_value').val(); change_to = $('#change_table_value').val();
@@ -358,7 +355,32 @@ end
} }
}); });
} }
}) });
$('#add_invoice').on('click', function () {
var dining_id = "<%= @dining.id %>";
var sale_id = $("#sale_id").val();
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
}
});
});
}); });
$('#back').on('click',function(){ $('#back').on('click',function(){
window.location.href = '/origami/table/'+ "<%= @dining.id %>"; window.location.href = '/origami/table/'+ "<%= @dining.id %>";

View File

@@ -204,9 +204,8 @@
var bank_integration = "<%= @bank_integration %>"; var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>"; var cashier_type = "<%= @cashier_type %>";
$("#reference_no_Err").html(""); $("#reference_no_Err").html("");
if(reference_no.length > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ $(this).off("click");
$(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
// var sub_total = $('#sub-total').text(); // var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text(); // var member_id = $('#membership_id').text();
@@ -244,15 +243,12 @@
}); });
} }
}else{ }else{
if (amount>0) { if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" ); swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{ }else{
swal ( "Oops" , "Enter Amount!" , "error" ); swal ( "Oops" , "Enter Amount!" , "error" );
} }
}
}else{
$("#reference_no_Err").html("can't be blank");
} }
}) })
</script> </script>

View File

@@ -4,7 +4,7 @@ if @order
:requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type, :requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
:payment_status,:payment_ref,:taxes,:total_amount,:total_tax, :payment_status,:payment_ref,:taxes,:total_amount,:total_tax,
:discount_amount,:convenience_charge,:grand_total,:status,:order_remark, :discount_amount,:convenience_charge,:grand_total,:status,:order_remark,
:reservation_remark,:sale_id) :remark,:sale_id)
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id) @delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
if @delivery if @delivery
json.delivery do |json| json.delivery do |json|

View File

@@ -1,48 +1,65 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid"> <div class="container-fluid">
<!-- start count function -->
<%
pending_count = 0
accepted_count = 0
delivered_count = 0
completed_count = 0
processed_count = 0
%>
<% if !@count_on_order.nil?
@count_on_order.each do |count_order|
if count_order.status == "new"
pending_count = count_order.count
elsif count_order.status == "accepted"
accepted_count = count_order.count
elsif count_order.status == "send_to_kitchen"
delivered_count = count_order.count
elsif count_order.status == "ready_to_delivery"
completed_count = count_order.count
end
end
end
if !@count_on_completed.nil?
processed_count = @count_on_completed.count
end
%>
<!-- end count function -->
<div class="row m-t--10"> <div class="row m-t--10">
<div class="col-lg-4 col-md-4 col-sm-4 div_order_margin"> <div class="col-lg-5 col-md-5 col-sm-5 div_order_margin">
<ul class="nav nav-tabs tab-col-teal" role="tablist"> <ul class="nav nav-tabs tab-col-teal <%= @shop.shop_code ? @shop.shop_code : '' %>" role="tablist">
<li class="nav-item red m-b-10" data-color="#F44336" data-type="pending"> <li class="nav-item red m-b-5" data-color="#F44336" data-type="pending">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num p-t-15 p-b-5"> <a class="nav-link" data-toggle="tab" href="#pending" role="tab">
<% if !@count_on_order.nil? %> <p class="num p-t-5">
<% @count_on_order.each do |count_order| <%= pending_count %>
if count_order.status == "new" %> </p> <%= t :pending %></a>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :pending %></a>
</li> </li>
<li class="nav-item purple m-b-10" data-color="#673AB7" data-type="processing"> <li class="nav-item purple m-b-5" data-color="#673AB7" data-type="processing">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num p-t-15 p-b-5"> <a class="nav-link" data-toggle="tab" href="#processing" role="tab">
<% if !@count_on_order.nil? %> <p class="num p-t-5">
<% @count_on_order.each do |count_order| <%= accepted_count %>
if count_order.status == "accepted" %> </p> <%= t :processing %></a>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :processing %></a>
</li> </li>
<li class="nav-item m-b-10" data-color="#009688" data-type="delivery" style="background-color: #009688;"> <li class="nav-item m-b-5" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num p-t-15 p-b-5"> <a class="nav-link" data-toggle="tab" href="#delivery" role="tab">
<% if !@count_on_order.nil? %> <p class="num p-t-5">
<% @count_on_order.each do |count_order| <%= delivered_count %>
if count_order.status == "send_to_kitchen" %> </p> <%= t :delivering %></a>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :delivering %></a>
</li> </li>
<li class="nav-item m-b-10" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;"> <li class="nav-item m-b-5" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num p-t-15 p-b-5"> <a class="nav-link" data-toggle="tab" href="#completed" role="tab">
<% if !@count_on_order.nil? %> <p class="num p-t-5">
<% @count_on_order.each do |count_order| <%= completed_count %>
if count_order.status == "ready_to_delivery" %> </p> <%= t :completed %></a>
<%= count_order.count %> </li>
<% end <li class="nav-item m-b-5" data-color="#5bc0de" data-type="processed" style="background-color: #5bc0de;">
end %> <a class="nav-link" data-toggle="tab" href="#processed" role="tab">
<% end %></p> <%= t :completed %></a> <p class="num p-t-5">
<%= processed_count %>
</p> <%= t :processed %></a>
</li> </li>
</ul> </ul>
@@ -50,7 +67,7 @@
<div class="tab-pane active" id="pending" role="tabpanel"> <div class="tab-pane active" id="pending" role="tabpanel">
<div class="card-block font-13"> <div class="card-block font-13">
<div id="menu-slimscroll" data-height="50"> <div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table order_reserve_cable"> <table class="table table-stripe custom-table <%= @shop.shop_code ? @shop.shop_code : '' %>_order_reserve_cable">
<tbody> <tbody>
<% i=1 <% i=1
@order.each do |order| %> @order.each do |order| %>
@@ -60,7 +77,7 @@
<%=i%> <%=i%>
</td> </td>
<td width ="20%" class="align-center"> <td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%d-%m-%Y") %> <%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td> </td>
<td width ="20%" class="align-center"> <td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %> <%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
@@ -197,7 +214,48 @@
</td> </td>
<td width ="30%" class="align-center"> <td width ="30%" class="align-center">
<span class="font-10 col-blue"> <span class="font-10 col-blue">
<%= order.delivery.to_json %> <% if order.delivery.delivery_type == 'service' %>
DELIVERY
<% elsif order.delivery.delivery_type == 'pick_up' %>
PICK-UP
<% else %>
DIRECT DELIVERY
<% end %>
</span>
</td>
</tr>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
</div>
</div>
<!--- Panel 5 - processed -->
<div class="tab-pane dining" id="processed" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<% i=1
@order.each do |order| %>
<% if order.status == 'delivered' && (order.created_at.utc.getlocal.strftime("%Y-%m-%d") == DateTime.now.strftime("%Y-%m-%d")) %>
<tr class="custom-tr fifth-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %> <% if order.delivery.delivery_type == 'service' %>
DELIVERY DELIVERY
<% elsif order.delivery.delivery_type == 'pick_up' %> <% elsif order.delivery.delivery_type == 'pick_up' %>
@@ -221,7 +279,7 @@
</div> </div>
<div class="col-lg-4 col-md-4 col-sm-4 div_card_order"> <div class="col-lg-4 col-md-4 col-sm-4 div_card_order">
<div class="card"> <div class="card m-b-5 p-t-5">
<div class="card-header custom-card-header" style="color:"> <div class="card-header custom-card-header" style="color:">
<table class="table"> <table class="table">
<tr> <tr>
@@ -231,7 +289,11 @@
<td width="40%" class="header-td align-left"> <td width="40%" class="header-td align-left">
<b><span class="font-15" id="requested_date_time"></span></b> <b><span class="font-15" id="requested_date_time"></span></b>
</td> </td>
<td width ="50%" class="header-td font- align-right"><b><span id="contact_info"></span></b></td> <td width ="50%" class="header-td align-right">
<b><span id="invoice_no"></span></b>
<span id="order_status" class="hidden"></span>
<span id="approved_code" class="hidden"></span>
</td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -297,8 +359,8 @@
</tr> </tr>
<tr> <tr>
<td width ="50%" class="footer-td align-left col-blue"> <td width ="50%" class="footer-td align-left col-blue">
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel"> <button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="rejected">
<strong>DECLINE</strong> <strong>REJECT</strong>
</button> </button>
</td> </td>
<td width ="50%" class="footer-td align-right col-blue"> <td width ="50%" class="footer-td align-right col-blue">
@@ -322,47 +384,55 @@
</div> </div>
</div> </div>
<div class="'col-lg-4 col-md-4 col-sm-4'" style="margin:0px -5px 0px -2px !important "> <div class="col-lg-3 col-md-3 col-sm-3">
<div class="card" style="background-color: #E8EAF6"> <div class="card m-b-5 p-t-5" style="background-color: #E8EAF6">
<div class="card-header custom-card-header" style="background-color: #E8EAF6"> <div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table"> <table class="table">
<tr> <tr>
<td width ="" class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION <td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<div class="card-block"> <div class="card-block" id="customer-info-slimscroll" data-height="95">
<table class="table"> <table class="table tbl_customer">
<tbody> <tbody>
<tr> <tr>
<td class="body-td align-left"> <td colspan="2" class="body-td align-left">
<span class="font-13">NAME</span><br> <span class="font-13">REF.</span><br>
<b id="customer_name"></b> <b id="trans_ref"></b>
</td> </td>
<td class="body-td align-right"> </tr>
<tr>
<td class="body-td align-left">
<span class="font-13">REQUESTED TIME</span><br> <span class="font-13">REQUESTED TIME</span><br>
<b id="requested_time"></b> <b id="requested_time"></b>
</td> </td>
<td class="body-td align-right expected_time">
<span class="font-13">COOKING TIME</span><br>
<b><span id="expected_time"></span> MINS</b>
</td>
</tr> </tr>
<tr> <tr>
<td class="body-td align-left"> <td colspan="2" class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">PHONE</span><br> <span class="font-13">PHONE</span><br>
<b id="phone"></b> <b id="phone"></b>
</td> </td>
<td class="body-td align-right expected_time">
<span class="font-13">EXPECTED WAITING TIME</span><br>
<b id="expected_time"></b>
</td>
</tr> </tr>
<tr> <tr>
<td class="body-td align-left"> <td colspan="2" class="body-td align-left">
<span class="font-13">ADDRESS</span><br> <span class="font-13">ADDRESS</span><br>
<b id="address"></b> <b id="address"></b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="body-td align-left"> <td colspan="2" class="body-td align-left">
<span class="font-13">DELEVERY</span><br> <span class="font-13">DELEVERY</span><br>
<b id="delivery_to"></b> <b id="delivery_to"></b>
</td> </td>
@@ -373,13 +443,33 @@
<b id="order_remark"></b> <b id="order_remark"></b>
</td> </td>
</tr> </tr>
<tr>
<td colspan="2" class="body-td align-left">
<b><i><span id="remark"></span></i></b>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="card-footer order_close_cashier">
<% if current_user.role != "waiter" %>
<div class="row">
<div class="col-sm-7 col-xs-7 col-md-7 col-lg-7"></div>
<div class="col-sm-4 col-xs-4 col-md-4 col-lg-4">
<button id="order_close_cashier" class="align-right text-center btn btn-md btn-link btn-primary waves-effect"><%= t("views.btn.close_cashier") %></button>
</div>
</div>
<% end %>
</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 : '' %>_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> </div>
</div>
<p id="ref_no" class="hidden"></p> <p id="ref_no" class="hidden"></p>
<p id="callback_url" class="hidden"></p> <p id="callback_url" class="hidden"></p>
<p id="order_id" class="hidden"></p> <p id="order_id" class="hidden"></p>
@@ -392,29 +482,193 @@
<h4 class="modal-title" id="waiting_timeModalLabel">Expected Waiting Time for <span id="requested_order_time"></span></h4> <h4 class="modal-title" id="waiting_timeModalLabel">Expected Waiting Time for <span id="requested_order_time"></span></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<input type="text" id="waiting_time" name="waiting_time" value="" class="timepicker form-control" placeholder="Expected Waiting Time"> <div class="row text-center m-t-20">
<span id="waiting_timeErr" style="color:red;"></span> <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info timer_type" data-value="after">After</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="15">15 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="30">30 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="45">45 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="60">60 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="75">75 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="90">90 Mins.</button>
</div>
</div>
</div> </div>
<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-red waves-effect " id="save" active="true">SAVE</button> <button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
<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>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <div class="modal fade" id="rejected_reasonModal" tabindex="-1" role="dialog">
$(function(){ <div class="modal-dialog modal-md" role="document">
$("#discount").hide(); <div class="modal-content">
$(".expected_time").hide(); <div class="modal-header">
$('.first-1').click(); <h4 class="modal-title" id="rejected_reasonLabel">Reason</h4>
}); </div>
<div class="modal-body">
<div class="form-group">
<textarea id="reject_reason" name="reject_reason" class="form-control" rows="3" cols="30"></textarea>
<span id="reject_reasonErr" style="color:red"></span>
</div>
</div>
<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 send_status">SEND</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
</script> <div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="void">OK</div>
</div>
</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-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="doemal_new_orderLabel">New Order</h4><hr>
</div>
<div class="modal-body doemal_new_orderBody">
<div class="form-group text-center">
You have new order <b><span id="new_order"></span></b> requested for <b><span id="new_order_date"></span></b>
</div>
</div>
<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>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_new_orderLabel">You have new orders</h4><hr>
</div>
<div class="modal-body notify_new_orderBody">
<div class="form-group text-center">
Are you accept or reject for these orders <b><span id="notify_new_order_lists"></span></b>?
</div>
</div>
<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>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="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">
<h4 class="modal-title text-center" id="notify_order_send_to_kitchenLabel">You have to send order to kitchen</h4><hr>
</div>
<div class="modal-body notify_order_send_to_kitchenBody">
<div class="form-group text-center">
Could you send these orders <b><span id="notify_order_send_to_kitchen_lists"></span></b> to kitchen?
</div>
</div>
<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>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="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">
<h4 class="modal-title text-center" id="notify_order_ready_to_deliveryLabel">You have orders that are ready to deliver</h4><hr>
</div>
<div class="modal-body notify_order_ready_to_deliveryBody">
<div class="form-group text-center">
Could you ready these orders <b><span id="notify_order_ready_to_delivery_lists"></span></b> to deliver?
</div>
</div>
<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>
</div>
</div>
</div>
</div>
</div>
</div>
</div> -->

View File

@@ -350,16 +350,30 @@
<i class="material-icons">reply</i> <i class="material-icons">reply</i>
Back Back
</button> </button>
<!-- -->
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
<% else %>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button> <button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button> <button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button> <button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button> <button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
<% if @cashier_type=="quick_service" %> <% end %>
<% if @cashier_type=="quick_service" %>
<hr> <hr>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button> <button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button> <button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button> <% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button> <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button> <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<!-- Waiter Buttons --> <!-- Waiter Buttons -->
@@ -415,16 +429,16 @@
</div> </div>
<!-- pdf light box --> <!-- pdf light box -->
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog"> <div class="modal fade" id="pdfModal" tabindex="-1" role="dialog" >
<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">
<h4 class="modal-title"> <h6 class="modal-title">
<span id="pdfModalLabel"></span> <span id="pdfModalLabel"></span>
<span id="changed_amount" class="p-l-120"></span> <span id="changed_amount" class="p-l-120"></span>
</h4> </h6>
</div> </div>
<div class="modal-body"> <div class="modal-body" style="height: 400px;">
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no"> <input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename"> <input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name"> <input type="hidden" name="printer_name" id="printer_name">
@@ -487,7 +501,40 @@
<div class="modal-footer"></div> <div class="modal-footer"></div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<div id="sxModal"> <div id="sxModal">
<div id="sxModal-Content"> <div id="sxModal-Content">
@@ -634,8 +681,8 @@ var customer_name = "<%= @customer.name %>";
calculate_member_discount(sale_id); calculate_member_discount(sale_id);
} }
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); $("#pdfModal").on('shown.bs.modal', function () {
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>", url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type, data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
@@ -730,44 +777,7 @@ var customer_name = "<%= @customer.name %>";
// swal("Opps","You are not authorized for void","warning") // swal("Opps","You are not authorized for void","warning")
// } // }
// }); // });
$('#void').on('click', function () {
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').text();
var remark = $("#remark").val();
var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function (result) {result
customer_display_view(null,"reload");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}
})
}
});
}else{
swal("Oops","You are not authorized for void","warning")
}
});
}); });
// bind survey to order or sale // bind survey to order or sale
@@ -940,59 +950,6 @@ var customer_name = "<%= @customer.name %>";
$('#balance').text(parseFloat(result)); $('#balance').text(parseFloat(result));
<% end %> <% end %>
} }
$('#foc').click(function() {
//$( "#loading_wrapper" ).show();
// payment
var remark = $("#foc_remark").val();
var cash = $('#grand_total').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type };
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to FOC This Receipt?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, FOC it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: "POST",
url: "/origami/payment/"+cashier_type+"/foc",
data: params,
success:function(result){
customer_display_view(null,"reload");
if (cash >= 0) {
swal({
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
});
}
}
});
}
});
}else{
swal("Oops","You are not authorized for foc","warning")
}
});
function customer_display_view(data,status) { function customer_display_view(data,status) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
@@ -1220,28 +1177,157 @@ var customer_name = "<%= @customer.name %>";
update_sale("", customer_id, customer_name, sale_id); update_sale("", customer_id, customer_name, sale_id);
}); });
function waste_and_spoilage(remark) { $(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
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);
if (type == "edit") {
var dining_id = $('#dining').text();
var sale_id = $('#sale_id').text();
if (dining_id) {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
}else{
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
}
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
$('#foc').on('click', function () {
var access_code = localStorage.getItem("access_code");
var remark = $("#foc_remark").val();
var cash = $('#grand_total').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
swal({
title: "Alert",
text: "Are you sure want to FOC This Receipt?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, FOC it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: "POST",
url: "/origami/payment/"+cashier_type+"/foc",
data: params,
success:function(result){
customer_display_view(null,"reload");
if (cash >= 0) {
swal({
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
});
}
}
});
}
});
});
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').text(); var sale_id = $('#sale_id').text();
console.log(sale_id) var remark = $("#remark").val();
swal({ var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
title: "Alert", $.ajax({
text: "Are you sure want to " + remark +" ?", type: 'POST',
type: "warning", url: ajax_url,
showCancelButton: true, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
confirmButtonColor: "#DD6B55", success: function (result) {result
confirmButtonText: "Yes, " +remark+ " it!", customer_display_view(null,"reload");
closeOnConfirm: false // For Server Print - from jade
}, function (isConfirm) { if ($("#server_mode").val() == "cloud") {
if (isConfirm) { code2lab.printFile(result.filepath.substr(6), result.printer_url);
var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage'; }
$.ajax({ if (cashier_type=="cashier") {
type: 'POST', window.location.href = '/origami';
url: url, }else{
data: "remark="+ remark + "&sale_id=" + sale_id, window.location.href = '/origami/quick_service';
success: function (result) { }
console.log(result) }
})
}
});
});
function waste_and_spoilage(remark) {
var access_code = localStorage.getItem("access_code");
var sale_id = $('#sale_id').text();
swal({
title: "Alert",
text: "Are you sure want to " + remark +" ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, " +remark+ " it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage';
$.ajax({
type: 'POST',
url: url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
console.log(result)
// For Server Print - from jade // For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
if (cashier_type=="cashier") { if (cashier_type=="cashier") {
@@ -1251,8 +1337,8 @@ var customer_name = "<%= @customer.name %>";
customer_display_view(null,"reload"); customer_display_view(null,"reload");
} }
} }
}); });
} }
}); });
} }
</script> </script>

View File

@@ -0,0 +1,207 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns">
<% @completed.each do |sale| %>
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
</div>
</div>
<div class="tab-pane " id="pending_order" role="tabpanel">
<div class="card-columns">
<% @sales.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
<% @orders.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
</div>
<div class="card-block">
<div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<%= @sale.receipt_no rescue '' %></span>
</div>
<% else%>
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
<div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Order No: <span id="receipt_no">
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div>
<% end%>
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% else%>
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% end%>
</div>
<div class="card-title row customer_detail p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status == 'sale' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; Customer : <%= @order.customer.name rescue "-" %>
<% end%>
</div>
</div>
<div id="order-detail-slimscroll" data-height="160">
<div class="card-text" style="">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
<% else%>
<% sub_total = 0
total = 0
@order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= total %></td>
</tr>
<% end%>
<% end%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<% if @status == 'sale' %>
<tr>
<%if @sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<% else%>
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<% end%>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
<% if current_user.role != "waiter" %>
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
<% end %>
</div>
</div>
</div>
<script>
var cashier_type = "quick_service";
$(document).ready(function(){
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
})
$('#reprint').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
});
</script>

View File

@@ -2,31 +2,50 @@
<div class="row clearfix"> <div class="row clearfix">
<!-- Column One --> <!-- Column One -->
<div class="col-lg-10 col-md-10 col-sm-10"> <div class="col-lg-10 col-md-10 col-sm-10">
<div class="card"> <!-- Nav tabs -->
<div class="card-header"> <ul class="nav nav-tabs tab-col-teal" role="tablist">
<strong id="order-title"> PENDING ORDER </strong> <li class="nav-item">
</div> <a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
<div class="card-block"> </li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div id="custom-slimscroll"> <div id="custom-slimscroll">
<div class="card-columns"> <div class="tab-content m-t-15">
<% @sale.each do |sale| %> <div class="tab-pane" id="completed" role="tabpanel">
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>"> <div class="card-columns">
<div class="card-block"> <% @completed.each do |sale| %>
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span> <div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
</div> <div class="card-block">
</div> <%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
<% end %> </div>
<% @order.each do |order| %> </div>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>"> <% end %>
<div class="card-block"> </div>
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span> </div>
</div>
<div class="tab-pane active" id="pending_order" role="tabpanel">
<div class="card-columns">
<% @sale.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div> </div>
<% end %> </div>
</div> <% end %>
<% @order.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div> </div>
</div>
</div>
</div> </div>
<!-- Column Three --> <!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
@@ -46,6 +65,10 @@
var sale_id = $(this).attr("data-id"); var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id; window.location.href = '/origami/quick_service/pending_order/' + sale_id;
}) })
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
})
$('#pay').on('click', function () { $('#pay').on('click', function () {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment"; window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";

View File

@@ -1,154 +1,171 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<!-- Column One --> <!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5"> <div class="col-lg-5 col-md-5 col-sm-5">
<div class="card"> <ul class="nav nav-tabs tab-col-teal" role="tablist">
<div class="card-header"> <li class="nav-item">
<strong id="order-title"> PENDING ORDER </strong> <a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</div> </li>
<div class="card-block"> <li class="nav-item">
<div id="custom-slimscroll"> <a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
<div class="card-columns"> </li>
<% @sales.each do |sale| %> </ul>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>"> <div id="custom-slimscroll">
<div class="card-block"> <div class="tab-content m-t-15">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span> <div class="tab-pane" id="completed" role="tabpanel">
</div> <div class="card-columns">
<% @completed.each do |sale| %>
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
</div> </div>
<% end %> </div>
<% @orders.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>"> <div class="tab-pane active" id="pending_order" role="tabpanel">
<div class="card-block"> <div class="card-columns">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span> <% @sales.each do |sale| %>
</div> <div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
<% @orders.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<% end %>
</div> </div>
<% end %> </div>
</div> </div>
</div> </div>
</div> </div>
</div> <!-- Column One -->
</div>
<!-- Column One -->
<!-- Column Two --> <!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5"> <div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" > <div class="card" >
<div class="card-header"> <div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div> <div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
</div>
<div class="card-block">
<div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<%= @sale.receipt_no rescue '' %></span>
</div>
<% else%>
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
<div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Order No: <span id="receipt_no">
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div>
<% end%>
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% else%>
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% end%>
</div> </div>
<div class="card-title row customer_detail p-l-5 p-r-5"> <div class="card-block">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %> <% if @status == 'sale' %>
<% else%> <div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Customer : <%= @order.customer.name rescue "-" %> &nbsp; Receipt No: <span id="receipt_no">
<% end%> <%= @sale.receipt_no rescue '' %></span>
</div> </div>
<% else%>
</div> <input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
<div id="order-detail-slimscroll" data-height="160"> <div class="col-lg-8 col-md-8 col-sm-8">
<div class="card-text" style=""> &nbsp; Order No: <span id="receipt_no">
<table class="table table-striped" id="order-items-table"> <%= @bookings.booking_orders[0].order_id rescue '' %></span>
<thead> </div>
<tr> <% end%>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
<% else%>
<% sub_total = 0
total = 0
@order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= total %></td>
</tr>
<% end%>
<% end%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<% if @status == 'sale' %> <% if @status == 'sale' %>
<tr> <div class="col-lg-6 col-md-6 col-sm-6 text-right">
<%if @sale.discount_type == 'member_discount'%> Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
<td class="charges-name"><strong>Member Discount:</strong></td> </div>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<% else%> <% else%>
<tr> <div class="col-lg-4 col-md-4 col-sm-4 text-right">
<td class="charges-name"><strong>Sub Total:</strong></td> Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> &nbsp; </span>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td> </div>
</tr>
<% end%> <% end%>
</table> </div>
<div class="card-title row customer_detail p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status == 'sale' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; Customer : <%= @order.customer.name rescue "-" %>
<% end%>
</div>
</div>
<div id="order-detail-slimscroll" data-height="160">
<div class="card-text" style="">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
<% else%>
<% sub_total = 0
total = 0
@order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= total %></td>
</tr>
<% end%>
<% end%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<% if @status == 'sale' %>
<tr>
<%if @sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<% else%>
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<% end%>
</table>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- Column Three --> <!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button> <button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
@@ -182,6 +199,10 @@ $(document).ready(function(){
var sale_id = $(this).attr("data-id"); var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id; window.location.href = '/origami/quick_service/pending_order/' + sale_id;
}) })
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
})
$('#pay').on('click', function () { $('#pay').on('click', function () {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment"; window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";

View File

@@ -30,7 +30,7 @@
<% @complete.each do |sale| %> <% @complete.each do |sale| %>
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>"> <div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block"> <div class="card-block">
<%= sale.receipt_no %><span class="pull-right font-12"><%= sale.sale_status %></span> <%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -135,7 +135,7 @@
<div class="tab-pane dining" id="orders" role="tabpanel"> <div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns"> <div class="card-columns">
<% @orders.each do |order| %> <% @orders.each do |order| %>
<div class="card orders red text-white" data-id = "<%= order.order_id %>"> <div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block"> <div class="card-block">
<% <%
order_status = "" order_status = ""
@@ -452,8 +452,13 @@
<% if current_login_employee.role != "waiter" %> <% if current_login_employee.role != "waiter" %>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button> <button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button> <button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button> <button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button> <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button> --> <!-- <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button> -->
<% end %> <% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button> <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
@@ -514,6 +519,29 @@
</div> </div>
</div> </div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog"> <div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -539,6 +567,39 @@
</div> </div>
</div> </div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var cashier_type = "cashier"; var cashier_type = "cashier";
$(document).ready(function(){ $(document).ready(function(){
@@ -938,25 +999,61 @@ $('#add_invoice').on('click',function(){
$('#edit').on('click',function(){ $('#edit').on('click',function(){
var dining_id = "<%= @room.id %>" var dining_id = "<%= @room.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>" var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/cashier/edit";
}); });
$('#void').on('click',function () { // $('#void').on('click',function () {
var sure = confirm("Are you sure want to Void"); // var sure = confirm("Are you sure want to Void");
if (sure == true) { // if (sure == true) {
var sale_id = $('#sale_id').val(); // var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void'; // var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
$.ajax({ // $.ajax({
type: 'POST', // type: 'POST',
url: ajax_url, // url: ajax_url,
success: function () { // success: function () {
window.location.href = '/origami/'; // window.location.href = '/origami/';
} // }
}) // })
} else { // } else {
// }
// });
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
var remark = $("#remark").val();
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/';
}
});
}
});
}else{
swal("Opps","You are not authorized for void","warning")
} }
}); });
$('#commissions').on('click', function () { $('#commissions').on('click', function () {
var dining_id = "<%= @room.id %>" var dining_id = "<%= @room.id %>"
@@ -1042,4 +1139,40 @@ $('#add_invoice').on('click',function(){
} }
}); });
} }
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
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);
if (type == "edit") {
var dining_id = "<%= @room.id rescue ""%>";
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/cashier/edit";
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste_and_spoilage"){
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script> </script>

View File

@@ -187,6 +187,7 @@
</div> </div>
<script> <script>
var cashier_type = "<%= @cashier_type %>"; var cashier_type = "<%= @cashier_type %>";
var access_code = localStorage.getItem("access_code");
// Bill Request // Bill Request
$(document).ready(function () { $(document).ready(function () {
@@ -201,7 +202,6 @@ var cashier_type = "<%= @cashier_type %>";
var sale_item_id = $(this).attr('data-id'); var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val(); var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val(); var price = $('#' + sale_item_id + "_price").val();
console.log(qty + "|" + price);
var qty_status = true; var qty_status = true;
var price_status = true; var price_status = true;
if((qty > 0) && (price > 0)){ if((qty > 0) && (price > 0)){
@@ -240,7 +240,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price, data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
swal({ swal({
title: "Information!", title: "Information!",
@@ -281,6 +281,7 @@ var cashier_type = "<%= @cashier_type %>";
})*/ })*/
$('#action').on('click', function () { $('#action').on('click', function () {
var access_code = localStorage.getItem("access_code");
var sale_item_id = $(this).attr('data-id'); var sale_item_id = $(this).attr('data-id');
var type = $(this).attr('data-type'); var type = $(this).attr('data-type');
var remark = $("#remark").val(); var remark = $("#remark").val();
@@ -293,7 +294,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark, data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
location.reload(); location.reload();
} }
@@ -306,7 +307,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
data: 'sale_item_id=' + sale_item_id, data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code,
success: function (result) { success: function (result) {
location.reload(); location.reload();
} }

View File

@@ -90,9 +90,24 @@
<div class="tab-pane" id="orders" role="tabpanel" style=""> <div class="tab-pane" id="orders" role="tabpanel" style="">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @orders.each do |order| %> <% @orders.each do |order| %>
<div class="card orders bg-red text-white" data-id = "<%= order.order_id %>"> <div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block"> <div class="card-block">
<%= order.order_id %> <%
order_status = ""
sale_order = SaleOrder.find_by_order_id(order)
if sale_order
unless sale_order.sale_id.nil?
sale = Sale.find(sale_order.sale_id)
order_status = sale.sale_status
if order_status == 'new'
order_status = order.status
end
end
else
order_status = order.status
end
%>
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -198,9 +213,13 @@
<!-- Column Three --> <!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button> <button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if @sale.sale_status != 'void' %> <% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<button type="button" class="btn btn-block bg-red waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> <% if current_login_employee.role == "cashier" %>
<% end %> <a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<% end %>
<% end %>
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button> <button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
</div> </div>
</div> </div>
@@ -229,6 +248,63 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<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-red waves-effect " id="void" active="true">VOID</button>
</div>
<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>
</div>
</div>
</div>
</div>
</div>
</div>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$(".tables").on('click', function(){ $(".tables").on('click', function(){
@@ -271,7 +347,14 @@ $('#back').on('click',function(){
// // }); // // });
// } // }
// }); // });
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
$('#void').on('click', function () { $('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
swal({ swal({
title: "Alert", title: "Alert",
text: "Are you sure want to Void?", text: "Are you sure want to Void?",
@@ -283,10 +366,11 @@ $('#back').on('click',function(){
}, function (isConfirm) { }, function (isConfirm) {
if (isConfirm) { if (isConfirm) {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void'; var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: ajax_url, url: ajax_url,
data: {'access_code':access_code},
success: function () { success: function () {
window.location.href = '/origami/sale/'+sale_id; window.location.href = '/origami/sale/'+sale_id;
} }
@@ -295,10 +379,52 @@ $('#back').on('click',function(){
}); });
}); });
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);
if (type == "edit") {
var dining_id = $('#dining').text();
var sale_id = $('#sale_id').text();
if (dining_id) {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
}else{
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
}
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
$('#re-print').click(function() { $('#re-print').click(function() {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint" window.location.href = '/origami/'+ sale_id + "/reprint"
return false; // return false;
}); });
</script> </script>

View File

@@ -31,7 +31,7 @@
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button> <button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
<button type="button" class="btn bg-blue btn-block green" id='close_cashier'> <%= t("views.btn.close_cashier") %> </button> <button type="button" class="btn bg-blue btn-block green" id='close_cashier'> <%= t("views.btn.close_cashier") %> </button>
<% if @bank_integration == '1' %> <% if @bank_integration == '1' && @cashier_type!="ordering" %>
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button> <button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
<% end %> <% end %>
</div> </div>
@@ -73,10 +73,12 @@
}); });
$('#back').on('click',function(){ $('#back').on('click',function(){
if(cashier_type!='quick_service'){ if(cashier_type=='cashier'){
window.location.href = '/origami'; window.location.href = '/origami';
}else{ }else if(cashier_type=='quick_service'){
window.location.href = '/origami/quick_service'; window.location.href = '/origami/quick_service';
}else{
window.location.href = '/origami/order_reservation';
} }
}); });

View File

@@ -9,7 +9,7 @@
<div class="row clearfix"> <div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 "> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10"> <div class="form-group p-l-10 p-r-10">
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();" }%>
</div> </div>
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 "> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
@@ -67,29 +67,29 @@
<div class="row clearfix"> <div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 "> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10"> <div class="form-group p-l-10 p-r-10">
<%= f.input :child , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%> <%= f.input :child , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
</div> </div>
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 "> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10"> <div class="form-group p-l-10 p-r-10">
<%= f.input :adult , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%> <%= f.input :adult , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
</div> </div>
</div> </div>
</div> </div>
<div class="row clearfix"> <div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 "> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10"> <div class="form-group p-l-10 p-r-10">
<%= f.input :male , input_html: { class: 'col-md-10' }%> <%= f.input :male , input_html: { min:'1',class: 'col-md-10' }%>
</div> </div>
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 "> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10"> <div class="form-group p-l-10 p-r-10">
<%= f.input :female , input_html: { class: 'col-md-10' }%> <%= f.input :female , input_html: { min:'1',class: 'col-md-10' }%>
</div> </div>
</div> </div>
</div> </div>
<%= f.input :total_customer, input_html: { :readonly => true, class: 'col-md-11'} %> <%= f.input :total_customer, input_html: { :readonly => true,min:'1', class: 'col-md-11'} %>
<%= f.input :local , input_html: { class: 'col-md-11' }%> <%= f.input :local , input_html: { min:'1',class: 'col-md-11' }%>
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;"> <fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
<legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend> <legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend>

View File

@@ -166,8 +166,14 @@
<%end%> <%end%>
<% end %> <% end %>
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button> <button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<button type="button" data-toggle="modal" data-target="#voidModal" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button> <button type="button" data-toggle="modal" data-target="#voidModal" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<% end %>
</div> </div>
</div> </div>
</div> </div>
@@ -251,6 +257,39 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
/* start check first bill or not*/ /* start check first bill or not*/
@@ -369,6 +408,7 @@ $('#back').on('click',function(){
}); });
$('#void').on('click',function () { $('#void').on('click',function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") { if ($(this).attr('active')=== "true") {
swal({ swal({
title: "Alert", title: "Alert",
@@ -386,7 +426,7 @@ $('#void').on('click',function () {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: ajax_url, url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id, data: "remark="+ remark + "&sale_id=" + sale_id + "&access_code=" + access_code ,
success: function () { success: function () {
window.location.href = '/origami'; window.location.href = '/origami';
} }
@@ -399,6 +439,7 @@ $('#void').on('click',function () {
}); });
$('#foc').click(function() { $('#foc').click(function() {
var access_code = localStorage.getItem("access_code");
var remark = $("#foc_remark").val(); var remark = $("#foc_remark").val();
var cash = $('#grand_total').text(); var cash = $('#grand_total').text();
var sub_total = $('#sub_total').text(); var sub_total = $('#sub_total').text();
@@ -406,7 +447,7 @@ $('#foc').click(function() {
if($('.receipt_block > div').hasClass('selected-item')){ if($('.receipt_block > div').hasClass('selected-item')){
sale_id = $('.receipt_block > div.selected-item').parent().attr('data-id'); sale_id = $('.receipt_block > div.selected-item').parent().attr('data-id');
} }
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':'cashier' }; var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':'cashier','access_code':access_code };
// console.log(sale_id); // console.log(sale_id);
if(sale_id != ''){ if(sale_id != ''){
if ($(this).attr('active')=== "true") { if ($(this).attr('active')=== "true") {
@@ -430,4 +471,45 @@ $('#foc').click(function() {
} }
} }
}); });
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
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);
if (type == "edit") {
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script> </script>

View File

@@ -202,7 +202,6 @@
var receipt_no = "<%= @receipt_no %>"; var receipt_no = "<%= @receipt_no %>";
$("#reference_no_Err").html(""); $("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click"); $(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
@@ -250,8 +249,5 @@
swal ( "Oops" , "Enter Amount!" , "error" ); swal ( "Oops" , "Enter Amount!" , "error" );
} }
} }
}else{
$("#reference_no_Err").html("can't be blank");
}
}) })
</script> </script>

View File

@@ -201,9 +201,8 @@
var receipt_no = "<%= @receipt_no %>"; var receipt_no = "<%= @receipt_no %>";
console.log(amount); console.log(amount);
console.log($("#validamount").attr("value")); console.log($("#validamount").attr("value"));
$("#reference_no_Err").html(""); $("#reference_no_Err").html("");
if(reference_no.length > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click"); $(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
// var sub_total = $('#sub-total').text(); // var sub_total = $('#sub-total').text();
@@ -244,14 +243,11 @@
}); });
} }
}else{ }else{
if (amount>0) { if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" ); swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{ }else{
swal ( "Oops" , "Enter Amount!" , "error" ); swal ( "Oops" , "Enter Amount!" , "error" );
}
} }
}else{
$("#reference_no_Err").html("can't be blank");
} }
}); });
</script> </script>

View File

@@ -16,7 +16,7 @@
<% if(@server_mode != 'cloud') %> <% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %> <%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %> <% else %>
<%= f.input :printer_name %> <%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %> <% end %>
<%= f.input :brand_name %> <%= f.input :brand_name %>
<%= f.input :printer_type %> <%= f.input :printer_type %>

View File

@@ -151,23 +151,23 @@
<% total_tax = 0 %> <% total_tax = 0 %>
<% unless @tax.empty? %> <% unless @tax.empty? %>
<% @tax.each do |tax| %> <% @tax.each do |tax| %>
<% total_tax += tax.tax_amount.to_f %> <% total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;"> <tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td> <td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<% end %>
<% end %> <% end %>
<% net = total - total_tax %> <% net = total - total_tax %>
<tr style="font-weight:600;"> <tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td> <td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<% end %> </tbody>
</tbody>
<% end %> <% end %>
</table> </table>
</div> </div>

View File

@@ -18,10 +18,10 @@
<option value="9">Last year</option> <option value="9">Last year</option>
</select> </select>
</div> </div>
<% if defined? payments %> <% if defined? providers %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14"><%= t("views.right_panel.detail.select_providers") %></label>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %> <%= select_tag "provider", options_for_select(@providers, :selected => params[:provider]), :class => "form-control" %>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
@@ -49,37 +49,6 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
<% if params[:shift_name].to_i > 0%> <% if params[:shift_name].to_i > 0%>
shift_id = '<%= params[:shift_name] %>' shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift_from %> - <%= @shift_to %> ' local_date = '<%= @shift_from %> - <%= @shift_to %> '
@@ -91,38 +60,4 @@
$("#from").val("<%=params[:from] rescue '-'%>"); $("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>"); $("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>); $("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
// shift = $(".shift-id").text()
// if (shift.length>0) {
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
// }
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script> </script>

Some files were not shown because too many files have changed in this diff Show More