Merge branch 'r-1902001-01' into foodcourt

This commit is contained in:
Thein Lin Kyaw
2020-08-04 11:45:01 +06:30
43 changed files with 401 additions and 970 deletions

View File

@@ -181,8 +181,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -159,8 +159,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -178,8 +178,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -45,9 +45,9 @@
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<% end %>
<div class="card-block">
<%= table.name %> <br>
<%= table.zone.name %>
@@ -55,12 +55,12 @@
<div style="font-size:12px;"></div>
</div>
</div>
<% else %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<% end %>
<div class="card-block">
<%= table.name %> <br>
<%= table.zone.name %>
@@ -108,7 +108,7 @@
<div class="card-block">
<%= room.name %> <br>
<%= room.zone.name %>
<span class="float-right font-12 new_text_<%= room.id %> hide">
<span class="float-right font-12 new_text_<%= room.id %> hide">
</div>
</div>
<% end %>
@@ -167,8 +167,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
@@ -224,10 +224,10 @@
<tr>
<td class='item-name'>
<%= sale_item.item_name %>
<% if !sale_item.set_menu_items.nil?
sale_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
<% end
<% if !sale_item.set_menu_items.nil?
sale_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
<% end
end %>
</td>
<td class='item-attr'><%= sale_item.qty %></td>
@@ -316,11 +316,11 @@
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
});
});
$('#back').on('click',function(){
window.location.href = '/origami/';
@@ -362,7 +362,7 @@
booking_id = booking[0].booking_id;
}
var cashier_type = "cashier";
var ajax_url = "/origami/split_bills";
$.ajax({
type: "POST",
@@ -383,7 +383,7 @@
window.location.href = '/origami/room/' + dining_id;
}
}
}
}
});

View File

