Merge branch 'r-1902001-01' of gitlab.com:code2lab/SXRestaurant into r-1902001-01

This commit is contained in:
Zoey
2019-06-21 10:04:48 +06:30
75 changed files with 1760 additions and 429 deletions

View File

@@ -84,12 +84,12 @@ For ReceiptBillAltName options
For Using Star Printer For Using Star Printer
*** Need to change these print settings *** Need to change these print settings
1) settings/print_settings => OrderItemStarPdf 1) settings/print_settings/unique_code => OrderItemStarPdf
2) settings/print_settings => ReceiptBillStarPdf 2) settings/print_settings/unique_code => ReceiptBillStarPdf
3) settings/print_settings => SaleItemsStarPdf 3) settings/print_settings/unique_code => SaleItemsStarPdf
*** Other print settings aren't need to change. *** Other print settings aren't need to change.
For Sale Items Summary Include at CloseCashierPrint For Show Sale Items Summary at CloseCashierPrint
1) settings/print_settings 1) settings/print_settings
a) Check => Shift Sale Items a) Check => Shift Sale Items

View File

@@ -1,3 +1,4 @@
//middle edit
$(function() { $(function() {
var role = $('#role').val(); var role = $('#role').val();
var second_display_lookup = $("#display_type").val(); var second_display_lookup = $("#display_type").val();
@@ -54,28 +55,16 @@ $(function() {
if (type ==-1 && modify_order == -1){ if (type ==-1 && modify_order == -1){
image_path = product[field].image_path.url; image_path = product[field].image_path.url;
} }
}else{
image_path = "/image/logo.png";
}
row = '<div class="col-md-3">'
row = '<div class="col-md-6 col-sm-6 col-lg-3 mt-3">'
+'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">' +'<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="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
+'<div class="col-md-10">'+ product[field].name +'</div>' +'<div class="col-md-10">'+ product[field].name +'</div>'
+"<div class='col-md-2 menu_item_box' data-item-code='"
+ product[field].item_code +"' data-instance = '"
+JSON.stringify(item_attributes)+"' data-id = '"
+JSON.stringify(item_attributes)+"' data-item = '"
+JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(options)+"'data-opt = '"
+JSON.stringify(options)+"' data-item-sets = '"
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
+"<i class='fa fa-bars material-icons m-l--10'>"
+'view_list</i>'
+'</div>'
+'</div>' +'</div>'
+"<div class='add_icon p-t-65' data-item-code='" +"<div class='add_icon p-t-65 p-b-65' data-item-code='"
+ product[field].item_code +"' data-name='" + product[field].item_code +"' data-name='"
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '" + product[field].name +"' data-qty = '"+ qty +"' data-price = '"
+ 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 = '"
@@ -83,16 +72,71 @@ $(function() {
+ JSON.stringify(item_attributes) +"' data-options = '" + JSON.stringify(item_attributes) +"' data-options = '"
+ JSON.stringify(options) +"' data-opt = '" + JSON.stringify(options) +"' data-opt = '"
+ JSON.stringify(options) +"' data-image='"+image_path+"'>" + JSON.stringify(options) +"' data-image='"+image_path+"'>"
+'</div>'
// +"<div class='card-block custom-card-block'>" +'<div class="card-footer custom-card-footer custom-flex-footer">'
// +"<img id='logo' height='125px' src='"+image_path+"'>" +'<span style="font-weight:900;flex-grow:1;">'+ product[field].unit_price +'</span>'
// +"</div>" +"<div class='offset-4 col-2 menu_item_box' data-item-code='"
+ product[field].item_code +"' data-instance = '"
+'<div class="card-footer custom-card-footer">' +JSON.stringify(item_attributes)+"' data-id = '"
+'<span>'+ product[field].unit_price +'</span>' +JSON.stringify(item_attributes)+"' data-item = '"
+'</div>' +JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(options)+"'data-opt = '"
+JSON.stringify(options)+"' data-item-sets = '"
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
+"<i class='fa fa-bars material-icons m-l--10'>"
+'view_list</i>'
+'</div>'
+'</div>' +'</div>'
+'</div>'; +'</div>';
}
else
{
row = '<div class="col-md-6 col-sm-6 col-lg-3 mt-1">'
+'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;">'
+'<div class="custom-card-head custom-card-no-img-head card-head row" style="margin:0px;display:flex;!important">'
+"<div class='col-12 add_icon p-t-65 p-b-65' data-item-code='"
+ product[field].item_code +"' data-name='"
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '"
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ JSON.stringify(options) +"' data-opt = '"
+ JSON.stringify(options) +"' data-image=''>"
+'<div class="product_box">'+ product[field].name +'</div>'
+'</div>'
+'</div>'
+"<div class='add_icon' data-item-code='"
+ product[field].item_code +"' data-name='"
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '"
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ JSON.stringify(options) +"' data-opt = '"
+ JSON.stringify(options) +"' data-image=''>"
+'</div>'
+'<div class="card-footer custom-card-no-img-footer custom-flex-footer">'
+'<span style="font-weight:900;flex-grow:1;">'+ product[field].unit_price +'</span>'
+"<div class='offset-4 col-2 menu_item_box menu_item_no_img_box' data-item-code='"
+ product[field].item_code +"' data-instance = '"
+JSON.stringify(item_attributes)+"' data-id = '"
+JSON.stringify(item_attributes)+"' data-item = '"
+JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(options)+"'data-opt = '"
+JSON.stringify(options)+"' data-item-sets = '"
+JSON.stringify(item_attributes)+"' data-image='' data-toggle='modal' data-target='.sx_item_detailModal'>"
+"<i class='fa fa-bars material-icons m-l--10'>"
+'view_list</i>'
+'</div>'
+'</div>'
+'</div>';
}
$('.menu_items_list').append(row); $('.menu_items_list').append(row);
} }
} }
@@ -499,7 +543,6 @@ $(function() {
//click item row for add order //click item row for add order
$(document).on('click', '.menu_item_box', function(event){ $(document).on('click', '.menu_item_box', function(event){
$('.attributes-list').empty(); $('.attributes-list').empty();
$('.options-list').empty(); $('.options-list').empty();
$('#modal_box_img').empty(); $('#modal_box_img').empty();
@@ -844,8 +887,11 @@ $(function() {
e.preventDefault(); e.preventDefault();
$("#oqs_loading_wrapper").show(); $("#oqs_loading_wrapper").show();
var cashier_type = $("#link_type").val(); var cashier_type = $("#link_type").val();
localStorage.setItem('cashier_type',cashier_type);
quick_service = window.location.href.indexOf("quick_service"); quick_service = window.location.href.indexOf("quick_service");
localStorage.setItem('quick_service',quick_service);
food_court = window.location.href.indexOf("food_court"); food_court = window.location.href.indexOf("food_court");
localStorage.setItem('food_court',food_court);
if (quick_service != -1 || food_court != -1) { if (quick_service != -1 || food_court != -1) {
type = cashier_type; type = cashier_type;
var table_type = $('#table_type').text(); var table_type = $('#table_type').text();
@@ -1379,6 +1425,7 @@ $(function() {
var menu_list = $('.menu_items_list'); var menu_list = $('.menu_items_list');
menu_list.empty(); menu_list.empty();
for(var field in menu_items) { for(var field in menu_items) {
console.log(menu_items[field].instances);
if (menu_items[field].is_sub_item == false) { if (menu_items[field].is_sub_item == false) {
instances = menu_items[field].instances ; instances = menu_items[field].instances ;
@@ -1439,52 +1486,109 @@ $(function() {
}else{ }else{
image_path = menu_items[field].image; image_path = menu_items[field].image;
} }
row = '<div class="col-md-6 col-sm-6 col-lg-3">'
+'<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;" >'
+'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>'
}else{ +'</div>'
if (modify_order) { +"<div class='"+add_icon+" p-t-65 p-b-65 m-r-' "
image_path = "../../image/logo.png"; +" data-item-code='"+ menu_items[field].code +"' "
}else{ +" data-name='"+ menu_items[field].name +"' "
image_path = "image/logo.png"; +" 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>'
+'<div class="card-footer custom-card-footer custom-flex-footer" style="opacity:0.7">'
+'<span style="font-weight:900;flex-grow:1;">'+ price +'</span>'
+ "<div class='offset-4 col-2 "+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 +"'"
+ " style='padding:0px 5px 0px 5px' >"
+ "<i class='m-l--5 fa " + fa_plus + "'>"
+ add
+ "</i>"
+'</div>'
row = '<div class="col-md-3">' +'</div>'
+'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">' +'</div>'; ;
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">' }else{
+'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>' row = '<div class="col-md-6 col-sm-6 col-lg-3 mt-1">'
+"<div class='col-md-2 "+menu_item_box+" ' data-item-code='" +'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;">'
+ menu_items[field].code +"' data-instance = '" +'<div class="custom-card-no-img-head card-head '+add_icon+' " style="margin:0px;display:flex;!important "'
+JSON.stringify(menu_items[field].instances)+"' data-id = '" +" data-item-code='"+ menu_items[field].code +"' "
+JSON.stringify(menu_items[field].attributes)+"' data-item = '" +" data-name='" + menu_items[field].name +"' "
+JSON.stringify(item_attributes)+"' data-option = '" +" data-qty = '"+ qty +"' "
+JSON.stringify(menu_items[field].options)+"'data-opt = '" +" data-price = '" + price +"' "
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '" +" data-instance-code = '"+ code +"' "
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' style='padding:0px 5px 0px 5px'>" +" data-instance = '" + name +"' "
+"<i class='m-l--5 fa "+fa_plus+" '>" +" data-promotion-price = '"+ promotion_price +"' "
+add+ '</i>' +" data-attributes = '" + JSON.stringify(item_attributes) +"' "
+'</div>' +" data-options = '"+ JSON.stringify(menu_items[field].options) +"' "
+'</div>' +" data-opt = '"+ JSON.stringify(menu_items[field].options) +"' "
+"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='" +" data-image='' data-toggle='"+data_modal+"' "
+ menu_items[field].code +"' data-name='" +" data-target='."+data_target+"' "
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '" +" data-item-sets = '"+JSON.stringify(menu_items[field].item_sets)+"'"
+ price +"' data-instance-code = '"+ code +"' data-instance = '" +" data-instances = '"+JSON.stringify(menu_items[field].instances)+"'>"
+ 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'>" +'<div class="product_box" style="width:100%;"><span>'+ menu_items[field].name +'<span></div>'
// +"<img id='logo' height='' src='"+image_path+"'>" +'</div>'
// +"</div>" +"<div class='"+add_icon+"' "
+" 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='' 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>'
+'<div class="card-footer custom-card-no-img-footer custom-flex-footer">'
+'<span style="font-weight:900;flex-grow:1;">'+ price + '</span>'
+" <div class='offset-4 col-2 menu_item_no_img_box "+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+"' "
+" style='padding:0px 5px 0px 5px'>"
+"<i class='m-l--5 fa "+fa_plus+" '>"
+add+ '</i>'
+'</div>'
+'</div>'
+'</div>'
+'</div>';
}
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
+'<span>'+ price +'</span>'
+'</div>'
+'</div>'
+'</div>'; ;
$('.menu_items_list').append(row); $('.menu_items_list').append(row);
} }
//end instances in menu-items alest 1 instance //end instances in menu-items alest 1 instance

View File

@@ -35,6 +35,7 @@
//= require BSBMaterial/demo.js //= require BSBMaterial/demo.js
//= require custom.js //= require custom.js
//= require jquery-fileupload/basic //= require jquery-fileupload/basic
//= require induties/induties.js
$(document).ready(function() { $(document).ready(function() {
$('.count-to').countTo(); $('.count-to').countTo();

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -288,6 +288,8 @@ function show_order_detail(url,sr_no){
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
var scrollTo = document.getElementById('div_card_order');
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
// console.log(data); // console.log(data);
$("#order_remark").text(""); $("#order_remark").text("");
$(".tbl_customer").show(); $(".tbl_customer").show();
@@ -373,24 +375,49 @@ function show_order_detail(url,sr_no){
item_price = items[i].unit_price; item_price = items[i].unit_price;
} }
var total = items[i].qty * item_price; var total = items[i].qty * item_price;
if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){ var check_mobile =document.getElementsByName("summary_items_mobile")[0].value;
row = '<tr>' if (check_mobile == "true"){
+'<td width ="70%" class="body-td align-left">'+items[i].item_name if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){
+' <br>' row =
+' <i><span class="font-12">'+items[i].options+'</span></i><br>'+ '<tr>'
'<span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>' +'<td width ="70%" class="body-td align-left">'+items[i].item_name
+'</td>' +' <br>'
+'<td width ="30%" class="body-td align-right">'+ total +'</td>' +' <i><span class="font-12">'+items[i].options+'</span></i></td>'+
+'</tr>'; '<td><span class="font-13">'+items[i].qty+ '</span>'
}else{ +'</td>'
row = '<tr>' +'<td width ="30%" class="body-td align-right">'+ total +'</td>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name +'</tr>';
+' <br>'+ }else{
'<span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>' row = '<tr>'
+'</td>' +'<td width ="70%" class="body-td align-left">'+items[i].item_name
+'<td width ="30%" class="body-td align-right">'+ total +'</td>' +' </td>'+
+'</tr>'; '<td><span class="font-13">'+items[i].qty+ '</span></td>'
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
+'</tr>';
}
} }
else{
if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){
row = '<tr>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
+' <br>'
+' <i><span class="font-12">'+items[i].options+'</span></i><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>';
}else{
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); $('.summary-items').append(row);
} }

View File

@@ -3,12 +3,12 @@ section .content{
} }
.custom-card-head{ .custom-card-head{
height: 40px; height: 40px;
#background-color: #54A5AF; background-color: #79D0F2;
background-color: #a1aade; color :#fff;
#background-color: #a1aade;
opacity: 0.8; opacity: 0.8;
padding:5px; padding:5px;
color :#000000; font-weight:400;
} }
.custom-card { .custom-card {
border: 2px solid rgba(0, 0, 0, 0.125) !important; border: 2px solid rgba(0, 0, 0, 0.125) !important;
@@ -16,6 +16,10 @@ section .content{
} }
.custom-card-footer{ .custom-card-footer{
padding:0.35rem 1.25rem !important; padding:0.35rem 1.25rem !important;
bottom:0;
position: absolute;
width: 100%;
font-weight:900;
} }
.custom-card-block { .custom-card-block {
@@ -301,3 +305,32 @@ i.logout_icon{
margin-left: 15px !important; margin-left: 15px !important;
margin-right: 15px !important; margin-right: 15px !important;
} }
.product_box{
position:relative;
text-align:center;
font-weight:900;
color:#fff;
font-size:1.5em;
margin:auto;
}
.custom-card-no-img-head{
#background-color: #54A5AF;
opacity: 0.8;
padding:5px;
color :#273040;
min-height:100px;
height: 150px;
background-color:#79D0F2;
}
.menu_item_no_img_box{
cursor: pointer;
}
.custom-card-no-img-footer{
padding:0.35rem 1.25rem !important;
}
.custom-flex-footer{
display:flex;
}

View File

@@ -11,6 +11,7 @@
@import "BSBMaterial/style"; @import "BSBMaterial/style";
@import "BSBMaterial/themes/all-themes"; @import "BSBMaterial/themes/all-themes";
@import "reset"; @import "reset";
@import "induties/assign_in_duties";
/*@import "bootstrap-select/css/bootstrap-select.min";*/ /*@import "bootstrap-select/css/bootstrap-select.min";*/

View File

@@ -0,0 +1,96 @@
// Place all the styles related to the induties/assign_in_duties controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.custom-card-head{
height: 40px;
background-color: grey;
color :#fff;
opacity: 0.8;
padding:5px;
font-weight:400;
align-items: center;
}
.form-group .form-control {
width: 100%;
border: none;
box-shadow: none;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-ms-border-radius: 0;
border-radius: 0;
padding-left: 0;
}
.radio-room{
margin-right:2rem;
}
.radio-table{
margin-left:1rem;
}
.bmd-form-group {
position: relative;
padding-top: 0 !important;
}
.btn_create_induty{
display: inline;
padding: 1.5rem;
margin: 0;
}
.create_induty_card{
min-height:500px;
}
#save_induties_by_name{
-webkit-appearance: none;
}
.checkboxLabel:before{
content: '\e40c';
font-family: "Material Icons";
font-size: 25px;
vertical-align: middle;
margin-right: 5px;
color: #2196F3;
}
#save_induties_by_name:checked ~ .checkboxLabel:before{
content: '\e86c';
}
.checkboxLabel {
font-size: 18px !important;
}
.add_more{
content: '\e40c';
font-family: "Material Icons";
font-size: 25px;
vertical-align: middle;
margin-right: 5px;
color: #2196F3;
}
.success-msg {
color: #270;
background-color: #DFF2BF;
margin: 10px 0;
padding: 10px;
border-radius: 3px 3px 3px 3px;
display: none;
margin-right: 0.5rem;
margin-left: 0.5rem;
}
.show_all_commissioner_card{
min-height: 830px;
max-height: 830px;
overflow: scroll;
}
.sweet-alert p {
font-size: 14px !important;
font-weight:bold;
}
.sweet-alert {
top :0;
margin-top: 20px !important;
}
.add_to_charges{
width:100%;
padding:1rem;
}

View File

@@ -100,3 +100,9 @@ td.grand-total-padding {
font-size: 17px; font-size: 17px;
padding-top: 20px !important; padding-top: 20px !important;
} }
.mobile_tab-col-teal > li {
margin:auto;
}
.mobile_tab-col-teal{
margin-left:1.5rem;
}

View File

@@ -21,6 +21,7 @@ class Api::ApiController < ActionController::API
def current_login_employee def current_login_employee
@employee = Employee.find_by_token_session(current_token) @employee = Employee.find_by_token_session(current_token)
puts @employee.to_json
end end
# def lookup_domain # def lookup_domain

View File

@@ -43,7 +43,7 @@ class Api::BillController < Api::ApiController
if booking if booking
if booking.sale_id.nil? if booking.sale_id.nil?
@sale = Sale.new @sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, cashier, order.source) @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, cashier, order.source,params[:current_checkin_induties_count])
@sale_data = Sale.find_by_sale_id(@sale_id) @sale_data = Sale.find_by_sale_id(@sale_id)
else else
@status = true @status = true
@@ -177,7 +177,7 @@ class Api::BillController < Api::ApiController
if @booking.sale_id.nil? if @booking.sale_id.nil?
@sale = Sale.new @sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_booking(@booking.booking_id, current_login_employee, cashier, order.source) @status, @sale_id = @sale.generate_invoice_from_booking(@booking.booking_id, current_login_employee, cashier, order.source,params[:current_checkin_induties_count])
@sale_data = Sale.find_by_sale_id(@sale_id) @sale_data = Sale.find_by_sale_id(@sale_id)
else else
@status = true @status = true

View File

@@ -0,0 +1,166 @@
class Api::Payment::MobilepaymentController < Api::ApiController
# skip_before_action :authenticate
def cash
cash = params[:cash]
sale_id = params[:sale_id]
member_info = nil
type = params[:type]
tax_type = params[:tax_type]
path = request.fullpath
latest_order_no = nil
cashier_id = params[:cashier_id]
current_user = Employee.find(cashier_id)
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
shop_detail = Shop.first
# rounding adjustment
if !path.include? ("credit_payment")
if shop_detail.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(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)
end
end
end
# end rounding adjustment
sale_payment = SalePayment.new
sale_payment =sale_payment.process_payment(saleObj, current_user, cash, "cash")
if sale_payment[0]
@cash ={"change_amount"=>sale_payment[3],"balance_amount"=>sale_payment[4] ,"receipt_url"=>''}
end
@out = true,@cash
# if !path.include? ("credit_payment")
# rebate_amount = nil
# # For Cashier by Zone
# # bookings = Booking.where("sale_id='#{sale_id}'")
# bookings = Booking.find_by_sale_id(sale_id)
# shift = ShiftSale.current_open_shift(current_user.id)
# if !shift.nil?
# cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
# else
# if bookings.dining_facility_id.to_i > 0
# table = DiningFacility.find(bookings.dining_facility_id)
# cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
# cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
# type = 'payment'
# from = getCloudDomain #get sub domain in cloud mode
# ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
# else
# shift = ShiftSale.find(saleObj.shift_sale_id)
# cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
# end
# end
# # For Print
# # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
# unique_code = "ReceiptBillPdf"
# print_settings = PrintSetting.all
# if !print_settings.nil?
# print_settings.each do |setting|
# if setting.unique_code == 'ReceiptBillPdf'
# unique_code = "ReceiptBillPdf"
# elsif setting.unique_code == 'ReceiptBillStarPdf'
# unique_code = "ReceiptBillStarPdf"
# end
# end
# end
# if !receipt_bill_a5_pdf.empty?
# receipt_bill_a5_pdf.each do |receipt_bilA5|
# if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
# if receipt_bilA5[1] == '1'
# unique_code = "ReceiptBillA5Pdf"
# end
# end
# end
# end
# customer= Customer.find(saleObj.customer_id)
# # get member information
# rebate = MembershipSetting.find_by_rebate(1)
# credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
# if customer.membership_id != nil && rebate && credit_data.nil?
# member_info = Customer.get_member_account(customer)
# if member_info["status"] == true
# rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
# current_balance = SaleAudit.paymal_search(sale_id)
# end
# end
# #orders print out
# if params[:type] == "quick_service"
# booking = Booking.find_by_sale_id(sale_id)
# if booking.dining_facility_id.to_i>0
# table_id = booking.dining_facility_id
# else
# table_id = 0
# end
# latest_order = booking.booking_orders.order("order_id DESC").limit(1).first()
# if !latest_order.nil?
# latest_order_no = latest_order.order_id
# end
# booking.booking_orders.each do |order|
# # Order.pay_process_order_queue(order.order_id, table_id)
# oqs = OrderQueueStation.new
# oqs.pay_process_order_queue(order.order_id, table_id)
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
# from = getCloudDomain #get sub domain in cloud mode
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
# end
# end
# #for card sale data
# card_data = Array.new
# card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
# if !card_sale_trans_ref_no.nil?
# card_sale_trans_ref_no.each do |cash_sale_trans|
# card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
# card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
# card_no = cash_sale_trans.pan.last(4)
# card_no = card_no.rjust(19,"**** **** **** ")
# card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
# end
# end
# #card_balance amount for Paymal payment
# card_balance_amount = SaleAudit.getCardBalanceAmount(sale_id)
# # get printer info
# print_settings=PrintSetting.find_by_unique_code(unique_code)
# # Calculate Food and Beverage Total
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
# other_amount = SaleItem.calculate_other_charges(sale_items)
# printer = Printer::ReceiptPrinter.new(print_settings)
# filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
# render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
# #end
# end
else
@out =false,"Something wrong!"
end
end
end

View File

@@ -8,7 +8,7 @@ class Crm::CustomersController < BaseCrmController
filter = params[:filter] filter = params[:filter]
filter_card_no = params[:filter_card_no] filter_card_no = params[:filter_card_no]
type = params[:type] type = params[:type]
@customer_update_phone_email =false @customer_update_phone_email_membertype =false
if filter_card_no=="" if filter_card_no==""
@crm_customers = Customer.all @crm_customers = Customer.all
elsif !filter_card_no.nil? elsif !filter_card_no.nil?
@@ -46,13 +46,16 @@ class Crm::CustomersController < BaseCrmController
else else
@crm_customers.each do |customer| @crm_customers.each do |customer|
if customer.contact_no != response["customer_data"]["phone"] if customer.contact_no != response["customer_data"]["phone"]
@customer_update_phone_email =true @customer_update_phone_email_membertype =true
end end
if customer.email != response["customer_data"]["email"] if customer.email != response["customer_data"]["email"]
@customer_update_phone_email =true @customer_update_phone_email_membertype =true
end end
if customer.name != response["customer_data"]["name"] if customer.name != response["customer_data"]["name"]
@customer_update_phone_email =true @customer_update_phone_email_membertype =true
end
if customer.membership_type.to_i != response["customer_data"]["member_group_id"]
@customer_update_phone_email_membertype =true
end end
end end
end end
@@ -122,7 +125,6 @@ class Crm::CustomersController < BaseCrmController
#get customer amount #get customer amount
@customer = Customer.find(params[:id]) @customer = Customer.find(params[:id])
@response = Customer.get_membership_transactions(@customer) @response = Customer.get_membership_transactions(@customer)
puts @response.to_json
Rails.logger.debug "get membership transactions response" Rails.logger.debug "get membership transactions response"
Rails.logger.debug @response.to_json Rails.logger.debug @response.to_json
@@ -555,13 +557,14 @@ class Crm::CustomersController < BaseCrmController
end end
end end
def customer_update_phone_email def customer_update_phone_email_member_type
@customer = Customer.find(params[:id]) @customer = Customer.find(params[:id])
response = Customer.search_paypar_account_no(@customer.paypar_account_no) response = Customer.search_paypar_account_no(@customer.paypar_account_no)
if response["status"] == true if response["status"] == true
@customer.name =response["customer_data"]["name"] @customer.name =response["customer_data"]["name"]
@customer.contact_no =response["customer_data"]["phone"] @customer.contact_no =response["customer_data"]["phone"]
@customer.email =response["customer_data"]["email"] @customer.email =response["customer_data"]["email"]
@customer.membership_type =response["customer_data"]["member_group_id"]
@customer.save @customer.save
respond_to do |format| respond_to do |format|
format.html { redirect_to crm_customers_path } format.html { redirect_to crm_customers_path }

View File

@@ -0,0 +1,71 @@
class Induties::AssignInDutiesController < ApplicationController
def index
@commissioners =[]
@commiss=Commissioner.active.all.order(created_at: :desc)
@commiss.each do|commissioner|
check_in_count =InDuty.where('commissioner_ids =? and out_time is null', commissioner.id.to_json).count;
@commissioners.push({ "id"=>commissioner.id,
"name"=>commissioner.name,
"image_path"=>commissioner.image_path.url,
"check_in_count"=>check_in_count
})
end
@booking_id = params[:booking_id]
end
def get_all_occupied_dining
commissionerIds =params[:id]
@check_in_commissioner =InDuty.select("in_duties.*,dining_facilities.type as dinning_type")
.joins(" LEFT JOIN dining_facilities on dining_facilities.id = in_duties.dinning_id").where('commissioner_ids =? and out_time is null', commissionerIds).order(created_at: :asc);
respond_to do |format|
format.json { render json: @check_in_commissioner.to_json }
end
end
def induties_create
commissioner_ids =params[:commissionerId]
booking_id =params[:booking_id]
dinning_id = params[:dinning_id]
induty = InDuty.new
induty.dinning_id = dinning_id
induty.booking_id = booking_id
induty.commissioner_ids = commissioner_ids
induty.by_name = params[:by_name]
induty.in_time = Time.now.utc
if induty.save
dinning = DiningFacility.find(induty.dinning_id)
@induty= {"id"=>induty.id,
"dinning_id"=>induty.dinning_id,
"in_time"=>induty.in_time,
"out_time"=>induty.out_time,
"dinning_type"=>dinning.type }
respond_to do |format|
format.json { render json: @induty.to_json }
end
end
end
def induties_checkout
induty_id = params[:induty_id]
induty = InDuty.find(induty_id)
induty.out_time = Time.now.utc
induty.save
@induty =induty
respond_to do |format|
format.json { render json: @induty.to_json }
end
end
def induties_remove
induty_id = params[:induty_id]
induty = InDuty.find(induty_id)
induty.destroy
end
def get_current_booking
@current_booking =InDuty.select("in_duties.*,dining_facilities.type as dinning_type")
.joins(" LEFT JOIN dining_facilities on dining_facilities.id = in_duties.dinning_id").where('booking_id =? and out_time is null', params[:booking_id]).order(created_at: :asc);
respond_to do |format|
format.json { render json: @current_booking.to_json }
end
end
end

View File

@@ -49,8 +49,7 @@ class Oqs::EditController < BaseOqsController
oqs = assign_item.order_queue_station oqs = assign_item.order_queue_station
printer = PrintSetting.all printer = PrintSetting.all
unique_code= ""
unique_code="OrderItemPdf"
if !printer.empty? if !printer.empty?
printer.each do |printer_setting| printer.each do |printer_setting|
if printer_setting.unique_code == 'OrderItemPdf' if printer_setting.unique_code == 'OrderItemPdf'
@@ -65,6 +64,8 @@ class Oqs::EditController < BaseOqsController
unique_code="OrderSetItemCustomisePdf" unique_code="OrderSetItemCustomisePdf"
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf' elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
unique_code="OrderItemSlimCustomisePdf" unique_code="OrderItemSlimCustomisePdf"
elsif printer_setting.unique_code == 'OrderItemStarPdf'
unique_code="OrderItemStarPdf"
end end
end end
end end

View File

@@ -17,6 +17,7 @@ class Origami::HomeController < BaseOrigamiController
# origami table detail # origami table detail
def show def show
@webview = check_mobile @webview = check_mobile
@tables = Table.unscoped.all.active.order('status desc') @tables = Table.unscoped.all.active.order('status desc')
@@ -35,7 +36,7 @@ class Origami::HomeController < BaseOrigamiController
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ") @dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
#@dining_booking = @dining.bookings.active.where("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'") #@dining_booking = @dining.bookings.active.where("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'")
@order_items = Array.new @order_items = Array.new
@dining_booking.each do |booking| @dining_booking.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved' if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new @order_items = Array.new
@@ -144,6 +145,7 @@ class Origami::HomeController < BaseOrigamiController
end end
end end
end end
end end
def check_emp_access_code def check_emp_access_code

View File

@@ -278,6 +278,8 @@ class Origami::PaymentsController < BaseOrigamiController
end end
def show def show
puts current_user
puts "Hello current_user"
path = request.fullpath path = request.fullpath
sale_id = params[:sale_id] sale_id = params[:sale_id]
@trans_flag = true @trans_flag = true
@@ -635,12 +637,25 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf" # unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id) customer= Customer.find(saleObj.customer_id)
#shop detail #shop detail
#shop_detail = Shop.first #shop_detail = Shop.first
printer = PrintSetting.all
unique_code="ReceiptBillPdf"
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'ReceiptBillPdf'
unique_code="ReceiptBillPdf"
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
unique_code="ReceiptBillA5Pdf"
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
unique_code="ReceiptBillStarPdf"
end
end
end
# get printer info # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total # Calculate Food and Beverage Total

View File

@@ -30,13 +30,15 @@ class Origami::QuickServiceController < ApplicationController
end end
#checked quick_service only #checked quick_service only
@quick_service_only = true @quick_service_only = false
lookup_dine_in = Lookup.collection_of('dinein_cashier') lookup_dine_in = Lookup.collection_of('quickservice_add_order')
puts 'lookup_dine_in!!!!'
puts lookup_dine_in
if !lookup_dine_in.empty? if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in| lookup_dine_in.each do |dine_in|
if dine_in[0].downcase == "dineincashier" if dine_in[0].downcase == "quickserviceaddorder"
if dine_in[1] == '1' if dine_in[1] == '1'
@quick_service_only = false @quick_service_only = true
end end
end end
end end

View File

@@ -28,7 +28,7 @@ class Origami::RequestBillsController < ApplicationController
if check_booking.sale_id.nil? if check_booking.sale_id.nil?
# Create Sale if it doesn't exist # Create Sale if it doesn't exist
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source) @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
@sale_data = Sale.find_by_sale_id(@sale_id) @sale_data = Sale.find_by_sale_id(@sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_id) @sale_items = SaleItem.where("sale_id=?",@sale_id)
@@ -38,6 +38,7 @@ class Origami::RequestBillsController < ApplicationController
in_duties.each do |in_duty| in_duties.each do |in_duty|
induty = InDuty.find(in_duty.id) induty = InDuty.find(in_duty.id)
induty.sale_id = @sale_id induty.sale_id = @sale_id
induty.out_time =Time.now.utc
induty.save induty.save
end end
end end

View File

@@ -120,7 +120,7 @@ class Origami::SplitBillController < BaseOrigamiController
if booking if booking
if booking.sale_id.nil? if booking.sale_id.nil?
sale = Sale.new sale = Sale.new
status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, current_user, cashier_type) status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, current_user, cashier_type,params[:current_checkin_induties_count])
sale_data = Sale.find_by_sale_id(sale_id) sale_data = Sale.find_by_sale_id(sale_id)
else else
status = true status = true
@@ -333,7 +333,7 @@ class Origami::SplitBillController < BaseOrigamiController
end end
sale = Sale.new sale = Sale.new
status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, current_user, cashier_type) status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, current_user, cashier_type ,params[:current_checkin_induties_count])
end end
Promotion.promo_activate(sale) Promotion.promo_activate(sale)

View File

@@ -105,7 +105,15 @@ class Origami::VoidController < BaseOrigamiController
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf" # get printer info
# print_settings = PrintSetting.find_by_unique_code('ReceiptBillPdf') # SaleItemsPdf
#
# if !print_settings.nil?
# unique_code = 'ReceiptBillPdf'
# elsif
# unique_code = 'ReceiptBillStarPdf'
# end
customer= Customer.find(sale.customer_id) customer= Customer.find(sale.customer_id)
#shop detail #shop detail
@@ -119,6 +127,20 @@ class Origami::VoidController < BaseOrigamiController
current_balance = 0 current_balance = 0
end end
printer = PrintSetting.all
unique_code="ReceiptBillPdf"
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'ReceiptBillPdf'
unique_code="ReceiptBillPdf"
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
unique_code="ReceiptBillA5Pdf"
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
unique_code="ReceiptBillStarPdf"
end
end
end
# get printer info # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total # Calculate Food and Beverage Total

View File

@@ -86,7 +86,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf" # unique_code = "ReceiptBillPdf"
customer= Customer.find(sale.customer_id) customer= Customer.find(sale.customer_id)
#shop detail #shop detail
@@ -100,6 +100,21 @@ class Origami::WasteSpoileController < BaseOrigamiController
current_balance = 0 current_balance = 0
end end
printer = PrintSetting.all
unique_code="ReceiptBillPdf"
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'ReceiptBillPdf'
unique_code="ReceiptBillPdf"
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
unique_code="ReceiptBillA5Pdf"
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
unique_code="ReceiptBillStarPdf"
end
end
end
# get printer info # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total # Calculate Food and Beverage Total

View File

@@ -130,6 +130,11 @@ class Reports::SaleitemController < BaseReportController
print_settings = PrintSetting.find_by_unique_code('SaleItemsPdf') # SaleItemsPdf print_settings = PrintSetting.find_by_unique_code('SaleItemsPdf') # SaleItemsPdf
print_settings_star = PrintSetting.find_by_unique_code('SaleItemsStarPdf') print_settings_star = PrintSetting.find_by_unique_code('SaleItemsStarPdf')
# if print_settings.nil? && print_settings_star.nil?
# @print_setting = PrintSetting.new(name: "SaleItemsPdf", unique_code: "SaleItemsPdf", template: "",font: "Zawgyi-One", header_font_size: "10", item_font_size: "8", printer_name: "", api_settings: "", brand_name: nil, printer_type: nil, page_width: "210", page_height: "1450", print_copies: "1", precision: "0", delimiter: "0", heading_space: "5" )
# @print_setting.save
# end
if print_settings.nil? if print_settings.nil?
if !print_settings_star.nil? if !print_settings_star.nil?
printer = Printer::CashierStationPrinter.new(print_settings_star) printer = Printer::CashierStationPrinter.new(print_settings_star)

View File

@@ -18,6 +18,7 @@ class Settings::CommissionersController < ApplicationController
def new def new
@commissioner = Commissioner.new @commissioner = Commissioner.new
@employee = Employee.all.order('name asc') @employee = Employee.all.order('name asc')
end end
# GET /commissioners/1/edit # GET /commissioners/1/edit
@@ -35,14 +36,21 @@ class Settings::CommissionersController < ApplicationController
unless @commissioner.resigned_date.nil? unless @commissioner.resigned_date.nil?
@commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') @commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d')
end end
respond_to do |format| # puts params[:from_induty].length
if @commissioner.save if (params[:from_induty] != "true")
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'} respond_to do |format|
format.json {render :show, status: :created, location: @commissioner} if @commissioner.save
else format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'}
format.html {render :new} format.json {render :show, status: :created, location: @commissioner}
format.json {render json: @commissioner.errors, status: :unprocessable_entity} else
format.html {render :new}
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
end
end end
else
@commissioner.save
flash[:notice] = 'Commissioner was successfully created.'
redirect_to induties_assign_in_duties_path(params[:booking_id])
end end
end end

View File

@@ -0,0 +1,2 @@
module Induties::AssignInDutiesHelper
end

View File

@@ -1,7 +1,7 @@
class Commissioner < ApplicationRecord class Commissioner < ApplicationRecord
belongs_to :employee, foreign_key: 'emp_id' belongs_to :employee, foreign_key: 'emp_id'
belongs_to :commission, foreign_key: 'commission_id' belongs_to :commission, foreign_key: 'commission_id'
has_many :in_juties has_many :in_duties
has_many :product_commissions has_many :product_commissions
scope :active, -> { where(is_active: true) } scope :active, -> { where(is_active: true) }

View File

@@ -34,7 +34,6 @@ class DiningCharge < ApplicationRecord
charge_block = DiningCharge.convert_to_minutes(chargesObj.charge_block.utc.strftime('%H:%M')) charge_block = DiningCharge.convert_to_minutes(chargesObj.charge_block.utc.strftime('%H:%M'))
result = dining_minutes / charge_block result = dining_minutes / charge_block
rounding_time = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.utc.strftime('%H:%M')) rounding_time = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.utc.strftime('%H:%M'))
if result.to_i < 1 if result.to_i < 1
# for dining minute is under charge_block # for dining minute is under charge_block

5
app/models/induties.rb Normal file
View File

@@ -0,0 +1,5 @@
module Induties
def self.table_name_prefix
'induties_'
end
end

View File

@@ -0,0 +1,2 @@
class Induties::AssignInDuty < ApplicationRecord
end

View File

@@ -11,11 +11,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
options = order_item[0].options options = order_item[0].options
# filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf" # filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty) # pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
print_setting = PrintSetting.all print_setting = PrintSetting.all
# check for item not to show # check for item not to show
pdf = ''
# if order_item[0].price != 0 # if order_item[0].price != 0
if !print_setting.empty? if !print_setting.empty?
print_setting.each do |print_settings| print_setting.each do |print_settings|
@@ -182,8 +182,6 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# Print for orders in booking # Print for orders in booking
def print_booking_summary(print_settings,oqs, booking_id, print_status,before_updated_qty="") def print_booking_summary(print_settings,oqs, booking_id, print_status,before_updated_qty="")
puts 'PrintSetting!!!'
puts print_setting.print_copies
# Must be one print # Must be one print
if print_settings.print_copies == 0 if print_settings.print_copies == 0
print_settings.print_copies = 1 print_settings.print_copies = 1

View File

View File

View File

@@ -26,7 +26,6 @@ class Sale < ApplicationRecord
} }
SALE_STATUS_OUTSTANDING = "outstanding" SALE_STATUS_OUTSTANDING = "outstanding"
SALE_STATUS_COMPLETED = "completed" SALE_STATUS_COMPLETED = "completed"
def self.sync_sale_records(sales) def self.sync_sale_records(sales)
if !sales.nil? if !sales.nil?
sales.each do |s| sales.each do |s|
@@ -63,8 +62,7 @@ class Sale < ApplicationRecord
puts '........ Sale data sync completed .......' puts '........ Sale data sync completed .......'
end end
end end
def generate_invoice_from_booking(booking_id, requested_by, cashier, order_source = nil, current_checkin_induties_count)
def generate_invoice_from_booking(booking_id, requested_by, cashier, order_source = nil)
booking = Booking.find(booking_id) booking = Booking.find(booking_id)
status = false status = false
Rails.logger.debug "Booking -> " + booking.id.to_s Rails.logger.debug "Booking -> " + booking.id.to_s
@@ -93,9 +91,22 @@ class Sale < ApplicationRecord
else else
dining_time = booking.checkin_at.strftime('%B %d, %H:%M %p').to_s + " - " + booking.checkout_at.strftime('%B %d, %H:%M %p').to_s dining_time = booking.checkin_at.strftime('%B %d, %H:%M %p').to_s + " - " + booking.checkout_at.strftime('%B %d, %H:%M %p').to_s
end end
later_time = booking.checkout_at
early_time = booking.checkin_at
distance_in_minutes = ((later_time - early_time)/60.0).round
basic_pay_amount =0
name =""
if current_checkin_induties_count != "0"
basic_pay = Commission.where('commission_type=?','Basic Pay')
basic_pay.each do |pay|
basic_pay_amount =pay.amount
name =pay.name
end
induties_pay_amount = (current_checkin_induties_count.to_i * (distance_in_minutes / 60.0).to_f * basic_pay_amount).to_i
create_saleitem_indutycharges(charges, current_checkin_induties_count.to_i, induties_pay_amount, booking.dining_facility.name, dining_time, order_source, basic_pay_amount)
end
create_saleitem_diningcharges(charges, block_count, diningprice, booking.dining_facility.name, dining_time, order_source) create_saleitem_diningcharges(charges, block_count, diningprice, booking.dining_facility.name, dining_time, order_source)
end end
return status, sale_id return status, sale_id
end end
end end
@@ -367,7 +378,25 @@ class Sale < ApplicationRecord
sale = Sale.find(self.id) sale = Sale.find(self.id)
self.compute_by_sale_items(self.id, sale.sale_items, self.total_discount, nil, order_source) self.compute_by_sale_items(self.id, sale.sale_items, self.total_discount, nil, order_source)
end end
def create_saleitem_indutycharges(chargeObj, current_checkin_induties_count, induties_pay_amount, dining_name, dining_time, order_source = nil, basic_pay_amount)
sale_item = SaleItem.new
sale_item.menu_category_code = "IndutyCharge"
sale_item.menu_category_name = "Induty Charge"
sale_item.product_code = ""
sale_item.product_name ='Vocalist' + " ( " + dining_time.to_s + " )"
sale_item.account_id = 0
sale_item.product_alt_name = "-"
sale_item.qty = current_checkin_induties_count
sale_item.unit_price = basic_pay_amount
sale_item.taxable_price = induties_pay_amount
sale_item.is_taxable = chargeObj.taxable
sale_item.sale_id = self.id
sale_item.price = induties_pay_amount
sale_item.save
# Re-calc
sale = Sale.find(self.id)
self.compute_by_sale_items(self.id, sale.sale_items, self.total_discount, nil, order_source)
end
def update_item (item) def update_item (item)
#save sale_audit #save sale_audit

View File

@@ -57,7 +57,7 @@ class SalePayment < ApplicationRecord
#route to payment type #route to payment type
case payment_method case payment_method
when "cash" when "cash"
payment_status = cash_payment(payment_for) payment_status ,outstanding_amount ,balance_amount = cash_payment(payment_for)
when "creditnote" when "creditnote"
if !self.sale.customer_id.nil? if !self.sale.customer_id.nil?
payment_status = creditnote_payment(self.customer_id) payment_status = creditnote_payment(self.customer_id)
@@ -127,7 +127,7 @@ class SalePayment < ApplicationRecord
# end # end
end end
return true, self.save,membership_data return true, self.save,membership_data, outstanding_amount ,balance_amount
else else
#record an payment in sale-audit #record an payment in sale-audit
remark = "Payment failed - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]" remark = "Payment failed - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
@@ -357,7 +357,16 @@ class SalePayment < ApplicationRecord
if !payment_for if !payment_for
sale_update_payment_status(self.received_amount,status) sale_update_payment_status(self.received_amount,status)
end end
return payment_status balance_amount =0.0
outstanding_amount =0.0
if self.sale.grand_total.to_f > self.received_amount.to_f
balance_amount = self.sale.grand_total.to_f - self.received_amount.to_f
outstanding_amount = 0.0
else
balance_amount = 0.0
outstanding_amount = self.received_amount.to_f - self.sale.grand_total.to_f
end
return payment_status , outstanding_amount.to_i, balance_amount.to_i
end end
def foc_payment def foc_payment

View File

@@ -1,12 +1,13 @@
class MoveTablePdf < Prawn::Document class MoveTablePdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(printer_settings,to,from,shop_detail,date,type,moved_by,order_items) def initialize(printer_settings,to,from,shop_detail,date,type,moved_by,order_items)
self.page_width = printer_settings.page_width self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = printer_settings.header_font_size.to_i
self.item_font_size = printer_settings.item_font_size.to_i self.item_font_size = printer_settings.item_font_size.to_i
self.margin = 0 self.margin = 0
self.margin_top = 7
self.price_width = 40 # No Need for item self.price_width = 40 # No Need for item
self.qty_width = 40 self.qty_width = 40
self.total_width = 40 # No Need for item self.total_width = 40 # No Need for item
@@ -15,7 +16,7 @@ class MoveTablePdf < Prawn::Document
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90 self.label_width=90
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# db font setup # db font setup
if printer_settings.font != "" if printer_settings.font != ""

View File

@@ -1,6 +1,6 @@
class OrderItemPdf < Prawn::Document class OrderItemPdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty) def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width self.page_width = print_settings.page_width
@@ -8,6 +8,7 @@ class OrderItemPdf < Prawn::Document
self.header_font_size = print_settings.header_font_size.to_i self.header_font_size = print_settings.header_font_size.to_i
self.item_font_size = print_settings.item_font_size.to_i self.item_font_size = print_settings.item_font_size.to_i
self.margin = 0 self.margin = 0
self.margin_top = 7
self.price_width = 40 # No Need for item self.price_width = 40 # No Need for item
self.qty_width = 40 self.qty_width = 40
self.total_width = 40 # No Need for item self.total_width = 40 # No Need for item
@@ -16,7 +17,7 @@ class OrderItemPdf < Prawn::Document
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90 self.label_width=90
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) super(:margin => self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# super(:margin => [10, 5, 30, 5], :page_size => [200,400]) # super(:margin => [10, 5, 30, 5], :page_size => [200,400])
# db font setup # db font setup

View File

@@ -1,6 +1,6 @@
class OrderItemStarPdf < Prawn::Document class OrderItemStarPdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty) def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width self.page_width = print_settings.page_width
@@ -8,6 +8,7 @@ class OrderItemStarPdf < Prawn::Document
self.header_font_size = print_settings.header_font_size.to_i self.header_font_size = print_settings.header_font_size.to_i
self.item_font_size = print_settings.item_font_size.to_i self.item_font_size = print_settings.item_font_size.to_i
self.margin = 0 self.margin = 0
self.margin_top = 7
self.price_width = 40 # No Need for item self.price_width = 40 # No Need for item
self.qty_width = 38 self.qty_width = 38
self.total_width = 40 # No Need for item self.total_width = 40 # No Need for item
@@ -16,7 +17,7 @@ class OrderItemStarPdf < Prawn::Document
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90 self.label_width=90
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# super(:margin => [10, 5, 30, 5], :page_size => [200,400]) # super(:margin => [10, 5, 30, 5], :page_size => [200,400])
# db font setup # db font setup

