Pull from master

This commit is contained in:
San Wai Lwin
2018-03-15 13:48:52 +06:30
parent 96f8640df7
commit 1188f6e8e9
29 changed files with 242 additions and 97 deletions

View File

@@ -162,6 +162,9 @@
<div id="sxModal">
<div id="sxModal-Content"><h3><%= t :card_tap %></h3></div>
<div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div>
</div>
<!-- The modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modalLabelLarge" aria-hidden="true">
@@ -212,4 +215,8 @@
$("#type").val("card");
}
}
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script>

View File

@@ -10,6 +10,7 @@
</div> -->
<!-- #END# Search Bar -->
<!-- Top Bar -->
<%if !request.path_info.include?('second_display') %>
<nav class="navbar">
<div class="container-fluid">
<div class="navbar-header">
@@ -79,7 +80,7 @@
</div>
</div>
</nav>
<%end%>
<script type="text/javascript">
$(function(){
$('.delete').click(function(){

View File

@@ -482,6 +482,11 @@
</div>
</div>
<% end %>
<style type="text/css">
.fadeInRight{
-webkit-animation-duration: 350ms !important;
}
</style>
<script>
jQuery(function(){
id = "<%=@menu[0].id%>";

View File

@@ -263,6 +263,9 @@
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
<div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div>
</div>
</div>
<script type="text/javascript">
@@ -479,11 +482,11 @@
if(booking_id!= "" && page == "pending"){
window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id;
}else{
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
}else{
if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
@@ -523,7 +526,11 @@
}
})
});
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script>

View File

@@ -189,18 +189,27 @@
</div>
<% end %>
</div>
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
<script>
$(document).ready(function () {
setHeaderBreadCrumb(_DASHBOARD_);
});
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
});
$(".qs_view").on('click', function() {
window.location.href = '/origami/quick_service';
document.getElementById('second_view').click();
window.location.href = '/origami/quick_service';
});
$("#second_view").on('click', function () {
var url = $(this).attr("data-href");
window.open(url,'_blank');
});
</script>

View File

@@ -134,7 +134,7 @@
<div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns">
<% @orders.each do |order| %>
<div class="card orders red text-white" data-id="<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block">
<%
order_status = ""
@@ -424,7 +424,7 @@
<i class="material-icons">reply</i>
<%= t("views.btn.back") %>
</button>
<a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a>
<!-- <a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a> -->
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% if @dining.status != "available" %>
@@ -491,11 +491,11 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</h4>
</div>
<div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
<option value="Cash">Cash</option>
<!-- <option value="Cash">Cash</option> -->
<option value="Credit">Credit</option>
<% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>">

View File

@@ -131,7 +131,7 @@
<div class="tab-pane active" id="orders" role="tabpanel" style="">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @orders.each do |order| %>
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id = "<%= order.order_id %>">
<div class="card-block">
<%
order_status = ""

View File

@@ -391,21 +391,23 @@
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="pdfModalLabel"></h4>
<h4 class="modal-title">
<span id="pdfModalLabel"></span>
<span id="changed_amount" class="p-l-120"></span>
</h4>
</div>
<div class="modal-body">
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name">
<p id="changed_amount"></p>
<div class="text-center">
<iframe id="receipt_pdf" src="" style="width: 400px; height: 600px;"></iframe>
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="row m-b-10 m-r-30">
<% if ENV["SERVER_MODE"] != 'cloud' %>
<div class="col-md-5">
<div class="col-md-5 m-r-20">
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
</div>
<% end %>
@@ -424,27 +426,29 @@
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="is_memberModalLabel">Are you Member?</h3>
<h1 class="modal-title" id="is_memberModalLabel">Are you Member?</h1>
</div>
<div class="modal-body">
<div class="row text-center">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR Code</button>
</div>
</div>
<div class="row clearfix"></div>
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-green waves-effect btn_customer_yes">Yes</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect" data-dismiss="modal">No</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Member</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR</button>
</div>
</div>
</div>
<div class="modal-footer"></div>
@@ -453,7 +457,12 @@
</div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
<div id="sxModal-Content">
<h3>Card Tap</h3>
</div>
<div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div>
</div>
<script type="text/javascript">
@@ -463,7 +472,7 @@ var customer_name = "<%= @customer.name %>";
$(document).ready(function(){
setHeaderBreadCrumb(_PAYMENTS_);
//start customer modal popup
if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((cashier_type=='quick_service') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
}
@@ -481,7 +490,9 @@ var customer_name = "<%= @customer.name %>";
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
console.log("ssssssssssss")
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
console.log(member_id);
console.log(member_discount);
if (member_id && member_discount) {
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide();
@@ -601,7 +612,7 @@ var customer_name = "<%= @customer.name %>";
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename);
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Payment Successful!");
$("#pdfModalLabel").text("Sale Completed");
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
@@ -1100,4 +1111,8 @@ var customer_name = "<%= @customer.name %>";
});
});
}
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script>

View File

@@ -203,11 +203,12 @@ $(document).ready(function(){
url: ajax_url,
// data: 'order_id='+ order_id,
success: function (result) {
console.log(result)
if (!result.status) {
swal("Information!", result.error_message);
}
else {
location.reload();
window.location.href = '../pending_order/'+ result.data;
}
}
});

View File

@@ -4,7 +4,7 @@
<div class="card">
<div class="card-block">
<div class="card-text" >
<div id="order-detail-slimscroll" data-height="150">
<div id="order-detail-slimscroll" data-height="160">
<table class="table table-striped second_display_items" id="order-items-table">
<thead>
<tr>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid" style="margin-top:-65px;">
<button type="button" class="hidden" id="s_reload">Reload</button>
<div class="slider" id="second_display_slider">
<%= render 'slider' %>

23
app/views/origami/split_bill/index.html.erb Normal file → Executable file
View File

@@ -624,20 +624,39 @@ function orderItemSplitBillProcess(cnt_items){
}
var order_ids = [];
var arr_order_ids = [];
if(order_items!=undefined && order_items!=null){
$.each(order_items,function(key,value){
var orderIds = {};
if($.inArray(value.order_id,order_ids) == -1){
order_ids.push(value.order_id);
orderIds[value.order_id] = 1;
arr_order_ids.push(orderIds);
}else{
if(arr_order_ids != null & arr_order_ids!=""){
if(arr_order_ids.length > 0){
$.each(arr_order_ids, function(k,val){
$.each(val,function(kk,vval){
if((val[kk]!= undefined) && (kk == value.order_id)){
val[kk] += 1;
}
});
arr_order_ids[k] = val;
});
}
}
}
});
}
// console.log(JSON.stringify(arr_order_ids));
var ajax_url = "/origami/split_bills";
$.ajax({
type: "POST",
url: ajax_url,
dataType: 'JSON',
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'order_items' : JSON.stringify(order_items), 'orders' : ''},
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'arr_order_ids': JSON.stringify(arr_order_ids), 'order_items' : JSON.stringify(order_items), 'orders' : ''},
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);
@@ -670,7 +689,7 @@ function orderSplitBillProcess(cnt_orders){
type: "POST",
url: ajax_url,
dataType: 'JSON',
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders)},
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders), 'arr_order_ids': []},
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);