@@ -73,8 +73,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -70,8 +70,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -74,8 +74,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -72,8 +72,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -199,8 +199,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -88,7 +88,7 @@
</td> -->
<td class="p-1" width="25%">
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-danger waves-effect cancel'>Cancel
Void/Update
<%= sale_item.status %>
</button>
</td>
<% else %>
@@ -147,15 +147,15 @@
<div class="col-md-4 cashier_number border-top border- border-left green" data-type="nett">Nett</div>
<div class="col-md-4 cashier_number border-top border- border-left red" data-type="del">Del</div>
<div class="col-md-4 cashier_number border-top border- border-left orange" data-type="clr">Clr</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> -->
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
<button type="button" class="btn btn-block btn-lg btn-danger action-btn waves-effect" id='cancel_all_void'>Cancel All</button>
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
</div>
</div>
@@ -180,231 +180,205 @@
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var cashier_type = "<%= @cashier_type %>";
var cashier_type = "<%= @cashier_type %>";
var access_code = localStorage.getItem("access_code");
// Bill Request
$(document).ready(function () {
// Bill Request
$(document).ready(function () {
setHeaderBreadCrumb(_SALE_EDIT_);
$('.editModal').on('click', function () {
$("#action").attr('data-type', $(this).attr('data-type'));
$("#action").attr('data-id', $(this).attr('data-id'));
$("#action").text($(this).attr('data-type'))
})
$(".update").on('click', function () {
var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val();
var qty_status = true;
var price_status = true;
if((qty > 0) && (price > 0)){
qty_status = true;
price_status = true;
$('#' + sale_item_id + "_qtyErr").html("");
$('#' + sale_item_id + "_priceErr").html("");
}else if((qty > 0) && (price <= 0 || price == '')){
price_status = false;
$('#' + sale_item_id + "_qtyErr").html("");
if(price == ''){
$('#' + sale_item_id + "_priceErr").html("can't be blank");
}else{
$('#' + sale_item_id + "_price").val("");
$('#' + sale_item_id + "_priceErr").html("Price must be greater than 0");
}
}else if((qty <= 0 || qty == '') && (price > 0)){
qty_status = false;
if(qty == ''){
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
}else{
$('#' + sale_item_id + "_qty").val("");
$('#' + sale_item_id + "_qtyErr").html("Quantity must be greater than 0");
}
$('#' + sale_item_id + "_priceErr").html("");
}else{
qty_status = false;
price_status = false;
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
$('#' + sale_item_id + "_priceErr").html("can't be blank");
}
if(qty_status && price_status){
var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code + "&type=" + cashier_type,
success: function (result) {
swal({
title: "Information!",
text: "Qty and Price was successfully Updated",
}, function () {
location.reload();
});
}
});
}
});
/*$('.void').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var remark = $("#remark").val();
var ajax_url = "/origami/item_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
success: function (result) {
location.reload();
}
});
})
$('.foc').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_foc";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
success: function (result) {
location.reload();
}
});
})*/
$('#action').on('click', function () {
var access_code = localStorage.getItem("access_code");
var sale_item_id = $(this).attr('data-id');
var type = $(this).attr('data-type');
var remark = $("#remark").val();
if (type=='foc') {
var ajax_url = "/origami/item_foc";
}else{
var ajax_url = "/origami/item_void";
}
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code + "&type=" + cashier_type,
success: function (result) {
location.reload();
}
});
})
$('.cancel').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code + "&type=" + cashier_type,
success: function (result) {
location.reload();
}
});
})
})
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
var sale_id = "<%= @saleobj.sale_id %>"
if (cashier_type=="quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;
}
})
$('#cancel_all_void').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id +'&type='+cashier_type,
success: function (result) {
location.reload();
}
});
})
$('#apply').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id+'&type='+cashier_type,
success: function (result) {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;
}
}
});
})
$( "input" ).focusin(function() {
$('.addfocus').removeClass('addfocus');
$( this ).addClass('addfocus');
setHeaderBreadCrumb(_SALE_EDIT_);
$('.editModal').on('click', function () {
$("#action").attr('data-type', $(this).attr('data-type'));
$("#action").attr('data-id', $(this).attr('data-id'));
$("#action").text($(this).attr('data-type'))
});
$(".cashier_number").on('click', function(event){
if(event.handled !== true) {
var original_value='';
original_value = $('.addfocus').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('.addfocus').val(input_value);
}
else{
$('.addfocus').val(original_value + '' + input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value);
$('.addfocus').val(amount);
break;
case 'del' :
var discount_text=$('.addfocus').val();
$('.addfocus').val(discount_text.substr(0,discount_text.length-1));
break;
case 'clr':
$('.addfocus').val("");
break;
$(".update").on('click', function () {
var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val();
var qty_status = true;
var price_status = true;
if((qty > 0) && (price > 0)){
qty_status = true;
price_status = true;
$('#' + sale_item_id + "_qtyErr").html("");
$('#' + sale_item_id + "_priceErr").html("");
}else if((qty > 0) && (price <= 0 || price == '')){
price_status = false;
$('#' + sale_item_id + "_qtyErr").html("");
if(price == ''){
$('#' + sale_item_id + "_priceErr").html("can't be blank");
}else{
$('#' + sale_item_id + "_price").val("");
$('#' + sale_item_id + "_priceErr").html("Price must be greater than 0");
}
event.handled = true;
} else {
return false;
}else if((qty <= 0 || qty == '') && (price > 0)){
qty_status = false;
if(qty == ''){
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
}else{
$('#' + sale_item_id + "_qty").val("");
$('#' + sale_item_id + "_qtyErr").html("Quantity must be greater than 0");
}
$('#' + sale_item_id + "_priceErr").html("");
}else{
qty_status = false;
price_status = false;
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
$('#' + sale_item_id + "_priceErr").html("can't be blank");
}
if(qty_status && price_status){
var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code + "&type=" + cashier_type,
success: function (result) {
swal({
title: "Information!",
text: "Qty and Price was successfully Updated",
}, function () {
location.reload();
});
}
});
}
});
$('#action').on('click', function () {
$(this).attr("disabled", true);
var access_code = localStorage.getItem("access_code");
var sale_item_id = $(this).attr('data-id');
var type = $(this).attr('data-type');
var remark = $("#remark").val();
if (type=='foc') {
var ajax_url = "/origami/item_foc";
}else{
var ajax_url = "/origami/item_void";
}
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code + "&type=" + cashier_type,
success: function (result) {
location.reload();
}
});
})
$('.cancel').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code + "&type=" + cashier_type,
success: function (result) {
location.reload();
}
});
})
})
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
var sale_id = "<%= @saleobj.sale_id %>"
if (cashier_type=="quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;
}
})
$('#cancel_all_void').on('click', function () {
$(this).attr('disabled', true);
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id +'&type='+cashier_type,
success: function (result) {
location.reload();
}
});
})
$('#apply').on('click', function () {
$(this).attr('disabled', true)
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id+'&type='+cashier_type,
success: function (result) {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;
}
}
});
})
$( "input" ).focusin(function() {
$('.addfocus').removeClass('addfocus');
$( this ).addClass('addfocus');
});
$(".cashier_number").on('click', function(event){
if(event.handled !== true) {
var original_value='';
original_value = $('.addfocus').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('.addfocus').val(input_value);
}
else{
$('.addfocus').val(original_value + '' + input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value);
$('.addfocus').val(amount);
break;
case 'del' :
var discount_text=$('.addfocus').val();
$('.addfocus').val(discount_text.substr(0,discount_text.length-1));
break;
case 'clr':
$('.addfocus').val("");
break;
}
event.handled = true;
} else {
return false;
}
});
//check for isNumber
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
@@ -412,16 +386,16 @@ var access_code = localStorage.getItem("access_code");
return false;
} else {
return true;
}
}
}
function checkQuantity(obj_value,sale_item_id) {
if(obj_value == '0'){
$("#"+sale_item_id+"_qty").val('1');
}
if(obj_value == '0'){
$("#"+sale_item_id+"_qty").val('1');
}
}
function checkPrice(obj_value,sale_item_id) {
}
</script>

View File

@@ -188,8 +188,8 @@
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>

View File

@@ -13,7 +13,7 @@
<td><%= @shift.shift_started_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></td>
</tr>
<tr>
<td><%= t :cashier_name %></td>
<td><%= t :cashier %></td>
<td><%= @shift.employee.name rescue ''%></td>
</tr>
@@ -45,8 +45,8 @@
</div>
<div class="modal-body">
<select class="form-control show-tick sel_com_port" id="sel_com_port" >
</select>
</select>
</div>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
@@ -77,7 +77,7 @@
return false;
} else {
return true;
}
}
}
function greaterThanOne(val){
@@ -182,7 +182,7 @@
if($("#loading_wrapper").is(':visible')){
resMsg = code2lab.reqBankPayment(cmd_type, payment_type, 1, "", com_port);
}
if(resMsg.includes("STATUS")){
var jobj = $.parseJSON(resMsg);