View File

@@ -1,7 +1,7 @@
class ReceiptBillStarPdf < Prawn::Document class ReceiptBillStarPdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount) def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount)
self.page_width = printer_settings.page_width self.page_width = printer_settings.page_width
@@ -9,6 +9,7 @@ class ReceiptBillStarPdf < Prawn::Document
self.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = printer_settings.header_font_size.to_i
self.item_font_size = printer_settings.item_font_size.to_i self.item_font_size = printer_settings.item_font_size.to_i
self.margin = 0 self.margin = 0
self.margin_top = 10
self.price_width = 60 self.price_width = 60
self.qty_width = 20 self.qty_width = 20
self.total_width = 40 self.total_width = 40
@@ -25,7 +26,7 @@ class ReceiptBillStarPdf < Prawn::Document
# @double = @qty_width * 1.3 # @double = @qty_width * 1.3
# @half_qty = @qty_width / 2 # @half_qty = @qty_width / 2
#setting page margin and width #setting page margin and width
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
#precision checked #precision checked
if printer_settings.precision.to_i > 2 if printer_settings.precision.to_i > 2

View File

@@ -0,0 +1,2 @@
json.set! :status, @out[0]
json.set! :data, @out[1]

View File

@@ -126,8 +126,8 @@
<% if crm_customer.membership_id.nil? && !crm_customer.membership_type.nil? && !crm_customer.membership_type =="" && !crm_customer.paypar_account_no =="" && !crm_customer.paypar_account_no.nil? %> <% if crm_customer.membership_id.nil? && !crm_customer.membership_type.nil? && !crm_customer.membership_type =="" && !crm_customer.paypar_account_no =="" && !crm_customer.paypar_account_no.nil? %>
<%= link_to t("views.btn.sync"), crm_customer_sync_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %> <%= link_to t("views.btn.sync"), crm_customer_sync_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %>
<% end %> <% end %>
<% if @customer_update_phone_email %> <% if @customer_update_phone_email_membertype %>
<%= link_to t("views.btn.update"), crm_customer_update_phone_email_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %> <%= link_to t("views.btn.update"), crm_customer_update_phone_email_member_type_path(crm_customer), :class => "btn btn-md bg-green waves-effect" %>
<% end %> <% end %>
<%= link_to t("views.btn.show"), crm_customer_path(crm_customer), :class => "btn btn-md bg-blue waves-effect" %> <%= link_to t("views.btn.show"), crm_customer_path(crm_customer), :class => "btn btn-md bg-blue waves-effect" %>
</td> </td>

