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

This commit is contained in:
Aung Myo
2017-08-18 14:02:15 +06:30
63 changed files with 825 additions and 193 deletions

View File

@@ -0,0 +1,9 @@
class Api::Restaurant::ItemSetsController < Api::ApiController
#Description
# Pull the default menu details and also other available (active) menus
# Input Params - order_id
def index
@item_sets = ItemSet.all
end
end

View File

@@ -5,8 +5,7 @@ class Api::Restaurant::MenuController < Api::ApiController
# Input Params - order_id
def index
@menus = Menu.all
@current_menu = Menu.current_menu
# @current_menu = Menu.current_menu
end
#Description

View File

@@ -6,8 +6,4 @@ class Api::Restaurant::MenuItemAttributesController < Api::ApiController
def index
@menu_attributes = MenuItemAttribute.all
end
end

View File

@@ -1,13 +1,8 @@
class Api::Restaurant::MenuItemOptionsController < Api::ApiController
#Description
# Pull the default menu details and also other available (active) menus
# Input Params - order_id
def index
@menu_options = MenuItemOption.all
end
end

View File

@@ -14,10 +14,9 @@ module TokenVerification
end
def authenticate_token
authenticate_with_http_token do |token, options|
authenticate_with_http_token do |token, options|
#@current_user = User.find_by(api_key: token)
Rails.logger.debug "token - " + token.to_s
@user = Employee.authenticate_by_token(token)
if @user
return true

View File

@@ -97,6 +97,6 @@ class Settings::DiningChargesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def dining_charge_params
# params.fetch(:dining_charge, {})
params.require(:dining_charge).permit(:item_code, :unit_price, :taxable, :charge_type,:minimum_free_time ,:charge_block,:time_rounding,:time_rounding_block, :zone_id)
params.require(:dining_charge).permit(:item_code, :unit_price, :taxable, :charge_type,:minimum_free_time ,:charge_block,:time_rounding,:time_rounding_block, :zone_id, :time_rounding_block_price)
end
end

View File

@@ -69,6 +69,6 @@ class Settings::ItemSetsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_item_set_params
params.require(:item_set).permit(:name, :min_selectable_qty, :max_selectable_qty)
params.require(:item_set).permit(:name, :alt_name, :min_selectable_qty, :max_selectable_qty)
end
end

View File

@@ -89,6 +89,6 @@ class Settings::MenuCategoriesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_category_params
params.require(:menu_category).permit(:code, :menu_id, :name, :alt_name, :order_by, :menu_category_id)
params.require(:menu_category).permit(:code, :menu_id, :name, :alt_name, :order_by, :menu_category_id, :is_available)
end
end

View File

@@ -70,6 +70,6 @@ class Settings::MenuItemOptionsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_option_params
params.require(:menu_item_option).permit(:name, :value)
params.require(:menu_item_option).permit(:option_type, :name, :value)
end
end

View File

