Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Nweni
2017-06-01 13:21:09 +06:30
72 changed files with 1297 additions and 870 deletions

4
.gitignore vendored
View File

@@ -41,3 +41,7 @@ config/deploy/config/*
# Ignore Byebug command history file.
.byebug_history
# Gem files
Gemfile
Gemfile.lock

12
Gemfile
View File

@@ -9,8 +9,14 @@ end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.0'
# Use mysql as the database for Active Record
#gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'pg'
gem 'mysql2', '>= 0.3.18', '< 0.5'
#Use PosgreSQL
#gem 'pg'
# redis server for cable
gem 'redis', '~> 3.0'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
@@ -37,6 +43,8 @@ gem 'to_xls-rails'
#Reporting gem
#gem 'compendium'
# Pagination
gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master'
# Use jquery as the JavaScript library
gem 'jquery-rails'

View File

@@ -1,3 +1,21 @@
GIT
remote: git://github.com/amatsuda/kaminari.git
revision: c3c853a944cd2bff072ae05e48c563b2c9a29597
branch: master
specs:
kaminari (1.0.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.0.1)
kaminari-activerecord (= 1.0.1)
kaminari-core (= 1.0.1)
kaminari-actionview (1.0.1)
actionview
kaminari-core (= 1.0.1)
kaminari-activerecord (1.0.1)
activerecord
kaminari-core (= 1.0.1)
kaminari-core (1.0.1)
GEM
remote: https://rubygems.org/
specs:
@@ -48,9 +66,9 @@ GEM
sass (>= 3.4.19)
builder (3.2.3)
byebug (9.0.6)
coffee-rails (4.2.1)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.2.x)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
@@ -96,7 +114,8 @@ GEM
mini_portile2 (2.1.0)
minitest (5.10.2)
multi_json (1.12.1)
nio4r (2.0.0)
mysql2 (0.4.6)
nio4r (2.1.0)
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
pdf-core (0.7.0)
@@ -231,13 +250,16 @@ DEPENDENCIES
font-awesome-rails
jbuilder (~> 2.5)
jquery-rails
kaminari!
listen (~> 3.0.5)
mysql2 (>= 0.3.18, < 0.5)
pg
prawn
prawn-table
puma (~> 3.0)
rack-cors
rails (~> 5.1.0)
redis (~> 3.0)
rspec-rails (~> 3.5)
sass-rails (~> 5.0)
schema_to_scaffold
@@ -255,4 +277,4 @@ DEPENDENCIES
web-console (>= 3.3.0)
BUNDLED WITH
1.14.6
1.15.0

View File

@@ -15,3 +15,23 @@
//= require jquery_ujs
//= require turbolinks
//= require cable
$(document).ready(function(){
$('.queue_station').on('click',function(){
var title=$(this).children().children('.card-title').text();
var titles=title.split(' ');
var orderBy=$(this).children().children().children().children('.order-by').text();
var orderAt=$(this).children().children().children().children('.order-at').text();
var orderCustomer=$(this).children().children('.order-customer').text();
$('#order-title').text($('#order-title').text() + titles[0]);
$('#order-by').text(orderBy);
$('#order-at').text(orderAt);
$('#order-customer').text(orderCustomer);
$('#order-from').text(titles[0]);
$('#order-items').text(titles[1]);
$('#order-qty').text(titles[2].substr(2).replace(']',''));
});
});

View File

@@ -1,5 +1,5 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the rails generate channel command.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
//= require action_cable
//= require_self

View File

@@ -0,0 +1,24 @@
App.order_queue_station = App.cable.subscriptions.create("OrderQueueStationChannel", {
connected: function() {},
disconnected: function() {},
received: function(message) {
alert(message);
},
order: function(message) {
return this.perform('order', {
message: message
});
}
});
// $(function(){
// $("#submit_order").on('click', function(event) {
// var orderData=$("#new_order").serializeObject();
// App.order_station.order(orderData);
// //orderData='';
// return event.preventDefault();
// });
// });

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

@@ -0,0 +1,3 @@
// Place all the styles related to the transactions/Sales controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -1,4 +1,14 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
class Channel < ActionCable::Channel::Base
end
# Order Queue Station Channel
class OrderChannel < ActionCable::Channel::Base
end
# Order Queue Station Channel
class OQSChannel < ActionCable::Channel::Base
end
end

View File

@@ -0,0 +1,13 @@
class OrderQueueStationChannel < ApplicationCable::Channel
def subscribed
stream_from "order_queue_station_channel"
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
end
def order(message)
# ToDo
end
end

View File

@@ -37,6 +37,7 @@ class Api::OrdersController < Api::ApiController
#Create Table Booking or Room Booking
if !params["booking_id"].nil? && params[:booking_id].to_i > 0
@order.new_booking = false
# @order.new_booking = true
@order.booking_id = params[:booking_id]
end

View File

@@ -1,5 +1,23 @@
class Crm::HomeController < BaseCrmController
def index
# @booking = Booking.all
@booking = Booking.select("bookings.id as booking_id,
bookings.checkin_at,
bookings.checkin_by,
bookings.dining_facility_id,
od.customer_id as customer,
od.item_count as count,
odt.id as order_item_id,
odt.item_name as item_name")
.joins("join booking_orders as bko ON bko.booking_id = bookings.id")
.joins("right join orders as od ON od.id = bko.order_id")
.joins("right join order_items as odt ON odt.order_id=od.id")
.order("bookings.id DESC")
@customer = Customer.all
end
def show
end

View File

@@ -1,6 +1,31 @@
class Oqs::HomeController < BaseOqsController
def index
@queue_stations=OrderQueueStation.all
#sample Data
@queue_items_details = { :queue_id => 1, :order_id => 1, :station_name => 'Queue Station 1', :zone => 'Table4', :item_name => 'beef', :price => 10.00, :qty => 2, :customer => 'Wathon', :item_order_by => 'Yan', :created_at => '2007-05-17'}
# @queue_items_details = OrderItem.select("oqs as queue_id, oqs.station_name, oqs.is_active, oqpz.zone_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.created_at")
# .joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = order_queue_items.order_queue_station_id")
# .joins("right join order_queue_stations as oqs ON oqs.id = order_queue_items.order_queue_station_id")
# .joins("right join orders as od ON od.id = order_queue_items.order_id")
# .joins("right join order_items as odt ON odt.item_code = order_queue_items.item_code")
# .order("odt.item_name DESC")
# Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
# order_items.id as order_items_id,dining_facilities.name as table_name")
# .joins("left join booking_orders on booking_orders.order_id = orders.id
# left join bookings on bookings.id = booking_orders.id
# left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
# left join order_items on order_items.order_id = orders.id")
# .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
# .group("orders.id")
end
def show
end
end

View File

@@ -1,6 +1,15 @@
class Origami::HomeController < BaseOrigamiController
def index
@order_table = Order.get_order_table()
@order_rooms = Order.get_order_rooms()
@orders = Order.get_orders()
end
def show
str = []
@order_details = OrderItem.get_order_items_details(params[:order_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end
render :json => str.to_json
end
end

View File

@@ -5,7 +5,7 @@ class Settings::MenuCategoriesController < ApplicationController
# GET /settings/menu_categories
# GET /settings/menu_categories.json
def index
@settings_menu_categories = MenuCategory.all
@settings_menu_categories = MenuCategory.all.page(params[:page]).per(10)
end
# GET /settings/menu_categories/1
@@ -63,7 +63,7 @@ class Settings::MenuCategoriesController < ApplicationController
# DELETE /settings/menu_categories/1
# DELETE /settings/menu_categories/1.json
def destroy
@settings_menu_category.destroy
# @settings_menu_category.destroy
respond_to do |format|
format.html { redirect_to settings_menu_categories_path, notice: 'Menu category was successfully destroyed.' }
format.json { head :no_content }

View File

@@ -4,12 +4,13 @@ class Settings::MenusController < ApplicationController
# GET /settings/menus
# GET /settings/menus.json
def index
@settings_menus = Menu.all
@settings_menus = Menu.all.page(params[:page]).per(10)
end
# GET /settings/menus/1
# GET /settings/menus/1.json
def show
@settings_menu_categories = @settings_menu.menu_categories.page(params[:page]).per(10)
end
# GET /settings/menus/new
@@ -25,7 +26,7 @@ class Settings::MenusController < ApplicationController
# POST /settings/menus.json
def create
@settings_menu = Menu.new(settings_menu_params)
@settings_menu.created_by = current_login_employee.name
respond_to do |format|
if @settings_menu.save
format.html { redirect_to settings_menus_path, notice: 'Menu was successfully created.' }
@@ -42,7 +43,7 @@ class Settings::MenusController < ApplicationController
def update
respond_to do |format|
if @settings_menu.update(settings_menu_params)
format.html { redirect_to settings_menu_path(@settings_menu), notice: 'Menu was successfully updated.' }
format.html { redirect_to settings_menus_path, notice: 'Menu was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_menu }
else
format.html { render :edit }

View File

@@ -1,12 +1,12 @@
class Settings::SetMenuItemsController < ApplicationController
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy]
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new]
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update]
# GET /settings/menu_items
# GET /settings/menu_items.json
def index
@settings_menu_items = @category.menu_items
end
# GET /settings/menu_items/1
# GET /settings/menu_items/1.json
def show
@@ -25,10 +25,13 @@ class Settings::SetMenuItemsController < ApplicationController
# POST /settings/menu_items.json
def create
@settings_menu_item = MenuItem.new(settings_menu_item_params)
if params[:simple_menu_item][:menu_item_id] == ''
@settings_menu_item.menu_category_id = params[:menu_category_id]
end
@settings_menu_item.created_by = current_login_employee.name
respond_to do |format|
if @settings_menu_item.save
format.html { redirect_to settings_menu_items_path, notice: 'Menu item was successfully created.' }
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully created.' }
format.json { render :show, status: :created, location: @settings_menu_item }
else
format.html { render :new }
@@ -42,7 +45,7 @@ class Settings::SetMenuItemsController < ApplicationController
def update
respond_to do |format|
if @settings_menu_item.update(settings_menu_item_params)
format.html { redirect_to settings_menu_item_path(@settings_menu_item), notice: 'Menu item was successfully updated.' }
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_menu_item }
else
format.html { render :edit }
@@ -54,9 +57,9 @@ class Settings::SetMenuItemsController < ApplicationController
# DELETE /settings/menu_items/1
# DELETE /settings/menu_items/1.json
def destroy
@settings_menu_item.destroy
# @settings_menu_item.destroy
respond_to do |format|
format.html { redirect_to settings_menu_items_path, notice: 'Menu item was successfully destroyed.' }
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully destroyed.' }
format.json { head :no_content }
end
end
@@ -73,6 +76,6 @@ class Settings::SetMenuItemsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_params
params.require(:menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id, :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id, :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
end
end

View File

@@ -1,12 +1,12 @@
class Settings::SimpleMenuItemsController < ApplicationController
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy]
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new]
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update]
# GET /settings/menu_items
# GET /settings/menu_items.json
def index
@settings_menu_items = @category.menu_items
end
# GET /settings/menu_items/1
# GET /settings/menu_items/1.json
def show
@@ -25,10 +25,13 @@ class Settings::SimpleMenuItemsController < ApplicationController
# POST /settings/menu_items.json
def create
@settings_menu_item = MenuItem.new(settings_menu_item_params)
if params[:simple_menu_item][:menu_item_id] == ''
@settings_menu_item.menu_category_id = params[:menu_category_id]
end
@settings_menu_item.created_by = current_login_employee.name
respond_to do |format|
if @settings_menu_item.save
format.html { redirect_to settings_menu_items_path, notice: 'Menu item was successfully created.' }
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' }
format.json { render :show, status: :created, location: @settings_menu_item }
else
format.html { render :new }
@@ -42,7 +45,7 @@ class Settings::SimpleMenuItemsController < ApplicationController
def update
respond_to do |format|
if @settings_menu_item.update(settings_menu_item_params)
format.html { redirect_to settings_menu_item_path(@settings_menu_item), notice: 'Menu item was successfully updated.' }
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_menu_item }
else
format.html { render :edit }
@@ -54,9 +57,9 @@ class Settings::SimpleMenuItemsController < ApplicationController
# DELETE /settings/menu_items/1
# DELETE /settings/menu_items/1.json
def destroy
@settings_menu_item.destroy
# @settings_menu_item.destroy
respond_to do |format|
format.html { redirect_to settings_menu_items_path, notice: 'Menu item was successfully destroyed.' }
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully destroyed.' }
format.json { head :no_content }
end
end

View File

@@ -0,0 +1,74 @@
class Transactions::SalesController < ApplicationController
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
# GET /transactions/sales
# GET /transactions/sales.json
def index
@transactions_sales = Sale.all
end
# GET /transactions/sales/1
# GET /transactions/sales/1.json
def show
end
# GET /transactions/sales/new
def new
@transactions_sale = Sale.new
end
# GET /transactions/sales/1/edit
def edit
end
# POST /transactions/sales
# POST /transactions/sales.json
def create
@transactions_sale = Sale.new(transactions_sale_params)
respond_to do |format|
if @transactions_sale.save
format.html { redirect_to @transactions_sale, notice: 'Sale was successfully created.' }
format.json { render :show, status: :created, location: @transactions_sale }
else
format.html { render :new }
format.json { render json: @transactions_sale.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /transactions/sales/1
# PATCH/PUT /transactions/sales/1.json
def update
respond_to do |format|
if @transactions_sale.update(transactions_sale_params)
format.html { redirect_to @transactions_sale, notice: 'Sale was successfully updated.' }
format.json { render :show, status: :ok, location: @transactions_sale }
else
format.html { render :edit }
format.json { render json: @transactions_sale.errors, status: :unprocessable_entity }
end
end
end
# DELETE /transactions/sales/1
# DELETE /transactions/sales/1.json
def destroy
@transactions_sale.destroy
respond_to do |format|
format.html { redirect_to transactions_sales_url, notice: 'Sale was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_sale
@transactions_sale = Sale.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def transactions_sale_params
params.require(:transactions_sale).permit(:cashier_id, :cashier_name, :requested_by, :requested_at, :receipt_no, :receipt_date, :customer_id, :payment_status, :sale_status, :total_amount, :total_discount, :total_tax, :tax_type, :grand_total, :rounding_adjustment, :amount_received, :amount_changed)
end
end

View File

@@ -0,0 +1,2 @@
module Transactions::SalesHelper
end

View File

@@ -0,0 +1,8 @@
class OrderBroadcastJob < ApplicationJob
queue_as :default
def perform(message)
order = Order.find(message) # message come as order_id
ApplicationCable.server.broadcast "order_queue_station_channel", order: order
end
end

View File

@@ -3,8 +3,9 @@ class OrderQueueProcessorJob < ApplicationJob
def perform(order_id)
# Do something later
#Order ID
#Order ID
order = Order.find(order_id)
#Loop through the order stations and process the items
#Execute orders and send to order stations
if order

View File

@@ -1,6 +1,9 @@
class DiningFacility < ApplicationRecord
belongs_to :zone
TABLE_TYPE = "Table"
ROOM_TYPE = "Room"
default_scope { order('order_by asc') }
scope :active, -> {where(is_active: true)}

View File

@@ -1,8 +1,8 @@
class Menu < ApplicationRecord
has_many :menu_categories, dependent: :destroy
validates_presence_of :name, :is_active, :valid_days, :valid_time_from, :valid_time_to
validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to
validates_format_of :valid_days, :with => /\A([0-7]{1}(,[0-7]{1})*)?\Z/i, :on => :create
#Default Scope to pull the active version only
default_scope { where(is_active: true).order("created_at desc") }

View File

@@ -8,7 +8,6 @@ class Order < ApplicationRecord
#internal references attributes for business logic control
attr_accessor :items, :guest, :table_id, :new_booking, :booking_type, :employee_name, :booking_id
#Main Controller method to create new order - validate all inputs and generate new order
# order_item : {
# order_item_code : "",
@@ -43,6 +42,9 @@ class Order < ApplicationRecord
#Send order to queue one it done!
process_order_queue
#send order to broadcast job
send_order_broadcast
return true, booking
end
@@ -198,7 +200,48 @@ class Order < ApplicationRecord
#Process order items and send to order queue
def process_order_queue
#Send to background job for processing
#Send to background job for processing
OrderQueueProcessorJob.perform_later(self.id)
end
#send order items and send to order queue
def send_order_broadcast
#Send to background job for processing
OrderBroadcastJob.perform_later(self.id)
end
#Origami: Cashier : to view order type Table
def self.get_order_table
order_table = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
order_items.id as order_items_id,dining_facilities.name as table_name")
.joins("left join booking_orders on booking_orders.order_id = orders.id
left join bookings on bookings.id = booking_orders.id
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
.group("orders.id")
end
#Origami: Cashier : to view order type Room
def self.get_order_rooms
order_rooms = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
order_items.id as order_items_id,dining_facilities.name as room_name")
.joins("left join booking_orders on booking_orders.order_id = orders.id
left join bookings on bookings.id = booking_orders.id
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true)
.group("orders.id")
end
#Origami: Cashier : to view orders
def self.get_orders
orders = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
order_items.id as order_items_id,dining_facilities.name as table_or_room_name")
.joins("left join booking_orders on booking_orders.order_id = orders.id
left join bookings on bookings.id = booking_orders.id
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.is_active=?",true)
.group("orders.id")
end
end

View File

@@ -33,4 +33,10 @@ class OrderItem < ApplicationRecord
end
#Origami : Cashier : to show order items details
def self.get_order_items_details(order_id)
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
.joins("left join orders on orders.id = order_items.order_id")
.where("order_items.order_id=?",order_id)
end
end

View File

@@ -8,7 +8,7 @@ class OrderQueueStation < ApplicationRecord
scope :active, -> {where(is_active: true)}
def process_order (order)
def process_order (order)
oqs_stations = OrderQueueStation.active
order_items = order.order_items
@@ -20,10 +20,10 @@ class OrderQueueStation < ApplicationRecord
#Loop through the processing items
pq_items.each do |pq_item|
#Processing through the looping items
order_items.each do |order_item|
order_items.each do |order_item|
if (pq_item == order_item.item_code)
#Same Order_items can appear in two location.
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
end
end

View File

@@ -1,3 +0,0 @@
class SaleDiscount < ApplicationRecord
belongs_to :sale
end

2
app/models/test.rb Normal file
View File

@@ -0,0 +1,2 @@
class Test < ApplicationRecord
end

View File

@@ -0,0 +1,5 @@
module Transactions
def self.table_name_prefix
'transactions_'
end
end

View File

@@ -0,0 +1,26 @@
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<% @i = 0 %>
<% @booking.each do |booking| %>
<div class="card">
<div class="card-block">
<h4 class="card-title">
<%= @i += 1 %> . <%= booking.dining_facility.name %>
- <%= booking.item_name %>
</h4>
<p class="card-text">Medium, Fries, Salad
</p>
<p class="card-text">
<small class="text-muted">
Order at <%= booking.checkin_at.strftime("%H,%m") %>, <%= booking.checkin_by %>
</small>
</p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<% end %>
<!--- end of Items-->
</div>

View File

@@ -0,0 +1,23 @@
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<% @customer.each do |customer| %>
<div class="card">
<div class="card-block">
<!-- <h4 class="card-title">Customer Name : <%= customer.name %></h4> -->
<p class="card-text">Name : <%= customer.name %></p>
<p class="card-text">Contact No : <%= customer.contact_no %></p>
<p class="card-text">Email : <%= customer.email %></p>
</div>
</div>
<% end %>
<div class="card card-inverse card-primary ">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block order-completed">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text">
<small class="text-muted">Order at 12:23, Kyaw Lwin</small> |
<small class="text-muted">Printed at 12:23</small> |
<small class="text-muted">Completed at 12:43</small>
</p>
</div>
</div>
<div class="card">
<div class="card-block order-void">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
</div>

View File

@@ -8,7 +8,7 @@
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Queue <span class="badge badge-pill badge-default">2000</span></a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Bookings <span class="badge badge-pill badge-default">18</span></a>
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Bookings <span class="badge badge-pill badge-default"><%= @count %></span></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Customers</a>
@@ -19,283 +19,22 @@
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Panel 0 - Completed -->
<div class="tab-pane" id="completed" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block order-completed">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text">
<small class="text-muted">Order at 12:23, Kyaw Lwin</small> |
<small class="text-muted">Printed at 12:23</small> |
<small class="text-muted">Completed at 12:43</small>
</p>
</div>
</div>
<div class="card">
<div class="card-block order-void">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
</div>
<%= render :partial => 'queue' %>
</div>
<!-- Panel 1 - Tables -->
<div class="tab-pane active" id="tables" role="tabpanel">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block">
<h4 class="card-title">1. Table 4 - Beef Steak [x1]</h4>
<p class="card-text">Medium, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">2. Table 4 - Beef Steak [x1]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">3. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">4. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">5. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">6. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">7. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">8. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">10. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">11. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">12. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">13. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">14. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">15. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">16. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">17. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">18. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">19. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<!--- end of Items-->
</div>
<%= render :partial => 'booking' %>
</div>
<!-- Panel 1 - Tables - End -->
<!-- Panel 2 - Rooms -->
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card p-3">
<blockquote class="card-block card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer>
<small class="text-muted">
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card card-inverse card-primary p-3 text-center">
<blockquote class="card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
<footer>
<small>
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card text-center">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
<%= render :partial => 'customer' %>
</div>
<!-- Panel 2 - Rooms - End -->
<!-- Panel 3 - Orders -->
<div class="tab-pane" id="orders" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card text-center">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
<!-- Panel 3 - Orders - End -->
</div>

View File

@@ -4,24 +4,27 @@
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default">2000</span></a>
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default">2000</span></a>
</li>
<%
status=""
@queue_stations.each do |que|
if que.is_active == false
status="disabled"
end
%>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Queue 1 <span class="badge badge-pill badge-default">18</span></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Queue 2</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Queue 3</a>
<a class="nav-link" data-toggle="tab" href=<%= '#' + que.station_name %> role="tab" <%= status %>><%= que.station_name %><span class="badge badge-pill badge-default">18</span></a>
</li>
<% end %>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Panel 0 - Completed -->
<div class="tab-pane" id="completed" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<div class="tab-pane active" id="completed" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block order-completed">
@@ -32,11 +35,9 @@
<small class="text-muted">Printed at 12:23</small> |
<small class="text-muted">Completed at 12:43</small>
</p>
</div>
</div>
<div class="card">
<!-- <div class="card">
<div class="card-block order-void">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
@@ -49,257 +50,50 @@
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
</div> -->
</div>
</div>
<!-- Panel 1 - Tables -->
<div class="tab-pane active" id="tables" role="tabpanel">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block">
<h4 class="card-title">1. Table 4 - Beef Steak [x1]</h4>
<p class="card-text">Medium, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">2. Table 4 - Beef Steak [x1]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">3. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">4. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">5. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">6. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">7. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">8. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">10. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">11. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">12. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">13. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">14. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">15. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">16. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">17. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">18. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">19. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<!--- end of Items-->
</div>
</div>
<!-- Panel 1 - Tables - End -->
<!-- Panel 2 - Rooms -->
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card p-3">
<blockquote class="card-block card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer>
<small class="text-muted">
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card card-inverse card-primary p-3 text-center">
<blockquote class="card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
<footer>
<small>
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card text-center">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
<%
@queue_stations.each do |que|
%>
<!-- Generated Pane -->
<div class="tab-pane" id=<%= que.station_name %> role="tabpanel">
<!--- Order Items -->
<div class="card-columns" style="padding-top:10px">
<%
if @queue_items_details[:station_name] == que.station_name
%>
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title"><%= @queue_items_details[:zone] + ' ' + @queue_items_details[:item_name] + ' [x' + @queue_items_details[:qty].to_s + ']' %></h4>
<p class="card-text">Medium, Fries, Salad</p>
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= @queue_items_details[:created_at] %>
</span> -
<span class="order-by">
<%= @queue_items_details[:item_order_by] %>
</span>
</small>
</p>
<p class="hidden order-customer"><%= @queue_items_details[:customer] %></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
</div>
</div>
<%
end
%>
</div>
<!-- Panel 2 - Rooms - End -->
<!-- Panel 3 - Orders -->
<div class="tab-pane" id="orders" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
<!--- end of Items-->
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card text-center">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
<!-- Panel 3 - Orders - End -->
<!-- end of Pane -->
<% end %>
</div>
@@ -309,7 +103,7 @@
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="card" >
<div class="card-header">
<div id="order-title"><strong>ORDER DETAILS</strong> - Table 4</div>
<div id="order-title"><strong>ORDER DETAILS</strong> - </div>
</div>
<div class="card-block">
<div class="card-title">
@@ -323,13 +117,13 @@
</thead>
<tbody>
<tr>
<td style="width:33%; text-align:left">Kyaw Lwin</td>
<td style="width:33%; text-align:right">20/04/17 9:30PM</td>
<td style="width:33%; text-align:right">John Smith</td>
<td id="order-by" style="width:33%; text-align:left">Kyaw Lwin</td>
<td id="order-at" style="width:33%; text-align:right">20/04/17 9:30PM</td>
<td id="order-customer" style="width:33%; text-align:right">John Smith</td>
</tr>
<tr>
<td><strong>Table/Room</strong></td>
<td colspan="2">Table 4</td>
<td id="order-from" colspan="2"></td>
</tr>
</tbody>
</table>
@@ -346,12 +140,12 @@
<table class="table">
<tbody>
<tr>
<td style="width:80%; text-align:left">
Menu Items Name <br/>
Less Sweet, No MSG
<td id="order-items" style="width:80%; text-align:left">
<!-- Menu Items Name <br/>
Less Sweet, No MSG -->
</td>
<td style="width:20%; text-align:right">
5
<td id="order-qty" style="width:20%; text-align:right">
<!-- 5 -->
</td>
</tr>

View File

@@ -18,67 +18,20 @@
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!-- Panel 1 - Tables -->
<div class="tab-pane active" id="tables" role="tabpanel">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<% @order_table.each do |order_table| %>
<div class="card" id="table-order-<%=order_table.order_id%>" onclick="callOrderDetails('<%=order_table.order_id%>')">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card p-3">
<blockquote class="card-block card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer>
<small class="text-muted">
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card card-inverse card-primary p-3 text-center">
<blockquote class="card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
<footer>
<small>
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card text-center">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card p-3 text-right">
<blockquote class="card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer>
<small class="text-muted">
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
<h4 class="card-title"><span id="table-name-<%=order_table.order_id%>" class="table-name"><%=order_table.table_name%></span></h4>
<p class="card-text"><%=order_table.total_price%></p>
</div>
</div>
<%end %>
</div>
</div>
@@ -87,46 +40,16 @@
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<% @order_rooms.each do |order_room| %>
<div class="card" id="table-order-<%=order_room.order_id%>" onclick="callOrderDetails('<%=order_room.order_id%>')">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card p-3">
<blockquote class="card-block card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer>
<small class="text-muted">
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card card-inverse card-primary p-3 text-center">
<blockquote class="card-blockquote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
<footer>
<small>
Someone famous in <cite title="Source Title">Source Title</cite>
</small>
</footer>
</blockquote>
</div>
<div class="card text-center">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
<% tablename = order_room.room_name%>
<h4 class="card-title"><span id="table-name-<%=order_room.order_id%>" class="table-name"><%=order_room.room_name%></span></h4>
<p class="card-text"><%=order_room.total_price%></p>
</div>
</div>
<%end %>
</div>
@@ -137,27 +60,15 @@
<!--- Booking Items -->
<div class="card-columns" style="padding-top:10px">
<div class="card">
<% @orders.each do |order| %>
<div class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('<%=order.order_id%>')">
<div class="card-block">
<h4 class="card-title">Card title that wraps to a new line</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card text-center">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
<h4 class="card-title"><span id="table-name-<%=order.order_id%>" class="table-name"><%=order.table_or_room_name%></span></h4>
<p class="card-text"><%=order.total_price%></p>
</div>
</div>
<%end %>
</div>
@@ -172,7 +83,7 @@
<div class="col-lg-5 col-md-5 col-sm-3">
<div class="card" >
<div class="card-header">
<div id="order-title"><strong>ORDER DETAILS</strong> - Table 4</div>
<div id="order-title"><strong>ORDER DETAILS</strong> <span id="order-detail-header"></span></div>
</div>
<div class="card-block">
<div class="card-title">
@@ -186,120 +97,21 @@
</thead>
</table>
</div>
<div class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
<table class="table">
<div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
<table class="table" id="append-table">
<tbody>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
Menu Items Name @ 50.00
</td>
<td style="width:20%; text-align:right">
5
</td>
<td style="width:20%; text-align:right">
250.00
</td>
</tr>
<tr>
<td style="width:60%; text-align:left">
<span id="item-name-price"></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-qty"></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-total-price"></span>
</td>
</tr>
</tbody>
</table>
</div>
@@ -307,24 +119,8 @@
<table class="table" style="margin-bottom:0px">
<tfooter>
<tr>
<td style="width:80%; text-align:left; border-top:none"><strong>Sub-Total</strong></td>
<td style="width:20%; text-align:right; border-top:none"><strong>750.00</strong></td>
</tr>
<tr>
<td style="width:80%; text-align:left">Discounts</td>
<td style="width:20%; text-align:right">(-250.00)</td>
</tr>
<tr>
<td style="width:80%; text-align:left">Service Tax</td>
<td style="width:20%; text-align:right">50.00</td>
</tr>
<tr>
<td style="width:80%; text-align:left">Commercial Tax</td>
<td style="width:20%; text-align:right">39.50</td>
</tr>
<tr>
<td style="width:80%; text-align:left"><strong>Grand Total</strong></td>
<td style="width:20%; text-align:right"><strong>589.50</strong></td>
<td style="width:80%; text-align:left; border-top:none"><strong>Sub Total</strong></td>
<td style="width:20%; text-align:right; border-top:none"><strong><span id="sub-total"></span></strong></td>
</tr>
</tfooter>
</table>
@@ -349,3 +145,55 @@
</div>
</div>
<script>
var old_order_id = 0
var old_table_name = ""
function callOrderDetails(order_id){
var tbody = ""
$("#append-table").html("")
if (old_order_id != order_id){
$("#table-order-"+old_order_id).removeClass("selected_color")
$("#table-order-"+order_id).addClass("selected_color")
old_order_id = order_id
}
$("#order-detail-header").html("")
$("#order-detail-header").append(document.getElementById("table-name-"+order_id).innerHTML)
$("#sub-total").html("")
url = "origami/"+order_id
$.ajax({type: "GET",
url: url,
data: { order_id: order_id},
success:function(result){
var sub_total = 0
for (i = 0; i < result.length; i++) {
var data = JSON.stringify(result[i]);
var parse_data = JSON.parse(data)
sub_total += (parse_data.qty*parse_data.price)
row = '<tbody><tr><td style="width:60%; text-align:left"><span id="item-name-price">'+parse_data.item_name+"@"+(parse_data.price*1)+'</span></td>'
+'<td style="width:20%; text-align:right"><span id="item-qty">'+(parse_data.qty*1)+'</span></td>s'
+'<td style="width:20%; text-align:right"><span id="item-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
+'</tr></tbody>'
tbody += row
}
$("#append-table").append(tbody)
$("#sub-total").append((sub_total)+"<br/>")
},
error:function(result){
// alert('error');
}
});
}
</script>
<style type="text/css">
.selected_color{
color:white;
background-color: blue;
}
</style>

View File

@@ -40,3 +40,4 @@
</tbody>
</table>
</div>
<%= paginate @settings_menu_categories, param_name: :page, :outer_window => 3 %>

View File

@@ -1,15 +1,12 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Settings</li>
<li>Menu category</li>
<li><a href="<%= settings_menu_categories_path %>">Menus Categories</a></li>
<li>Details</li>
<span style="float: right">
</span>
</ul>
</div>
<br/>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Menu Category</h4>
@@ -47,20 +44,41 @@
<%= link_to "New Simple Menu Item",new_settings_menu_category_simple_menu_item_path(@settings_menu_category),:class => 'btn btn-primary btn-sm' %>
<%= link_to "New Set Menu Item",new_settings_menu_category_set_menu_item_path(@settings_menu_category),:class => 'btn btn-primary btn-sm' %>
</span>
</h4>
</span></h4>
<table class="table">
<thead>
<tr>
<th>Item code</th>
<th>Name</th>
<th>Alt name</th>
<th>Type</th>
<th>Parent Item</th>
<th>Created by</th>
<th>Created at</th>
<th colspan="3"></th>
</tr>
</thead>
<% settings_menu_items = @settings_menu_category.menu_items %>
<tbody>
<% settings_menu_items.each do |settings_menu_item| %>
<tr>
<td><%= settings_menu_item.item_code %></td>
<td><%= settings_menu_item.name %></td>
<td><%= settings_menu_item.alt_name %></td>
<td><%= settings_menu_item.type %></td>
<td><%= settings_menu_item.parent.name rescue "-" %></td>
<td><%= settings_menu_item.created_by %></td>
<td><%=l settings_menu_item.created_at, :format => :short %></td>
<td><%= link_to 'Show', settings_menu_category_simple_menu_item_path(@settings_menu_category, settings_menu_item ) %></td>
<td><%= link_to 'Edit', edit_settings_menu_category_simple_menu_item_path(@settings_menu_category, settings_menu_item) %></td>
<td><%= link_to 'Destroy', settings_menu_category_simple_menu_item_path(@settings_menu_category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -2,9 +2,8 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Settings</li>
<li>Menu</li>
<li><a href="<%= root_path %>">Home</a></li>
<li>Menus</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_menu_path,:class => 'btn btn-primary btn-sm' %>
</span>
@@ -35,10 +34,12 @@
<td><%= settings_menu.valid_time_from.strftime("%H:%M") rescue "-" %></td>
<td><%= settings_menu.valid_time_to.strftime("%H:%M") rescue "-" %></td>
<td><%= settings_menu.created_by %></td>
<td><%=l settings_menu.created_at, format: :short %></td>
<!-- <td><%=l settings_menu.created_at, format: :short %></td> -->
<td><%= settings_menu.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_menu_path(settings_menu) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= paginate @settings_menus, param_name: :page, :outer_window => 3 %>

View File

@@ -1,8 +1,8 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Settings</li>
<li>Menu</li>
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_menus_path %>">Menus</a></li>
<li>Details</li>
<span style="float: right">
</span>
</ul>
@@ -62,13 +62,13 @@
</thead>
<tbody>
<% @settings_menu.menu_categories.each do |category|%>
<% @settings_menu_categories.each do |category|%>
<tr>
<td><%= link_to category.name, settings_menu_category_path(category) %></td>
<td><%= category.children.count rescue "-" %></td>
<td><%= category.menu_items.count %></td>
<td><%= category.order_by %></td>
<td><%=l category.created_at, format: :short %></td>
<td><%= category.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_menu_menu_category_path(@settings_menu, category) %></td>
</tr>
<% end %>
@@ -76,3 +76,4 @@
</table>
</div>
</div>
<%= paginate @settings_menu_categories, param_name: :page, :outer_window => 3 %>

View File

@@ -1,4 +1,4 @@
<%= simple_form_for([:setting, @settings_menu_item]) do |f| %>
<%= simple_form_for([:settings,@category, @settings_menu_item]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
@@ -6,12 +6,11 @@
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :type %>
<%= f.association :menu_category %>
<%= f.association :menu_item %>
<%= f.input :menu_item_id, :label => "Parent Menu Item", :collection => MenuItem.collection %>
<%= f.input :min_qty %>
<%= f.input :min_selectable_item %>
<%= f.input :max_selectable_item %>
<%= f.input :created_by %>
</div>
<div class="form-actions">

View File

@@ -1,4 +1,4 @@
<%= simple_form_for([:settings,:menu_category, @settings_menu_item]) do |f| %>
<%= simple_form_for([:settings,@category, @settings_menu_item]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">

View File

@@ -1,17 +1,14 @@
<!-- <h1>Editing Settings Menu Item</h1>
<%= render 'form', settings_menu_item: @settings_menu_item %>
<%= link_to 'Show', @settings_menu_item %> |
<%= link_to 'Back', settings_menu_items_path %> -->
<%= render 'form', settings_menu_item: @settings_menu_item %>-->
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_menu_items_path %>">Menu Items</a></li>
<li><a href="">Menu Items</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_menu_item: @settings_menu_item %>
<%= render 'form', settings_simple_menu_item: @settings_menu_item %>
</div>

View File

@@ -5,7 +5,7 @@
<li>Menu Items</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_menu_category_menu_item_path(@category),:class => 'btn btn-primary btn-sm' %>
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_menu_category_simple_menu_item_path(@category),:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
@@ -40,7 +40,13 @@
<br/>
<div class="card">
<div class="card-block">
<h4 class="card-title">Menu Items</h4>
<h4 class="card-title">Menu Items
<span style="float: right">
<%= link_to "New Simple Menu Item",new_settings_menu_category_simple_menu_item_path(@category),:class => 'btn btn-primary btn-sm' %>
<%= link_to "New Set Menu Item",new_settings_menu_category_set_menu_item_path(@category),:class => 'btn btn-primary btn-sm' %>
</span></h4>
<h4 class="card-title"><%= @settings_menu_items.count %></h4>
<table class="table">
<thead>
<tr>
@@ -67,9 +73,9 @@
<td><%= settings_menu_item.created_by %></td>
<td><%=l settings_menu_item.created_at, :format => :short %></td>
<td><%= link_to 'Show', settings_menu_category_menu_item_path(@category, settings_menu_item ) %></td>
<td><%= link_to 'Edit', edit_settings_menu_category_menu_item_path(@category, settings_menu_item) %></td>
<td><%= link_to 'Destroy', settings_menu_category_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
<td><%= link_to 'Show', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ) %></td>
<td><%= link_to 'Edit', edit_settings_menu_category_simple_menu_item_path(@category, settings_menu_item) %></td>
<td><%= link_to 'Destroy', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>

View File

@@ -36,13 +36,13 @@
<td><%= @settings_menu_item.name rescue "-" %></td>
<td><%= @settings_menu_item.alt_name %></td>
<td><%= @settings_menu_item.type %></td>
<td><%= @settings_menu_item.menu_category %></td>
<td><%= @settings_menu_item.menu_item %></td>
<td><%= @settings_menu_item.menu_qty %></td>
<td><%= @settings_menu_item.menu_category_id %></td>
<td><%= @settings_menu_item.menu_item_id %></td>
<td><%= @settings_menu_item.min_qty %></td>
<td><%= @settings_menu_item.min_selectable_item %></td>
<td><%= @settings_menu_item.max_selectable_item %></td>
<td><%=l @settings_menu_item.created_at, format: :short %></td>
<td><%= link_to 'Edit', edit_settings_menu_menu_item_path(@settings_menu_category, @settings_menu_category) %></td>
<td><%= link_to 'Edit', edit_settings_menu_category_simple_menu_item_path(@category, @settings_menu_item) %></td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,27 @@
<%= simple_form_for(@transactions_sale) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.association :cashier %>
<%= f.input :cashier_name %>
<%= f.input :requested_by %>
<%= f.input :requested_at %>
<%= f.input :receipt_no %>
<%= f.input :receipt_date %>
<%= f.association :customer %>
<%= f.input :payment_status %>
<%= f.input :sale_status %>
<%= f.input :total_amount %>
<%= f.input :total_discount %>
<%= f.input :total_tax %>
<%= f.input :tax_type %>
<%= f.input :grand_total %>
<%= f.input :rounding_adjustment %>
<%= f.input :amount_received %>
<%= f.input :amount_changed %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! transactions_sale, :id, :cashier_id, :cashier_name, :requested_by, :requested_at, :receipt_no, :receipt_date, :customer_id, :payment_status, :sale_status, :total_amount, :total_discount, :total_tax, :tax_type, :grand_total, :rounding_adjustment, :amount_received, :amount_changed, :created_at, :updated_at
json.url transactions_sale_url(transactions_sale, format: :json)

View File

@@ -0,0 +1,6 @@
<h1>Editing Transactions Sale</h1>
<%= render 'form', transactions_sale: @transactions_sale %>
<%= link_to 'Show', @transactions_sale %> |
<%= link_to 'Back', transactions_sales_path %>

View File

@@ -0,0 +1,59 @@
<p id="notice"><%= notice %></p>
<h1>Transactions Sales</h1>
<table>
<thead>
<tr>
<th>Cashier</th>
<th>Cashier name</th>
<th>Requested by</th>
<th>Requested at</th>
<th>Receipt no</th>
<th>Receipt date</th>
<th>Customer</th>
<th>Payment status</th>
<th>Sale status</th>
<th>Total amount</th>
<th>Total discount</th>
<th>Total tax</th>
<th>Tax type</th>
<th>Grand total</th>
<th>Rounding adjustment</th>
<th>Amount received</th>
<th>Amount changed</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @transactions_sales.each do |transactions_sale| %>
<tr>
<td><%= transactions_sale.cashier %></td>
<td><%= transactions_sale.cashier_name %></td>
<td><%= transactions_sale.requested_by %></td>
<td><%= transactions_sale.requested_at %></td>
<td><%= transactions_sale.receipt_no %></td>
<td><%= transactions_sale.receipt_date %></td>
<td><%= transactions_sale.customer %></td>
<td><%= transactions_sale.payment_status %></td>
<td><%= transactions_sale.sale_status %></td>
<td><%= transactions_sale.total_amount %></td>
<td><%= transactions_sale.total_discount %></td>
<td><%= transactions_sale.total_tax %></td>
<td><%= transactions_sale.tax_type %></td>
<td><%= transactions_sale.grand_total %></td>
<td><%= transactions_sale.rounding_adjustment %></td>
<td><%= transactions_sale.amount_received %></td>
<td><%= transactions_sale.amount_changed %></td>
<td><%= link_to 'Show', transactions_sale %></td>
<td><%= link_to 'Edit', edit_transactions_sale_path(transactions_sale) %></td>
<td><%= link_to 'Destroy', transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Transactions Sale', new_transactions_sale_path %>

View File

@@ -0,0 +1 @@
json.array! @transactions_sales, partial: 'transactions_sales/transactions_sale', as: :transactions_sale

View File

@@ -0,0 +1,5 @@
<h1>New Transactions Sale</h1>
<%= render 'form', transactions_sale: @transactions_sale %>
<%= link_to 'Back', transactions_sales_path %>

View File

@@ -0,0 +1,89 @@
<p id="notice"><%= notice %></p>
<p>
<strong>Cashier:</strong>
<%= @transactions_sale.cashier %>
</p>
<p>
<strong>Cashier name:</strong>
<%= @transactions_sale.cashier_name %>
</p>
<p>
<strong>Requested by:</strong>
<%= @transactions_sale.requested_by %>
</p>
<p>
<strong>Requested at:</strong>
<%= @transactions_sale.requested_at %>
</p>
<p>
<strong>Receipt no:</strong>
<%= @transactions_sale.receipt_no %>
</p>
<p>
<strong>Receipt date:</strong>
<%= @transactions_sale.receipt_date %>
</p>
<p>
<strong>Customer:</strong>
<%= @transactions_sale.customer %>
</p>
<p>
<strong>Payment status:</strong>
<%= @transactions_sale.payment_status %>
</p>
<p>
<strong>Sale status:</strong>
<%= @transactions_sale.sale_status %>
</p>
<p>
<strong>Total amount:</strong>
<%= @transactions_sale.total_amount %>
</p>
<p>
<strong>Total discount:</strong>
<%= @transactions_sale.total_discount %>
</p>
<p>
<strong>Total tax:</strong>
<%= @transactions_sale.total_tax %>
</p>
<p>
<strong>Tax type:</strong>
<%= @transactions_sale.tax_type %>
</p>
<p>
<strong>Grand total:</strong>
<%= @transactions_sale.grand_total %>
</p>
<p>
<strong>Rounding adjustment:</strong>
<%= @transactions_sale.rounding_adjustment %>
</p>
<p>
<strong>Amount received:</strong>
<%= @transactions_sale.amount_received %>
</p>
<p>
<strong>Amount changed:</strong>
<%= @transactions_sale.amount_changed %>
</p>
<%= link_to 'Edit', edit_transactions_sale_path(@transactions_sale) %> |
<%= link_to 'Back', transactions_sales_path %>

View File

@@ -0,0 +1 @@
json.partial! "transactions_sales/transactions_sale", transactions_sale: @transactions_sale

View File

@@ -51,4 +51,7 @@ Rails.application.configure do
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Set Cable URL
config.action_cable.url = "ws://192.168.1.140:3002/cable"
end

View File

@@ -5,6 +5,9 @@ Rails.application.routes.draw do
root 'home#index'
mount Sidekiq::Web => '/kiq'
# Action Cable Creation
mount ActionCable.server => "/cable"
#--------- SmartSales Installation ------------#
get 'install' => 'install#index'
post 'install' => 'install#create'
@@ -142,7 +145,12 @@ Rails.application.routes.draw do
end
end
#--------- Transactions Sections ------------#
namespace :transactions do
resources :sales
end
#--------- Reports Controller Sections ------------#
namespace :reports do
resources :sales, :only => [:index, :show]
resources :orders, :only => [:index, :show]

View File

@@ -1,13 +0,0 @@
class CreateSaleDiscounts < ActiveRecord::Migration[5.0]
def change
create_table :sale_discounts do |t|
t.references :sale, foreign_key: true
t.string :discount_type, :null => false
t.decimal :discount_value, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :discount_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :discount_code
t.timestamps
end
end
end

View File

@@ -20,3 +20,5 @@ rails generate scaffold Setup/TaxProfile name:string rate:decimal inclusive:bool
rails generate scaffold_controller Setup/CashierTerminal name:string is_active:boolean is_currently_login:boolean auto_print_receipt:string printer_name:string header:json footer:json font:string font_size:string show_tax:boolean show_cashier:boolean show_guest_info:boolean --no-migration
rails generate scaffold_controller Settings/OrderQueueStation station_name:string is_active:boolean processing_items:json print_copy:boolean printer_name:string font_size:integer cut_per_item:boolean use_alternate_name:boolean created_by:string --no-migration
rails generate scaffold_controller transactions/Sale cashier:references cashier_name:string requested_by:string requested_at:datetime receipt_no:string receipt_date:datetime customer:references payment_status:string sale_status:string total_amount:decimal total_discount:decimal total_tax:decimal tax_type:string grand_total:decimal rounding_adjustment:decimal amount_received:decimal amount_changed:decimal --no-migration

BIN
dump.rdb

Binary file not shown.

BIN
redis-stable.tar.gz Normal file

Binary file not shown.

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 Transactions::SalesController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# Transactions::Sale. As you add validations to Transactions::Sale, 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
# Transactions::SalesController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "returns a success response" do
sale = Transactions::Sale.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
sale = Transactions::Sale.create! valid_attributes
get :show, params: {id: sale.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
sale = Transactions::Sale.create! valid_attributes
get :edit, params: {id: sale.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 Transactions::Sale" do
expect {
post :create, params: {transactions_sale: valid_attributes}, session: valid_session
}.to change(Transactions::Sale, :count).by(1)
end
it "redirects to the created transactions_sale" do
post :create, params: {transactions_sale: valid_attributes}, session: valid_session
expect(response).to redirect_to(Transactions::Sale.last)
end
end
context "with invalid params" do
it "returns a success response (i.e. to display the 'new' template)" do
post :create, params: {transactions_sale: 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 transactions_sale" do
sale = Transactions::Sale.create! valid_attributes
put :update, params: {id: sale.to_param, transactions_sale: new_attributes}, session: valid_session
sale.reload
skip("Add assertions for updated state")
end
it "redirects to the transactions_sale" do
sale = Transactions::Sale.create! valid_attributes
put :update, params: {id: sale.to_param, transactions_sale: valid_attributes}, session: valid_session
expect(response).to redirect_to(sale)
end
end
context "with invalid params" do
it "returns a success response (i.e. to display the 'edit' template)" do
sale = Transactions::Sale.create! valid_attributes
put :update, params: {id: sale.to_param, transactions_sale: invalid_attributes}, session: valid_session
expect(response).to be_success
end
end
end
describe "DELETE #destroy" do
it "destroys the requested transactions_sale" do
sale = Transactions::Sale.create! valid_attributes
expect {
delete :destroy, params: {id: sale.to_param}, session: valid_session
}.to change(Transactions::Sale, :count).by(-1)
end
it "redirects to the transactions_sales list" do
sale = Transactions::Sale.create! valid_attributes
delete :destroy, params: {id: sale.to_param}, session: valid_session
expect(response).to redirect_to(transactions_sales_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 Transactions::SalesHelper. For example:
#
# describe Transactions::SalesHelper 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 Transactions::SalesHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,60 @@
require 'rails_helper'
RSpec.describe "transactions/sales/edit", type: :view do
before(:each) do
@transactions_sale = assign(:transactions_sale, Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "MyString",
:requested_by => "MyString",
:receipt_no => "MyString",
:customer => nil,
:payment_status => "MyString",
:sale_status => "MyString",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "MyString",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
))
end
it "renders the edit transactions_sale form" do
render
assert_select "form[action=?][method=?]", transactions_sale_path(@transactions_sale), "post" do
assert_select "input[name=?]", "transactions_sale[cashier_id]"
assert_select "input[name=?]", "transactions_sale[cashier_name]"
assert_select "input[name=?]", "transactions_sale[requested_by]"
assert_select "input[name=?]", "transactions_sale[receipt_no]"
assert_select "input[name=?]", "transactions_sale[customer_id]"
assert_select "input[name=?]", "transactions_sale[payment_status]"
assert_select "input[name=?]", "transactions_sale[sale_status]"
assert_select "input[name=?]", "transactions_sale[total_amount]"
assert_select "input[name=?]", "transactions_sale[total_discount]"
assert_select "input[name=?]", "transactions_sale[total_tax]"
assert_select "input[name=?]", "transactions_sale[tax_type]"
assert_select "input[name=?]", "transactions_sale[grand_total]"
assert_select "input[name=?]", "transactions_sale[rounding_adjustment]"
assert_select "input[name=?]", "transactions_sale[amount_received]"
assert_select "input[name=?]", "transactions_sale[amount_changed]"
end
end
end

View File

@@ -0,0 +1,61 @@
require 'rails_helper'
RSpec.describe "transactions/sales/index", type: :view do
before(:each) do
assign(:transactions_sales, [
Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "Cashier Name",
:requested_by => "Requested By",
:receipt_no => "Receipt No",
:customer => nil,
:payment_status => "Payment Status",
:sale_status => "Sale Status",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "Tax Type",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
),
Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "Cashier Name",
:requested_by => "Requested By",
:receipt_no => "Receipt No",
:customer => nil,
:payment_status => "Payment Status",
:sale_status => "Sale Status",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "Tax Type",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
)
])
end
it "renders a list of transactions/sales" do
render
assert_select "tr>td", :text => nil.to_s, :count => 2
assert_select "tr>td", :text => "Cashier Name".to_s, :count => 2
assert_select "tr>td", :text => "Requested By".to_s, :count => 2
assert_select "tr>td", :text => "Receipt No".to_s, :count => 2
assert_select "tr>td", :text => nil.to_s, :count => 2
assert_select "tr>td", :text => "Payment Status".to_s, :count => 2
assert_select "tr>td", :text => "Sale Status".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "Tax Type".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
end
end

View File

@@ -0,0 +1,60 @@
require 'rails_helper'
RSpec.describe "transactions/sales/new", type: :view do
before(:each) do
assign(:transactions_sale, Transactions::Sale.new(
:cashier => nil,
:cashier_name => "MyString",
:requested_by => "MyString",
:receipt_no => "MyString",
:customer => nil,
:payment_status => "MyString",
:sale_status => "MyString",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "MyString",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
))
end
it "renders new transactions_sale form" do
render
assert_select "form[action=?][method=?]", transactions_sales_path, "post" do
assert_select "input[name=?]", "transactions_sale[cashier_id]"
assert_select "input[name=?]", "transactions_sale[cashier_name]"
assert_select "input[name=?]", "transactions_sale[requested_by]"
assert_select "input[name=?]", "transactions_sale[receipt_no]"
assert_select "input[name=?]", "transactions_sale[customer_id]"
assert_select "input[name=?]", "transactions_sale[payment_status]"
assert_select "input[name=?]", "transactions_sale[sale_status]"
assert_select "input[name=?]", "transactions_sale[total_amount]"
assert_select "input[name=?]", "transactions_sale[total_discount]"
assert_select "input[name=?]", "transactions_sale[total_tax]"
assert_select "input[name=?]", "transactions_sale[tax_type]"
assert_select "input[name=?]", "transactions_sale[grand_total]"
assert_select "input[name=?]", "transactions_sale[rounding_adjustment]"
assert_select "input[name=?]", "transactions_sale[amount_received]"
assert_select "input[name=?]", "transactions_sale[amount_changed]"
end
end
end

View File

@@ -0,0 +1,42 @@
require 'rails_helper'
RSpec.describe "transactions/sales/show", type: :view do
before(:each) do
@transactions_sale = assign(:transactions_sale, Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "Cashier Name",
:requested_by => "Requested By",
:receipt_no => "Receipt No",
:customer => nil,
:payment_status => "Payment Status",
:sale_status => "Sale Status",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "Tax Type",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(//)
expect(rendered).to match(/Cashier Name/)
expect(rendered).to match(/Requested By/)
expect(rendered).to match(/Receipt No/)
expect(rendered).to match(//)
expect(rendered).to match(/Payment Status/)
expect(rendered).to match(/Sale Status/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/Tax Type/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
end
end

View File

@@ -0,0 +1,5 @@
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end

View File

@@ -0,0 +1,9 @@
require "application_system_test_case"
class Transactions::SalesTest < ApplicationSystemTestCase
# test "visiting the index" do
# visit transactions_sales_url
#
# assert_selector "h1", text: "Transactions::Sale"
# end
end