View File

@@ -0,0 +1,10 @@
<%= simple_form_for(@induties_assign_in_duty) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! induties_assign_in_duty, :id, :created_at, :updated_at
json.url induties_assign_in_duty_url(induties_assign_in_duty, format: :json)

View File

@@ -0,0 +1,6 @@
<h1>Editing Induties Assign In Duty</h1>
<%= render 'form', induties_assign_in_duty: @induties_assign_in_duty %>
<%= link_to 'Show', @induties_assign_in_duty %> |
<%= link_to 'Back', induties_assign_in_duties_path %>

View File

@@ -0,0 +1,345 @@
<!-- <div class="page-header">
<ol class="breadcrumb">
<span class="float-right">
<a href="" id="back">Back</a>
</span>
</ol>
</div> -->
<div class="row">
<div class="col-md-12 col-sm-12 col-lg-8">
<div class="card show_all_commissioner_card">
<div class="card-block row" style="margin:0.5rem;">
<% @commissioners.each do |com| %>
<div class="col-md-6 col-sm-6 col-lg-3 mt-3 touch_commissioner" commissionerId='<%= com["id"] %>' commissionerName='<%= com["name"] %>'>
<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(<%=com["image_path"] %>);background-repeat: no-repeat; background-size: cover;">
<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">
<div class="col-8" style="padding:0px !important;"><%=com["name"] %></div>
<% if com["check_in_count"] >0%>
<div class="col-4 row" style="margin:auto;"><span class="badge badge-primary" style="margin:auto;font-size: 0.8rem;">A :<%=com["check_in_count"] %></span></div>
<% end %>
</div>
<div class="add_icon p-t-65 p-b-65 m-r-">
</div>
</div>
</div>
<% end %>
<div class="col-md-6 col-sm-6 col-lg-3 mt-3 add_more_commissioner">
<div class="card custom-card testimonial-card fadeInRight" style="height:100%;width: 100%;">
<div class="row" style="margin: auto;">
<i class="material-icons" style="color: gray;font-size: 9rem;">add</i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12 col-sm-12 col-lg-4" id="show_list_induty_card">
<div class="card" >
<div class="alert success-msg" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<i class="fa fa-check"></i>
Successed!
</div>
<div class="card-header row" style="margin-right: 0;margin-left: 0">
<div class="col-7 commissionerName"><label>Create In Duty</label></div>
<div class="col-5"><button type="button" class="btn btn-block btn-default waves-effect" id="back"><i class="material-icons">reply</i>Back to Order</button></div>
</div>
<input type="hidden" name="booking_id" value="<%=@booking_id %>" id="booking_id">
<input type="hidden" name="commissionerId" value="" id="commissionerId">
<div class="row create_induty_card" style="margin-left:1rem;margin-right: 1rem;">
<table class="table table-striped" id="show_in_duty_table">
<thead >
<tr>
<th>Dining</th>
<th>Check In At</th>
<th>Action</th>
</tr>
</thead>
<tbody class="occupide_dining">
</tbody>
</table>
</div>
<div class="row" >
<div class="col-8 add_to_order" style="margin: auto;">
</div>
</div>
<div class="row form-inputs form-group" style="margin: auto;">
<hr style="width :100%;margin-bottom: 1rem;">
<div class="col-12 " style="">
<div class="row form-inputs form-group" style="margin: auto;">
<div class="col-12" >
<label class="radio-room"><input type="radio" name="radio" id="radio-room" value="room" checked="checked" /> Room</label>
<label class="radio-table"><input type="radio" name="radio" id="radio-table" value="table" /> Table</label>
</div>
</div>
<div class="row form-inputs form-group room_collection" style="margin: auto;">
<div class="col-12 ">
<%= simple_form_for 'zone', :method => :get do |f| %>
<%= f.collection_select :dinning_id, Room.all, :id, :name, {prompt: 'Select Room'},:class=>'form-control',:required => true %>
<%end %>
</div>
</div>
<div class="row form-inputs form-group table_collection" style="margin: auto;">
<div class="col-12 ">
<%= simple_form_for 'zone_t', :method => :get do |f| %>
<%= f.collection_select :dinning_id, Table.all, :id, :name, {prompt: 'Select Table'},:class=>'form-control',:required => true %>
<%end %>
</div>
</div>
</div>
</div>
<div class="row form-inputs form-group" style="margin: auto;">
<div class="col-12 ">
<%= simple_form_for 'save_induties', :url => induties_induties_create_path, :method => :post do |f| %>
<%= f.check_box :by_name,:class=>'form-control'%>
<label class="checkboxLabel" for="save_induties_by_name">By Name</label>
<% end %>
</div>
</div>
<button type="button" class=" btn bg-blue form-actions btn_create_induty" id="btn_create_induty" disabled="">Create In Duty</button>
</div>
</div>
</div>
<script type="text/javascript">
$(".table_collection").hide();
$('#back').on('click',function(){
event.preventDefault();
var dinning_id = localStorage.getItem('dinning_id');
var dinning_type = localStorage.getItem('dinning_type');
window.location.href = '/origami/'+dinning_type+'/'+dinning_id;
});
$( document ).ready(function() {
// document.getElementById("btn_create_induty").disabled = true;
$('#btn_create_induty').attr("disabled", 'disabled');
var booking_id=document.getElementById("booking_id").value
getCurrentBooking(booking_id);
});
$(document).on('click', '.btn_create_induty', function(event){
$('.add_to_order').html("");
event.preventDefault();
var str=document.getElementById("zone_dinning_id").value;
var str_t=document.getElementById("zone_t_dinning_id").value;
if (str == ""){
zone_dinning_id =document.getElementById("zone_t_dinning_id").value;
}
if (str_t == ""){
zone_dinning_id =document.getElementById("zone_dinning_id").value;
}
if(str == "" && str_t == ""){
document.getElementById('zone_dinning_id').focus();
$('#zone_dinning_id').css('border-color', 'red');
$('#zone_t_dinning_id').css('border-color', 'red');
return false
}
else{
var booking_id=document.getElementById("booking_id").value
var commissionerId=document.getElementById("commissionerId").value
var by_name =document.getElementById("save_induties_by_name").checked
$.ajax({
type: "POST",
url: "assign_create",
dataType: "json",
data: {booking_id:booking_id,commissionerId:commissionerId,dinning_id:zone_dinning_id,by_name:by_name},
success: function (data) {
in_time = changDateFormat(data.in_time);
d_type = data.dinning_type.charAt(0);
row ='<tr>'
+'<td>'+d_type+'-'+data.dinning_id+'</td>'
+'<td>'+in_time+'</td>'
+'<td><a href="" onclick = "checkout_induty(this)" class="btn checkout_induty" style= "background-color: #3F51B5;"indutyId="'+ data.id +'" >Check Out</a>&nbsp;<a href="" onclick = "remove_induty(this)" class="btn remove_induty" style= "background-color: red;"indutyId="'+ data.id +'" >Remove</a></td>'
+'</tr>';
$('.occupide_dining').append(row);
$('#zone_dinning_id').val("");
document.getElementById("save_induties_by_name").checked = false;
var scrollTo = document.getElementById('show_list_induty_card');
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
$(".success-msg").css('display','block');
}
});
}
});
$(document).on('click', '.touch_commissioner', function(event){
$('#btn_create_induty').attr("disabled", '');
$(".success-msg").css('display','none');
$('.add_to_order').html("");
document.getElementById("btn_create_induty").disabled = false;
var commissionerId = this.getAttribute("commissionerId");
var commissionerName = this.getAttribute("commissionerName");
var url = "get_all_occupied_dining_path" ;
$('.occupide_dining').html("");
$('.commissionerName').html("");
booking_id=document.getElementById("booking_id").value
$.ajax({
type: "GET",
url: "/induties/assign_in_duties/get_all_occupied_dining/"+commissionerId,
dataType: "json",
success: function (data) {
$('.commissionerName').append('<label>'+commissionerName+' (<a href="" onclick = "getCurrent(this)">'+booking_id+'</a> )</label');
data.forEach(function(items) {
in_time = changDateFormat(items.in_time);
d_type = items.dinning_type.charAt(0);
row ='<tr>'
+'<td>'+d_type+'-'+items.dinning_id+'</td>'
+'<td>'+in_time+'</td>'
+'<td><a href="" onclick = "checkout_induty(this)" class="btn checkout_induty" style= "background-color: #3F51B5;"indutyId="'+ items.id +'" >Check Out</a>&nbsp;<a href="" onclick = "remove_induty(this)" class="btn remove_induty" style= "background-color: red;"indutyId="'+ items.id +'" >Remove</a></td>'
+'</tr>';
$('.occupide_dining').append(row);
});
$('#commissionerId').val(commissionerId);
var scrollTo = document.getElementById('show_list_induty_card');
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
}
});
});
function changDateFormat(date){
datetime = new Date(date);
day = datetime.getDate();
month = datetime.getMonth() + 1; //month: 0-11
year = datetime.getFullYear();
date = year + "-" + day + "-" + month;
var hours = datetime.getHours();
var minutes = datetime.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var in_time = date +' '+hours + ':' + minutes + ' ' + ampm;
return in_time;
}
$('input[type=radio]').change(function() {
if(this.value == "room"){
$(".table_collection").css('display','none');
$(".room_collection").css('display','block');
}
else{
$(".room_collection").css('display','none');
$(".table_collection").css('display','block');
}
});
function checkout_induty(row){
event.preventDefault();
var indutyId = row.getAttribute("indutyId");
var booking_id=document.getElementById("booking_id").value
datetime = new Date();
datetime = changDateFormat(datetime);
swal({
title: '',
text: 'Are you sure want to checkout at ' +datetime,
html:true,
confirmButtonColor: "#3F51B5",
confirmButtonText: "OK",
closeOnConfirm: true,
showCancelButton: true,
cancelButtonColor: '#d33',
}, function(isConfirm){
if(isConfirm){
$.ajax({
type: "POST",
url: "assign_checkout/"+indutyId,
dataType: "json",
success: function (data) {
var d = row.parentNode.parentNode.rowIndex;
document.getElementById('show_in_duty_table').deleteRow(d);
var scrollTo = document.getElementById('show_list_induty_card');
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
$(".success-msg").css('display','block');
}
});
}
});
}
function remove_induty(row){
event.preventDefault();
var indutyId = row.getAttribute("indutyId");
var booking_id=document.getElementById("booking_id").value
swal({
title: '',
text: 'Are you sure want to remove induties ',
html:true,
confirmButtonColor: "#3F51B5",
confirmButtonText: "OK",
closeOnConfirm: true,
showCancelButton: true,
cancelButtonColor: '#d33',
}, function(isConfirm){
if(isConfirm){
$.ajax({
type: "DELETE",
url: "assign_remove/"+indutyId,
dataType: "json",
success: function (data) {
var d = row.parentNode.parentNode.rowIndex;
document.getElementById('show_in_duty_table').deleteRow(d);
var scrollTo = document.getElementById('show_list_induty_card');
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
$(".success-msg").css('display','block');
}
});
}
});
}
$(document).on('click', '.add_more_commissioner', function(event){
localStorage.setItem('from_induty', true);
localStorage.setItem('booking_id', document.getElementById("booking_id").value);
window.location.href ='/settings/commissioners/new';
});
localStorage.setItem('from_induty', false);
function getCurrentBooking(booking_id){
document.getElementById("btn_create_induty").disabled = true;
$('.commissionerName').html("");
$('.add_to_order').html("");
$('.occupide_dining').html("");
$.ajax({
type: "GET",
url: "get_current_booking",
dataType: "json",
success: function (data) {
dinning_id = localStorage.getItem('dinning_id');
dinning_type = localStorage.getItem('dinning_type');
booking_id=document.getElementById("booking_id").value
$('.commissionerName').append('<label><a href="" onclick = "getCurrent(this)">'+booking_id+'</a></label');
$('.add_to_order').append('<input type="hidden" name="current_checkin_count" value='+data.length+'><input type="submit" class="btn bg-blue form-actions add_to_charges" value="Charges to Invoice" onclick = "addToOrder(this)" current_checkin_induties_count ='+data.length+'>');
data.forEach(function(items) {
in_time = changDateFormat(items.in_time);
d_type = items.dinning_type.charAt(0);
row ='<tr>'
+'<td>'+d_type+'-'+items.dinning_id+'</td>'
+'<td>'+in_time+'</td>'
+'<td><a href="" onclick = "checkout_induty(this)" class="btn checkout_induty" style= "background-color: #3F51B5;"indutyId="'+ items.id +'" >Check Out</a>&nbsp;<a href="" onclick = "remove_induty(this)" class="btn remove_induty" style= "background-color: red;"indutyId="'+ items.id +'" >Remove</a></td>'
+'</tr>';
$('.occupide_dining').append(row);
});
var scrollTo = document.getElementById('show_list_induty_card');
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
}
});
}
function getCurrent(row){
$(".success-msg").css('display','none');
booking_id=document.getElementById("booking_id").value
event.preventDefault();
getCurrentBooking(booking_id);
}
function addToOrder(row){
event.preventDefault();
$(".success-msg").css('display','none');
booking_id=document.getElementById("booking_id").value
var current_checkin_induties_count = row.getAttribute("current_checkin_induties_count");
localStorage.setItem("current_checkin_induties_count",current_checkin_induties_count);
var dinning_id = localStorage.getItem('dinning_id');
var dinning_type = localStorage.getItem('dinning_type');
window.location.href = '/origami/'+dinning_type+'/'+dinning_id;
}
</script>

