Merge branch 'menu_sync' of bitbucket.org:code2lab/sxrestaurant into staging
This commit is contained in:
3
app/assets/javascripts/dining_charges.coffee
Normal file
3
app/assets/javascripts/dining_charges.coffee
Normal 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/
|
||||
3
app/assets/javascripts/settings/item_sets.coffee
Normal file
3
app/assets/javascripts/settings/item_sets.coffee
Normal 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/
|
||||
3
app/assets/stylesheets/dining_charges.scss
Normal file
3
app/assets/stylesheets/dining_charges.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the dining_charges controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -26,7 +26,22 @@ ul.dropdown-menu li a{
|
||||
background-color: transparent !important;
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.page-header{
|
||||
border-bottom :0px solid #000 !important;
|
||||
margin :0px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.card-block {
|
||||
text-align:center;
|
||||
background-color:#ddd;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: auto;
|
||||
background-color: #ef404a;
|
||||
width: 100%;
|
||||
}
|
||||
3
app/assets/stylesheets/settings/item_sets.scss
Normal file
3
app/assets/stylesheets/settings/item_sets.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the Settings/ItemSets controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
72
app/controllers/origami/voucher_controller.rb
Normal file
72
app/controllers/origami/voucher_controller.rb
Normal file
@@ -0,0 +1,72 @@
|
||||
class Origami::VoucherController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit voucher_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@vouchercount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "voucher"
|
||||
@vouchercount = @vouchercount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_voucher = total - @vouchercount - others
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
sale_id = params[:refnumber]
|
||||
if(Sale.exists?(sale_id))
|
||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
if customer_data
|
||||
membership_id = customer_data.membership_id
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance") #need to modify here
|
||||
if member_actions.gateway_url
|
||||
campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
merchant_uid= member_actions.merchant_account_id
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
# membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
||||
# if membership_data["status"]==true
|
||||
begin
|
||||
response = HTTParty.get(url,
|
||||
:body => { app_token: token,membership_id:membership_id,
|
||||
campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
|
||||
auth_token:auth_token
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
if( response["status"]==true )
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "voucher")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
91
app/controllers/settings/dining_charges_controller.rb
Normal file
91
app/controllers/settings/dining_charges_controller.rb
Normal file
@@ -0,0 +1,91 @@
|
||||
class Settings::DiningChargesController < ApplicationController
|
||||
before_action :set_dining_charge, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_facility
|
||||
before_action :set_settings_zone
|
||||
# GET /dining_charges
|
||||
# GET /dining_charges.json
|
||||
def index
|
||||
@dining_charges = DiningCharge.all
|
||||
end
|
||||
|
||||
# GET /dining_charges/1
|
||||
# GET /dining_charges/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /dining_charges/new
|
||||
def new
|
||||
@dining_charge = DiningCharge.new
|
||||
end
|
||||
|
||||
# GET /dining_charges/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /dining_charges
|
||||
# POST /dining_charges.json
|
||||
def create
|
||||
@dining_charge = DiningCharge.new(dining_charge_params)
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
respond_to do |format|
|
||||
if @dining_charge.save
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @dining_charge }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @dining_charge.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /dining_charges/1
|
||||
# PATCH/PUT /dining_charges/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
if @dining_charge.update(dining_charge_params)
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @dining_charge }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @dining_charge.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /dining_charges/1
|
||||
# DELETE /dining_charges/1.json
|
||||
def destroy
|
||||
@dining_charge.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to dining_charges_url, notice: 'Dining charge was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_dining_charge
|
||||
@dining_charge = DiningCharge.find(params[:id])
|
||||
end
|
||||
|
||||
def set_settings_facility
|
||||
if params[:table_id]
|
||||
@table = true
|
||||
@settings_dining_facility = Table.find(params[:table_id])
|
||||
elsif params[:room_id]
|
||||
@room = true
|
||||
@settings_dining_facility = Room.find(params[:room_id])
|
||||
end
|
||||
end
|
||||
|
||||
def set_settings_zone
|
||||
@zone = Zone.find(params[:zone_id])
|
||||
end
|
||||
|
||||
# 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)
|
||||
end
|
||||
end
|
||||
74
app/controllers/settings/item_sets_controller.rb
Normal file
74
app/controllers/settings/item_sets_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Settings::ItemSetsController < ApplicationController
|
||||
before_action :set_settings_item_set, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/item_sets
|
||||
# GET /settings/item_sets.json
|
||||
def index
|
||||
@settings_item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# GET /settings/item_sets/1
|
||||
# GET /settings/item_sets/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /settings/item_sets/new
|
||||
def new
|
||||
@settings_item_set = ItemSet.new
|
||||
end
|
||||
|
||||
# GET /settings/item_sets/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /settings/item_sets
|
||||
# POST /settings/item_sets.json
|
||||
def create
|
||||
@settings_item_set = ItemSet.new(settings_item_set_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_item_set.save
|
||||
format.html { redirect_to @settings_item_set, notice: 'Item set was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_item_set }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /settings/item_sets/1
|
||||
# PATCH/PUT /settings/item_sets/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @settings_item_set.update(settings_item_set_params)
|
||||
format.html { redirect_to @settings_item_set, notice: 'Item set was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_item_set }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /settings/item_sets/1
|
||||
# DELETE /settings/item_sets/1.json
|
||||
def destroy
|
||||
@settings_item_set.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_item_sets_url, notice: 'Item set was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_item_set
|
||||
@settings_item_set = ItemSet.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_item_set_params
|
||||
params.require(:settings_item_set).permit(:name, :min_selectable_qty, :max_selectable_qty)
|
||||
end
|
||||
end
|
||||
2
app/helpers/dining_charges_helper.rb
Normal file
2
app/helpers/dining_charges_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module DiningChargesHelper
|
||||
end
|
||||
2
app/helpers/settings/item_sets_helper.rb
Normal file
2
app/helpers/settings/item_sets_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Settings::ItemSetsHelper
|
||||
end
|
||||
41
app/models/dining_charge.rb
Normal file
41
app/models/dining_charge.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
class DiningCharge < ApplicationRecord
|
||||
belongs_to :table
|
||||
belongs_to :room
|
||||
|
||||
def amount_calculate(dining_charges_obj, checkin , checkout)
|
||||
|
||||
if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil?
|
||||
|
||||
minutes = ((checkin - checkout) * 24 * 60).to_i # stay minutes
|
||||
dining_minutes = minutes - dining_charges_obj.minimum_free_time # stayminutes - free minutes
|
||||
charge_type = dining_charges_obj.charge_type
|
||||
if charge_type == 'hr'
|
||||
|
||||
elsif charge_type == 'day'
|
||||
price = charge_by_day
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def charge_by_hour
|
||||
|
||||
end
|
||||
|
||||
def charge_by_day(chargesObj, dining_minutes)
|
||||
minues_per_day = 12 * 60
|
||||
result = dining_minutes / minues_per_day
|
||||
if result < 1
|
||||
return chargesObj.unit_price
|
||||
elsif result > 1
|
||||
solid_price = result * chargesObj.unit_price
|
||||
|
||||
remain_value = dining_minutes % minues_per_day
|
||||
roundingblock = remain_value / chargesObj.time_rounding_block
|
||||
if roundingblock > 1
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
class DiningFacility < ApplicationRecord
|
||||
belongs_to :zone
|
||||
has_many :dining_charges
|
||||
|
||||
TABLE_TYPE = "Table"
|
||||
ROOM_TYPE = "Room"
|
||||
|
||||
7
app/models/item_set.rb
Normal file
7
app/models/item_set.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class ItemSet < ApplicationRecord
|
||||
has_many :menu_item_sets
|
||||
has_many :menu_items, through: :menu_item_sets
|
||||
|
||||
has_many :menu_instance_item_sets
|
||||
has_many :menu_item_instances, through: :menu_instance_item_sets
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
class MenuCategory < ApplicationRecord
|
||||
before_create :generate_menu_category_code
|
||||
# before_create :generate_menu_category_code
|
||||
|
||||
belongs_to :menu
|
||||
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
||||
@@ -37,7 +37,7 @@ class MenuCategory < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def generate_menu_category_code
|
||||
self.code = SeedGenerator.generate_code(self.class.name, "C")
|
||||
end
|
||||
# def generate_menu_category_code
|
||||
# self.code = SeedGenerator.generate_code(self.class.name, "C")
|
||||
# end
|
||||
end
|
||||
|
||||
4
app/models/menu_instance_item_set.rb
Normal file
4
app/models/menu_instance_item_set.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class MenuInstanceItemSet < ApplicationRecord
|
||||
belongs_to :item_set
|
||||
belongs_to :menu_item_instance
|
||||
end
|
||||
@@ -1,6 +1,5 @@
|
||||
class MenuItem < ApplicationRecord
|
||||
|
||||
before_create :generate_menu_item_code
|
||||
# before_create :generate_menu_item_code
|
||||
|
||||
belongs_to :menu_category, :optional => true
|
||||
has_many :menu_item_instances
|
||||
@@ -8,6 +7,9 @@ class MenuItem < ApplicationRecord
|
||||
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||
belongs_to :account
|
||||
|
||||
has_many :menu_item_sets
|
||||
has_many :item_sets, through: :menu_item_sets
|
||||
|
||||
validates_presence_of :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
|
||||
|
||||
default_scope { order('item_code asc') }
|
||||
@@ -70,10 +72,10 @@ class MenuItem < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
# private
|
||||
|
||||
def generate_menu_item_code
|
||||
self.item_code = SeedGenerator.generate_code(self.class.name, "I")
|
||||
end
|
||||
# def generate_menu_item_code
|
||||
# self.item_code = SeedGenerator.generate_code(self.class.name, "I")
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class MenuItemInstance < ApplicationRecord
|
||||
belongs_to :menu_item
|
||||
before_create :generate_menu_item_instance_code
|
||||
# before_create :generate_menu_item_instance_code
|
||||
|
||||
def self.findParentCategory(item)
|
||||
if item.menu_category_id
|
||||
@@ -11,9 +11,9 @@ class MenuItemInstance < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# private
|
||||
|
||||
def generate_menu_item_instance_code
|
||||
self.item_instance_code = SeedGenerator.generate_code(self.class.name, "II")
|
||||
end
|
||||
# def generate_menu_item_instance_code
|
||||
# self.item_instance_code = SeedGenerator.generate_code(self.class.name, "II")
|
||||
# end
|
||||
end
|
||||
|
||||
4
app/models/menu_item_set.rb
Normal file
4
app/models/menu_item_set.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class MenuItemSet < ApplicationRecord
|
||||
belongs_to :item_set
|
||||
belongs_to :menu_item
|
||||
end
|
||||
@@ -65,7 +65,6 @@ class Order < ApplicationRecord
|
||||
end
|
||||
|
||||
def adding_line_items
|
||||
|
||||
if self.items
|
||||
#re-order to
|
||||
ordered_list = re_order_items(self.items)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
|
||||
|
||||
|
||||
<% if current_login_employee.role = "admin" %>
|
||||
|
||||
<% elsif current_login_employee.role = "cashier" %>
|
||||
<%= link_to "Cashier Station", origami_path %>
|
||||
|
||||
<% elsif current_login_employee = "waiter" %>
|
||||
<% elsif current_login_employee = "account" %>
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
|
||||
<% else %>
|
||||
@@ -14,22 +14,29 @@
|
||||
|
||||
<% end %>
|
||||
<% shop = Shop.first %>
|
||||
|
||||
<!-- -->
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="page-header" style="width:100%;text-align:center;background-color:#ddd;">
|
||||
<h4 style="color : #ef404a;font-weight:bold;font-style:italic;"><%= shop.name %></h4>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<%= shop.address %>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<%= shop.phone_no %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="card">
|
||||
<div class="page-header" style="width:100%;text-align:center;background-color:#ddd;">
|
||||
<h4 style="color : #ef404a;font-weight:bold;font-style:italic;margin-bottom:0px;"><%= shop.name %></h4>
|
||||
</div>
|
||||
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
|
||||
<%= shop.address %>
|
||||
</div>
|
||||
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
|
||||
<%= shop.phone_no %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: auto;
|
||||
background-color: #ef404a;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
5
app/views/origami/voucher/create.json.jbuilder
Normal file
5
app/views/origami/voucher/create.json.jbuilder
Normal file
@@ -0,0 +1,5 @@
|
||||
if(@status)
|
||||
json.status @status
|
||||
else
|
||||
json.status false
|
||||
end
|
||||
179
app/views/origami/voucher/index.html.erb
Normal file
179
app/views/origami/voucher/index.html.erb
Normal file
@@ -0,0 +1,179 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>Voucher / Coupon</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="margin-top:10px;padding-top:20px;">
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_voucher %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @vouchercount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Recent Voucher paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@vouchercount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="<%=@sale_id %>" class="form-control col-lg-7 col-md-7 col-sm-7 float-value" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<!-- <div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div> -->
|
||||
<input type="text" name="" id="amount" class="form-control col-lg-7 col-md-7 col-sm-7 float-value" value="" data-value="amount" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:75px;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="1" data-type="num">1</div>
|
||||
<div class=" cashier_number left" data-value="2" data-type="num">2</div>
|
||||
<div class=" cashier_number left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="4" data-type="num">4</div>
|
||||
<div class=" cashier_number left" data-value="5" data-type="num">5</div>
|
||||
<div class=" cashier_number left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="7" data-type="num">7</div>
|
||||
<div class=" cashier_number left" data-value="8" data-type="num">8</div>
|
||||
<div class=" cashier_number left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="0" data-type="num">0</div>
|
||||
<div class=" cashier_number left" data-value="." data-type="num">.</div>
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number green" data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
<div class="row bottom">
|
||||
<div class="cashier_number long" data-value="1000" data-type="add">1000</div>
|
||||
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="cashier_number long" data-value="5000" data-type="add">5000</div>
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="pay purple" id="voucher_pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
$('#validamount').attr("value",parseFloat("<%= @can_voucher %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
});
|
||||
// number key pad
|
||||
var float_value = ""
|
||||
var total = 0
|
||||
|
||||
$(document).on('focusout', '.float-value', function(event){
|
||||
float_value = $(this).attr("data-value");
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#'+float_value).val();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#'+float_value).val(input_value);
|
||||
}else{
|
||||
$('#'+float_value).val(original_value+input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#'+float_value).val(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#'+float_value).val("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#'+float_value).val();
|
||||
$('#'+float_value).val(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#'+float_value).val(remain_amount);
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
$('#voucher_pay').on('click',function(){
|
||||
var amount = $('#amount').val();
|
||||
var refnumber = $("#<%=@sale_id %>").val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
|
||||
// alert(amount);
|
||||
// alert(refnumber);
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_voucher_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id+ "&refnumber="+ refnumber,
|
||||
success:function(result){
|
||||
if(result){
|
||||
alert("Payment success")
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("Paid Amount is over!");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! dining_charge, :id, :created_at, :updated_at
|
||||
json.url dining_charge_url(dining_charge, format: :json)
|
||||
18
app/views/settings/dining_charges/_form.html.erb
Normal file
18
app/views/settings/dining_charges/_form.html.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
<%= simple_form_for([:settings,@zone,@settings_dining_facility,@dining_charge]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :item_code %>
|
||||
<%= f.input :unit_price %>
|
||||
<%= f.input :taxable %>
|
||||
<%= f.input :charge_type %>
|
||||
<%= f.input :minimum_free_time %>
|
||||
<%= f.input :charge_block %>
|
||||
<%= f.input :time_rounding %>
|
||||
<%= f.input :time_rounding_block %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
19
app/views/settings/dining_charges/edit.html.erb
Normal file
19
app/views/settings/dining_charges/edit.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<!-- <h1>Editing Dining Charge</h1>
|
||||
|
||||
<%= render 'form', dining_charge: @dining_charge %>-->
|
||||
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_zone_path(@zone) %>">Zone</a></li>
|
||||
<% if @table %>
|
||||
<li><a href="<%= edit_settings_zone_table_path(@zone,@settings_dining_facility) %>">Table / Room</a></li>
|
||||
<% elsif @room %>
|
||||
<li><a href="<%= edit_settings_zone_room_path(@zone,@settings_dining_facility) %>">Table / Room</a></li>
|
||||
<% end %>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', dining_charge: @dining_charge %>
|
||||
</div>
|
||||
25
app/views/settings/dining_charges/index.html.erb
Normal file
25
app/views/settings/dining_charges/index.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<h1>Dining Charges</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @dining_charges.each do |dining_charge| %>
|
||||
<tr>
|
||||
<td><%= link_to 'Show', dining_charge %></td>
|
||||
<td><%= link_to 'Edit', edit_dining_charge_path(dining_charge) %></td>
|
||||
<td><%= link_to 'Destroy', dining_charge, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Dining Charge', new_dining_charge_path %>
|
||||
1
app/views/settings/dining_charges/index.json.jbuilder
Normal file
1
app/views/settings/dining_charges/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @dining_charges, partial: 'dining_charges/dining_charge', as: :dining_charge
|
||||
18
app/views/settings/dining_charges/new.html.erb
Normal file
18
app/views/settings/dining_charges/new.html.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
<!-- <h1>New Dining Charge</h1>
|
||||
|
||||
<%= render 'form', dining_charge: @dining_charge %> -->
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_zone_path(@zone) %>">Zone</a></li>
|
||||
<% if @table %>
|
||||
<li><a href="<%= edit_settings_zone_table_path(@zone,@settings_dining_facility) %>">Table / Room</a></li>
|
||||
<% elsif @room %>
|
||||
<li><a href="<%= edit_settings_zone_room_path(@zone,@settings_dining_facility) %>">Table / Room</a></li>
|
||||
<% end %>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', dining_charge: @dining_charge %>
|
||||
</div>
|
||||
4
app/views/settings/dining_charges/show.html.erb
Normal file
4
app/views/settings/dining_charges/show.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<%= link_to 'Edit', edit_dining_charge_path(@dining_charge) %> |
|
||||
<%= link_to 'Back', dining_charges_path %>
|
||||
1
app/views/settings/dining_charges/show.json.jbuilder
Normal file
1
app/views/settings/dining_charges/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "dining_charges/dining_charge", dining_charge: @dining_charge
|
||||
@@ -16,6 +16,7 @@
|
||||
<th style="width:20%">Name</th>
|
||||
<th style="width:20%">Role</th>
|
||||
<th style="width:20%">Created At</th>
|
||||
<th style="width:20%">Updated At</th>
|
||||
<th style="width:20%">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -26,6 +27,7 @@
|
||||
<td><%= link_to employee.name,settings_employee_path(employee) %></td>
|
||||
<td><%= employee.role %></td>
|
||||
<td><%= employee.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td><%= employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td>
|
||||
<%= link_to 'Edit', edit_settings_employee_path(employee) %>
|
||||
<%if employee.role != "administrator"%>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_employees_path %>">Employee</a></li>
|
||||
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
@@ -15,7 +15,8 @@
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Role</th>
|
||||
|
||||
<th>Created At</th>
|
||||
<th>Updated At</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -24,6 +25,8 @@
|
||||
<tr>
|
||||
<td><%= @employee.name %></td>
|
||||
<td><%= @employee.role %></td>
|
||||
<td><%= @employee.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td><%= @employee.updated_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td>
|
||||
<%= link_to 'Edit', edit_settings_employee_path(@employee) %>
|
||||
</td>
|
||||
@@ -34,4 +37,3 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
13
app/views/settings/item_sets/_form.html.erb
Normal file
13
app/views/settings/item_sets/_form.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<%= simple_form_for(@settings_item_set) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.input :min_selectable_qty %>
|
||||
<%= f.input :max_selectable_qty %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! settings_item_set, :id, :name, :min_selectable_qty, :max_selectable_qty, :created_at, :updated_at
|
||||
json.url settings_item_set_url(settings_item_set, format: :json)
|
||||
6
app/views/settings/item_sets/edit.html.erb
Normal file
6
app/views/settings/item_sets/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing Settings Item Set</h1>
|
||||
|
||||
<%= render 'form', settings_item_set: @settings_item_set %>
|
||||
|
||||
<%= link_to 'Show', @settings_item_set %> |
|
||||
<%= link_to 'Back', settings_item_sets_path %>
|
||||
31
app/views/settings/item_sets/index.html.erb
Normal file
31
app/views/settings/item_sets/index.html.erb
Normal file
@@ -0,0 +1,31 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<h1>Settings Item Sets</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Min selectable qty</th>
|
||||
<th>Max selectable qty</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @settings_item_sets.each do |settings_item_set| %>
|
||||
<tr>
|
||||
<td><%= settings_item_set.name %></td>
|
||||
<td><%= settings_item_set.min_selectable_qty %></td>
|
||||
<td><%= settings_item_set.max_selectable_qty %></td>
|
||||
<td><%= link_to 'Show', settings_item_set %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_item_set_path(settings_item_set) %></td>
|
||||
<td><%= link_to 'Destroy', settings_item_set, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Settings Item Set', new_settings_item_set_path %>
|
||||
1
app/views/settings/item_sets/index.json.jbuilder
Normal file
1
app/views/settings/item_sets/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @settings_item_sets, partial: 'settings_item_sets/settings_item_set', as: :settings_item_set
|
||||
5
app/views/settings/item_sets/new.html.erb
Normal file
5
app/views/settings/item_sets/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New Settings Item Set</h1>
|
||||
|
||||
<%= render 'form', settings_item_set: @settings_item_set %>
|
||||
|
||||
<%= link_to 'Back', settings_item_sets_path %>
|
||||
19
app/views/settings/item_sets/show.html.erb
Normal file
19
app/views/settings/item_sets/show.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @settings_item_set.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Min selectable qty:</strong>
|
||||
<%= @settings_item_set.min_selectable_qty %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Max selectable qty:</strong>
|
||||
<%= @settings_item_set.max_selectable_qty %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_settings_item_set_path(@settings_item_set) %> |
|
||||
<%= link_to 'Back', settings_item_sets_path %>
|
||||
1
app/views/settings/item_sets/show.json.jbuilder
Normal file
1
app/views/settings/item_sets/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "settings_item_sets/settings_item_set", settings_item_set: @settings_item_set
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li><a href="<%= settings_menus_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_menu_categories_path %>">Menus Categories</a></li>
|
||||
<li>Details</li>
|
||||
<span style="float: right">
|
||||
|
||||
@@ -7,6 +7,26 @@
|
||||
<%= f.input :seater %>
|
||||
<%= f.input :order_by %>
|
||||
<%= f.input :is_active %>
|
||||
<% if @settings_table.dining_charges.length == 0 %>
|
||||
<div class="div-border">
|
||||
<div class="col-md-10">
|
||||
<%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn btn-primary' %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% @settings_table.dining_charges.each do |dc| %>
|
||||
<div class="div-border">
|
||||
<div class="col-md-10"><b><u>Dining Charge</u></b></div>
|
||||
<div class="col-md-10">item code : <%= dc.item_code %></div>
|
||||
<div class="col-md-10">Unit price : <%= dc.unit_price %></div>
|
||||
<div class="col-md-10">Charge type : <%= dc.charge_type %></div>
|
||||
<div class="col-md-10">
|
||||
<%= link_to 'Edit Charges', edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc),:class => 'btn btn-primary' %>
|
||||
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc) %>">Edit Charge</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -2,6 +2,9 @@ require 'sidekiq/web'
|
||||
|
||||
Rails.application.routes.draw do
|
||||
|
||||
namespace :settings do
|
||||
resources :item_sets
|
||||
end
|
||||
root 'home#index'
|
||||
mount Sidekiq::Web => '/kiq'
|
||||
|
||||
@@ -137,6 +140,7 @@ Rails.application.routes.draw do
|
||||
post 'payment/visa' => "visa#create"
|
||||
post 'payment/paypar' => 'paypar_payments#create'
|
||||
post 'payment/credit' => 'credit_payments#create'
|
||||
post 'payment/voucher' => 'voucher_payments#create'
|
||||
|
||||
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
||||
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
||||
@@ -145,6 +149,7 @@ Rails.application.routes.draw do
|
||||
get 'sale/:sale_id/payment/others_payment/Master' => "master#index"
|
||||
get 'sale/:sale_id/payment/others_payment/JCB' => "jcb#index"
|
||||
get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index"
|
||||
get 'sale/:sale_id/payment/others_payment/Voucher' => "voucher#index"
|
||||
|
||||
#---------Void --------------#
|
||||
post 'sale/:sale_id/void' => 'void#overall_void'
|
||||
@@ -255,9 +260,13 @@ Rails.application.routes.draw do
|
||||
#zones
|
||||
resources :zones do
|
||||
#tables
|
||||
resources :tables
|
||||
resources :tables do
|
||||
resources :dining_charges
|
||||
end
|
||||
#rooms
|
||||
resources :rooms
|
||||
resources :rooms do
|
||||
resources :dining_charges
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
16
db/migrate/20170811052036_create_dining_charges.rb
Normal file
16
db/migrate/20170811052036_create_dining_charges.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreateDiningCharges < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :dining_charges do |t|
|
||||
t.references :dining_facility
|
||||
t.string :item_code, :null => false
|
||||
t.integer :unit_price, :default => 0
|
||||
t.boolean :taxable, :default => true
|
||||
t.string :charge_type, :default => "hr"
|
||||
t.time :minimum_free_time
|
||||
t.time :charge_block
|
||||
t.string :time_rounding, :default => "down"
|
||||
t.time :time_rounding_block
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
11
db/migrate/20170811071000_create_item_sets.rb
Normal file
11
db/migrate/20170811071000_create_item_sets.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class CreateItemSets < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :item_sets do |t|
|
||||
t.string :name
|
||||
t.integer :min_selectable_qty
|
||||
t.integer :max_selectable_qty
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
10
db/migrate/20170811071108_create_menu_item_sets.rb
Normal file
10
db/migrate/20170811071108_create_menu_item_sets.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CreateMenuItemSets < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_item_sets do |t|
|
||||
t.references :item_set, foreign_key: true
|
||||
t.references :menu_item, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
10
db/migrate/20170811071327_create_menu_instance_item_sets.rb
Normal file
10
db/migrate/20170811071327_create_menu_instance_item_sets.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CreateMenuInstanceItemSets < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_instance_item_sets do |t|
|
||||
t.references :item_set, foreign_key: true
|
||||
t.references :menu_item_instance, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1224,6 +1224,7 @@ payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://staging.membership.paypar.ws"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://staging.membership.paypar.ws"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"Voucher",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"})
|
||||
|
||||
#Default Order Queue stations
|
||||
order_queue_station1 = OrderQueueStation.create({station_name: "K1", is_active: true,printer_name: "Cashier", processing_items: JSON.generate(['I0001','I0002','I0003','I0004']), print_copy:false, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
|
||||
|
||||
141
spec/controllers/dining_charges_controller_spec.rb
Normal file
141
spec/controllers/dining_charges_controller_spec.rb
Normal 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 DiningChargesController, type: :controller do
|
||||
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# DiningCharge. As you add validations to DiningCharge, 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
|
||||
# DiningChargesController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe "GET #index" do
|
||||
it "returns a success response" do
|
||||
dining_charge = DiningCharge.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
|
||||
dining_charge = DiningCharge.create! valid_attributes
|
||||
get :show, params: {id: dining_charge.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
|
||||
dining_charge = DiningCharge.create! valid_attributes
|
||||
get :edit, params: {id: dining_charge.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 DiningCharge" do
|
||||
expect {
|
||||
post :create, params: {dining_charge: valid_attributes}, session: valid_session
|
||||
}.to change(DiningCharge, :count).by(1)
|
||||
end
|
||||
|
||||
it "redirects to the created dining_charge" do
|
||||
post :create, params: {dining_charge: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(DiningCharge.last)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'new' template)" do
|
||||
post :create, params: {dining_charge: 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 dining_charge" do
|
||||
dining_charge = DiningCharge.create! valid_attributes
|
||||
put :update, params: {id: dining_charge.to_param, dining_charge: new_attributes}, session: valid_session
|
||||
dining_charge.reload
|
||||
skip("Add assertions for updated state")
|
||||
end
|
||||
|
||||
it "redirects to the dining_charge" do
|
||||
dining_charge = DiningCharge.create! valid_attributes
|
||||
put :update, params: {id: dining_charge.to_param, dining_charge: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(dining_charge)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||
dining_charge = DiningCharge.create! valid_attributes
|
||||
put :update, params: {id: dining_charge.to_param, dining_charge: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE #destroy" do
|
||||
it "destroys the requested dining_charge" do
|
||||
dining_charge = DiningCharge.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, params: {id: dining_charge.to_param}, session: valid_session
|
||||
}.to change(DiningCharge, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the dining_charges list" do
|
||||
dining_charge = DiningCharge.create! valid_attributes
|
||||
delete :destroy, params: {id: dining_charge.to_param}, session: valid_session
|
||||
expect(response).to redirect_to(dining_charges_url)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
141
spec/controllers/settings/item_sets_controller_spec.rb
Normal file
141
spec/controllers/settings/item_sets_controller_spec.rb
Normal 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 Settings::ItemSetsController, type: :controller do
|
||||
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# Settings::ItemSet. As you add validations to Settings::ItemSet, 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
|
||||
# Settings::ItemSetsController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe "GET #index" do
|
||||
it "returns a success response" do
|
||||
item_set = Settings::ItemSet.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
|
||||
item_set = Settings::ItemSet.create! valid_attributes
|
||||
get :show, params: {id: item_set.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
|
||||
item_set = Settings::ItemSet.create! valid_attributes
|
||||
get :edit, params: {id: item_set.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 Settings::ItemSet" do
|
||||
expect {
|
||||
post :create, params: {settings_item_set: valid_attributes}, session: valid_session
|
||||
}.to change(Settings::ItemSet, :count).by(1)
|
||||
end
|
||||
|
||||
it "redirects to the created settings_item_set" do
|
||||
post :create, params: {settings_item_set: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(Settings::ItemSet.last)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'new' template)" do
|
||||
post :create, params: {settings_item_set: 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 settings_item_set" do
|
||||
item_set = Settings::ItemSet.create! valid_attributes
|
||||
put :update, params: {id: item_set.to_param, settings_item_set: new_attributes}, session: valid_session
|
||||
item_set.reload
|
||||
skip("Add assertions for updated state")
|
||||
end
|
||||
|
||||
it "redirects to the settings_item_set" do
|
||||
item_set = Settings::ItemSet.create! valid_attributes
|
||||
put :update, params: {id: item_set.to_param, settings_item_set: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(item_set)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||
item_set = Settings::ItemSet.create! valid_attributes
|
||||
put :update, params: {id: item_set.to_param, settings_item_set: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE #destroy" do
|
||||
it "destroys the requested settings_item_set" do
|
||||
item_set = Settings::ItemSet.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, params: {id: item_set.to_param}, session: valid_session
|
||||
}.to change(Settings::ItemSet, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the settings_item_sets list" do
|
||||
item_set = Settings::ItemSet.create! valid_attributes
|
||||
delete :destroy, params: {id: item_set.to_param}, session: valid_session
|
||||
expect(response).to redirect_to(settings_item_sets_url)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
15
spec/helpers/dining_charges_helper_spec.rb
Normal file
15
spec/helpers/dining_charges_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the DiningChargesHelper. For example:
|
||||
#
|
||||
# describe DiningChargesHelper 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 DiningChargesHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
15
spec/helpers/settings/item_sets_helper_spec.rb
Normal file
15
spec/helpers/settings/item_sets_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Settings::ItemSetsHelper. For example:
|
||||
#
|
||||
# describe Settings::ItemSetsHelper 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 Settings::ItemSetsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/dining_charge_spec.rb
Normal file
5
spec/models/dining_charge_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DiningCharge, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/item_set_spec.rb
Normal file
5
spec/models/item_set_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ItemSet, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/menu_instance_item_set_spec.rb
Normal file
5
spec/models/menu_instance_item_set_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe MenuInstanceItemSet, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/menu_item_set_spec.rb
Normal file
5
spec/models/menu_item_set_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe MenuItemSet, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/settings/item_set_spec.rb
Normal file
5
spec/models/settings/item_set_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Settings::ItemSet, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
10
spec/requests/dining_charges_spec.rb
Normal file
10
spec/requests/dining_charges_spec.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "DiningCharges", type: :request do
|
||||
describe "GET /dining_charges" do
|
||||
it "works! (now write some real specs)" do
|
||||
get dining_charges_path
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
10
spec/requests/settings/settings_item_sets_spec.rb
Normal file
10
spec/requests/settings/settings_item_sets_spec.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Settings::ItemSets", type: :request do
|
||||
describe "GET /settings_item_sets" do
|
||||
it "works! (now write some real specs)" do
|
||||
get settings_item_sets_path
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
39
spec/routing/dining_charges_routing_spec.rb
Normal file
39
spec/routing/dining_charges_routing_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe DiningChargesController, type: :routing do
|
||||
describe "routing" do
|
||||
|
||||
it "routes to #index" do
|
||||
expect(:get => "/dining_charges").to route_to("dining_charges#index")
|
||||
end
|
||||
|
||||
it "routes to #new" do
|
||||
expect(:get => "/dining_charges/new").to route_to("dining_charges#new")
|
||||
end
|
||||
|
||||
it "routes to #show" do
|
||||
expect(:get => "/dining_charges/1").to route_to("dining_charges#show", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #edit" do
|
||||
expect(:get => "/dining_charges/1/edit").to route_to("dining_charges#edit", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #create" do
|
||||
expect(:post => "/dining_charges").to route_to("dining_charges#create")
|
||||
end
|
||||
|
||||
it "routes to #update via PUT" do
|
||||
expect(:put => "/dining_charges/1").to route_to("dining_charges#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #update via PATCH" do
|
||||
expect(:patch => "/dining_charges/1").to route_to("dining_charges#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #destroy" do
|
||||
expect(:delete => "/dining_charges/1").to route_to("dining_charges#destroy", :id => "1")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
39
spec/routing/settings/item_sets_routing_spec.rb
Normal file
39
spec/routing/settings/item_sets_routing_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Settings::ItemSetsController, type: :routing do
|
||||
describe "routing" do
|
||||
|
||||
it "routes to #index" do
|
||||
expect(:get => "/settings/item_sets").to route_to("settings/item_sets#index")
|
||||
end
|
||||
|
||||
it "routes to #new" do
|
||||
expect(:get => "/settings/item_sets/new").to route_to("settings/item_sets#new")
|
||||
end
|
||||
|
||||
it "routes to #show" do
|
||||
expect(:get => "/settings/item_sets/1").to route_to("settings/item_sets#show", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #edit" do
|
||||
expect(:get => "/settings/item_sets/1/edit").to route_to("settings/item_sets#edit", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #create" do
|
||||
expect(:post => "/settings/item_sets").to route_to("settings/item_sets#create")
|
||||
end
|
||||
|
||||
it "routes to #update via PUT" do
|
||||
expect(:put => "/settings/item_sets/1").to route_to("settings/item_sets#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #update via PATCH" do
|
||||
expect(:patch => "/settings/item_sets/1").to route_to("settings/item_sets#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #destroy" do
|
||||
expect(:delete => "/settings/item_sets/1").to route_to("settings/item_sets#destroy", :id => "1")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
14
spec/views/dining_charges/edit.html.erb_spec.rb
Normal file
14
spec/views/dining_charges/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "dining_charges/edit", type: :view do
|
||||
before(:each) do
|
||||
@dining_charge = assign(:dining_charge, DiningCharge.create!())
|
||||
end
|
||||
|
||||
it "renders the edit dining_charge form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", dining_charge_path(@dining_charge), "post" do
|
||||
end
|
||||
end
|
||||
end
|
||||
14
spec/views/dining_charges/index.html.erb_spec.rb
Normal file
14
spec/views/dining_charges/index.html.erb_spec.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "dining_charges/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:dining_charges, [
|
||||
DiningCharge.create!(),
|
||||
DiningCharge.create!()
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of dining_charges" do
|
||||
render
|
||||
end
|
||||
end
|
||||
14
spec/views/dining_charges/new.html.erb_spec.rb
Normal file
14
spec/views/dining_charges/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "dining_charges/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:dining_charge, DiningCharge.new())
|
||||
end
|
||||
|
||||
it "renders new dining_charge form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", dining_charges_path, "post" do
|
||||
end
|
||||
end
|
||||
end
|
||||
11
spec/views/dining_charges/show.html.erb_spec.rb
Normal file
11
spec/views/dining_charges/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "dining_charges/show", type: :view do
|
||||
before(:each) do
|
||||
@dining_charge = assign(:dining_charge, DiningCharge.create!())
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
end
|
||||
end
|
||||
24
spec/views/settings/item_sets/edit.html.erb_spec.rb
Normal file
24
spec/views/settings/item_sets/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/item_sets/edit", type: :view do
|
||||
before(:each) do
|
||||
@settings_item_set = assign(:settings_item_set, Settings::ItemSet.create!(
|
||||
:name => "MyString",
|
||||
:min_selectable_qty => 1,
|
||||
:max_selectable_qty => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit settings_item_set form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", settings_item_set_path(@settings_item_set), "post" do
|
||||
|
||||
assert_select "input[name=?]", "settings_item_set[name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_item_set[min_selectable_qty]"
|
||||
|
||||
assert_select "input[name=?]", "settings_item_set[max_selectable_qty]"
|
||||
end
|
||||
end
|
||||
end
|
||||
25
spec/views/settings/item_sets/index.html.erb_spec.rb
Normal file
25
spec/views/settings/item_sets/index.html.erb_spec.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/item_sets/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:settings_item_sets, [
|
||||
Settings::ItemSet.create!(
|
||||
:name => "Name",
|
||||
:min_selectable_qty => 2,
|
||||
:max_selectable_qty => 3
|
||||
),
|
||||
Settings::ItemSet.create!(
|
||||
:name => "Name",
|
||||
:min_selectable_qty => 2,
|
||||
:max_selectable_qty => 3
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of settings/item_sets" do
|
||||
render
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||
assert_select "tr>td", :text => 3.to_s, :count => 2
|
||||
end
|
||||
end
|
||||
24
spec/views/settings/item_sets/new.html.erb_spec.rb
Normal file
24
spec/views/settings/item_sets/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/item_sets/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:settings_item_set, Settings::ItemSet.new(
|
||||
:name => "MyString",
|
||||
:min_selectable_qty => 1,
|
||||
:max_selectable_qty => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new settings_item_set form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", settings_item_sets_path, "post" do
|
||||
|
||||
assert_select "input[name=?]", "settings_item_set[name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_item_set[min_selectable_qty]"
|
||||
|
||||
assert_select "input[name=?]", "settings_item_set[max_selectable_qty]"
|
||||
end
|
||||
end
|
||||
end
|
||||
18
spec/views/settings/item_sets/show.html.erb_spec.rb
Normal file
18
spec/views/settings/item_sets/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/item_sets/show", type: :view do
|
||||
before(:each) do
|
||||
@settings_item_set = assign(:settings_item_set, Settings::ItemSet.create!(
|
||||
:name => "Name",
|
||||
:min_selectable_qty => 2,
|
||||
:max_selectable_qty => 3
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Name/)
|
||||
expect(rendered).to match(/2/)
|
||||
expect(rendered).to match(/3/)
|
||||
end
|
||||
end
|
||||
9
test/system/dining_charges_test.rb
Normal file
9
test/system/dining_charges_test.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class DiningChargesTest < ApplicationSystemTestCase
|
||||
# test "visiting the index" do
|
||||
# visit dining_charges_url
|
||||
#
|
||||
# assert_selector "h1", text: "DiningCharge"
|
||||
# end
|
||||
end
|
||||
9
test/system/item_sets_test.rb
Normal file
9
test/system/item_sets_test.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class Settings::ItemSetsTest < ApplicationSystemTestCase
|
||||
# test "visiting the index" do
|
||||
# visit settings_item_sets_url
|
||||
#
|
||||
# assert_selector "h1", text: "Settings::ItemSet"
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user