@@ -0,0 +1,76 @@
class Settings::ProductsController < ApplicationController
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
# GET /settings/products
# GET /settings/products.json
def index
@settings_products = Product.all
end
# GET /settings/products/1
# GET /settings/products/1.json
def show
end
# GET /settings/products/new
def new
@settings_product = Product.new
end
# GET /settings/products/1/edit
def edit
end
# POST /settings/products
# POST /settings/products.json
def create
@settings_product = Product.new(settings_product_params)
@settings_product.created_by = current_user.name
respond_to do |format|
if @settings_product.save
format.html { redirect_to settings_products_path, notice: 'Product was successfully created.' }
format.json { render :show, status: :created, location: @settings_product }
else
format.html { render :new }
format.json { render json: @settings_product.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/products/1
# PATCH/PUT /settings/products/1.json
def update
respond_to do |format|
if @settings_product.update(settings_product_params)
format.html { redirect_to settings_product_path, notice: 'Product was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_product }
else
format.html { render :edit }
format.json { render json: @settings_product.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/products/1
# DELETE /settings/products/1.json
def destroy
@settings_product.destroy
respond_to do |format|
format.html { redirect_to settings_products_path, notice: 'Product was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_settings_product
@settings_product = Product.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_product_params
params.require(:product).permit(:item_code, :name, :alt_name, :unit_price, :image_path, :description, :information, :taxable,:created_by)
end
end

View File

@@ -0,0 +1,76 @@
class Settings::PromotionsController < ApplicationController
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
# GET /promotions
# GET /promotions.json
def index
@promotions = Promotion.all
end
# GET /promotions/1
# GET /promotions/1.json
def show
end
# GET /promotions/new
def new
@promotion = Promotion.new
@promotion.promo_start_date = DateTime.now
@promotion.promo_end_date = DateTime.now
end
# GET /promotions/1/edit
def edit
end
# POST /promotions
# POST /promotions.json
def create
@promotion = Promotion.new(promotion_params)
@promotion.created_by = current_login_employee.id
respond_to do |format|
if @promotion.save
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully created.' }
format.json { render :show, status: :created, location: @promotion }
else
format.html { render :new }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /promotions/1
# PATCH/PUT /promotions/1.json
def update
respond_to do |format|
if @promotion.update(promotion_params)
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully updated.' }
format.json { render :show, status: :ok, location: @promotion }
else
format.html { render :edit }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# DELETE /promotions/1
# DELETE /promotions/1.json
def destroy
@promotion.destroy
respond_to do |format|
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_promotion
@promotion = Promotion.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def promotion_params
params.require(:promotion).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by)
end
end

View File

@@ -12,7 +12,7 @@ class Settings::SetMenuItemsController < ApplicationController
# GET /settings/menu_items/1
# GET /settings/menu_items/1.json
def show
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
end

View File

@@ -12,7 +12,7 @@ class Settings::SimpleMenuItemsController < ApplicationController
# GET /settings/menu_items/1
# GET /settings/menu_items/1.json
def show
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
end

View File

@@ -0,0 +1,2 @@
module Settings::PromotionsHelper
end

View File

@@ -35,7 +35,6 @@ class Employee < ApplicationRecord
end
def self.authenticate_by_token(session_token)
if (session_token)
user = Employee.find_by_token_session(session_token)
if user && user.session_expiry.utc > DateTime.now.utc

View File

@@ -1,4 +1,3 @@
class MenuItemOption < ApplicationRecord
validates_presence_of :name, :value
end

3
app/models/product.rb Normal file
View File

@@ -0,0 +1,3 @@
class Product < ApplicationRecord
validates_presence_of :name
end

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

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

View File

@@ -1,2 +1,116 @@
class Shop < ApplicationRecord
def promo_activate
current_day = Time.now.strftime("%Y-%d-%m")
current_time = Time.now.strftime('%H:%M')
day = Date.today.wday
promoList = is_between_promo_datetime(current_day,current_time)
if promoList.size > 0
itemList = combine_item(saleObj)
is_promo_day(promoList,day, itemList)
end
end
def is_between_promo_datetime(current_day,current_time)
promoList = Promotion.where('( promo_start_date < ? AND promo_end_date > ?) AND (promo_start_time < ? AND promo_end_time > ?)', current_day, current_day, current_time, current_time)
return promoList
end
def combine_item(saleObj)
itemList = saleObj.sale_items.group(:product_code).sum(:qty)
end
def is_promo_day(promoList, day, orderitemList)
promoList.each do |promo|
dayresult = promo.promo_day.include?(day)
if dayresult
orderitemList.each do |item|
find_promo_item(promo, item)
end
end
end
end
def find_promo_item(promo, orderitem)
if promo.prouduct_item == orderitem
if promo.minmum_qty < orderitem.qty
return false
else
same, promo_item_code = check_giveaway_product(promo, orderitem)
if same
give_promotion_same_product
else
find_promo_item_in_orderlist
end
end
end
end
def check_giveaway_product(promo, orderitem)
promo.promotion_products.each do |promo_product|
if promo_product.item_code == orderitem.item_code
return true, promo_product.item_code
else
return false, promo_product.item_code
end
end
end
def self.give_promotion_same_product(qty, promoqty, foc_min_qty)
multiple = qty / promoqty # loop count
charge_qty = 0
foc_qty = 0
if multiple > 0
multiple.times.each do |key|
if qty >= promoqty
charge_qty += promoqty
different = qty - promoqty
qty = different
if different == 0
Shop.add_promotion_item
foc_qty += foc_min_qty
else
foc_qty += foc_min_qty
qty = qty - foc_min_qty
end
else
if multiple == foc_qty
charge_qty += qty
else
charge_qty += qty
end
end
end
else
charge_qty = qty
end
puts "Charged - " + charge_qty.to_s
puts "FOC - " + foc_qty.to_s
end
def find_promo_item_in_orderlist(promo_item_code, orderitemList)
orderitemList.each do |item|
if item.item_code == promo_item_code
give_promotion_second_product(item)
else
add_promotion_second_item
end
end
end
def give_promotion_second_product(item, foc_min_qty)
if item.qty > foc_min_qty
else
end
end
def self.add_promotion_item
end
def self.add_promotion_second_item
end
end

View File

@@ -0,0 +1,7 @@
json.array! @item_sets do |set|
json.id set.id
json.name set.name
json.alt_name set.alt_name
json.min_selectable_qty set.min_selectable_qty
json.max_selectable_qty set.max_selectable_qty
end

View File

@@ -5,13 +5,14 @@ json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories)
json.menu_categories menu.menu_categories do |category|
json.categories menu.menu_categories do |category|
json.id category.id
json.name category.name
json.alt_name category.alt_name
json.is_available category.is_available
if category.menu_items
json.menu_items category.menu_items do |item|
json.items category.menu_items do |item|
json.partial! 'api/restaurant/menu/menu_item', item: item
end
end

View File

@@ -1,40 +1,47 @@
#Menu Item Information
json.item_code item.item_code
json.name item.name
json.alt_name item.alt_name
json.type item.type
json.min_qty item.min_qty
json.min_selectable_item item.min_selectable_item
json.max_selectable_item item.max_selectable_item
json.id item.id
json.item_code item.item_code
json.name item.name
json.alt_name item.alt_name
json.image item.image_path.url
json.description item.description
json.Information item.information
json.type item.type
json.account_id item.account_id
json.min_qty item.min_qty
json.is_available item.is_available
json.is_sub_item item.is_sub_item
json.attributes item.item_attributes
json.options item.item_options
# json.min_selectable_item item.min_selectable_item
# json.max_selectable_item item.max_selectable_item
#Item instance
if item.menu_item_instances.count == 1 then
# if item.menu_item_instances.count == 1 then
# item_instance = item.menu_item_instances[0]
# json.price = item_instance.price
# json.is_available = item_instance.is_available
# json.is_on_promotion = item_instance.is_on_promotion
# json.promotion_price = item_instance.promotion_price
# json.item_attributes = item_instance.item_attributes
item_instance = item.menu_item_instances[0]
json.price = item_instance.price
json.is_available = item_instance.is_available
json.is_on_promotion = item_instance.is_on_promotion
json.promotion_price = item_instance.promotion_price
json.item_attributes = item_instance.item_attributes
elsif item.menu_item_instances.count > 1 then
json.item_instances item.menu_item_instances do |is|
json.item_instance_item_code = is.item_instance_code
json.item_instance_name = is.item_instance_name
# elsif item.menu_item_instances.count > 1 then
json.instances item.menu_item_instances do |is|
json.code = is.item_instance_code
json.name = is.item_instance_name
json.price = is.price
json.is_available = is.is_available
json.is_on_promotion = is.is_on_promotion
json.promotion_price = is.promotion_price
json.item_attributes = is.item_attributes
end
# end
end
#Child Menu items
if (item.menu_item_sets) then
json.set_items item.menu_item_sets.each do |item|
json.partial! 'api/restaurant/menu/menu_item', item: item
end
end
# if (item.children) then
# json.set_items item.children.each do |item|
# json.partial! 'api/restaurant/menu/menu_item', item: item
# end
# end

View File

@@ -4,9 +4,11 @@ json.array! @menus do |menu|
json.valid_days menu.valid_days
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (@current_menu)
json.current_menu do
json.partial! 'api/restaurant/menu/menu', menu: @current_menu
end
end
json.partial! 'api/restaurant/menu/menu', menu: menu
# if (@current_menu)
# json.current_menu do
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
# end
# end
end

View File

@@ -1,4 +1,5 @@
json.array! @menu_attributes do |attribute|
json.id attribute.id
json.type attribute.attribute_type
json.name attribute.name
json.value attribute.value

View File

@@ -1,4 +1,6 @@
json.array! @menu_options do |option|
json.id option.id
json.type option.option_type
json.name option.name
json.value option.value
end

View File

@@ -30,6 +30,9 @@
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>
<li><%= link_to "Products", settings_products_path, :tabindex =>"-1" %></li>
</ul>
</li>

View File

@@ -3,13 +3,14 @@
<div class="form-inputs">
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
<%= f.input :unit_price %>
<%= f.input :unit_price, :input_html => { :id => 'unit_price'} %>
<%= f.input :taxable %>
<%= f.input :charge_type, :collection => [:hr, :day] %>
<%= f.input :minimum_free_time %>
<%= f.input :charge_block %>
<%= f.input :charge_block, :input_html => { :id => 'charge_block'} %>
<%= f.input :time_rounding %>
<%= f.input :time_rounding_block %>
<%= f.input :time_rounding_block, :input_html => { :id => 'time_rounding_block'} %>
<%= f.input :time_rounding_block_price, :input_html => { :id => 'time_rounding_block_price'} %>
</div>
<div class="form-actions">
@@ -17,3 +18,39 @@
</div>
<% end %>
<script>
function price(){
var unit_price = $("#unit_price").val();
var hour1 = $("select[name='dining_charge[time_rounding_block(4i)]']").val();
var min1 = $("select[name='dining_charge[time_rounding_block(5i)]']").val();
var time1=(parseInt(hour1)*60)+parseInt(min1);
var hour2 = $("select[name='dining_charge[charge_block(4i)]']").val();
var min2 = $("select[name='dining_charge[charge_block(5i)]']").val();
var time2=(parseInt(hour2)*60)+parseInt(min2);
var result=(unit_price*time1)/time2;
$("#time_rounding_block_price").val(result);
// return result;
}
$( "#unit_price" ).change(function() {
price();
});
$( "select[name='dining_charge[time_rounding_block(4i)]']" ).change(function() {
price();
});
$( "select[name='dining_charge[time_rounding_block(5i)]']" ).change(function() {
price();
});
$( "select[name='dining_charge[charge_block(4i)]']" ).change(function() {
price();
});
$( "select[name='dining_charge[charge_block(5i)]']" ).change(function() {
price();
});
</script>

View File

@@ -16,8 +16,9 @@
</div>
<%= render 'form', dining_charge: @dining_charge %>
</div>
<script>
function randomNumber(len) {
function randomNumber(len) {
var randomNumber;
var n = '';
@@ -27,6 +28,5 @@ function randomNumber(len) {
}
return n;
}
document.getElementById("item_code").value = "<%= @zone.id %>"+"<%= @settings_dining_facility.id %>"+"_"+randomNumber(5);
document.getElementById("item_code").value = "<%= @zone.id %>"+"<%= @settings_dining_facility.id %>"+"_"+randomNumber(5);
</script>

View File

@@ -3,6 +3,7 @@
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :min_selectable_qty,input_html: {value: f.object.min_selectable_qty || '0'} %>
<%= f.input :max_selectable_qty,input_html: {value: f.object.max_selectable_qty || '0'} %>
</div>

View File

@@ -14,6 +14,7 @@
<thead>
<tr>
<th>Name</th>
<th>Alt Name</th>
<th>Min selectable qty</th>
<th>Max selectable qty</th>
<th>Action</th>
@@ -24,6 +25,7 @@
<% @settings_item_sets.each do |item| %>
<tr>
<td><%= item.name %></td>
<td><%= item.alt_name %></td>
<td><%= item.min_selectable_qty %></td>
<td><%= item.max_selectable_qty %></td>
<td><%= link_to 'Show', settings_item_set_path(item),:class=>'btn btn-sm btn-success' %>

View File

@@ -17,6 +17,10 @@
<td><strong>Name:</strong></td>
<td><%= @settings_item_set.name %></td>
</tr>
<tr>
<td><strong>Alt Name:</strong></td>
<td><%= @settings_item_set.alt_name %></td>
</tr>
<tr>
<td><strong>Min selectable qty:</strong></td>
<td> <%= @settings_item_set.min_selectable_qty %></td>

View File

@@ -2,13 +2,13 @@
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :menu_id, as: :hidden %>
<%= f.input :menu_id, as: :hidden %>
<%= f.input :code, label: "Category Code" %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :is_available %>
<%= f.input :order_by %>
<%= f.association :parent %>
</div>
<div class="form-actions">

View File

@@ -17,6 +17,7 @@
<th>Menu</th>
<th>Name</th>
<th>Alt name</th>
<th>Is Available</th>
<th>Order by</th>
<th>Parent</th>
<th></th>
@@ -31,6 +32,7 @@
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
<td><%= settings_menu_category.alt_name rescue ''%></td>
<td><%= settings_menu_category.is_available rescue false%></td>
<td><%= settings_menu_category.order_by rescue ''%></td>
<td><%= settings_menu_category.parent.name rescue ''%></td>
<td><%= link_to 'Edit', edit_settings_menu_category_path(settings_menu_category) %> | <%= link_to 'Destroy', settings_menu_category_path(settings_menu_category), method: :delete, data: { confirm: 'Are you sure?' } %></td></td>

View File

@@ -16,6 +16,7 @@
<th>Menu</th>
<th>Name</th>
<th>Alt name</th>
<th>Is Available</th>
<th>Order by</th>
<th>Created At</th>
<th>Action</th>
@@ -27,6 +28,7 @@
<td><%= @settings_menu_category.menu.name %></td>
<td><%= @settings_menu_category.name rescue "-" %></td>
<td><%= @settings_menu_category.alt_name %></td>
<td><%= settings_menu_category.is_available rescue false%></td>
<td><%= @settings_menu_category.order_by %></td>
<td><%= @settings_menu_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, @settings_menu_category) %></td>

View File

@@ -3,6 +3,7 @@
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :option_type %>
<%= f.input :name %>
<%= f.input :value %>

View File

@@ -13,6 +13,7 @@
<table class="table table-striped">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Value</th>
</tr>
@@ -21,6 +22,7 @@
<tbody>
<% @settings_menu_item_options.each do |settings_menu_item_option| %>
<tr>
<td><%= settings_menu_item_option.option_type %></td>
<td><%= link_to settings_menu_item_option.name, settings_menu_item_option_path(settings_menu_item_option) %></td>
<td><%= settings_menu_item_option.value %></td>
<td><%= link_to 'Edit', edit_settings_menu_item_option_path(settings_menu_item_option) %>

View File

@@ -13,6 +13,7 @@
<table class="table">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Value</th>
<th>Created At</th>
@@ -22,6 +23,7 @@
<tbody>
<tr>
<td><%= @settings_menu_item_option.option_type %></td>
<td><%= @settings_menu_item_option.name %></td>
<td><%= @settings_menu_item_option.value rescue "-" %></td>
<td><%=l @settings_menu_item_option.created_at, format: :short %></td>

View File

@@ -0,0 +1,18 @@
<%= simple_form_for([:settings,@settings_product]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :unit_price %>
<%= f.input :image_path %>
<%= f.input :description %>
<%= f.input :information %>
<label><%= f.check_box :taxable %>Taxable</label>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! settings_product, :id, :created_at, :updated_at
json.url settings_product_url(settings_product, format: :json)

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_products_path %>">Products</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_product: @settings_product %>
</div>

View File

@@ -0,0 +1,45 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Product</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_product_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Item Code</th>
<th>Name</th>
<th>Alt Name</th>
<th>Unit Price</th>
<!-- <th style="width:20%">image_path</th> -->
<th>Description</th>
<th>Information</th>
<th>Taxable</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @settings_products.each do |settings_product| %>
<tr>
<td><%= settings_product.item_code %></td>
<td><%= settings_product.name %></td>
<td><%= settings_product.alt_name %></td>
<td><%= settings_product.unit_price %></td>
<td><%= settings_product.description %></td>
<td><%= settings_product.information %></td>
<td><%= settings_product.taxable %></td>
<td><%= link_to 'Show', settings_product_path(settings_product) %></td>
<td><%= link_to 'Edit', edit_settings_product_path(settings_product) %></td>
<td><%= link_to 'Destroy', settings_product_path(settings_product), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @settings_products, partial: 'settings_products/settings_product', as: :settings_product

View File

@@ -0,0 +1,26 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_products_path %>">Products</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', settings_product: @settings_product %>
</div>
<script>
function randomNumber(len) {
var sValidCharacters = "01234ABCDEFGHIJabcdefghijk56789lmnKLMNOPQRSTUVWXYZopqrstuvwxyz";
var sCharCode = "";
for (i = 1; i <= len; i++) {
sCharCode = sCharCode + sValidCharacters.charAt(parseInt(Math.random() * sValidCharacters.length));
if ((i === 4) || (i === 8)) {
sCharCode = sCharCode + "-";
}
}
return sCharCode;
}
document.getElementById("item_code").value = randomNumber(12);
</script>

View File

@@ -0,0 +1,33 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_products_path %>">Products</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Product</h4>
<table class="table">
<tbody>
<tr><td style="width:20%">Item code</td><td><%= @settings_product.item_code %></td></tr>
<tr><td style="width:20%">Name</td><td><%= @settings_product.name %></td></tr>
<tr><td style="width:20%">Alt name</td><td><%= @settings_product.alt_name %></td></tr>
<tr><td style="width:20%">Unit price</td><td><%= @settings_product.unit_price %></td></tr>
<tr><td style="width:20%">Image path</td><td><%= image_tag @settings_product.image_path, :size => '200x200'%></td></tr>
<tr><td style="width:20%">Description</td><td><%= @settings_product.description %></td></tr>
<tr><td style="width:20%">Information</td><td><%= @settings_product.information %></td></tr>
<tr><td style="width:20%">Taxable</td><td><%= @settings_product.taxable %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_product_path(@settings_product) %></td><td><%= link_to 'Destroy', settings_product_path(@settings_product), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "settings_products/settings_product", settings_product: @settings_product

View File

@@ -0,0 +1,48 @@
<%= simple_form_for([:settings,@promotion]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<div class="div-border">
<div class="row">
<div class="col-md-6"><%= f.input :promo_code %></div>
<div class="col-md-6"></div>
</div>
<div class="row">
<div class="col-md-6">
<span>Promo Start Date</span>
<%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control"%>
<br>
</div>
<div class="col-md-6">
<span>Promo End Date</span>
<%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control"%>
</div>
</div>
<div class="row">
<div class="col-md-6">
<%= f.input :promo_start_hour %>
<!-- <span>Promo Start Hour</span>
<%= text_field_tag :promo_start_hour , nil, :placeholder => "From Time", :id => "fromtime", :class => 'form-control' %> -->
</div>
<div class="col-md-6"><%= f.input :promo_end_hour %></div>
</div>
<div class="row">
<div class="col-md-12"><%= f.input :promo_day %></div>
</div>
<div class="row">
<div class="col-md-6">
<%= f.input :promo_type,input_html: { class: "" },
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "" %>
</div>
</div>
<div class="row">
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc"),input_html: { selected: 2 } %></div>
<div class="col-md-6"><%= f.input :min_qty %></div>
</div>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! promotion, :id, :created_at, :updated_at
json.url promotion_url(promotion, format: :json)

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', promotion: @promotion %>
</div>

View File

@@ -0,0 +1,58 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Promotions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_promotion_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Promotion Code</th>
<th>Start Date</th>
<th>End Date</th>
<th>Start Time</th>
<th>End Time</th>
<th>Promotion Day</th>
<th>Original Product</th>
<th>Created By</th>
<th>Created At</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% @promotions.each do |pro| %>
<tr>
<td><%= link_to pro.promo_code, settings_promotion_path(pro) %></td>
<td><%= pro.promo_start_date %></td>
<td><%= pro.promo_end_date %></td>
<td><%= pro.promo_start_hour.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_end_hour.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_day %></td>
<td>
<% if MenuItem.exists?(pro.original_product) %>
<%= MenuItem.find(pro.original_product).name %>
<% end %>
</td>
<% if Employee.exists?(pro.created_by) %>
<td><%= Employee.find(pro.created_by).name %></td>
<% else %>
<td><%= pro.created_by %></td>
<% end %>
<td><%= pro.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_promotion_path(pro) %></td>
<td><%= link_to 'Destroy', settings_promotion_path(pro), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @promotions, partial: 'promotions/promotion', as: :promotion

View File

@@ -0,0 +1,17 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', promotion: @promotion %>
</div>
<script>
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
// $( "#fromtime" ).timepicker();
// $( "#totime" ).timepicker({ 'scrollDefault': 'now' });
$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });
</script>

View File

@@ -0,0 +1,4 @@
<p id="notice"><%= notice %></p>
<%= link_to 'Edit', edit_promotion_path(@promotion) %> |
<%= link_to 'Back', promotions_path %>

View File

@@ -0,0 +1 @@
json.partial! "promotions/promotion", promotion: @promotion

View File

@@ -21,10 +21,7 @@
<th>Type</th>
<th>Account Type</th>
<th>Menu category</th>
<th>Menu item</th>
<th>Min qty</th>
<th>Min selectable item</th>
<th>Max selectable item</th>
<th>Created At</th>
<th>Action</th>
</tr>
@@ -38,10 +35,7 @@
<td><%= @settings_menu_item.type %></td>
<td><%= @settings_menu_item.account.title %></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><%= @settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_menu_category_set_menu_item_path(@category, @settings_menu_item) %></td>
@@ -51,58 +45,7 @@
</div>
</div>
<% if @sub_menu.count > 0 %>
<br>
<div class="card">
<div class="card-block">
<h4 class="card-title">Sub Menu Items </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>
<tbody>
<% @sub_menu.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><%= settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<% if settings_menu_item.type == "SimpleMenuItem" %>
<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>
<% else %>
<td><%= link_to 'Show', settings_menu_category_set_menu_item_path(@category, settings_menu_item ) %></td>
<td><%= link_to 'Edit', edit_settings_menu_category_set_menu_item_path(@category, settings_menu_item) %></td>
<td><%= link_to 'Destroy', settings_menu_category_set_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<%= paginate @sub_menu, param_name: :page, :outer_window => 3 %>
<% end %>
<br>
<div class="card">
<div class="card-block">
<h4 class="card-title">Menu Item Instances

View File

@@ -23,10 +23,10 @@
<th>Type</th>
<th>Accout</th>
<th>Menu category</th>
<th>Menu item</th>
<!-- <th>Menu item</th> -->
<th>Min qty</th>
<th>Min selectable item</th>
<th>Max selectable item</th>
<!-- <th>Min selectable item</th>
<th>Max selectable item</th> -->
<th>Created At</th>
<th>Action</th>
</tr>
@@ -40,10 +40,7 @@
<td><%= @settings_menu_item.type %></td>
<td><%= @settings_menu_item.account.title %></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><%= @settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
@@ -54,60 +51,7 @@
</div>
</div>
<% if @sub_menu.count > 0 %>
<br>
<div class="card">
<div class="card-block">
<h4 class="card-title">Sub Menu Items </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>
<tbody>
<% @sub_menu.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><%= settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<% if settings_menu_item.type == "SimpleMenuItem" %>
<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>
<% else %>
<td><%= link_to 'Show', settings_menu_category_set_menu_item_path(@category, settings_menu_item ) %></td>
<td><%= link_to 'Edit', edit_settings_menu_category_set_menu_item_path(@category, settings_menu_item) %></td>
<td><%= link_to 'Destroy', settings_menu_category_set_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<%= paginate @sub_menu, param_name: :page, :outer_window => 3 %>
<% end %>
<br>
<div class="card">
<div class="card-block">
<h4 class="card-title">Menu Item Instances

View File

@@ -35,6 +35,7 @@ Rails.application.routes.draw do
resources :menu_item_attributes, only: [:index]
resources :menu_item_options, only: [:index]
resources :menu_sold_out, only: [:index]
get "item_sets" => "item_sets#index"
end
#User request move table or bills
@@ -247,6 +248,8 @@ Rails.application.routes.draw do
resources :menu_item_options
#tax_profiles
resources :tax_profiles
#products
resources :products
#lookups
resources :lookups
#cashier_terminals
@@ -275,6 +278,9 @@ Rails.application.routes.draw do
end
end
#promotion
resources :promotions
end
#--------- Transactions Sections ------------#

View File

@@ -8,7 +8,7 @@ class CreateMenuCategories < ActiveRecord::Migration[5.1]
t.integer :order_by
t.string :created_by, :null => false
t.references :menu_category, :null => true
t.boolean :is_available, :null => false, :default => true
t.timestamps
end
end

View File

@@ -1,6 +1,7 @@
class CreateMenuItemOptions < ActiveRecord::Migration[5.1]
def change
create_table :menu_item_options do |t|
t.string :option_type
t.string :name, :null => false
t.string :value, :null => false

View File

@@ -2,6 +2,7 @@ class CreateItemSets < ActiveRecord::Migration[5.1]
def change
create_table :item_sets do |t|
t.string :name
t.string :alt_name
t.integer :min_selectable_qty
t.integer :max_selectable_qty

View File

@@ -0,0 +1,18 @@
class CreatePromotion < ActiveRecord::Migration[5.1]
def change
create_table :promotions do |t|
t.string :promo_code, :limit => 16
t.date :promo_start_date, :null => false
t.date :promo_end_date, :null => false
t.time :promo_start_hour, :null => false
t.time :promo_end_hour, :null => false
t.string :promo_day, :null => false, :default => "[0,1,2,3,4,5,6]"
t.string :promo_type, :null => false, :default => "Quantity"
t.string :original_product
t.integer :min_qty
t.string :created_by, :null => false
t.timestamps
end
end
end

View File

@@ -0,0 +1,13 @@
class CreatePromotionProduct < ActiveRecord::Migration[5.1]
def change
create_table :promotion_products do |t|
t.references :promotion, foreign_key: true
t.string :item_code, :null => false
t.integer :min_qty
t.integer :net_off
t.integer :net_price
t.integer :percentage
t.timestamps
end
end
end

View File

@@ -0,0 +1,16 @@
class SettingsProducts < ActiveRecord::Migration[5.1]
def change
create_table :products do |t|
t.string :item_code, :limit => 16
t.string :name, :null => false
t.string :alt_name
t.integer :unit_price
t.string :image_path
t.string :description
t.string :information
t.boolean :taxable
t.string :created_by, :null => false
t.timestamps
end
end
end

View File

@@ -114,18 +114,20 @@ customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contac
tax_profiles = TaxProfile.create({id:1, name: "Commercial Tax", rate:5.0, order_by:2, created_by:"SYSTEM DEFAULT"})
service_charges = TaxProfile.create({id:2, name: "Service Charges", rate:10.0, order_by:1, created_by:"SYSTEM DEFAULT"})
#Account for Menu Item Type (eg: Food, Beverage)
# food = Account.create({title: "Food", account_type: "0"})
# beverage = Account.create({title: "Beverage", account_type: "1"})
#Default menu
# menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"})
menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"})
menu_options = MenuItemOption.create([{name: "Less Spicy", value: "less_spicy"},{name: "Spicy", value: "spicy"},{name: "Super Spicy", value: "super_spicy"}])
menu_options = MenuItemOption.create([{name: "Less Oil", value: "less_oil"},{name: "No MSG", value: "no_msg"},{name: "Less Sweet", value: "less_sweet"}])
#Default Account
food = Account.create({title: "Food", account_type: "0"})
beverage = Account.create({title: "Beverage", account_type: "1"})
product = Account.create({title: "Product", account_type: "2"})
#Default Menu Options
menu_options = MenuItemOption.create([{option_type: "Spicy", name: "Less Spicy", value: "less_spicy"},{option_type: "Spicy", name: "Spicy", value: "spicy"},{option_type: "Spicy", name: "Super Spicy", value: "super_spicy"}])
menu_options = MenuItemOption.create([{option_type: "Oil", name: "Less Oil", value: "less_oil"},{name: "No MSG", value: "no_msg"},{option_type: "Sweet", name: "Less Sweet", value: "less_sweet"}])
# #Default Menu Category
# menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1,created_by: "SYSTEM DEFAULT"})
menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1, is_available: 1, created_by: "SYSTEM DEFAULT"})
# menu_category2 = MenuCategory.create({menu: menu, code:"C005", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 2,created_by: "SYSTEM DEFAULT"})
# menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Pork", alt_name: "Pork", order_by: 3,created_by: "SYSTEM DEFAULT"})
# menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Chicken", alt_name: "Chicken", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"})
@@ -154,11 +156,6 @@ activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_pr
# order_queue_station2 = OrderQueueStation.create({station_name: "Queue Station 2", is_active: true,printer_name: "drink_printer", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})
# zone_order_queue_station = OrderQueueStation.create({station_name: "Zone 1 Queue Station 2", is_active: true, printer_name: "print_station", processing_items: JSON.generate(['01001','01002','01003','01004','02005','02006','02007','02008']), print_copy: true, cut_per_item: true, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
#Default Order Queue Process By Zone
# zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_order_queue_station, zone: zone2})
#Create Adminstrator employee
admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"})
@@ -175,4 +172,75 @@ queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf
cashier_terminal = CashierTerminal.create({name:"Terminal 1"})
cashier_terminal2 = CashierTerminal.create({name:"Terminal 2"})
cashier_terminal3 = CashierTerminal.create({name:"Terminal 3"})
zone = Zone.create({id:1, name: "H1", is_active:true, created_by: "SYSTEM DEFAULT"})
table = Table.create({name:"61", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"62", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"53", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"54", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"24", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"25", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"26", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"34", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"35", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"45", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"46", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"47", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"48", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
zone2 = Zone.create({id:2, name: "H2", is_active:true, created_by: "SYSTEM DEFAULT"})
table = Table.create({name:"51", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"52", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"11", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"12", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"21", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"22", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"23", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"31", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"32", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"33", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"41", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"42", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"43", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"44", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
zone3 = Zone.create({id:3, name: "H3", is_active:true, created_by: "SYSTEM DEFAULT"})
table = Table.create({name:"71", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"72", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"73", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"74", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"75", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"76", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"77", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"78", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"member_discount",gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:6},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_member_campaign",gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:6},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
])
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://membership.paypar.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
#Default Order Queue stations
order_queue_station1 = OrderQueueStation.create({station_name: "K1", is_active: true,printer_name: "Cashier", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
order_queue_station2 = OrderQueueStation.create({station_name: "K2", is_active: true,printer_name: "Cashier", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})
zone_order_queue_station = OrderQueueStation.create({station_name: "K3", is_active: true, printer_name: "Cashier", processing_items: JSON.generate(['01001','01002','01003','01004','02005','02006','02007','02008']), print_copy: true, cut_per_item: true, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
# QueueStationZone
zone_queue_station1 = OrderQueueProcessByZone.create({order_queue_station: order_queue_station1, zone: zone})
zone_queue_station2 = OrderQueueProcessByZone.create({order_queue_station: order_queue_station2, zone: zone2})
zone_queue_station3 = OrderQueueProcessByZone.create({order_queue_station: zone_order_queue_station, zone: zone3})
puts " Finished System Default Set Up Data "