View File

@@ -0,0 +1 @@
json.array! @induties_assign_in_duties, partial: 'induties_assign_in_duties/induties_assign_in_duty', as: :induties_assign_in_duty

View File

@@ -0,0 +1,5 @@
<h1>New Induties Assign In Duty</h1>
<%= render 'form', induties_assign_in_duty: @induties_assign_in_duty %>
<%= link_to 'Back', induties_assign_in_duties_path %>

View File

@@ -0,0 +1,4 @@
<p id="notice"><%= notice %></p>
<%= link_to 'Edit', edit_induties_assign_in_duty_path(@induties_assign_in_duty) %> |
<%= link_to 'Back', induties_assign_in_duties_path %>

View File

@@ -0,0 +1 @@
json.partial! "induties_assign_in_duties/induties_assign_in_duty", induties_assign_in_duty: @induties_assign_in_duty

View File

@@ -4,7 +4,6 @@
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%> <% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
<% modify_order = request.path_info.include?('modify_order')%> <% modify_order = request.path_info.include?('modify_order')%>
<div class="container-fluid " style="padding:0px 3px 0px 3px;"> <div class="container-fluid " style="padding:0px 3px 0px 3px;">
<div id="oqs_loading_wrapper" style="display:none;"> <div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div> <div id="oqs_loading"></div>
@@ -166,15 +165,15 @@
Back Back
</button> </button>
<% if @quick_service_only %> <%# <% if @quick_service_only %>
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-9" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order <!-- <button type="button" class="btn btn-lg btn-primary waves-effect col-md-9" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
</button> </button> -->
<% else %> <%# <% else %>
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order <button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
</button> </button>
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a> <a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
<input type="hidden" name="table_id" value="" id="table_id"> <input type="hidden" name="table_id" value="" id="table_id">
<% end %> <%# <% end %>
<%else%> <%else%>
<button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'> <button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>Back <i class="material-icons">reply</i>Back
@@ -282,7 +281,7 @@
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button> <button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
<% end %> <% end %>
<%end%> <%end%>
<% if !@quick_service_only && current_user.role == "waiter"%> <% if @quick_service_only && current_user.role == "waiter"%>
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button> <button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
<%end%> <%end%>
<%else%> <%else%>

