check and fixed SQA feedback

This commit is contained in:
phyusin
2018-03-09 09:49:19 +06:30
parent fcc076a19e
commit 7dd0f71894
13 changed files with 162 additions and 58 deletions

View File

@@ -985,19 +985,19 @@ $(function() {
$("#back").on("click", function(){
var table_id = $('#table_id').text();
var table_type = $('#table_type').text();
type = window.location.href.indexOf("quick_service");
if (type == 'true') {
type = window.location.href.includes("quick_service");
if (type == true) {
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
window.location.href = "/origami/dashboard"
window.location.href = "/origami/dashboard";
}else{
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
window.location.href = "/origami/table/" + table_id;
}else {
window.location.href = "/origami/room/" + table_id
window.location.href = "/origami/room/" + table_id;
}
}
});

View File

@@ -90,13 +90,15 @@ class HomeController < ApplicationController
@sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(today,current_user,@from,@to)
@total_payment_methods.each do |payment|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
pay = Sale.payment_sale('card', today, current_user,@from,@to)
@sale_data.push({'card' => pay.payment_amount})
else
pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to)
@sale_data.push({payment.payment_method => pay.payment_amount})
if !@total_payment_methods.nil?
@total_payment_methods.each do |payment|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
pay = Sale.payment_sale('card', today, current_user,@from,@to)
@sale_data.push({'card' => pay.payment_amount})
else
pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to)
@sale_data.push({payment.payment_method => pay.payment_amount})
end
end
end
@summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to)
@@ -109,10 +111,12 @@ class HomeController < ApplicationController
@total_order = Sale.total_order(today,current_user,@from,@to)
@total_accounts = Sale.total_account(today,current_user,@from,@to)
@account_data = Array.new
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today,current_user,@from,@to)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
if !@total_accounts.nil?
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today,current_user,@from,@to)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
end
end

View File

@@ -63,7 +63,11 @@ class Origami::CustomersController < BaseOrigamiController
else
@booking_order = BookingOrder.find_by_order_id(@sale_id)
@booking = Booking.find(@booking_order.booking_id)
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
if @booking.dining_facility_id.to_i > 0
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
else
@dining_facility = nil
end
end
filter = params[:filter]

View File

@@ -112,10 +112,10 @@ class Ability
can :index, :other_charge
can :create, :other_charge
# can :index, :discount
# can :create, :discount
# can :remove_discount_items, :discount
# can :remove_all_discount, :discount
can :index, :discount
can :create, :discount
can :remove_discount_items, :discount
can :remove_all_discount, :discount
can :member_discount, :discount
can :first_bill, :payment
@@ -194,6 +194,26 @@ class Ability
elsif user.role == "waiter"
can :index, :home
can :show, :home
can :manage, Customer
can :get_customer, Customer
can :add_customer, Customer
can :update_sale_by_customer, Customer
can :index, :other_charge
can :create, :other_charge
can :index, :discount
can :create, :discount
can :remove_discount_items, :discount
can :remove_all_discount, :discount
can :member_discount, :discount
#ability for move table
can :move_dining, :movetable
can :moving, :movetable
can :move_dining, :moveroom
#ability for split_bill
can :index, :split_bill
can :create, :split_bill

View File

@@ -218,7 +218,7 @@
<% end %>
<% end %>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<% if current_user.role == 'administrator' %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<% else %>
@@ -262,11 +262,11 @@
</div>
</div>
</div>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<% if current_user.role == 'administrator' %>
</div>
<% end %>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<% if current_user.role == 'administrator' %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<% else %>

View File

@@ -57,7 +57,7 @@
<i class="material-icons font-10 logout_icon">exit_to_app</i>
<span class="font-18">Logout</span>
</p> -->
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%= logout_path %>" data-method="delete">
<i class="material-icons font-7 logout_icon">exit_to_app</i>
<span class="font-15">Logout</span>
</p>

View File

@@ -467,8 +467,16 @@
{
var id = $("#table_id").val();
var type = $("#type").val();
var booking_id = "";
<% if !@booking_order.nil? %>
booking_id = "<%= @booking_order.booking_id %>";
<% end %>
if (cashier_type == "quick_service") {
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/';
}
}else{
if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
@@ -496,7 +504,10 @@
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(page == "payment"){
if(page == "pending"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/pending/';
}
else if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {

View File

@@ -425,10 +425,7 @@
<%= t("views.btn.back") %>
</button>
<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>
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% end %>
<% if current_login_employee.role != "waiter" %>
<% if @dining.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
@@ -455,10 +452,10 @@
<% if current_login_employee.role != "waiter" %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% end %>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
@@ -515,7 +512,6 @@
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -44,11 +44,15 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">

View File

@@ -59,18 +59,22 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
<% end %>
</div>
</div>

View File

@@ -708,7 +708,7 @@ var customer_name = "<%= @customer.name %>";
var sale_id = $('#dining').text();
}
//var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys"
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys";
});
// bind customer to order or sale
@@ -720,7 +720,7 @@ var customer_name = "<%= @customer.name %>";
var sale_id = $('#save_order_id').attr('data-order');
}
var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers"
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers/payment";
});
// Add Other Charges

View File

@@ -153,6 +153,14 @@
<% if current_user.role != "waiter" || @status != "sale"%>
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
<%end%>
<!-- <% if @status != "order"%>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% end %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<% if @status != "order"%>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% end %> -->
<% if current_user.role != "waiter" && @status != "order"%>
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<%end%>
@@ -163,6 +171,7 @@
</div>
</div>
<script>
var cashier_type = "quick_service";
$(document).ready(function(){
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
@@ -203,5 +212,61 @@ $(document).ready(function(){
}
});
});
// bind survey to order or sale
$("#survey").on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys";
});
// bind customer to order or sale
$("#customer").on('click', function () {
var sale = $('#sale_id').val();
if (sale.includes("SAL")) {
var sale_id = sale;
} else {
var sale_id = $('#save_order_id').val();
}
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers/pending";
});
// Add Other Charges
$('#other-charges').click(function () {
var sale = $('#sale_id').val();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').val();
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges';
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
});
// Discount for Payment
$('#discount').click(function () {
if ($(this).attr('active')=== "true") {
var sale = $('#sale_id').val();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').val();
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id + "/"+cashier_type+'/discount';
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
swal("Oops","You are not authorized for Discount","warning")
}
return false;
});
});
</script>

View File

@@ -392,10 +392,7 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<% end %>
<% if current_login_employee.role != "waiter" %>
<% if @room.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
@@ -419,14 +416,14 @@
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
<% if current_login_employee.role != "waiter" %>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<% end %>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
@@ -481,7 +478,6 @@
<% end %>
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
<% end %>
<% end %>
</div>
</div>
</div>
@@ -582,7 +578,7 @@ $(document).ready(function(){
var sale_id = "<%= @room.id %>";
}
//var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id + "/surveys"
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys"
});
// bind customer to order or sale
$("#customer").on('click', function(){
@@ -617,7 +613,7 @@ $(document).ready(function(){
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id + '/discount'
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/discount'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
@@ -639,7 +635,7 @@ $(document).ready(function(){
}
if(sale_id!=""){
window.location.href = '/origami/' + sale_id + '/other_charges'
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );