Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
BIN
app/assets/images/profile-1.png
Normal file
BIN
app/assets/images/profile-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
app/assets/images/profile-2.png
Normal file
BIN
app/assets/images/profile-2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
app/assets/images/profile-3.png
Normal file
BIN
app/assets/images/profile-3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -30,7 +30,9 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
if (!session[:session_token].nil?)
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,10 +1,30 @@
|
||||
class HomeController < ApplicationController
|
||||
skip_before_action :authenticate, only: [:index, :create, :destroy]
|
||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||
|
||||
def index
|
||||
@employees = Employee.all.order("name asc")
|
||||
@login_form = LoginForm.new()
|
||||
end
|
||||
|
||||
def show
|
||||
@login_form = LoginForm.new()
|
||||
@login_form.emp_id = params[:emp_id]
|
||||
end
|
||||
|
||||
def update
|
||||
@login_form = LoginForm.new()
|
||||
@login_form.emp_id = params[:emp_id]
|
||||
@login_form.password = params[:login_form][:password]
|
||||
@employee = Employee.login(@login_form.emp_id, @login_form.password)
|
||||
|
||||
if @employee != nil
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
else
|
||||
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@login_form = LoginForm.new()
|
||||
@login_form.emp_id = params[:login_form][:emp_id]
|
||||
@@ -27,9 +47,9 @@ class HomeController < ApplicationController
|
||||
else
|
||||
render :index
|
||||
end
|
||||
else
|
||||
else
|
||||
redirect_to origami_root_path, :notice => "Username and Password dosn't match!"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status}")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,8 +8,10 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
@order = Order.find(params[:order_id])
|
||||
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
||||
if sale_order
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
@sale_status = sale.sale_status
|
||||
unless sale_order.sale_id.nil?
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
@sale_status = sale.sale_status
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
module ApplicationHelper
|
||||
|
||||
def flash_class(level)
|
||||
case level
|
||||
when :notice then "alert alert-info fade-in"
|
||||
when :success then "alert alert-success fade-in"
|
||||
when :error then "alert alert-error fade-in"
|
||||
when :alert then "alert alert-error fade-in"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,9 +13,9 @@ class Employee < ApplicationRecord
|
||||
def self.login(emp_id, password)
|
||||
user = Employee.find_by_emp_id(emp_id)
|
||||
if (user)
|
||||
user.authenticate(password)
|
||||
#user.authenticate(password)
|
||||
|
||||
if (user)
|
||||
if (user.authenticate(password))
|
||||
user.generate_token
|
||||
user.session_expiry = DateTime.now.utc + 30.minutes
|
||||
user.session_last_login = DateTime.now.utc
|
||||
|
||||
@@ -82,6 +82,15 @@ class Order < ApplicationRecord
|
||||
set_order_items
|
||||
end
|
||||
|
||||
# not insert with price 0
|
||||
# puts item[:price]
|
||||
# puts item
|
||||
# if(item[:price] != 0 )
|
||||
# OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id],
|
||||
# item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
|
||||
# self.employee_name)
|
||||
# end
|
||||
|
||||
OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id],
|
||||
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
|
||||
self.employee_name)
|
||||
|
||||
@@ -36,9 +36,11 @@ class OrderQueueStation < ApplicationRecord
|
||||
# #Same Order_items can appear in two location.
|
||||
# AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
# else
|
||||
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
oqs_order_items.push(order_item)
|
||||
|
||||
if (order_item.price != 0)
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
oqs_order_items.push(order_item)
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,19 +6,23 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
#Print
|
||||
order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
||||
|
||||
filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf"
|
||||
pdf = OrderItemPdf.new(order_item[0], print_status, options)
|
||||
pdf.render_file filename
|
||||
filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf"
|
||||
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
# check for item not to show
|
||||
if order_item[0].price != 0
|
||||
pdf = OrderItemPdf.new(order_item[0], print_status, options)
|
||||
pdf.render_file filename
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Query for per order
|
||||
@@ -33,14 +37,18 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||
# For Item Options
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
# check for item not to show
|
||||
if odi.price != 0 || odi.price != 10
|
||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
# For Print Order Summary
|
||||
@@ -69,19 +77,22 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||
# For Item Options
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
||||
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
# check for item not to show
|
||||
if odi.price != 0
|
||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
||||
pdf.render_file filename
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
@@ -109,7 +120,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||
.where("order_items.item_code = '#{ id }'")
|
||||
.where("order_items.item_code = '#{ id }' AND order_items.price != 0")
|
||||
.group("order_items.item_code")
|
||||
elsif type == "order_summary"
|
||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
|
||||
@@ -118,7 +129,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||
.where("orders.order_id = '#{ id }'")
|
||||
.where("orders.order_id = '#{ id }' AND order_items.price != 0")
|
||||
.group("order_items.order_items_id")
|
||||
else
|
||||
# order summary for booking
|
||||
@@ -128,7 +139,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||
.where("b.booking_id = '#{ id }'")
|
||||
.where("b.booking_id = '#{ id }' AND order_items.price != 0")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -97,7 +97,7 @@ class SalePayment < ApplicationRecord
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
redeem_prices = sale_data.grand_total -others
|
||||
redeem_prices = sale_data.grand_total - others
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
@@ -232,11 +232,19 @@ class SalePayment < ApplicationRecord
|
||||
self.sale.amount_changed = self.sale.amount_received.to_f - self.sale.grand_total.to_f
|
||||
all_received_amount = 0.0
|
||||
sObj = Sale.find(self.sale_id)
|
||||
is_credit = 0
|
||||
sObj.sale_payments.each do |spay|
|
||||
all_received_amount += spay.payment_amount.to_f
|
||||
if spay.payment_method == "creditnote"
|
||||
is_credit = 1
|
||||
end
|
||||
end
|
||||
if (self.sale.grand_total <= all_received_amount)
|
||||
self.sale.payment_status = "paid"
|
||||
if is_credit == 0
|
||||
self.sale.payment_status = "paid"
|
||||
else
|
||||
self.sale.payment_status = "outstanding"
|
||||
end
|
||||
self.sale.sale_status = "completed"
|
||||
self.sale.save!
|
||||
table_update_status(sObj)
|
||||
|
||||
@@ -60,7 +60,7 @@ class OrderItemPdf < Prawn::Document
|
||||
def order_items(order_item, options)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
|
||||
@@ -86,38 +86,38 @@ class OrderSummaryPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
order_item.each do|odi|
|
||||
y_position = cursor
|
||||
|
||||
# pad_top(15) {
|
||||
# text_box "#{odi.item_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
# text_box "#{odi.qty}", :at =>[self.item_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
# }
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
if options != ""
|
||||
# check for item not to show
|
||||
if odi.price != 0
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "#{options}", :size => self.item_font_size,:align => :left
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
if options != ""
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{options}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 5
|
||||
end
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 5
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
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
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details)
|
||||
self.page_width = 210
|
||||
self.page_height = 2500
|
||||
self.page_height = 7000
|
||||
self.margin = 5
|
||||
self.price_width = 40
|
||||
self.qty_width = 20
|
||||
@@ -119,22 +119,25 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
sub_total = 0.0
|
||||
sale_items.each do |item|
|
||||
sub_total += (item.qty*item.unit_price)
|
||||
qty = item.qty
|
||||
total_price = item.qty*item.unit_price
|
||||
price = item.unit_price
|
||||
product_name = item.product_name
|
||||
# check for item not to show
|
||||
if item.price != 0
|
||||
sub_total += (item.qty*item.unit_price)
|
||||
qty = item.qty
|
||||
total_price = item.qty*item.unit_price
|
||||
price = item.unit_price
|
||||
product_name = item.product_name
|
||||
|
||||
|
||||
y_position = cursor
|
||||
y_position = cursor
|
||||
|
||||
pad_top(15) {
|
||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{total_price}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
}
|
||||
move_down 1
|
||||
pad_top(15) {
|
||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{total_price}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
}
|
||||
move_down 1
|
||||
end
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
<%= current_login_employee.name %>
|
||||
|
||||
<% if current_login_employee.role = "admin" %>
|
||||
<% elsif current_login_employee.role = "cashier" %>
|
||||
<%= link_to "Cashier Station", origami_path %>
|
||||
@@ -13,7 +13,23 @@
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
|
||||
<% end %>
|
||||
<% shop = Shop.first %>
|
||||
|
||||
<!-- -->
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="page-header" style="width:100%;text-align:center;background-color:#ddd;">
|
||||
<h4 style="color : #ef404a;font-weight:bold;font-style:italic;"><%= shop.name %></h4>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<%= shop.address %>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<%= shop.phone_no %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
<!--
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
<%= simple_form_for(@login_form, url: login_path, method: "POST") do |f| %>
|
||||
<%= simple_form_for(@login_form, url: login_path, method: "POST") do |f| %>
|
||||
<div class="card">
|
||||
<h4 class="card-title text-center" style="margin:10px">Login</h4>
|
||||
<div class="content" style="margin:10px">
|
||||
@@ -22,4 +22,40 @@
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="card-deck">
|
||||
|
||||
<% @employees.each do |employee| %>
|
||||
|
||||
<div data-formid="#form_<%= employee.emp_id %>" class="empBtn card card-inverse card-primary mb-3 text-center" style="width: 15rem;height:15rem;">
|
||||
<form id="form_<%=employee.emp_id%>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH"></form>
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">
|
||||
<%= employee.name %>
|
||||
</h4>
|
||||
<div class="card-content">
|
||||
(<%= employee.emp_id%>)
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<small><%= employee.role %></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$(".empBtn").click(function(event){
|
||||
event.preventDefault();
|
||||
console.log($(this).data("formid"));
|
||||
var item = $(this).data("formid");
|
||||
$(item).submit();
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
68
app/views/home/show.html.erb
Normal file
68
app/views/home/show.html.erb
Normal file
@@ -0,0 +1,68 @@
|
||||
<style>
|
||||
.pin_pad {
|
||||
width:10rem;
|
||||
height:10rem;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
line-height: 10rem;
|
||||
margin:2px;
|
||||
margin-top:4px;
|
||||
margin-bottom:4px;
|
||||
font-size:3rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
<%= simple_form_for(@login_form, url: emp_login_update_path, method: "PATCH") do |f| %>
|
||||
<div class="card">
|
||||
<div class="content" style="margin:10px">
|
||||
<div class="form-group">
|
||||
<%= f.input :emp_id,as: :hidden, label: "Access PIN", required: false, class: "form-control" %>
|
||||
|
||||
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" style="margin:10px; margin-top:0px; text-align:center">
|
||||
<button class="pin_pad" data-value="1">1</button>
|
||||
<button class="pin_pad" data-value="2">2</button>
|
||||
<button class="pin_pad" data-value="3">3</button>
|
||||
<button class="pin_pad" data-value="4">4</button>
|
||||
<button class="pin_pad" data-value="5">5</button>
|
||||
<button class="pin_pad" data-value="6">6</button>
|
||||
<button class="pin_pad" data-value="7">7</button>
|
||||
<button class="pin_pad" data-value="8">8</button>
|
||||
<button class="pin_pad" data-value="9">9</button>
|
||||
<button class="pin_pad" data-value="CLR">CLR</button>
|
||||
<button class="pin_pad" data-value="8">0</button>
|
||||
<button class="pin_pad btn-warning" data-value="ENT">ENT</button>
|
||||
|
||||
</div>
|
||||
<div class="footer text-center" style="margin:10px">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$(".pin_pad").click(function(event){
|
||||
event.preventDefault();
|
||||
console.log($(this).data("value"));
|
||||
var value = $(this).data("value");
|
||||
|
||||
if (value == "CLR") {
|
||||
$("#login_form_password").val("");
|
||||
} else if(value == "ENT") {
|
||||
$("#new_login_form").submit();
|
||||
} else {
|
||||
var old_value = $("#login_form_password").val();
|
||||
$("#login_form_password").val(old_value + value);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -34,7 +34,8 @@
|
||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@queue_completed_item.each do |qid|
|
||||
@queue_completed_item.each do |qid|
|
||||
if qid.price != 0
|
||||
%>
|
||||
<div class="card queue_station">
|
||||
<div class="card-block">
|
||||
@@ -69,7 +70,8 @@
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
@@ -85,8 +87,9 @@
|
||||
<!--- Order Items -->
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@queue_items_details.each do |qid|
|
||||
if qid.station_name == qsi[:station_name]
|
||||
@queue_items_details.each do |qid|
|
||||
if qid.price != 0
|
||||
if qid.station_name == qsi[:station_name]
|
||||
%>
|
||||
<div class="card queue_station">
|
||||
<div class="card-block">
|
||||
@@ -121,7 +124,8 @@
|
||||
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
<tbody>
|
||||
<% sub_total = 0 %>
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||
<%
|
||||
sub_total += sale_item.qty*sale_item.unit_price
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||
@@ -42,7 +45,10 @@
|
||||
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||
</td>
|
||||
</tr>
|
||||
<%end %>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -166,7 +172,7 @@
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<button id="net" class="btn btn-warning fluid action-btn">Net</button>
|
||||
<button id="net" class="btn btn-warning fluid action-btn">Nett</button>
|
||||
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
|
||||
<button id="remove-item" class="btn btn-default fluid action-btn">Remove</button>
|
||||
</div>
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
<%if @customer %>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||
<p>Customer : <%= @customer.name rescue "" %></p>
|
||||
<%end%>
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
@@ -249,8 +249,10 @@
|
||||
</table>
|
||||
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
|
||||
<% end %>
|
||||
<% if @sale_array.size > 1 %>
|
||||
<br><br>
|
||||
Pending Payment
|
||||
<% end %>
|
||||
<% @sale_array.each do |sale|
|
||||
if @sale_array.size > 1
|
||||
unless sale.receipt_no == @sale_array[0].receipt_no
|
||||
@@ -473,7 +475,7 @@ $('#edit').on('click',function(){
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||
})
|
||||
|
||||
|
||||
$('#void').on('click',function () {
|
||||
var sure = confirm("Are you sure want to Void");
|
||||
if (sure == true) {
|
||||
|
||||
@@ -95,10 +95,12 @@
|
||||
order_status = ""
|
||||
sale_order = SaleOrder.find_by_order_id(order)
|
||||
if sale_order
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
order_status = sale.sale_status
|
||||
if order_status == 'new'
|
||||
order_status = order.status
|
||||
unless sale_order.sale_id.nil?
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
order_status = sale.sale_status
|
||||
if order_status == 'new'
|
||||
order_status = order.status
|
||||
end
|
||||
end
|
||||
else
|
||||
order_status = order.status
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
sub_total = 0
|
||||
if @status == "sale"
|
||||
@obj.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @obj.sale_id %>">
|
||||
<% unless sale_item.price == 0 %>
|
||||
@@ -213,32 +213,52 @@
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<%
|
||||
if @status_sale == 'sale'
|
||||
unless @order_items.nil?
|
||||
%>
|
||||
Pending New Order
|
||||
<table class="table table-striped">
|
||||
<%
|
||||
count = 0
|
||||
@order_items.each do |order_item |
|
||||
count += 1
|
||||
%>
|
||||
|
||||
<%
|
||||
if @status == 'sale'
|
||||
unless @order_items.nil?
|
||||
%>
|
||||
Added New Order
|
||||
<table class="table table-striped">
|
||||
<%
|
||||
@order_items.each do |order_item |
|
||||
<tr>
|
||||
<td><%= count %>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</table>
|
||||
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
|
||||
<% end %>
|
||||
<% if @sale_array.size > 1 %>
|
||||
<br><br>
|
||||
Pending Payment
|
||||
<% end %>
|
||||
<% @sale_array.each do |sale|
|
||||
if @sale_array.size > 1
|
||||
unless sale.receipt_no == @sale_array[0].receipt_no
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</table>
|
||||
<button class='btn btn-primary'> Add to existing invoice </button>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td>Receipt No - <%= sale.receipt_no %></td>
|
||||
<td><button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show Detail </button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user