View File

@@ -219,6 +219,7 @@
getCreditSales("","","cashier"); //credit sales script data binding getCreditSales("","","cashier"); //credit sales script data binding
$(".tables").on('click', function(){ $(".tables").on('click', function(){
localStorage.setItem('dinning_type','table');
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;
}); });
@@ -229,6 +230,7 @@
}); });
$(".rooms").on('click', function(){ $(".rooms").on('click', function(){
localStorage.setItem('dinning_type','room');
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
window.location.href = '/origami/room/' + dining_id; window.location.href = '/origami/room/' + dining_id;
}); });

View File

@@ -796,6 +796,7 @@
<script> <script>
var cashier_type = "cashier"; var cashier_type = "cashier";
$(document).ready(function () { $(document).ready(function () {
// alert(localStorage.getItem("current_checkin_count"));
localStorage.removeItem("trans_flag"); localStorage.removeItem("trans_flag");
/* check webview loaded*/ /* check webview loaded*/
var webview = <%= @webview %>; var webview = <%= @webview %>;
@@ -825,8 +826,9 @@
window.location.href = '/origami/table/' + dining_id + "/table_invoice/" + sale_id; window.location.href = '/origami/table/' + dining_id + "/table_invoice/" + sale_id;
}) })
$(".tables").on('click', function () { $(".tables").on('click', function () {
localStorage.setItem('dinning_type','table');
var customer_id = $(".customer-id").text(); var customer_id = $(".customer-id").text();
localStorage.setItem('customer_id',customer_id);
show_customer_details(customer_id); show_customer_details(customer_id);
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
@@ -843,8 +845,9 @@
}); });
$(".rooms").on('click', function () { $(".rooms").on('click', function () {
localStorage.setItem('dinning_type','room');
var customer_id = $(".customer-id").text(); var customer_id = $(".customer-id").text();
localStorage.setItem('customer_id',customer_id);
show_customer_details(customer_id); show_customer_details(customer_id);
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
@@ -1074,6 +1077,8 @@
var order_id = $('#save_order_id').attr('data-order'); var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills"; var ajax_url = "/origami/" + order_id + "/request_bills";
localStorage.setItem("tax_type", "all"); localStorage.setItem("tax_type", "all");
var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count");
localStorage.removeItem("current_checkin_induties_count");
if(order_id!=undefined && order_id!=null && order_id!=""){ if(order_id!=undefined && order_id!=null && order_id!=""){
if($('#request_bills').is(":visible")) { if($('#request_bills').is(":visible")) {
$('#request_bills').prop("disabled",true); $('#request_bills').prop("disabled",true);
@@ -1081,7 +1086,7 @@
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
// data: 'order_id='+ order_id, data: {current_checkin_induties_count: current_checkin_induties_count},
success: function (result) { success: function (result) {
if (!result.status) { if (!result.status) {
swal({ swal({
@@ -1207,9 +1212,10 @@
}); });
$('#in_duties').on('click', function () { $('#in_duties').on('click', function () {
localStorage.setItem('dinning_id',<%= @dining.id %>);
var dining_id = "<%= @dining.id %>"; var dining_id = "<%= @dining.id %>";
var booking_id = "<%= @booking.booking_id rescue "" %>"; var booking_id = "<%= @booking.booking_id rescue "" %>";
window.location.href = '/origami/assign_in_duty/'+ booking_id; window.location.href = '/induties/'+ booking_id +'/assign';
}); });
$('#void').on('click', function () { $('#void').on('click', function () {

View File

@@ -1,9 +1,6 @@
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<br/> <br/>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<label>Dining Name:</label> <label>Dining Name:</label>

View File

@@ -29,9 +29,17 @@
%> %>
<!-- end count function --> <!-- end count function -->
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>"> <input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<div class="row m-t--10"> <% if request.user_agent.include? "Mobile" %>
<div class="row m-t-10" style="margin-left: 0.2rem">
<% else %>
<div class="row m-t-10">
<% end %>
<div class="col-lg-5 col-md-5 col-sm-5 div_order_margin"> <div class="col-lg-5 col-md-5 col-sm-5 div_order_margin">
<% if !request.user_agent.include? "Mobile" %>
<ul class="nav nav-tabs tab-col-teal <%= @shop.shop_code ? @shop.shop_code : '' %>" role="tablist"> <ul class="nav nav-tabs tab-col-teal <%= @shop.shop_code ? @shop.shop_code : '' %>" role="tablist">
<% else %>
<ul class="nav nav-tabs tab-col-teal mobile_tab-col-teal <%= @shop.shop_code ? @shop.shop_code : '' %>" role="tablist">
<% end %>
<li class="nav-item red m-b-5" 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"> <a class="nav-link" data-toggle="tab" href="#pending" role="tab">
<p class="num p-t-5"> <p class="num p-t-5">
@@ -50,6 +58,7 @@
<%= delivered_count %> <%= delivered_count %>
</p> <%= t :delivering %></a> </p> <%= t :delivering %></a>
</li> </li>
<% if !request.user_agent.include? "Mobile" %>
<li class="nav-item m-b-5" 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"> <a class="nav-link" data-toggle="tab" href="#completed" role="tab">
<p class="num p-t-5"> <p class="num p-t-5">
@@ -62,6 +71,7 @@
<%= processed_count %> <%= processed_count %>
</p> <%= t :processed %></a> </p> <%= t :processed %></a>
</li> </li>
<% end %>
</ul> </ul>
<div class="tab-content m-t--10"> <div class="tab-content m-t--10">
@@ -334,7 +344,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" id="div_card_order">
<div class="card m-b-5 p-t-5"> <div class="card m-b-5 p-t-5">
<div class="card-header custom-card-header"> <div class="card-header custom-card-header">
<table class="table"> <table class="table">
@@ -355,6 +365,11 @@
</div> </div>
<div class="card-block custom-card-block"> <div class="card-block custom-card-block">
<div id="order-detail-slimscroll" data-height="110"> <div id="order-detail-slimscroll" data-height="110">
<% if request.user_agent.include? "Mobile" %>
<input type="hidden" name="summary_items_mobile" value="true">
<%else %>
<input type="hidden" name="summary_items_mobile" value="false">
<%end %>
<table class="table summary-items"> <table class="table summary-items">
<tbody> <tbody>
<!-- <tr> <!-- <tr>
@@ -406,8 +421,12 @@
</div> </div>
</div> </div>
</div> </div>
<% if request.user_agent.include? "Mobile" %>
<div class="col-lg-3 col-md-3 col-sm-3" style="margin-right: 0.5rem">
<% else %>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3">
<% end %>
<div class="card m-b-5 p-t-5" 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">

View File

@@ -914,6 +914,8 @@ $(document).ready(function(){
show_customer_details(customer_id); show_customer_details(customer_id);
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
localStorage.setItem('dinning_type','table');
localStorage.setItem('customer_id',customer_id);
window.location.href = '/origami/table/' + dining_id; window.location.href = '/origami/table/' + dining_id;
}); });
@@ -932,6 +934,8 @@ $(document).ready(function(){
show_customer_details(customer_id); show_customer_details(customer_id);
var dining_id = $(this).attr("data-id"); var dining_id = $(this).attr("data-id");
localStorage.setItem('dinning_type','room');
localStorage.setItem('customer_id',customer_id);
window.location.href = '/origami/room/' + dining_id; window.location.href = '/origami/room/' + dining_id;
}); });
@@ -1146,6 +1150,8 @@ $('#pay').on('click',function() {
}); });
// Bill Request // Bill Request
$('#request_bills').click(function() { $('#request_bills').click(function() {
var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count");
localStorage.removeItem("current_checkin_induties_count");
var order_id = $('#save_order_id').attr('data-order'); var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills"; var ajax_url = "/origami/" + order_id + "/request_bills";
if(order_id!=undefined && order_id!=null && order_id!=""){ if(order_id!=undefined && order_id!=null && order_id!=""){
@@ -1156,7 +1162,7 @@ $('#request_bills').click(function() {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
// data: 'order_id='+ order_id, data: {current_checkin_induties_count: current_checkin_induties_count},
success: function (result) { success: function (result) {
if (!result.status) { if (!result.status) {
swal({ swal({
@@ -1367,9 +1373,10 @@ $('#add_invoice').on('click',function(){
}); });
$('#in_duties').on('click', function () { $('#in_duties').on('click', function () {
localStorage.setItem('dinning_id',<%= @room.id %>);
var dining_id = "<%= @room.id %>"; var dining_id = "<%= @room.id %>";
var booking_id = "<%= @booking.booking_id rescue "" %>"; var booking_id = "<%= @booking.booking_id rescue "" %>";
window.location.href = '/origami/assign_in_duty/'+ booking_id; window.location.href = '/induties/'+ booking_id +'/assign';
}); });
// Ordering // Ordering

View File

@@ -46,8 +46,6 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% puts 'testing!!!!!!' %>
<% puts @print_settings.precision.to_i %>
<% if @print_settings.precision.to_i > 0 <% if @print_settings.precision.to_i > 0
precision = @print_settings.precision precision = @print_settings.precision
else else

View File

@@ -36,6 +36,8 @@
<%= f.label :resigned_date %><br/> <%= f.label :resigned_date %><br/>
<%= f.text_field :resigned_date, {class: 'form-control datepicker', id: 'resigned_date', readonly: true} %><br/> <%= f.text_field :resigned_date, {class: 'form-control datepicker', id: 'resigned_date', readonly: true} %><br/>
<%= f.input :is_active %> <%= f.input :is_active %>
<input type="hidden" name="from_induty" value="" class="from_induty">
<input type="hidden" name="booking_id" value="" class="booking_id">
</div> </div>
<div class="form-actions"> <div class="form-actions">
@@ -70,3 +72,7 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript">
$('.from_induty').val(localStorage.getItem('from_induty'));
$('.booking_id').val(localStorage.getItem('booking_id'));
</script>

View File

@@ -10,3 +10,4 @@
</div> </div>
<%= render 'form', commissioner: @commissioner %> <%= render 'form', commissioner: @commissioner %>

View File

@@ -10,7 +10,7 @@
<!--<%= f.label :product_code, 'Product' %> <!--<%= f.label :product_code, 'Product' %>
<%= f.collection_select :product_code, MenuItem.all.order('name asc'), :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>--> <%= f.collection_select :product_code, MenuItem.all.order('name asc'), :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>-->
<%= f.input :name %> <%= f.input :name %>
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %> <%= f.input :commission_type, :collection => ['Percentage','Net Amount','Basic Pay'], prompt: 'Select Commission Type', class: 'form-control' %>
<%= f.input :amount %> <%= f.input :amount %>
<%= f.input :is_active,:class => "filled-in" ,:id => "" %> <%= f.input :is_active,:class => "filled-in" ,:id => "" %>

View File

@@ -17,7 +17,7 @@
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th><%= t("views.right_panel.detail.product") %> <%= t("views.right_panel.detail.name_txt2") %></th> <th><%= t("views.right_panel.detail.group") %> <%= t("views.right_panel.detail.name_txt2") %></th>
<th><%= t("views.right_panel.detail.commission_type") %></th> <th><%= t("views.right_panel.detail.commission_type") %></th>
<th><%= t("views.right_panel.detail.amount") %></th> <th><%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.active") %></th> <th><%= t("views.right_panel.detail.active") %></th>

View File

@@ -1,6 +1,6 @@
application_path="#{File.expand_path("../..", __FILE__)}" application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path directory application_path
#environment ENV.fetch("RAILS_ENV") { "production" } environment ENV.fetch("RAILS_ENV") { "production" }
environment "production" environment "production"
pidfile "#{application_path}/tmp/puma/pid" pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state" state_path "#{application_path}/tmp/puma/state"

View File

@@ -2,6 +2,16 @@ require 'sidekiq/web'
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :induties do
# resources :assign_in_duties
get ':booking_id/assign' => 'assign_in_duties#index', as: :assign_in_duties
get "/assign_in_duties/get_all_occupied_dining/:id" =>'assign_in_duties#get_all_occupied_dining', as: :get_all_occupied_dining
post ':booking_id/assign_create' => 'assign_in_duties#induties_create', as: :induties_create
post ':booking_id/assign_checkout/:induty_id' => 'assign_in_duties#induties_checkout', as: :induties_checkout
delete ':booking_id/assign_remove/:induty_id' => 'assign_in_duties#induties_remove', as: :induties_remove
get ':booking_id/get_current_booking' => 'assign_in_duties#get_current_booking'
end
scope "(:locale)", locale: /en|mm/ do scope "(:locale)", locale: /en|mm/ do
root 'home#index' root 'home#index'
mount Sidekiq::Web => '/kiq' mount Sidekiq::Web => '/kiq'
@@ -46,7 +56,9 @@ scope "(:locale)", locale: /en|mm/ do
resources :menu_item_instances, only: [:show] resources :menu_item_instances, only: [:show]
get "item_sets" => "item_sets#index" get "item_sets" => "item_sets#index"
end end
namespace :payment do
post 'mobilepayment/:cashier_id/:receipt_no/cash' =>"mobilepayment#cash"
end
#User request move table or bills #User request move table or bills
post "bill/:booking_id" => "bill#create" post "bill/:booking_id" => "bill#create"
post "move" => "move#create" post "move" => "move#create"
@@ -362,7 +374,7 @@ scope "(:locale)", locale: /en|mm/ do
root "home#index" root "home#index"
resources :customers resources :customers
get "/customers/:id/sync" => "customers#sync", as:"customer_sync" get "/customers/:id/sync" => "customers#sync", as:"customer_sync"
get "/customers/:id/customer_update_phone_email" => "customers#customer_update_phone_email", as:"customer_update_phone_email" get "/customers/:id/customer_update_phone_email_member_type" => "customers#customer_update_phone_email_member_type", as:"customer_update_phone_email_member_type"
resources :dining_queues resources :dining_queues
post "update_booking", to: "bookings#update_booking", as: "update_booking" #assign and cancel post "update_booking", to: "bookings#update_booking", as: "update_booking" #assign and cancel
get '/print/:id', to: "home#print_order" #print order for crm get '/print/:id', to: "home#print_order" #print order for crm

View File

@@ -0,0 +1,5 @@
class AddBynameToInduties < ActiveRecord::Migration[5.1]
def change
add_column :in_duties, :by_name, :boolean, default: false
end
end

View File

@@ -0,0 +1,141 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
#
# Also compared to earlier versions of this generator, there are no longer any
# expectations of assigns and templates rendered. These features have been
# removed from Rails core in Rails 5, but can be added back in via the
# `rails-controller-testing` gem.
RSpec.describe Induties::AssignInDutiesController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# Induties::AssignInDuty. As you add validations to Induties::AssignInDuty, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# Induties::AssignInDutiesController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "returns a success response" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
get :index, params: {}, session: valid_session
expect(response).to be_success
end
end
describe "GET #show" do
it "returns a success response" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
get :show, params: {id: assign_in_duty.to_param}, session: valid_session
expect(response).to be_success
end
end
describe "GET #new" do
it "returns a success response" do
get :new, params: {}, session: valid_session
expect(response).to be_success
end
end
describe "GET #edit" do
it "returns a success response" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
get :edit, params: {id: assign_in_duty.to_param}, session: valid_session
expect(response).to be_success
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Induties::AssignInDuty" do
expect {
post :create, params: {induties_assign_in_duty: valid_attributes}, session: valid_session
}.to change(Induties::AssignInDuty, :count).by(1)
end
it "redirects to the created induties_assign_in_duty" do
post :create, params: {induties_assign_in_duty: valid_attributes}, session: valid_session
expect(response).to redirect_to(Induties::AssignInDuty.last)
end
end
context "with invalid params" do
it "returns a success response (i.e. to display the 'new' template)" do
post :create, params: {induties_assign_in_duty: invalid_attributes}, session: valid_session
expect(response).to be_success
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested induties_assign_in_duty" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
put :update, params: {id: assign_in_duty.to_param, induties_assign_in_duty: new_attributes}, session: valid_session
assign_in_duty.reload
skip("Add assertions for updated state")
end
it "redirects to the induties_assign_in_duty" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
put :update, params: {id: assign_in_duty.to_param, induties_assign_in_duty: valid_attributes}, session: valid_session
expect(response).to redirect_to(assign_in_duty)
end
end
context "with invalid params" do
it "returns a success response (i.e. to display the 'edit' template)" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
put :update, params: {id: assign_in_duty.to_param, induties_assign_in_duty: invalid_attributes}, session: valid_session
expect(response).to be_success
end
end
end
describe "DELETE #destroy" do
it "destroys the requested induties_assign_in_duty" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
expect {
delete :destroy, params: {id: assign_in_duty.to_param}, session: valid_session
}.to change(Induties::AssignInDuty, :count).by(-1)
end
it "redirects to the induties_assign_in_duties list" do
assign_in_duty = Induties::AssignInDuty.create! valid_attributes
delete :destroy, params: {id: assign_in_duty.to_param}, session: valid_session
expect(response).to redirect_to(induties_assign_in_duties_url)
end
end
end

View File

@@ -0,0 +1,15 @@
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Induties::AssignInDutiesHelper. For example:
#
# describe Induties::AssignInDutiesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe Induties::AssignInDutiesHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Induties::AssignInDuty, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,10 @@
require 'rails_helper'
RSpec.describe "Induties::AssignInDuties", type: :request do
describe "GET /induties_assign_in_duties" do
it "works! (now write some real specs)" do
get induties_assign_in_duties_path
expect(response).to have_http_status(200)
end
end
end

View File

@@ -0,0 +1,39 @@
require "rails_helper"
RSpec.describe Induties::AssignInDutiesController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/induties/assign_in_duties").to route_to("induties/assign_in_duties#index")
end
it "routes to #new" do
expect(:get => "/induties/assign_in_duties/new").to route_to("induties/assign_in_duties#new")
end
it "routes to #show" do
expect(:get => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/induties/assign_in_duties/1/edit").to route_to("induties/assign_in_duties#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/induties/assign_in_duties").to route_to("induties/assign_in_duties#create")
end
it "routes to #update via PUT" do
expect(:put => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/induties/assign_in_duties/1").to route_to("induties/assign_in_duties#destroy", :id => "1")
end
end
end

View File

@@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "induties/assign_in_duties/edit", type: :view do
before(:each) do
@induties_assign_in_duty = assign(:induties_assign_in_duty, Induties::AssignInDuty.create!())
end
it "renders the edit induties_assign_in_duty form" do
render
assert_select "form[action=?][method=?]", induties_assign_in_duty_path(@induties_assign_in_duty), "post" do
end
end
end

View File

@@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "induties/assign_in_duties/index", type: :view do
before(:each) do
assign(:induties_assign_in_duties, [
Induties::AssignInDuty.create!(),
Induties::AssignInDuty.create!()
])
end
it "renders a list of induties/assign_in_duties" do
render
end
end

View File

@@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "induties/assign_in_duties/new", type: :view do
before(:each) do
assign(:induties_assign_in_duty, Induties::AssignInDuty.new())
end
it "renders new induties_assign_in_duty form" do
render
assert_select "form[action=?][method=?]", induties_assign_in_duties_path, "post" do
end
end
end

View File

@@ -0,0 +1,11 @@
require 'rails_helper'
RSpec.describe "induties/assign_in_duties/show", type: :view do
before(:each) do
@induties_assign_in_duty = assign(:induties_assign_in_duty, Induties::AssignInDuty.create!())
end
it "renders attributes in <p>" do
render
end
end

View File

@@ -0,0 +1,9 @@
require "application_system_test_case"
class Induties::AssignInDutiesTest < ApplicationSystemTestCase
# test "visiting the index" do
# visit induties_assign_in_duties_url
#
# assert_selector "h1", text: "Induties::AssignInDuty"
# end
end