This commit is contained in:
Nweni
2017-08-30 14:21:05 +06:30
81 changed files with 4943 additions and 1327 deletions

2
.idea/.generators generated
View File

@@ -5,4 +5,4 @@ You are allowed to:
2. Remove generators 2. Remove generators
3. Add installed generators 3. Add installed generators
To add new installed generators automatically delete this file and reload the project. To add new installed generators automatically delete this file and reload the project.
--><GeneratorsGroup><Generator name="active_record:migration" /><Generator name="active_record:model" /><Generator name="active_record:observer" /><Generator name="active_record:session_migration" /><Generator name="controller" /><Generator name="erb:controller" /><Generator name="erb:mailer" /><Generator name="erb:scaffold" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="mailer" /><Generator name="metal" /><Generator name="migration" /><Generator name="model" /><Generator name="model_subclass" /><Generator name="observer" /><Generator name="performance_test" /><Generator name="plugin" /><Generator name="resource" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="session_migration" /><Generator name="stylesheets" /><Generator name="test_unit:controller" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:observer" /><Generator name="test_unit:performance" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /></GeneratorsGroup></Settings> --><GeneratorsGroup><Generator name="assets" /><Generator name="cancan:ability" /><Generator name="channel" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="factory_girl:model" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="kaminari:config" /><Generator name="kaminari:views" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="nested_form:install" /><Generator name="resource" /><Generator name="rspec:controller" /><Generator name="rspec:feature" /><Generator name="rspec:helper" /><Generator name="rspec:install" /><Generator name="rspec:integration" /><Generator name="rspec:job" /><Generator name="rspec:mailer" /><Generator name="rspec:model" /><Generator name="rspec:observer" /><Generator name="rspec:request" /><Generator name="rspec:scaffold" /><Generator name="rspec:view" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="sidekiq:worker" /><Generator name="simple_form:install" /><Generator name="system_test" /><Generator name="task" /><Generator name="test_unit:controller" /><Generator name="test_unit:generator" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:job" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /><Generator name="test_unit:system" /><Generator name="uploader" /></GeneratorsGroup></Settings>

View File

@@ -38,6 +38,7 @@
<orderEntry type="library" scope="PROVIDED" name="bindex (v0.5.0, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="bindex (v0.5.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap (v4.0.0.alpha6, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="bootstrap (v4.0.0.alpha6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap-datepicker-rails (v1.6.4.1, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="bootstrap-datepicker-rails (v1.6.4.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap-daterangepicker-rails (v0.0.8, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.14.6, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="bundler (v1.14.6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="byebug (v9.0.6, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="byebug (v9.0.6, rbenv: 2.3.3) [gem]" level="application" />
@@ -79,6 +80,7 @@
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.2.0, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.2.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.3, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="momentjs-rails (v2.17.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.12.1, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.12.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mysql2 (v0.4.6, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="mysql2 (v0.4.6, rbenv: 2.3.3) [gem]" level="application" />
@@ -111,6 +113,7 @@
<orderEntry type="library" scope="PROVIDED" name="sass (v3.4.24, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="sass (v3.4.24, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass-rails (v5.0.6, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="sass-rails (v5.0.6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="schema_to_scaffold (v0.8.0, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="schema_to_scaffold (v0.8.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="select2-rails (v4.0.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="shoulda-matchers (v3.1.1, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="shoulda-matchers (v3.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sidekiq (v5.0.3, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="sidekiq (v5.0.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="simple_form (v3.5.0, rbenv: 2.3.3) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="simple_form (v3.5.0, rbenv: 2.3.3) [gem]" level="application" />

1378
.idea/workspace.xml generated

File diff suppressed because it is too large Load Diff

11
Gemfile
View File

@@ -34,7 +34,7 @@ gem 'simple_form'
gem 'nested_form' gem 'nested_form'
gem 'bootstrap', '~> 4.0.0.alpha3' gem 'bootstrap', '~> 4.0.0.alpha3'
gem 'tether-rails' gem 'tether-rails'
gem "font-awesome-rails" gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.2'
gem 'rack-cors' gem 'rack-cors'
# image upload # image upload
@@ -111,9 +111,8 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'httparty', '~> 0.15.5' gem 'httparty', '~> 0.15.5'
# gem 'momentjs-rails', '>= 2.9.0' gem 'momentjs-rails' # for date-range selector
# gem 'bootstrap-datepicker-rails' gem 'bootstrap-daterangepicker-rails' # date-range picker
# # gem 'momentjs-rails', '>= 2.9.0' gem 'bootstrap-datepicker-rails' # date picker
# gem 'bootstrap3-datetimepicker-rails'z
gem 'bootstrap-datepicker-rails'
gem 'jquery-datetimepicker-rails' gem 'jquery-datetimepicker-rails'
gem 'select2-rails' # for multi-select and auto-complete select box

View File

@@ -48,6 +48,8 @@ GEM
sass (>= 3.4.19) sass (>= 3.4.19)
bootstrap-datepicker-rails (1.6.4.1) bootstrap-datepicker-rails (1.6.4.1)
railties (>= 3.0) railties (>= 3.0)
bootstrap-daterangepicker-rails (0.0.8)
railties (>= 3.1)
builder (3.2.3) builder (3.2.3)
byebug (9.0.6) byebug (9.0.6)
cancancan (1.17.0) cancancan (1.17.0)
@@ -121,6 +123,8 @@ GEM
mime-types-data (3.2016.0521) mime-types-data (3.2016.0521)
mini_portile2 (2.2.0) mini_portile2 (2.2.0)
minitest (5.10.3) minitest (5.10.3)
momentjs-rails (2.17.1)
railties (>= 3.1)
multi_json (1.12.1) multi_json (1.12.1)
multi_xml (0.6.0) multi_xml (0.6.0)
mysql2 (0.4.6) mysql2 (0.4.6)
@@ -197,6 +201,8 @@ GEM
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
schema_to_scaffold (0.8.0) schema_to_scaffold (0.8.0)
activesupport (>= 3.2.1) activesupport (>= 3.2.1)
select2-rails (4.0.3)
thor (~> 0.14)
shoulda-matchers (3.1.1) shoulda-matchers (3.1.1)
activesupport (>= 4.0.0) activesupport (>= 4.0.0)
sidekiq (5.0.3) sidekiq (5.0.3)
@@ -254,6 +260,7 @@ DEPENDENCIES
bcrypt (~> 3.1.7) bcrypt (~> 3.1.7)
bootstrap (~> 4.0.0.alpha3) bootstrap (~> 4.0.0.alpha3)
bootstrap-datepicker-rails bootstrap-datepicker-rails
bootstrap-daterangepicker-rails
byebug byebug
cancancan (~> 1.10) cancancan (~> 1.10)
carrierwave (~> 1.0) carrierwave (~> 1.0)
@@ -263,7 +270,7 @@ DEPENDENCIES
factory_girl_rails (~> 4.0) factory_girl_rails (~> 4.0)
faker faker
filterrific filterrific
font-awesome-rails font-awesome-rails (~> 4.7, >= 4.7.0.2)
httparty (~> 0.15.5) httparty (~> 0.15.5)
jbuilder (~> 2.5) jbuilder (~> 2.5)
jquery-datetimepicker-rails jquery-datetimepicker-rails
@@ -271,6 +278,7 @@ DEPENDENCIES
jquery-ui-rails jquery-ui-rails
kaminari (~> 1.0.1) kaminari (~> 1.0.1)
listen (~> 3.0.5) listen (~> 3.0.5)
momentjs-rails
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
nested_form nested_form
pg pg
@@ -282,6 +290,7 @@ DEPENDENCIES
rspec-rails (~> 3.5) rspec-rails (~> 3.5)
sass-rails (~> 5.0) sass-rails (~> 5.0)
schema_to_scaffold schema_to_scaffold
select2-rails
shoulda-matchers (~> 3.1) shoulda-matchers (~> 3.1)
sidekiq sidekiq
simple_form simple_form

View File

@@ -1,13 +1,18 @@
# README # README
SXRestuarant is a new Dedicate project for SmartSales Restaurant. It is improvement from v1.2 with upgrade to latest Bootstrap and Rails 5. The API is better define and route are refactor. SXRestuarant is a new Dedicate project for SmartSales Restaurant. It is improvement from v1.2 with upgrade to latest Bootstrap and Rails 5.2. The API is better define and route are refactor.
Things you may want to cover: Things you may want to cover:
* Ruby version * Ruby version
ruby 2.3.2p217 ruby 2.4.1p111
* ToDo list * ToDo list
1. Cloud Sync
2. Action Cable
3. Shop Setup
4. Payment Integation
* System dependencies * System dependencies
@@ -23,4 +28,55 @@ ruby 2.3.2p217
* Deployment instructions * Deployment instructions
* ...
* Features
1. OQS
1. Filter
2. Order Item to each Stations
3. Edit Order Item
2. Origami(Sale)
1. Sale
2. Add Customer for membership
3. Discount and Member Discount for Sale
4. Assign Commissioner
5. Add other charges to Sale
3. CRM
1. Customer Management
2. Queue Management
4. Backend
1. Dining Setup
2. Queue Station Setup
3. Menu Setup
4. Cashier Terminal Setup
5. Tax Profile Setup
6. Printer Setup
7. Payment Integration
8. Employee Management
9. Promotion Setup
10. Commissioner Setup
11. Membership Integration
5. Inventory
6. Report

View File

@@ -20,8 +20,12 @@
//= require settings/processing_items //= require settings/processing_items
//= require jquery-ui //= require jquery-ui
//= require bootstrap-datepicker //= require bootstrap-datepicker
//= require moment
//= require daterangepicker
//= require select2
//= require jquery.datetimepicker //= require jquery.datetimepicker
$(document).on('turbolinks:load', function() { $(document).on('turbolinks:load', function() {
$('.datepicker').datepicker({ $('.datepicker').datepicker({
format : 'dd-mm-yyyy', format : 'dd-mm-yyyy',

View File

@@ -6,6 +6,7 @@
//= require cable //= require cable
//= require jquery-ui //= require jquery-ui
//= require bootstrap-datepicker //= require bootstrap-datepicker
//= require jquery.datetimepicker
$(document).ready(function(){ $(document).ready(function(){
// auto refresh every 60 seconds // auto refresh every 60 seconds

View File

@@ -4,6 +4,8 @@
@import "theme"; @import "theme";
@import "jquery-ui"; @import "jquery-ui";
@import "bootstrap-datepicker3"; @import "bootstrap-datepicker3";
@import "daterangepicker-bs3";
@import "select2";
@import "jquery.datetimepicker"; @import "jquery.datetimepicker";
/* Show it is fixed to the top */ /* Show it is fixed to the top */

View File

@@ -4,6 +4,8 @@
@import "jquery-ui"; @import "jquery-ui";
@import "bootstrap-datepicker3"; @import "bootstrap-datepicker3";
@import "jquery.datetimepicker";
/* Show it is fixed to the top */ /* Show it is fixed to the top */
// body { // body {
// min-height: 75rem; // min-height: 75rem;

View File

@@ -60,4 +60,31 @@ ul.dropdown-menu li a{
.padding-10 { .padding-10 {
padding: 10px; padding: 10px;
} }
/* Colors */
.purple {
background-color:#7a62d3;
}
.orange{
background-color:#FF7F50;
}
.red {
background-color:#ff0000;
}
.green{
background-color: #009900;
}
.orange{
background-color: #FF8C00;
}
.blue{
background-color: blue;
}
/* End Colors */

View File

@@ -4,8 +4,25 @@ class Api::Restaurant::MenuController < Api::ApiController
# Pull the default menu details and also other available (active) menus # Pull the default menu details and also other available (active) menus
# Input Params - order_id # Input Params - order_id
def index def index
@menus = Menu.all param_checksum = params[:checksum]
# @current_menu = Menu.current_menu # checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
all_menu = Menu.all
# to hash
menu_array = []
all_menu.each do |m|
menu_array.push(m.to_json(:include => {:menu_categories => { :include => { :menu_items => { :include => [:menu_item_sets, :menu_item_instances => {:include => :menu_instance_item_sets}]} } }}))
end
#export Checksum file generate by md5
menu_checksum = Digest::MD5.hexdigest(menu_array.to_json)
if menu_checksum != param_checksum
response.headers['CHECKSUM'] = menu_checksum
@menus = all_menu
end
# @current_menu = Menu.current_menu
end end
#Description #Description

View File

@@ -6,13 +6,33 @@ class Crm::CustomersController < BaseCrmController
# GET /crm/customers.json # GET /crm/customers.json
def index def index
filter = params[:filter] filter = params[:filter]
type = params[:type]
if filter.nil? if filter.nil?
@crm_customers = Customer.all @crm_customers = Customer.all
else else
@crm_customers = Customer.search(filter) @crm_customers = Customer.search(filter)
# search account no from paypar
if !@crm_customers.present? && type == "card"
response = Customer.search_paypar_account_no(filter)
if response["status"] == true
@crm_customers = Customer.new
@crm_customers.name = response["customer_data"]["name"]
@crm_customers.contact_no = response["customer_data"]["phone"]
@crm_customers.email = response["customer_data"]["email"]
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
@crm_customers.nrc_no = response["customer_data"]["NRC"]
@crm_customers.address = response["customer_data"]["address"]
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
@crm_customers.paypar_account_no = filter
@crm_customers.membership_id = response["customer_data"]["id"]
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save
@crm_customers = Customer.search(filter)
end
end
end end
#@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new @crm_customer = Customer.new
@count_customer = Customer.count_customer @count_customer = Customer.count_customer

View File

@@ -1,75 +0,0 @@
class Origami::CommissionersController < BaseOrigamiController
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
# GET /commissioners
# GET /commissioners.json
def index
@commissioners = Commissioner.all.order("id asc")
end
# GET /commissioners/1
# GET /commissioners/1.json
def show
end
# GET /commissioners/new
def new
@commissioner = Commissioner.new
@employee = Employee.all.order('name asc')
end
# GET /commissioners/1/edit
def edit
end
# POST /commissioners
# POST /commissioners.json
def create
@commissioner = Commissioner.new(commissioner_params)
@commissioner.created_by = current_user.id
respond_to do |format|
if @commissioner.save
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully created.' }
format.json { render :show, status: :created, location: @commissioner }
else
format.html { render :new }
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /commissioners/1
# PATCH/PUT /commissioners/1.json
def update
respond_to do |format|
if @commissioner.update(commissioner_params)
format.html { redirect_to origami_commissioner_path(@commissioner) , notice: 'Commissioner was successfully updated.' }
format.json { render :show, status: :ok, location: @commissioner }
else
format.html { render :edit }
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
end
end
end
# DELETE /commissioners/1
# DELETE /commissioners/1.json
def destroy
@commissioner.destroy
respond_to do |format|
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_commissioner
@commissioner = Commissioner.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def commissioner_params
params.require(:commissioner).permit(:name,:emp_id,:created_by,:commission_type, :is_active)
end
end

View File

@@ -9,13 +9,40 @@ class Origami::CustomersController < BaseOrigamiController
end end
def get_customer def get_customer
filter = params[:filter] filter = params[:filter]
type = params[:type]
if filter.nil? if filter.nil?
@crm_customers = Customer.order("customer_id").page(params[:page]) @crm_customers = Customer.order("customer_id").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5) #@products = Product.order("name").page(params[:page]).per(5)
else else
@crm_customers = Customer.search(filter) @crm_customers = Customer.search(filter)
# search account no from paypar
if !@crm_customers.present? && type == "card"
response = Customer.search_paypar_account_no(filter)
if response["status"] == true
@crm_customers = Customer.new
@crm_customers.name = response["customer_data"]["name"]
@crm_customers.contact_no = response["customer_data"]["phone"]
@crm_customers.email = response["customer_data"]["email"]
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
@crm_customers.nrc_no = response["customer_data"]["NRC"]
@crm_customers.address = response["customer_data"]["address"]
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
@crm_customers.paypar_account_no = filter
@crm_customers.membership_id = response["customer_data"]["id"]
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save
@crm_customers = Customer.search(filter)
else
@crm_customers = [{"customer_id": response["status"],"message": response["message"] }]
end
end
end end
render :json => @crm_customers.to_json render :json => @crm_customers.to_json
end end

View File

@@ -8,10 +8,10 @@ class Origami::InJutiesController < BaseOrigamiController
end end
def index_in_juty def index_in_juty
@juties_in= InJuty.where("dinning_id=?",params[:table_id]) @juty_in= InJuty.where("dinning_id=?",params[:table_id])
@table = DiningFacility.find(params[:table_id]) @table = DiningFacility.find(params[:table_id])
@in_juty = InJuty.new @in_juty = InJuty.new
@juties_in = Kaminari.paginate_array(@juty_in).page(params[:page]).per(10)
end end
# GET /in_juties/1 # GET /in_juties/1
# GET /in_juties/1.json # GET /in_juties/1.json
@@ -31,6 +31,9 @@ class Origami::InJutiesController < BaseOrigamiController
def edit_in_juty def edit_in_juty
@in_juty = InJuty.find(params[:id]) @in_juty = InJuty.find(params[:id])
@table = DiningFacility.find(params[:table_id]) @table = DiningFacility.find(params[:table_id])
@commissioner = @in_juty.commissioner
render json: {in_juty: @in_juty, commissioner: @commissioner}
end end
def assign_in_juty def assign_in_juty
@@ -56,10 +59,10 @@ class Origami::InJutiesController < BaseOrigamiController
def create_for_in_juty def create_for_in_juty
@in_juty = InJuty.new @in_juty = InJuty.new
@in_juty.dinning_id = in_juty_params[:dinning_id] @in_juty.dinning_id = in_juty_params[:dinning_id]
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids] @in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
@in_juty.in_time = in_juty_params[:in_time] @in_juty.in_time = in_juty_params[:in_time]
@in_juty.out_time = in_juty_params[:out_time] @in_juty.out_time = in_juty_params[:out_time]
respond_to do |format| respond_to do |format|
@@ -71,7 +74,7 @@ class Origami::InJutiesController < BaseOrigamiController
format.json { render json: @in_juty.errors, status: :unprocessable_entity } format.json { render json: @in_juty.errors, status: :unprocessable_entity }
end end
end end
end end
# PATCH/PUT /in_juties/1 # PATCH/PUT /in_juties/1
@@ -90,11 +93,18 @@ class Origami::InJutiesController < BaseOrigamiController
def update_for_in_juty def update_for_in_juty
@in_juty.dinning_id = params[:dining_id] @in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
@in_juty.commissioner_ids = params[:commissioner_ids] @in_juty.in_time = in_juty_params[:in_time]
@in_juty.in_time = params[:in_time] @in_juty.out_time = in_juty_params[:out_time]
@in_juty.out_time = params[:out_time] respond_to do |format|
@in_juty.save if @in_juty.save
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' }
format.json { render :show, status: :ok, location: @in_juty }
else
format.html { render :edit }
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
end
end
end end
# DELETE /in_juties/1 # DELETE /in_juties/1
@@ -110,7 +120,7 @@ class Origami::InJutiesController < BaseOrigamiController
def destroy_in_juty def destroy_in_juty
@table_id = params[:table_id] @table_id = params[:table_id]
@in_juty.destroy @in_juty.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to origami_index_in_juty_path(@table_id), notice: 'In juty was successfully destroyed.' } format.html { redirect_to origami_index_in_juty_path(@table_id), notice: 'In juty was successfully destroyed.' }
format.json { head :no_content } format.json { head :no_content }
@@ -125,6 +135,6 @@ class Origami::InJutiesController < BaseOrigamiController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def in_juty_params def in_juty_params
params.require(:in_juty).permit(:dinning_id,:commissioner_ids,:in_time,:out_time) params.require(:in_juty).permit(:id,:dinning_id,:commissioner_ids,:in_time,:out_time)
end end
end end

View File

@@ -62,15 +62,16 @@ class Origami::ProductCommissionsController < ApplicationController
end end
def set_commissioner_to_sale_item def set_commissioner_to_sale_item
# byebug
deselect = false deselect = false
sale_item_id = params[:sale_item_id] sale_item_id = params[:sale_item_id]
commissioner_id = params[:commissioner_id] commissioner_id = params[:commissioner_id]
@sale_item = SaleItem.find(sale_item_id) @sale_item = SaleItem.find(sale_item_id)
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code) @menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
@commission = Commission.where('product_id = ? AND is_active = ?', @menu_item.id, true).take @commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.id, true).take
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take @commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take @product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
# byebug
if !@product_commission.nil? if !@product_commission.nil?
if @product_commission.commissioner_id == @commissioner.id if @product_commission.commissioner_id == @commissioner.id
@product_commission.destroy @product_commission.destroy
@@ -81,7 +82,8 @@ class Origami::ProductCommissionsController < ApplicationController
end end
else else
@product_commission = ProductCommission.new @product_commission = ProductCommission.new
@product_commission.product_id = @menu_item.id @product_commission.product_code = @menu_item.id
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
unless @commission.nil? unless @commission.nil?
@product_commission.commission_id = @commission.id @product_commission.commission_id = @commission.id
if @commission.commission_type == 'Percentage' if @commission.commission_type == 'Percentage'

View File

@@ -0,0 +1,49 @@
class Reports::CommissionController < BaseReportController
# authorize_resource :class => false
def index
from_date = DateTime.now.beginning_of_day.utc.getlocal
to_date = DateTime.now.end_of_day.utc.getlocal
unless params[:daterange].blank?
from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day.utc.getlocal
to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day.utc.getlocal
@daterange = params[:daterange]
end
commissioner = params[:commissioner].to_i
@com_id = commissioner
@commissioner = Commissioner.active.all
@transaction = ProductCommission.get_transaction(from_date, to_date, commissioner)
@from = from_date
@to = to_date
respond_to do |format|
format.html
format.xls
end
end
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
shift_id = sale.id.nil? ? '-' : sale.id
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
date_arr.push(str)
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end

View File

@@ -0,0 +1,93 @@
class Settings::CommissionersController < ApplicationController
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
# GET /commissioners
# GET /commissioners.json
def index
@commissioners = Commissioner.all.order("id asc")
end
# GET /commissioners/1
# GET /commissioners/1.json
def show
end
# GET /commissioners/new
def new
@commissioner = Commissioner.new
@employee = Employee.all.order('name asc')
end
# GET /commissioners/1/edit
def edit
end
# POST /commissioners
# POST /commissioners.json
def create
@commissioner = Commissioner.new(commissioner_params)
@commissioner.created_by = current_user.id
unless @commissioner.joined_date.nil?
@commissioner.joined_date = @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d')
end
unless @commissioner.resigned_date.nil?
@commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d')
end
respond_to do |format|
if @commissioner.save
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'}
format.json {render :show, status: :created, location: @commissioner}
else
format.html {render :new}
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
end
end
end
# PATCH/PUT /commissioners/1
# PATCH/PUT /commissioners/1.json
def update
respond_to do |format|
if @commissioner.update(commissioner_params)
format.html {redirect_to settings_commissioner_path(@commissioner), notice: 'Commissioner was successfully updated.'}
format.json {render :show, status: :ok, location: @commissioner}
else
format.html {render :edit}
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
end
end
end
# DELETE /commissioners/1
# DELETE /commissioners/1.json
def destroy
@commissioner.destroy
respond_to do |format|
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully destroyed.'}
format.json {head :no_content}
end
end
def get_transaction_by_commissioner
commissioner_id = params[:commissioner_id]
@transactions = []
@product_commissions = ProductCommission.where(commissioner_id: commissioner_id).order('updated_at desc')
@product_commissions.each_with_index do |p, i|
@transactions[i] = []
@transactions[i] << p
@transactions[i] << p.commission.menu_item.name
end
render json: @transactions
end
private
# Use callbacks to share common setup or constraints between actions.
def set_commissioner
@commissioner = Commissioner.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def commissioner_params
params.require(:commissioner).permit(:name, :emp_id, :created_by, :commission_id, :joined_date, :resigned_date, :is_active)
end
end

View File

@@ -1,4 +1,4 @@
class Origami::CommissionsController < BaseOrigamiController class Settings::CommissionsController < ApplicationController
before_action :set_commission, only: [:show, :edit, :update, :destroy] before_action :set_commission, only: [:show, :edit, :update, :destroy]
# GET /commissions # GET /commissions
@@ -27,10 +27,11 @@ class Origami::CommissionsController < BaseOrigamiController
# POST /commissions.json # POST /commissions.json
def create def create
@commission = Commission.new(commission_params) @commission = Commission.new(commission_params)
@commission.product_type = 'menu_item'
respond_to do |format| respond_to do |format|
if @commission.save if @commission.save
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully created.'} format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully created.'}
format.json {render :show, status: :created, location: @commission} format.json {render :show, status: :created, location: @commission}
else else
format.html {render :new} format.html {render :new}
@@ -44,7 +45,7 @@ class Origami::CommissionsController < BaseOrigamiController
def update def update
respond_to do |format| respond_to do |format|
if @commission.update(commission_params) if @commission.update(commission_params)
format.html {redirect_to origami_commission_path(@commission), notice: 'Commission was successfully updated.'} format.html {redirect_to settings_commission_path(@commission), notice: 'Commission was successfully updated.'}
format.json {render :show, status: :ok, location: @commission} format.json {render :show, status: :ok, location: @commission}
else else
format.html {render :edit} format.html {render :edit}
@@ -58,7 +59,7 @@ class Origami::CommissionsController < BaseOrigamiController
def destroy def destroy
@commission.destroy @commission.destroy
respond_to do |format| respond_to do |format|
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.'} format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully destroyed.'}
format.json {head :no_content} format.json {head :no_content}
end end
end end
@@ -96,6 +97,6 @@ class Origami::CommissionsController < BaseOrigamiController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def commission_params def commission_params
params.require(:commission).permit(:product_id, :amount, :commission_type, :is_active) params.require(:commission).permit(:product_type, :product_code, :amount, :commission_type, :is_active)
end end
end end

View File

@@ -79,7 +79,7 @@ class Settings::SimpleMenuItemsController < ApplicationController
respond_to do |format| respond_to do |format|
if @settings_menu_item.save if @settings_menu_item.save
menu_item = MenuItem.find(@settings_menu_item.id) menu_item = MenuItem.find(@settings_menu_item.id)
menu_item.update_attributes(item_options: params[:simple_menu_item][:item_options]) menu_item.update_attributes(item_attributes: params[:simple_menu_item][:item_attributes], item_options: params[:simple_menu_item][:item_options])
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' } format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' }
format.json { render :show, status: :created, location: @settings_menu_item } format.json { render :show, status: :created, location: @settings_menu_item }

View File

@@ -0,0 +1,66 @@
class DatePickerInput < SimpleForm::Inputs::StringInput
def input(wrapper_options)
set_html_options
set_value_html_option
template.content_tag :div, class: 'input-group date datetimepicker' do
input = super(wrapper_options) # leave StringInput do the real rendering
input + input_button
end
end
def input_html_classes
super.push '' # 'form-control'
end
private
def input_button
template.content_tag :span, class: 'input-group-btn' do
template.content_tag :button, class: 'btn btn-default', type: 'button' do
template.content_tag :span, '', class: 'fa fa-calendar'
end
end
end
def set_html_options
input_html_options[:type] = 'text'
input_html_options[:data] ||= {}
input_html_options[:data].merge!(date_options: date_options)
end
def set_value_html_option
return unless value.present?
input_html_options[:value] ||= I18n.localize(value, format: display_pattern)
end
def value
object.send(attribute_name) if object.respond_to? attribute_name
end
def display_pattern
I18n.t('datepicker.dformat', default: '%d/%m/%Y')
end
def picker_pattern
I18n.t('datepicker.pformat', default: 'DD/MM/YYYY')
end
def date_view_header_format
I18n.t('dayViewHeaderFormat', default: 'MMMM YYYY')
end
def date_options_base
{
locale: I18n.locale.to_s,
format: picker_pattern,
dayViewHeaderFormat: date_view_header_format
}
end
def date_options
custom_options = input_html_options[:data][:date_options] || {}
date_options_base.merge!(custom_options)
end
end

View File

@@ -0,0 +1,13 @@
class DatetimePickerInput < DatePickerInput
private
def display_pattern
I18n.t('datepicker.dformat', default: '%d/%m/%Y') + ' ' +
I18n.t('timepicker.dformat', default: '%R')
end
def picker_pattern
I18n.t('datepicker.pformat', default: 'DD/MM/YYYY') + ' ' +
I18n.t('timepicker.pformat', default: 'HH:mm')
end
end

View File

@@ -0,0 +1,15 @@
class TimePickerInput < DatePickerInput
private
def display_pattern
I18n.t('timepicker.dformat', default: '%R')
end
def picker_pattern
I18n.t('timepicker.pformat', default: 'HH:mm')
end
def date_options
date_options_base
end
end

View File

@@ -1,5 +1,15 @@
class Commission < ApplicationRecord class Commission < ApplicationRecord
belongs_to :menu_item, foreign_key: 'product_id' self.primary_key = 'commission_id'
# primary key - need to be unique
before_create :generate_custom_id
belongs_to :menu_item, foreign_key: 'product_code'
has_many :commissioners has_many :commissioners
has_many :product_commissions has_many :product_commissions
private
def generate_custom_id
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
end
end end

View File

@@ -1,6 +1,6 @@
class Commissioner < ApplicationRecord class Commissioner < ApplicationRecord
belongs_to :employee, foreign_key: 'emp_id' belongs_to :employee, foreign_key: 'emp_id'
belongs_to :commission, foreign_key: 'commission_type' belongs_to :commission, foreign_key: 'commission_id'
has_many :in_juties has_many :in_juties
has_many :product_commissions has_many :product_commissions
scope :active, -> { where(is_active: true) } scope :active, -> { where(is_active: true) }

View File

@@ -91,46 +91,54 @@ class Customer < ApplicationRecord
auth_token = memberaction.auth_token.to_s auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL") @customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
@customers.each do |customer| @customers.each do |customer|
begin member_params = { name: customer.name,phone: customer.contact_no,
response = HTTParty.post(url, email: customer.email,dob: customer.date_of_birth,
:body => address: customer.address,nrc:customer.nrc_no,
{ name: customer.name,phone: customer.contact_no, card_no:customer.card_no,member_group_id: customer.membership_type,
email: customer.email,dob: customer.date_of_birth, merchant_uid:merchant_uid,auth_token:auth_token}.to_json
address: customer.address,nrc:customer.nrc_no,
card_no:customer.card_no,member_group_id: customer.membership_type,
merchant_uid:merchant_uid,auth_token:auth_token
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
})
rescue Net::OpenTimeout
response = { status: false, message: "Server Time out" }
rescue OpenURI::HTTPError
response = { status: false, message: "Can't connect server"}
rescue SocketError # Check for paypar account exists
response = { status: false, message: "Can't connect server"} # if paypar_account_no != nil || paypar_account_no != ''
end if paypar_account_no.present?
member_params = { name: customer.name,phone: customer.contact_no,
email: customer.email,dob: customer.date_of_birth,
address: customer.address,nrc:customer.nrc_no,
paypar_account_no: customer.paypar_account_no,
card_no:customer.card_no,member_group_id: customer.membership_type,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
if response["status"] == true begin
status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) response = HTTParty.post(url,
end :body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
})
rescue Net::OpenTimeout
response = { status: false, message: "Server Time out" }
rescue OpenURI::HTTPError
response = { status: false, message: "Can't connect server"}
rescue SocketError
response = { status: false, message: "Can't connect server"}
end
if response["status"] == true
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
end
end end
end end
def self.update_rebate def self.update_rebate
sales = Sale.where("rebate_status = 'false'") sales = Sale.where("rebate_status = 'false'")
sales.each do |sale| sales.each do |sale|
if sale.customer.membership_id if sale.customer.membership_id
response = self.rebat(Sale.find(sale.sale_id)) response = self.rebat(Sale.find(sale.sale_id))
puts response.to_json
if response["status"] == true if response["status"] == true
status = sale.update_attributes(rebate_status: "true") status = sale.update_attributes(rebate_status: "true")
end end
@@ -188,12 +196,44 @@ class Customer < ApplicationRecord
response = { "status": false, "message": "Can't connect server"} response = { "status": false, "message": "Can't connect server"}
end end
return response return response
puts response.to_json
end end
end end
end end
def self.search_paypar_account_no(account_no)
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("search_paypar_account_no")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
begin
response = HTTParty.get(url,
:body => { paypar_account_no:account_no,
merchant_uid:merchant_uid,
auth_token:auth_token
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
},
:timeout => 10
)
rescue HTTParty::Error
response = {status: false, message: "Server Error"}
rescue Net::OpenTimeout
response = { status: false , message: "Server Time out"}
rescue OpenURI::HTTPError
response = { status: false, message: "Can't connect server"}
rescue SocketError
response = { status: false, message: "Can't connect server"}
end
return response
end
def self.search(search) def self.search(search)
if search if search
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])

View File

@@ -1,6 +1,6 @@
class MenuItemAttribute < ApplicationRecord class MenuItemAttribute < ApplicationRecord
validates_presence_of :attribute_type, :name, :value validates_presence_of :attribute_type, :name, :value
def self.collection def self.collection
MenuItemAttribute.select("name, value").map { |e| [e.name, e.value] } MenuItemAttribute.select("name").map { |e| [e.name, e.name] }
end end
end end

View File

@@ -90,7 +90,7 @@ class Order < ApplicationRecord
# self.employee_name) # self.employee_name)
# end # end
OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id], OrderItem.processs_item(menu_item[:item_code], item[:item_instance_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id],
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
self.employee_name) self.employee_name)

View File

@@ -20,11 +20,12 @@ class OrderItem < ApplicationRecord
# option_values : [], # option_values : [],
# sub_order_items : [], # sub_order_items : [],
# } # }
def self.processs_item (item_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by) def self.processs_item (item_code, instance_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by)
orderitem = OrderItem.create do |oitem| orderitem = OrderItem.create do |oitem|
oitem.order_id = order_id oitem.order_id = order_id
oitem.item_code = item_code oitem.item_code = item_code
oitem.item_instance_code = instance_code
oitem.item_name = menu_name oitem.item_name = menu_name
oitem.alt_name = alt_name oitem.alt_name = alt_name
oitem.account_id = account_id oitem.account_id = account_id

View File

@@ -5,7 +5,14 @@ class ProductCommission < ApplicationRecord
belongs_to :sale_item, foreign_key: 'sale_item_id' belongs_to :sale_item, foreign_key: 'sale_item_id'
belongs_to :sale, foreign_key: 'sale_id' belongs_to :sale, foreign_key: 'sale_id'
def self.check_product_commission(sale_item_id) def self.get_transaction(from, to, commissioner)
transaction = self.all
if !from.nil? && !to.nil?
transaction = transaction.where('updated_at between ? and ?', from, to)
end
if commissioner != 0
transaction = transaction.where(commissioner_id: commissioner)
end
return transaction
end end
end end

View File

@@ -23,12 +23,13 @@ class Promotion < ApplicationRecord
end end
def self.is_between_promo_datetime(current_day,current_time) #database is not local time def self.is_between_promo_datetime(current_day,current_time) #database is not local time
promoList = Promotion.where("(TO_CHAR(promo_start_date, 'YYYY-MM-DD') <=? AND TO_CHAR(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time) promoList = Promotion.where("(date_format(promo_start_date, 'YYYY-MM-DD') <=? AND date_format(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
return promoList return promoList
end end
def self.combine_item(saleObj) def self.combine_item(saleObj)
itemList = saleObj.sale_items.group(:product_code).sum(:qty) order_id = saleObj.sale_orders[0].order_id
itemList = OrderItem.where("order_id = ?", order_id).group(:item_instance_code).sum(:qty)
end end
def self.is_promo_day(promoList, day, orderitemList, sale_id) def self.is_promo_day(promoList, day, orderitemList, sale_id)
@@ -44,7 +45,8 @@ class Promotion < ApplicationRecord
end end
def self.find_promo_item(promo, orderitem, sale_id) def self.find_promo_item(promo, orderitem, sale_id)
if promo.original_product.to_s == orderitem[0].to_s item_code = OrderItem.find_by_item_instance_code(orderitem[0]).item_code
if promo.original_product.to_s == item_code
if promo.min_qty.to_i > orderitem[1].to_i if promo.min_qty.to_i > orderitem[1].to_i
return false return false
else else
@@ -69,13 +71,13 @@ class Promotion < ApplicationRecord
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id) give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id)
elsif promo.promo_type == Promotion::PROMO_TYPE4 elsif promo.promo_type == Promotion::PROMO_TYPE4
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id) give_promotion_discount(same,promo_product,promo.min_qty, orderitem, sale_id)
end end
end end
def self.check_giveaway_product(promo, orderitem) def self.check_giveaway_product(promo, orderitem)
promo.promotion_products.each do |promo_product| promo.promotion_products.each do |promo_product|
if promo_product.item_code == orderitem if promo_product.item_code == OrderItem.find_by_item_instance_code(orderitem).item_code
return true, promo_product return true, promo_product
else else
return false, promo_product return false, promo_product
@@ -110,7 +112,13 @@ class Promotion < ApplicationRecord
else else
charge_qty += qty charge_qty += qty
end end
item = OrderItem.find_by_item_code(orderitem[0]) item = OrderItem.find_by_item_instance_code(orderitem[0])
byebug
# if promo_product == OrderItem.find_by_item_instance_code(orderitem[0]).item_code
# item = OrderItem.find_by_item_instance_code(orderitem[0])
# else
# item = OrderItem.find_by_item_code(promo_product)
# end
update_existing_item(foc_qty, item, sale_id, "promotion", item.price) update_existing_item(foc_qty, item, sale_id, "promotion", item.price)
puts "Charged - " + charge_qty.to_s puts "Charged - " + charge_qty.to_s
@@ -124,7 +132,7 @@ class Promotion < ApplicationRecord
if (foc_qty < promotion_qty) if (foc_qty < promotion_qty)
promotion_qty = foc_qty promotion_qty = foc_qty
end end
item = OrderItem.find_by_item_code(promo_product) item = OrderItem.find_by_item_instance_code(promo_product,orderID)
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price) update_existing_item(promotion_qty, item, sale_id, "promotion", item.price)
end end
@@ -138,8 +146,8 @@ class Promotion < ApplicationRecord
sale_item.remark = type sale_item.remark = type
sale_item.qty = foc_qty * (-1) sale_item.qty = foc_qty * (-1)
sale_item.unit_price = item_price * (-1) sale_item.unit_price = item_price # * (-1)
sale_item.taxable_price = item_price * (-1) sale_item.taxable_price = item_price # * (-1)
sale_item.price = foc_qty * item_price * (-1) sale_item.price = foc_qty * item_price * (-1)
sale_item.is_taxable = false sale_item.is_taxable = false
@@ -156,11 +164,11 @@ class Promotion < ApplicationRecord
if same if same
foc_qty = orderitem[1].to_i / foc_min_qty foc_qty = orderitem[1].to_i / foc_min_qty
item = OrderItem.find_by_item_code(orderitem[0]) item = OrderItem.find_by_item_instance_code(orderitem[0])
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off) update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off)
else else
foc_qty = find_second_item_qty(sale_id, promo_product.item_code) foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
item = OrderItem.find_by_item_code(promo_product.item_code) item = OrderItem.find_by_item_instance_code(promo_product.item_code)
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off) update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off)
end end
end end
@@ -170,12 +178,12 @@ class Promotion < ApplicationRecord
if same if same
foc_qty = orderitem[1].to_i / foc_min_qty foc_qty = orderitem[1].to_i / foc_min_qty
item = OrderItem.find_by_item_code(orderitem[0]) item = OrderItem.find_by_item_instance_code(orderitem[0]) # need to specify with menu item instance
price = item.price - promo_product.net_price price = item.price.to_i - promo_product.net_price.to_i
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price) update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
else else
foc_qty = find_second_item_qty(sale_id, promo_product.item_code) foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
item = OrderItem.find_by_item_code(promo_product.item_code) item = OrderItem.find_by_item_instance_code(promo_product.item_code)
price = item.price - promo_product.net_price price = item.price - promo_product.net_price
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price) update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
end end
@@ -186,14 +194,16 @@ class Promotion < ApplicationRecord
if same if same
foc_qty = orderitem[1].to_i / foc_min_qty foc_qty = orderitem[1].to_i / foc_min_qty
item = OrderItem.find_by_item_code(orderitem[0]) item = OrderItem.find_by_item_instance_code(orderitem[0])
total = orderitem[1].to_i * item.price # total = orderitem[1].to_i * item.price
total = item.price
price = calculate_discount(total, promo_product.percentage) price = calculate_discount(total, promo_product.percentage)
update_existing_item(foc_qty, item, sale_id, "promotion discount", price) update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
else else
foc_qty = find_second_item_qty(sale_id, promo_product.item_code) foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
item = OrderItem.find_by_item_code(promo_product.item_code) item = OrderItem.find_by_item_instance_code(promo_product.item_code)
total = item.price * foc_qty # total = item.price * foc_qty
total = item.price
price = calculate_discount(total, promo_product.percentage) price = calculate_discount(total, promo_product.percentage)
update_existing_item(foc_qty, item, sale_id, "promotion discount", price) update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
end end
@@ -203,7 +213,7 @@ class Promotion < ApplicationRecord
saleObj = Sale.find_by_sale_id(sale_id) saleObj = Sale.find_by_sale_id(sale_id)
itemList = combine_item(saleObj) itemList = combine_item(saleObj)
itemList.each do |item| itemList.each do |item|
if item[0] == promo_item if OrderItem.find_by_item_instance_code(item[0]).item_code == promo_item
return item[1] return item[1]
end end
end end

View File

@@ -324,7 +324,6 @@ class SalePayment < ApplicationRecord
update_shift update_shift
end end
end end
end end
# update for cashier shift # update for cashier shift

View File

@@ -17,5 +17,4 @@ if (menu.menu_categories)
end end
end end
end end
end end

View File

@@ -1,44 +1,82 @@
# Format for attributes json # Format for attributes json
attr_format = [] attr_format = []
param_count = item.item_attributes.count # Format for attributes json
# Format for attributes json if item.item_attributes.count > 0
item.item_attributes.each do|attr_id| item.item_attributes.each do|attr_id|
menu_attr = MenuItemAttribute.find(attr_id) menu_attr = MenuItemAttribute.find(attr_id)
if attr_format.count == 0 if attr_format.count == 0
attr_format.push({ type: menu_attr.attribute_type, value: [] }) attr_format.push({ type: menu_attr.attribute_type, values: [menu_attr.name] })
end next
attr_format.each do |af|
if menu_attr.attribute_type == af[:type]
af[:value].push(menu_attr.value)
else
new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
attr_format.push(new_attr)
end end
break if attr_format.count > param_count
end
param_count -= 1 attr_format.each do |af|
if menu_attr.attribute_type.in? attr_format.map {|k| k[:type]}
if menu_attr.attribute_type == af[:type]
af[:values].push(menu_attr.name)
end
else
new_attr = {type: menu_attr.attribute_type, values: [ menu_attr.name ] }
attr_format.push(new_attr)
break
end
end
end
end
# Format for option json
opt_format = []
# Format for attributes json
if item.item_options.count > 0
item.item_options.each do|opt|
menu_opt = MenuItemOption.find(opt)
if opt_format.count == 0
opt_format.push({ type: menu_opt.option_type, values: [menu_opt.name] })
next
end
opt_format.each do |of|
if menu_opt.option_type.in? opt_format.map {|k| k[:type]}
if menu_opt.option_type == of[:type]
of[:values].push(menu_opt.name)
end
else
new_opt = {type: menu_opt.option_type, values: [ menu_opt.name ] }
opt_format.push(new_opt)
break
end
end
end
end end
#Menu Item Information #Menu Item Information
json.id item.id json.id item.id
json.item_code item.item_code json.code item.item_code
json.name item.name json.name item.name
json.alt_name item.alt_name json.alt_name item.alt_name
json.image item.image_path.url json.image item.image_path.url
json.description item.description json.description item.description
json.Information item.information json.information item.information
json.type item.type json.type item.type
json.account_id item.account_id json.account_id item.account_id
json.min_qty item.min_qty json.min_qty item.min_qty
json.is_available item.is_available json.is_available item.is_available
json.is_sub_item item.is_sub_item json.is_sub_item item.is_sub_item
json.unit item.unit json.unit item.unit
json.item_sets item.item_sets
# Item Sets of Menu Item
json.item_sets item.item_sets do |its|
json.id its.id
json.name its.name
json.alt_name its.alt_name
json.min_selectable_qty its.min_selectable_qty
json.max_selectable_qty its.max_selectable_qty
json.instances its.menu_item_instances do |i|
json.id i.id
end
end
json.attributes attr_format json.attributes attr_format
json.options item.item_options json.options opt_format
# json.min_selectable_item item.min_selectable_item # json.min_selectable_item item.min_selectable_item
# json.max_selectable_item item.max_selectable_item # json.max_selectable_item item.max_selectable_item
@@ -52,6 +90,7 @@ json.options item.item_options
# json.item_attributes = item_instance.item_attributes # json.item_attributes = item_instance.item_attributes
json.instances item.menu_item_instances do |is| json.instances item.menu_item_instances do |is|
json.id is.id
json.code is.item_instance_code json.code is.item_instance_code
json.name is.item_instance_name json.name is.item_instance_name
json.price is.price json.price is.price
@@ -59,8 +98,8 @@ json.options item.item_options
json.is_default is.is_default json.is_default is.is_default
json.is_on_promotion is.is_on_promotion json.is_on_promotion is.is_on_promotion
json.promotion_price is.promotion_price json.promotion_price is.promotion_price
json.item_attributes is.item_attributes json.values is.item_attributes
json.item_sets is.item_sets # json.item_sets is.item_sets
end end
#Child Menu items #Child Menu items

View File

@@ -1,4 +1,4 @@
json.array! @menus do |menu| menu_json = json.array! @menus do |menu|
json.id menu.id json.id menu.id
json.name menu.name json.name menu.name
json.valid_days menu.valid_days json.valid_days menu.valid_days
@@ -12,3 +12,4 @@ json.array! @menus do |menu|
# end # end
# end # end
end end

View File

@@ -169,6 +169,7 @@
if(cardNo.length == 16){ if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo); $("#paypar_account_no").val(cardNo);
$("#search").val(cardNo); $("#search").val(cardNo);
$("#type").val("card");
} }
} }
</script> </script>

View File

@@ -25,6 +25,7 @@
<%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %> <%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
<div class="input-append col-md-7 form-group pull-left"> <div class="input-append col-md-7 form-group pull-left">
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control input-xs col-md-9"> <input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control input-xs col-md-9">
<input type="hidden" name="type" id="type" value="">
<button type="submit" class="btn btn-primary btn-md">Search</button> <button type="submit" class="btn btn-primary btn-md">Search</button>
<!-- <a href="modal-window" data-toggle= "modal" data-target="#modal-window" class="btn btn-primary btn-md" id="card_read" >Read Card</a> --> <!-- <a href="modal-window" data-toggle= "modal" data-target="#modal-window" class="btn btn-primary btn-md" id="card_read" >Read Card</a> -->

View File

@@ -28,8 +28,8 @@
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li> <li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" /> <hr class="hr_advance" />
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li> <li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
<li><%= link_to "Commissions", origami_commissions_path , :tabindex =>"-1" %></li> <li><%= link_to "Commissions", settings_commissions_path , :tabindex =>"-1" %></li>
<li><%= link_to "Commissioners", origami_commissioners_path , :tabindex =>"-1" %></li> <li><%= link_to "Commissioners", settings_commissioners_path , :tabindex =>"-1" %></li>
<hr class="hr_advance" /> <hr class="hr_advance" />
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li> <li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" /> <hr class="hr_advance" />
@@ -55,6 +55,7 @@
<li><%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %></li> <li><%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %></li> <li><%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %></li> <li><%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Commission Report", reports_commission_index_path, :tabindex =>"-1" %></li>
</ul> </ul>
</li> </li>
<li class="navbar-nav mr-auto"> <li class="navbar-nav mr-auto">

View File

@@ -49,48 +49,6 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Large modal -->
<button class="btn btn-primary" data-toggle="modal" data-target=".sx_item_detailModal">Large modal</button>
<div class="modal fade sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;">
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-5">
<%= image_tag "logo.png" ,width: '', height: '', :style => '' %>
<br><br>
<div class="form-group">
<h4 class="col-md-12">Quantity</h4>
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
</div>
<div class="form-group row">
<h4 class="col-md-6">Total</h4>
<h4 class="col-md-6" id="total_price"> 2500 Ks</h4>
</div>
</div>
<div class="col-md-7">
<h4>Options</h4>
<h4>Attributes</h4>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal" id="save_order">Add Order</button>
</div>
</div>
</div>
</div>
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true"> <div class="modal fade" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true">
@@ -130,6 +88,51 @@
</div> </div>
</div> </div>
<!-- Large modal -->
<div class="modal fade sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;">
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-5">
<%= image_tag "logo.png" ,width: '', height: '', :style => '' %>
<br><br>
<div class="form-group">
<h4 class="col-md-12">Quantity</h4>
<input type="number" name="qty" class="form-control col-md-12 input-number change_qty" id="change_qty" value="" min="1" max="100">
</div>
<div class="form-group row">
<h4 class="col-md-6">Total</h4>
<h4 class="col-md-6" id="total_price"></h4>
<p class="hidden" id="unit_price"></p>
</div>
</div>
<div class="col-md-7 item-detail">
<div class="hide attr-alert alert-danger" role="alert">
<strong>Oh !</strong>Have not attribute for this item Please select another attribute .
</div>
<div class="attributes-list">
</div>
<div class="option-list">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success add_to_order" data-dismiss="modal" id="add_to_order">Add to Order</button>
</div>
</div>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
@@ -141,6 +144,13 @@ $(function(){
show_menu_item_list(url); show_menu_item_list(url);
}); });
//End menu category Click //End menu category Click
$(".change_qty").change(function(){
qty = $(this).val();
price = $("#unit_price").text();
$("#total_price").text(qty*price);
});
//show menu item list when click menu category //show menu item list when click menu category
function show_menu_item_list(url_item){ function show_menu_item_list(url_item){
@@ -154,43 +164,36 @@ $(function(){
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
console.log(data);
var menu_items_list = $('.menu_items_list'); var menu_items_list = $('.menu_items_list');
menu_items_list.empty(); menu_items_list.empty();
menu_items = data.menu_items; menu_items = data.menu_items;
console.log(data);
for(var field in menu_items) { for(var field in menu_items) {
instances = menu_items[field].instances ;
var code = menu_items[field].instances[0].code $(instances).each(function(i){
var name = menu_items[field].instances[0].name if (instances[i].is_default === true) {
var price = parseFloat(menu_items[field].instances[0].price).toFixed(2); code = instances[i].code;
var is_available = menu_items[field].instances[0].is_available name = instances[i].name;
var is_on_promotion = menu_items[field].instances[0].is_on_promotion price = parseFloat(instances[i].price).toFixed(2);
var item_attributes = menu_items[field].instances[0].item_attributes is_available = instances[i].is_available ;
var promotion_price = menu_items[field].instances[0].promotion_price is_on_promotion = instances[i].is_on_promotion;
item_attributes = instances[i].values;
promotion_price = instances[i].promotion_price;
code = instances[i].code;
}
});
row = '<div class="card">'
row = '<div class="card">'
+'<div class="card-head" style="line-height:14px;">' +'<div class="card-head" style="line-height:14px;">'
+'<small class="col-md-9">'+ menu_items[field].name +'</small>' +'<small class="col-md-9">'+ menu_items[field].name +'</small>'
+'<div class="col-md-3 add_icon"' +"<div class='col-md-3 add_icon' data-item-code='"+ menu_items[field].code +"' data-name='"+ menu_items[field].name +"' data-price = '"+ price +"' data-instance-code = '"+ code +"' data-instance = '"+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"+ JSON.stringify(item_attributes) +"'>"
+'data-id="'+ menu_items[field].name +'"'
+'data-item-code="'+ menu_items[field].item_code +'"'
+'data-name="'+ menu_items[field].name +'"'
+'data-price="'+ price +'"'
+'data-available="'+ is_available +'"'
+'data-promotion="'+ is_on_promotion +'"'
+'data-attributes="'+ item_attributes +'"'
+'data-instance-code="'+ code +'"'
+'data-instance="'+ name +'"'
+'data-promotion-price="'+ promotion_price +'"'
+'>'
+'<i class="fa fa-plus "' +'<i class="fa fa-plus "'
+ 'style="margin-top:4px;">' + 'style="margin-top:4px;">'
+'</i></div>' +'</i></div>'
+'</div>' +'</div>'
+'<div class="menu_item_box" data-toggle="modal" data-target=".sx_item_detailModal">' +"<div class='menu_item_box' data-instance = '"+JSON.stringify(menu_items[field].instances)+"' data-id = '"+JSON.stringify(menu_items[field].attributes)+"' data-item = '"+JSON.stringify(item_attributes)+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
+'<div class="card-block">' +'<div class="card-block">'
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>' +'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
+'</div>' +'</div>'
@@ -206,7 +209,115 @@ $(function(){
}); });
//end Ajax //end Ajax
} }
//end show detail function //end show list function
//click item row for add order
$(document).on('click', '.menu_item_box', function(event){
$('.attributes-list').empty();
$('.attr-alert').addClass('hide');
data = $(this).parent().children().children('.add_icon');
attributes = $(this).data('id');
selected_item = $(this).data('item');
instances = $(this).data('instance');
for(var field in attributes) {
value = attributes[field]["values"];
type = attributes[field]["type"]
row = "<h4>"+attributes[field]["type"]+"</h4>"
$(value).each(function(i){
status ="";
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
status = "selected-option";
}
row +="<button id='selected-option' data-instances='"+JSON.stringify(instances)+"' data-type='"+type+"' data-value='"+value[i]+"' class='btn btn-default attribute_btn "+ status +" "+ type +" '>"+value[i]+"</button>";
});
$(".attributes-list").append(row);
}
$('#change_qty').val(1);
$('#title_name').text(data.attr('data-name'));
$('#item_code').text(data.attr('data-item-code'));
$('#total_price').text(data.attr('data-price'));
$('#unit_price').text(data.attr('data-price'));
});
// click select option icon for add
$(document).on('click', '.attribute_btn', function(event){
value = $(this).data('value');
type = $(this).data('type');
instances = $(this).data('instances');
console.log(instances);
if ($(".attribute_btn").attr("data-type")==type){
$('.'+type).removeClass("selected-option");
}
$(this).addClass('selected-option');
selected_item = $('.selected-option').text();
qty = $('#change_qty').val();
total_price = 0;
for(var field in instances) {
item_attr = instances[field].values;
if(parseInt(jQuery.inArray(selected_item, item_attr))!== -1){
unit_price = instances[field].price
total_price = qty * unit_price
$('#instance_name').text(instances[field].name);
$('#instance_code').text(instances[field].code);
$('#promotion_price').text(instances[field].promotion_price);
$('#total_price').text(total_price);
$('#unit_price').text(unit_price);
}
}
if (total_price == 0) {
$('.attr-alert').removeClass('hide');
$('#total_price').text(total_price);
}else{
$('.attr-alert').addClass('hide');
$('#total_price').text(total_price);
}
}); //End selecct attribute buttom
// click add order
$(document).on('click', '.add_to_order', function(event){
total_price = $('#total_price').text();
unit_price = $('#unit_price').text();
qty = $('#change_qty').val();
var item_row = $('.selected-option');
var arr = [];
var attribute_arr = [];
$(item_row).each(function(i){
value = $(item_row[i]).attr('data-value');
arr = {value};
});
console.log(arr);
if(total_price > 0){
$('.add_to_order').attr('data-item-code',$('#item_code').text());
$('.add_to_order').attr('data-name',$('#title_name').text());
$('.add_to_order').attr('data-price',unit_price);
$('.add_to_order').attr('data-instance-code',$('#instance_code').text());
$('.add_to_order').attr('data-instance',$('#instance_name').text());
$('.add_to_order').attr('data-promotion-price',$('#promotion_price').text());
$('.add_to_order').attr('data-attributes',$('#instance_name').text());
var item_data = $(this);
show_item_detail(item_data);
calculate_sub_total();
}else{
$.alert({
title: 'Alert!',
content: 'Please select another item',
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
}
}); //End Add Icon Click
// click plus icon for add // click plus icon for add
$(document).on('click', '.add_icon', function(event){ $(document).on('click', '.add_icon', function(event){
@@ -219,9 +330,9 @@ $(function(){
qty = 1; qty = 1;
append = 0; append = 0;
price = parseFloat(data.attr('data-price')).toFixed(2); price = parseFloat(data.attr('data-price')).toFixed(2);
instance_code = data.attr('data-instance'); instance_name = data.attr('data-instance');
if (instance_code == "undefined"){ if (instance_name == "undefined"){
instance = ''; instance = '';
}else{ }else{
instance = "("+data.attr('data-instance')+")"; instance = "("+data.attr('data-instance')+")";
@@ -231,11 +342,13 @@ $(function(){
var item_row = $('.summary-items tbody tr'); var item_row = $('.summary-items tbody tr');
$(item_row).each(function(i){ $(item_row).each(function(i){
if ($(item_row[i]).attr('data-code') == data.attr('data-item-code')) { item_code = $(item_row[i]).attr('data-code');
instance_code = $(item_row[i]).attr('data-instance-code');
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')) {
qty = parseInt($(item_row[i]).children('#item_qty').text()) +1; qty = parseInt($(item_row[i]).children('#item_qty').text()) +1;
$(item_row[i]).children('#item_qty').text(qty); $(item_row[i]).children('#item_qty').text(qty);
parseFloat($(item_row[i]).children('#item_price').text(price*qty)).toFixed(2); parseFloat($(item_row[i]).children('#item_price').text(price*qty)).toFixed(2);
append = 1; append = 1;
}else{ }else{
qty = 1; qty = 1;
@@ -243,9 +356,9 @@ $(function(){
}); });
if (append===0) { if (append===0) {
row ="<tr class='item_box' data-price ='"+price+ "'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"+instance+ "'data-code='"+data.attr('data-item-code')+"'>" row ="<tr class='item_box' data-price ='"+price+ "'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"+data.attr('data-instance-code')+"' data-attributes='"+data.attr('data-attributes')+"'>"
+'<td class="item-cell-no">'+rowCount+'</td>' +'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance + '</td>' +'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance +'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>' +'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">' +'<td class="item-cell-price" id="item_price">'
+ parseFloat(price).toFixed(2) + parseFloat(price).toFixed(2)
@@ -253,7 +366,6 @@ $(function(){
+'</tr>'; +'</tr>';
$(".summary-items tbody").append(row); $(".summary-items tbody").append(row);
} }
} }
//click item row for update qty //click item row for update qty
@@ -265,14 +377,6 @@ $(function(){
$('#modal-qty').val(qty); $('#modal-qty').val(qty);
}); });
//click item row for update qty
$(document).on('click', '.menu_item_box', function(event){
data = $(this).parent().children().children('.add_icon');
$('#title_name').text(data.attr('data-name'));
console.log(data);
});
//click remove buttom in modal box //click remove buttom in modal box
$('#sx_itemModal').on('click','#remove', function(){ $('#sx_itemModal').on('click','#remove', function(){
$('.summary-items tr').filter(function(){ $('.summary-items tr').filter(function(){
@@ -321,7 +425,6 @@ $(function(){
function summary_items_filter(){ function summary_items_filter(){
$('.summary-items tr').filter(function(){ $('.summary-items tr').filter(function(){
if ($(this).attr('data-active') == 'true'){ if ($(this).attr('data-active') == 'true'){
qty = $('#modal-qty').val(); qty = $('#modal-qty').val();
price = parseFloat($(this).attr('data-price')); price = parseFloat($(this).attr('data-price'));
@@ -406,6 +509,17 @@ $(function(){
padding-top: 100px; padding-top: 100px;
} }
.selected-option {
color: #fff !important;
background-color: green !important;
}
.attribute_btn {
white-space: normal !important;
height: 60px;
width: 90px;
margin-bottom: 5px;
margin-right: 5px;
}
</style> </style>

View File

@@ -1,21 +0,0 @@
<div class="col-md-3">
<%= simple_form_for([:origami, @commissioner]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.label :emp_id %>
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %><br/>
<%= f.label :commission_type %>
<%= f.select :commission_type, Commission.all.map{ |l| [l.menu_item.name, l.id] } %>
<br/>
<label><%= f.check_box :is_active %> Active </label>
</div><br/>
<div class="form-actions">
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>

View File

@@ -1,47 +0,0 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Commissioner</h4>
<table class="table">
<tbody>
<tr>
<td style="width:20%">Name</td>
<td><%= @commissioner.name %></td>
</tr>
<tr>
<td style="width:20%">Employee Name</td>
<td>
<%= @commissioner.employee.name rescue '-' %>
</td>
</tr>
<tr>
<td style="width:20%">Commission Type</td>
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Active</td>
<td><%= @commissioner.is_active %></td>
</tr>
<tr>
<td style="width:20%">Created By</td>
<td><%= Employee.find(@commissioner.created_by).name %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_commissioner_path(@commissioner), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
</div>
</div>
</div>

View File

@@ -22,6 +22,7 @@
<%= form_tag path, :id => "filter_form", :method => :get do %> <%= form_tag path, :id => "filter_form", :method => :get do %>
<div class="input-append col-md-7 form-group pull-left"> <div class="input-append col-md-7 form-group pull-left">
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-9"> <input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-9">
<input type="hidden" name="type" id="type" value="">
<button type="submit" class="btn btn-primary btn-sm">Search</button> <button type="submit" class="btn btn-primary btn-sm">Search</button>
</div> </div>
<% end %> <% end %>
@@ -258,12 +259,23 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "get_customer" , url: "get_customer" ,
data: { filter : customer_mamber_card_no }, data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
customer_id = data[0].customer_id; if (data[0].customer_id == false) {
customer_name = data[0].name; $.alert({
update_sale(customer_id, customer_name,sale_id); title: 'Alert!',
content: data[0].message,
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id);
}
} }
}); });
} }
@@ -282,6 +294,7 @@
if(cardNo.length == 16){ if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo); $("#paypar_account_no").val(cardNo);
$("#search").val(cardNo); $("#search").val(cardNo);
$("#type").val("card")
} }
} }

View File

@@ -1,40 +1,43 @@
<%= simple_form_for @in_juty,:url => origami_create_for_in_juty_path, :method => :post do |f| %> <%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :method => :post do |f| %>
<span class="patch_method"></span> <span class="patch_method"></span>
<%= f.error_notification %> <%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-inputs">
<%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %>
<label>Dining Name:</label>
<%= @table.name %>
<br/>
<br/>
<label>Commissioner Name:</label>
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
<br/><br/>
<%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %>
<%= f.input :out_time, :placeholder => "From Date", :class => "form-control" %>
</div><br>
<div class="form-group">
<%= f.button :submit, "Create", :class => 'btn btn-primary ', :id => 'create' %>
<%= f.button :submit, "Update", :class => 'btn btn-primary ', :disabled => '', :id => 'update' %>
<%= f.button :button, "Reset", :class => 'btn btn-danger ', :id => 'reset' %>
</div>
<div class="form-inputs">
<%= f.hidden_field :dinning_id,:value => @table.id, :class => "form-control col-md-6 " %>
<label>Dining Name:</label>
<%= @table.name %>
<br/>
<br/>
<label>Commissioner Name:</label>
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/><br/>
<label>In time</label>
<%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%><br/>
<label>Out time</label>
<%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
</div><br>
<div class="form-group">
<%= f.button :submit, "Create",:class => 'btn btn-primary ', :id => 'create' %>
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'disabled', :id => 'update' %>
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
</div>
<% end %> <% end %>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(document).ready(function () {
$('.datepicker').datepicker({ $('#reset').click(function () {
format : 'dd-mm-yyyy', location.reload();
autoclose: true return false;
});
}); });
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
</script> </script>

View File

@@ -2,8 +2,7 @@
<%= f.error_notification %> <%= f.error_notification %>
<div class="form-inputs"> <div class="form-inputs">
<%= f.input :dinning_id %> <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/><br/>
<%= f.input :commissioner_ids %>
<%= f.input :in_time %> <%= f.input :in_time %>
<%= f.input :out_time %> <%= f.input :out_time %>
</div> </div>

View File

@@ -1,9 +1,10 @@
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Select</th>
<th>Dining Facility Name</th> <th>Dining Facility Name</th>
<th>Commissioner Ids</th> <th>Commissioner Ids</th>
<th>In time</th> <th>In time</th>
@@ -15,65 +16,67 @@
<tbody> <tbody>
<% @juties_in.each do |in_juty| %> <% @juties_in.each do |in_juty| %>
<tr class="injuty_tr" data-ref="<%= in_juty.id %>"> <tr class="injuty_tr" data-ref="<%= in_juty.id %>">
<td> <td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td> <input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
<td><%= in_juty.dining_facility.name rescue '-' %></td> <td><%= in_juty.dining_facility.name rescue '-' %></td>
<td><%= in_juty.commissioner.name rescue '-' %></td> <td><%= in_juty.commissioner.name rescue '-' %></td>
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td> <td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td> <td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= link_to 'Back', origami_path(in_juty.dining_facility.id) %></td> <td><%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
<td><%= link_to 'Edit', origami_edit_in_juty_path(in_juty.dining_facility.id,in_juty) %></td>
<td><%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id,in_juty),method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%= paginate @juties_in %>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<%= render 'assign_in_juty', in_juty: @in_juty ,table: @table %> <%= render 'assign_in_juty', in_juty: @in_juty, table: @table %>
</div> </div>
</div> </div>
<div class="col-md-1">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
</div>
<script type="text/javascript"> <script type="text/javascript">
$(document).on('click',".injuty_tr",function(){ $(document).on('click', ".injuty_tr", function () {
debugger;
// if(this.checked){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
//$( "#checkbox_check" ).prop( "checked", true );
var in_juty_id = $(this).attr('data-ref');
var table_id = "<%= @table.id %>";
var url = "/origami/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
$.ajax({ $(this).closest('tr').find('.checkbox_check').prop("checked", true);
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
// Selected for Taxes
$('#in_juty_commissioner_ids').val(data.commissioner.name);
$('#in_juty_in_time').val(data.in_time);
$('#in_juty_out_time').val(data.out_time);
$('#update').removeAttr('disabled'); var in_juty_id = $(this).attr('data-ref');
$('#update').attr('value', 'Update'); var table_id = "<%= @table.id %>";
$('#create').attr('disabled','disabled'); var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
$("#new_in_juty").attr('class', 'simple_form new_in_juty'); $.ajax({
var id = customer_id; type: "GET",
$("#new_customer").attr('id', id); url: url,
data: {},
$(".edit_customer").attr('id', id); success: function (data) {
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".patch_method").html('<input type="hidden" name="_method" value="patch">');
}
});
// }else{
// } $('#in_juty_id').val(data.in_juty.id);
}) $('#in_juty_commissioner_ids').val(data.commissioner.id);
</script> $('#in_juty_in_time').val(data.in_juty.in_time);
$('#in_juty_out_time').val(data.in_juty.out_time);
$('#update').removeAttr('disabled').val('');
$('#update').attr('value', 'Update');
$('#create').attr('disabled', 'disabled');
$("#new_in_juty").attr('class', 'simple_form edit_in_juty');
var id = "edit_in_juty_" + in_juty_id;
$("#new_in_juty").attr('id', id);
$(".edit_in_juty").attr('id', id);
$(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
$(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
$(".patch_method").html('<input type="hidden" name="_method" value="patch">');
}
});
});
$('#back').on('click', function () {
window.location.href = '/origami/table/' + "<%= @table.id %>";
})
</script>

View File

@@ -0,0 +1,85 @@
<div class="row">
<div class="col-md-12">
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
<% if period_type != false %>
<div class="row">
<div class="form-group col-md-3">
<label class="">Select Date Range</label>
<% if @daterange %>
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
<% else %>
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
<% end %>
</div>
<div class="form-group col-md-3">
<label class="">Commissioner</label>
<select class="form-control" name="commissioner" id="commissioner">
<option value=""></option>
<% @commissioner.each do |c| %>
<% if @com_id == c.id %>
<option value="<%= c.id %>" selected><%= c.name %></option>
<% else %>
<option value="<%= c.id %>"><%= c.name %></option>
<% end %> %>
<% end %>
</select>
</div>
<div class="form-group col-md-2 margin-top-20">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
<div class="form-group col-md-2 margin-top-20">
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#commissioner').select2({
placeholder: 'Select Commissioner'
});
$('#clear_filter').click(function () {
$('#daterange').val('');
$('#commissioner').val('').text('');
});
$('input[name="daterange"]').daterangepicker({
autoUpdateInput: false,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
locale: {
format: 'YYYY-MM-DD'
}
},
function (start, end, label) {
$('input[name="daterange"]').val(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
});
$('input[name="daterange"]').on('apply.daterangepicker', function (ev, picker) {
$('input[name="daterange"]').val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
from_date = picker.startDate.format('YYYY-MM-DD 00:00:00');
to_date = picker.endDate.format('YYYY-MM-DD 23:59:59');
});
$('input[name="daterange"]').on('cancel.daterangepicker', function (ev, picker) {
$('input[name="daterange"]').val('');
});
});
</script>

View File

@@ -0,0 +1,81 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= dashboard_path %>">Home</a></li>
<li>Commission Report</li>
</ul>
</div>
<div class="container">
<%= render :partial => 'commission_report_filter',
:locals => {:period_type => true, :shift_name => true, :report_path => reports_commission_index_path} %>
<hr/>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 text-right">
<a href="javascript:export_to('<%= reports_commission_index_path %>.xls')" class="btn btn-default">Export to
Excel</a>
</div>
</div>
</div>
<div class="container margin-top-20">
<div class="card row">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
</tr>
<tr>
<th>Commissioner Name</th>
<th>Product Name</th>
<th>Qty</th>
<th>Commission Price</th>
<th>Commission Amount</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<% total_qty = 0 %>
<% total_price = 0 %>
<% total_amount = 0 %>
<% @transaction.each do |result| %>
<tr>
<td>
<%= result.commissioner.name rescue '-' %>
</td>
<td>
<%= result.commission.menu_item.name rescue '-' %>
</td>
<td><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %></td>
<td><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %></td>
<td><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %></td>
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
</tr>
<% total_qty += result.qty.to_f %>
<% total_price += result.price.to_f %>
<% total_amount += result.amount.to_f %>
<% end %>
<tr style="border-top: 3px solid grey;">
<td colspan="2"></td>
<td><b><%= sprintf("%.2f", total_qty) rescue '-' %></b></td>
<td><b><%= sprintf("%.2f", total_price) rescue '-' %></b></td>
<td><b><%= sprintf("%.2f", total_amount) rescue '-' %></b></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(function () {
});
</script>

View File

@@ -0,0 +1,52 @@
<div class="container margin-top-20">
<div class="card row">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
</tr>
<tr>
<th>Commissioner Name</th>
<th>Product Name</th>
<th>Qty</th>
<th>Commission Price</th>
<th>Commission Amount</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<% total_qty = 0 %>
<% total_price = 0 %>
<% total_amount = 0 %>
<% @transaction.each do |result| %>
<tr>
<td>
<%= result.commissioner.name rescue '-' %>
</td>
<td>
<%= result.commission.menu_item.name rescue '-' %>
</td>
<td><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %></td>
<td><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %></td>
<td><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %></td>
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
</tr>
<% total_qty += result.qty.to_f %>
<% total_price += result.price.to_f %>
<% total_amount += result.amount.to_f %>
<% end %>
<tr style="border-top: 3px solid grey;">
<td colspan="2"></td>
<td><b><%= sprintf("%.2f", total_qty) rescue '-' %></b></td>
<td><b><%= sprintf("%.2f", total_price) rescue '-' %></b></td>
<td><b><%= sprintf("%.2f", total_amount) rescue '-' %></b></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,42 @@
<div class="col-md-3">
<%= simple_form_for([:settings, @commissioner]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.label :emp_id, 'Employee' %>
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
<br/>
<%= f.label :commission_id, 'Commission' %><br/>
<%= f.select :commission_id, Commission.all.map {|l| [l.menu_item.name, l.id]}, {prompt: 'Select a Product'}, {class: 'form-control'} %>
<br/>
<%= f.label :joined_date %><br/>
<%= f.text_field :joined_date, {class: 'form-control', id: 'joined_date', readonly: true} %><br/>
<%= f.label :resigned_date %><br/>
<%= f.text_field :resigned_date, {class: 'form-control', id: 'resigned_date', readonly: true} %><br/>
<label><%= f.check_box :is_active %> Active </label>
</div>
<br/>
<div class="form-actions">
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#joined_date').datepicker({
format: 'yyyy-mm-dd',
autoclose: true
});
$('#resigned_date').datepicker({
format: 'yyyy-mm-dd',
autoclose: true
});
});
</script>

View File

@@ -1,8 +1,8 @@
<div class="span12"> <div class="span12">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li> <li><a href="<%= settings_commissioners_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li> <li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
<li>Edit</li> <li>Edit</li>
</ul> </ul>
</div> </div>

View File

@@ -1,9 +1,9 @@
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li> <li><a href="<%= settings_commissioners_path %>">Home</a></li>
<li>Commissioner</li> <li>Commissioner</li>
<span style="float: right"> <span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path, :class => 'btn btn-primary btn-sm' %> <%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commissioner_path, :class => 'btn btn-primary btn-sm' %>
</span> </span>
</ul> </ul>
</div> </div>
@@ -16,8 +16,10 @@
<th>Name</th> <th>Name</th>
<th>Employee Name</th> <th>Employee Name</th>
<th>Commission type</th> <th>Commission type</th>
<th>Joined Date</th>
<th>Resigned Date</th>
<th>Active</th> <th>Active</th>
<th colspan="3"></th> <th colspan="4"></th>
</tr> </tr>
</thead> </thead>
@@ -29,10 +31,12 @@
<%= commissioner.employee.name rescue '-' %> <%= commissioner.employee.name rescue '-' %>
</td> </td>
<td><%= commissioner.commission.menu_item.name rescue '-' %></td> <td><%= commissioner.commission.menu_item.name rescue '-' %></td>
<td><%= commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
<td><%= commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
<td><%= commissioner.is_active %></td> <td><%= commissioner.is_active %></td>
<td><%= link_to 'Show', origami_commissioner_path(commissioner) %></td> <td><%= link_to 'Show', settings_commissioner_path(commissioner) %></td>
<td><%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %></td> <td><%= link_to 'Edit', edit_settings_commissioner_path(commissioner) %></td>
<td><%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td> <td><%= link_to 'Destroy', settings_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -1,8 +1,8 @@
<div class="span12"> <div class="span12">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li> <li><a href="<%= settings_commissioners_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li> <li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
<li>New</li> <li>New</li>
</ul> </ul>
</div> </div>

View File

@@ -0,0 +1,132 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= settings_commissioner_path %>">Home</a></li>
<li><a href="<%= settings_commissioner_path %>">Commissioners</a></li>
<span style="float: right">
</span>
</ul>
</div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#info" role="tab">Info</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#transaction" id="transaction_tab" role="tab">Transaction</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content">
<!--- Panel 0 - Info -->
<div class="tab-pane active" id="info" role="tabpanel" style="max-height:670px; overflow:auto">
<div class="card">
<div class="card-block">
<table class="table">
<tbody>
<tr>
<td style="width:20%">Name</td>
<td><%= @commissioner.name %></td>
</tr>
<tr>
<td style="width:20%">Employee Name</td>
<td><%= @commissioner.employee.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Commission Type</td>
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Joined Date</td>
<td><%= @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Resigned Date</td>
<td><%= @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Active</td>
<td><%= @commissioner.is_active %></td>
</tr>
<tr>
<td style="width:20%">Created By</td>
<td><%= Employee.find(@commissioner.created_by).name %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_settings_commissioner_path(@commissioner), class: 'btn btn-info' %>
<%= link_to 'Destroy', settings_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
</div>
</div>
</div>
<!--- Panel 1 - Transaction -->
<div class="tab-pane" id="transaction" role="tabpanel" style="max-height:670px; overflow:auto">
<div class="card">
<div class="card-block">
<table class="table" id="myTable">
<thead>
<tr>
<th><%= 'Product Type' %></th>
<th><%= 'Product Name' %></th>
<th><%= 'Qty' %></th>
<th><%= 'Price' %></th>
<th><%= 'Amount' %></th>
<th><%= 'Date' %></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<br/>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#transaction_tab").click(function () {
get_transaction();
});
function get_transaction() {
var commissioner_id = <%= @commissioner.id %>
paramlist = 'commissioner_id=' + commissioner_id ;
$.ajax({
type: 'GET',
url: '<%= settings_get_transaction_by_commissioner_path() %>',
data: paramlist,
success: function (data) {
// $('#myTable').DataTable().destroy();
$('#myTable tbody > tr').remove();
$.each(data, function (i, item) {
tr = "<tr>" + "<td>" + data[i][0].product_type + "</td>" + "<td>" + data[i][1] + "</td>" + "<td>" + data[i][0].qty + "</td>" + "<td>" + data[i][0].price + "</td>" + "<td>" + data[i][0].amount + "</td>" + "<td>" + new Date(data[i][0].updated_at).toISOString().split('T')[0] + "</td>" + "</tr>";
$('#myTable tbody').append(tr);
});
// $('#myTable').DataTable({
// data: data,
// columns: [
// {data: 'product_type'},
// {data: 'product_code'},
// {data: 'commission_id'},
// {data: 'qty'},
// {data: 'price'},
// {data: 'amount'}
// ],
// "order": [[0, "desc"]]
// });
}
});
}
});
</script>

View File

@@ -1,17 +1,17 @@
<div class="col-md-3"> <div class="col-md-3">
<%= simple_form_for([:origami,@commission]) do |f| %> <%= simple_form_for([:settings,@commission]) do |f| %>
<%= f.error_notification %> <%= f.error_notification %>
<div class="form-inputs"> <div class="form-inputs">
<%= f.label :product_id %> <%= f.label :product_code, 'Product' %>
<%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/> <%= f.collection_select :product_code, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
<%= f.input :amount %>
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %> <%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
<%= f.input :amount %>
<label><%= f.check_box :is_active %> Active </label> <label><%= f.check_box :is_active %> Active </label>
</div><br> </div><br>
<div class="form-actions"> <div class="form-actions">
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %> <%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %> <%= f.button :submit, class: 'btn btn-info' %>
</div> </div>
<% end %> <% end %>

View File

@@ -1,8 +1,8 @@
<div class="span12"> <div class="span12">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li> <li><a href="<%= settings_commissions_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li> <li><a href="<%= settings_commissions_path %>">Commissions</a></li>
<li>Edit</li> <li>Edit</li>
</ul> </ul>
</div> </div>

View File

@@ -1,9 +1,9 @@
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li> <li><a href="<%= settings_commissions_path %>">Home</a></li>
<li>Commissions</li> <li>Commissions</li>
<span style="float: right"> <span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path, :class => 'btn btn-primary btn-sm' %> <%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commission_path, :class => 'btn btn-primary btn-sm' %>
</span> </span>
</ul> </ul>
</div> </div>
@@ -14,8 +14,8 @@
<thead> <thead>
<tr> <tr>
<th>Product Name</th> <th>Product Name</th>
<th>Commission Type</th>
<th>Amount</th> <th>Amount</th>
<th>Commission type</th>
<th>Active</th> <th>Active</th>
<th colspan="3"></th> <th colspan="3"></th>
</tr> </tr>
@@ -25,12 +25,12 @@
<% @commissions.each do |commission| %> <% @commissions.each do |commission| %>
<tr> <tr>
<td><%= commission.menu_item.name rescue '-' %></td> <td><%= commission.menu_item.name rescue '-' %></td>
<td><%= commission.amount rescue '-' %></td>
<td><%= commission.commission_type rescue '-' %></td> <td><%= commission.commission_type rescue '-' %></td>
<td><%= commission.amount rescue '-' %></td>
<td><%= commission.is_active rescue '-' %></td> <td><%= commission.is_active rescue '-' %></td>
<td><%= link_to 'Show', origami_commission_path(commission) %></td> <td><%= link_to 'Show', settings_commissions_path(commission) %></td>
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td> <td><%= link_to 'Edit', edit_settings_commission_path(commission) %></td>
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td> <td><%= link_to 'Destroy', settings_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -1,8 +1,8 @@
<div class="span12"> <div class="span12">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li> <li><a href="<%= settings_commissions_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li> <li><a href="<%= settings_commissions_path %>">Commissions</a></li>
<li>New</li> <li>New</li>
</ul> </ul>
</div> </div>

View File

@@ -2,8 +2,8 @@
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li> <li><a href="<%= settings_commissions_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li> <li><a href="<%= settings_commissions_path %>">Commissions</a></li>
<span style="float: right"> <span style="float: right">
</span> </span>
@@ -32,9 +32,9 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %> <%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_commission_path(@commission), class: 'btn btn-info' %> <%= link_to 'Edit', edit_settings_commission_path(@commission), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_commission_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %> <%= link_to 'Destroy', settings_commissions_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
</div> </div>
</div> </div>

View File

@@ -13,5 +13,4 @@
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5)); $("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
// $( "#fromtime" ).timepicker(); // $( "#fromtime" ).timepicker();
// $( "#totime" ).timepicker({ 'scrollDefault': 'now' }); // $( "#totime" ).timepicker({ 'scrollDefault': 'now' });
$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });
</script> </script>

View File

@@ -0,0 +1,13 @@
SimpleForm.setup do |config|
config.wrappers :ranged_datetime, tag: 'div', class: 'form-group col-md-6', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :readonly
b.use :label, class: 'control-label'
b.use :input, class: 'form-control'
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
end

View File

@@ -11,10 +11,10 @@ Rails.application.routes.draw do
#--------- SmartSales Installation ------------# #--------- SmartSales Installation ------------#
get 'install' => 'install#index' get 'install' => 'install#index'
post 'install' => 'install#create' post 'install' => 'install#create'
#--------- Login/Authentication ------------# #--------- Login/Authentication ------------#
get 'auth/:emp_id' => 'home#show' , as: :emp_login get 'auth/:emp_id' => 'home#show', as: :emp_login
patch "auth/:emp_id" => 'home#update', as: :emp_login_update patch "auth/:emp_id" => 'home#update', as: :emp_login_update
post 'login' => 'home#create' post 'login' => 'home#create'
@@ -23,14 +23,14 @@ Rails.application.routes.draw do
#--------- API Routes ------------# #--------- API Routes ------------#
namespace :api, :defaults => { :format => 'json' } do namespace :api, :defaults => {:format => 'json'} do
#Session Login and Logout #Session Login and Logout
post 'authenticate' => "authenticate#create" post 'authenticate' => "authenticate#create"
delete 'authenticate' => "authenticate#destroy" delete 'authenticate' => "authenticate#destroy"
namespace :restaurant do namespace :restaurant do
get 'zones' => "zones#index" get 'zones' => "zones#index"
resources :menu, only:[:index, :show] resources :menu, only: [:index, :show]
resources :menu_categories, only: [:index, :show] resources :menu_categories, only: [:index, :show]
resources :menu_items, only: [:index, :show] resources :menu_items, only: [:index, :show]
resources :menu_item_attributes, only: [:index] resources :menu_item_attributes, only: [:index]
@@ -57,10 +57,10 @@ Rails.application.routes.draw do
get "customers/get_order/:id" => "customers#get_customer_order" get "customers/get_order/:id" => "customers#get_customer_order"
#Generating Invoice and making payments - output render @sale #Generating Invoice and making payments - output render @sale
resources :invoices, only: [:index, :show, :create, :update, :destroy ] do resources :invoices, only: [:index, :show, :create, :update, :destroy] do
resources :sale_items, only:[:create, :update, :destroy] resources :sale_items, only: [:create, :update, :destroy]
resources :discounts, only: [:create, :update, :destroy] resources :discounts, only: [:create, :update, :destroy]
resources :memberships, only:[:create] resources :memberships, only: [:create]
post "payment/:payment_method" => "payment#create" post "payment/:payment_method" => "payment#create"
put "payment/:id" => "payment#update" put "payment/:id" => "payment#update"
resources :receipt, only: [:create, :show] #generate receipt, show receipt resources :receipt, only: [:create, :show] #generate receipt, show receipt
@@ -72,8 +72,8 @@ Rails.application.routes.draw do
#--------- Cashier ------------# #--------- Cashier ------------#
namespace :origami do namespace :origami do
resources :cash_ins, only:[:new, :create] resources :cash_ins, only: [:new, :create]
resources :cash_outs, only:[:new, :create] resources :cash_outs, only: [:new, :create]
root "home#index" root "home#index"
get "table/:dining_id" => "home#show" do #origami/:booking_id will show get "table/:dining_id" => "home#show" do #origami/:booking_id will show
# resources :discounts, only: [:index,:new, :create ] #add discount type # resources :discounts, only: [:index,:new, :create ] #add discount type
@@ -87,17 +87,13 @@ Rails.application.routes.draw do
post 'item_void_cancel' => "sale_edit#item_void_cancel" post 'item_void_cancel' => "sale_edit#item_void_cancel"
post 'cancel_all_void' => 'sale_edit#cancel_all_void' post 'cancel_all_void' => 'sale_edit#cancel_all_void'
post 'apply_void' => 'sale_edit#apply_void' post 'apply_void' => 'sale_edit#apply_void'
# commissions
get '/table/:table_id/sale/:sale_id/load_commissioners' => 'commissions#load_commissioners', as: 'load_commissioners'
post 'select_sale_item' => 'commissions#select_sale_item'
# product_commission
post 'select_commissioner' => 'product_commissions#set_commissioner_to_sale_item'
# in_juties # in_juties
get '/table/:table_id/assign_in_juty' => 'in_juties#assign_in_juty', as: 'assign_in_juty' get '/table/:table_id/assign_in_juty' => 'in_juties#assign_in_juty', as: 'assign_in_juty'
post 'assign_in_juty' => 'in_juties#create_for_in_juty', as: 'create_for_in_juty'
get 'assign_in_juty/:table_id' => 'in_juties#index_in_juty', as: 'index_in_juty' get 'assign_in_juty/:table_id' => 'in_juties#index_in_juty', as: 'index_in_juty'
get 'table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty' post 'assign_in_juty/:table_id' => 'in_juties#create_for_in_juty'
put '/edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty'
get 'assign_in_juty/table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty'
patch 'edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty'
delete 'table/:table_id/destroy_in_juty/:id' => 'in_juties#destroy_in_juty', as: 'destroy_in_juty' delete 'table/:table_id/destroy_in_juty/:id' => 'in_juties#destroy_in_juty', as: 'destroy_in_juty'
get 'table/:dining_id/movetable' => "movetable#move_dining" get 'table/:dining_id/movetable' => "movetable#move_dining"
@@ -122,8 +118,8 @@ Rails.application.routes.draw do
# Discount for Member # Discount for Member
post "/:id/member_discount" => "discounts#member_discount" post "/:id/member_discount" => "discounts#member_discount"
get "/:id/request_bills" => "request_bills#print",:as => "request_bill" get "/:id/request_bills" => "request_bills#print", :as => "request_bill"
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' } get '/:sale_id/reprint' => 'payments#reprint', :defaults => {:format => 'json'}
#---------Shift ---------------# #---------Shift ---------------#
resources :shifts, only: [:index, :new, :create, :edit] resources :shifts, only: [:index, :new, :create, :edit]
@@ -141,11 +137,11 @@ Rails.application.routes.draw do
#payment - Outing payments - Cash only [ *Misc expeness tracking] #payment - Outing payments - Cash only [ *Misc expeness tracking]
#--------- Payment ------------# #--------- Payment ------------#
post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj',:as => "calculate_rouding_adjs" post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj', :as => "calculate_rouding_adjs"
get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => { :format => 'json' } get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => {:format => 'json'}
get 'sale/:sale_id/payment' => 'payments#show' get 'sale/:sale_id/payment' => 'payments#show'
post 'payment/foc' => 'payments#foc', :defaults => { :format => 'json' } post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'}
post 'payment/cash' => 'payments#create' post 'payment/cash' => 'payments#create'
post 'payment/mpu' => "mpu#create" post 'payment/mpu' => "mpu#create"
post 'payment/jcb' => "jcb#create" post 'payment/jcb' => "jcb#create"
@@ -168,43 +164,41 @@ Rails.application.routes.draw do
post 'sale/:sale_id/void' => 'void#overall_void' post 'sale/:sale_id/void' => 'void#overall_void'
#---------Multiple Invoices --------------# #---------Multiple Invoices --------------#
get 'table/:table_id/table_invoices' => "table_invoices#index" , :as => "table_invoice_index" get 'table/:table_id/table_invoices' => "table_invoices#index", :as => "table_invoice_index"
get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show" , :as => "table_invoice_show" get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show", :as => "table_invoice_show"
get 'room/:room_id/room_invoices' => "room_invoices#index" , :as => "room_invoice_index" get 'room/:room_id/room_invoices' => "room_invoices#index", :as => "room_invoice_index"
get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show" , :as => "room_invoice_show" get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show", :as => "room_invoice_show"
#---------Add Customer --------------# #---------Add Customer --------------#
#resources :customers #resources :customers
get '/:sale_id/customers', to: "customers#add_customer" get '/:sale_id/customers', to: "customers#add_customer"
get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details" get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details"
post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer" # update customer id in sale table post '/:sale_id/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
post '/:sale_id/get_customer' => "customers#get_customer" post '/:sale_id/get_customer' => "customers#get_customer"
resources :addorders resources :addorders
resources :commissions
resources :commissioners
resources :in_juties resources :in_juties
end end
#--------- Waiter/Ordering Station ------------# #--------- Waiter/Ordering Station ------------#
namespace :oishi do namespace :oishi do
#zones #zones
#tables #tables
#orders #orders
end end
#--------- Customer Relationship Management ------------# #--------- Customer Relationship Management ------------#
namespace :crm do namespace :crm do
root "home#index" root "home#index"
resources :customers resources :customers
resources :dining_queues resources :dining_queues
post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel post "update_booking", to: "bookings#update_booking", as: "update_booking" #assign and cancel
get '/print/:id', to: "home#print_order"#print order for crm get '/print/:id', to: "home#print_order" #print order for crm
get "/dining_queues/:id/assign" =>"dining_queues#assign", :as => "assign" get "/dining_queues/:id/assign" => "dining_queues#assign", :as => "assign"
post "/dining_queues/assign_table" =>"dining_queues#assign_table", :as => "assign_table" post "/dining_queues/assign_table" => "dining_queues#assign_table", :as => "assign_table"
post "/dining_queues/cancel_queue" =>"dining_queues#cancel_queue", :as => "cancel_queue" post "/dining_queues/cancel_queue" => "dining_queues#cancel_queue", :as => "cancel_queue"
end end
@@ -223,7 +217,7 @@ Rails.application.routes.draw do
get 'print/print/:id', to: "print#print" get 'print/print/:id', to: "print#print"
get 'print/print_order_summary/:id', to: "print#print_order_summary" get 'print/print_order_summary/:id', to: "print#print_order_summary"
get "/get_items/:id" =>"home#get_items_by_oqs", :as => "get_order_items_by_oqs" get "/get_items/:id" => "home#get_items_by_oqs", :as => "get_order_items_by_oqs"
#dashboard #dashboard
# #
end end
@@ -235,7 +229,7 @@ Rails.application.routes.draw do
#menu #menu
resources :menus do resources :menus do
#menu_categories #menu_categories
resources :menu_categories, only: [:new, :create, :edit,:delete] resources :menu_categories, only: [:new, :create, :edit, :delete]
end end
resources :item_sets resources :item_sets
@@ -299,16 +293,28 @@ Rails.application.routes.draw do
resources :promotion_products resources :promotion_products
end end
# commission
resources :commissions
resources :commissioners
get '/get_transactions_by_commissioner' => 'commissioners#get_transaction_by_commissioner', as:'get_transaction_by_commissioner'
end end
# commissions
get 'origami/table/:table_id/sale/:sale_id/load_commissioners' => 'settings/commissions#load_commissioners', as: 'load_commissioners'
post 'origami/select_sale_item' => 'settings/commissions#select_sale_item', as: 'select_sale_item'
# product_commission
post 'origami/select_commissioner' => 'origami/product_commissions#set_commissioner_to_sale_item', as: 'select_commissioner'
#--------- Transactions Sections ------------# #--------- Transactions Sections ------------#
namespace :transactions do namespace :transactions do
resources :sales resources :sales
resources :orders resources :orders
resources :credit_notes resources :credit_notes
get "/sales/:sale_id/manual_complete_sale" =>"manual_sales#manual_complete_sale", :as => "manual_complete_sale" get "/sales/:sale_id/manual_complete_sale" => "manual_sales#manual_complete_sale", :as => "manual_complete_sale"
get "/sales/:sale_id/void" =>"manual_sales#void", :as => "void" get "/sales/:sale_id/void" => "manual_sales#void", :as => "void"
post "sales/:sale_id/manual_void_sale", to: "manual_sales#manual_void_sale", :as => "manual_void_sale" post "sales/:sale_id/manual_void_sale", to: "manual_sales#manual_void_sale", :as => "manual_void_sale"
end end
@@ -320,6 +326,7 @@ Rails.application.routes.draw do
resources :shiftsale, :only => [:index, :show] resources :shiftsale, :only => [:index, :show]
resources :credit_payment, :only => [:index, :show] resources :credit_payment, :only => [:index, :show]
resources :void_sale, :only => [:index, :show] resources :void_sale, :only => [:index, :show]
resources :commission, :only => [:index, :show]
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date" get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
end end

View File

@@ -6,6 +6,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1]
t.string :order_item_status, :null => false, :default => "new" t.string :order_item_status, :null => false, :default => "new"
t.string :item_order_by #person who order this t.string :item_order_by #person who order this
t.string :item_code, :null => false t.string :item_code, :null => false
t.string :item_instance_code
t.string :item_name, :null => false t.string :item_name, :null => false
t.string :alt_name, :null => false t.string :alt_name, :null => false
t.integer :account_id, :limit => 8, :null => false, :default => 1 t.integer :account_id, :limit => 8, :null => false, :default => 1

View File

@@ -1,12 +0,0 @@
class CreateCommissioners < ActiveRecord::Migration[5.1]
def change
create_table :commissioners do |t|
t.string :name, :null => false
t.string :emp_id
t.string :created_by
t.string :commission_type
t.boolean :is_active
t.timestamps
end
end
end

View File

@@ -1,11 +0,0 @@
class CreateCommissions < ActiveRecord::Migration[5.1]
def change
create_table :commissions do |t|
t.integer :product_id, null: false
t.integer :amount
t.string :commission_type
t.boolean :is_active
t.timestamps
end
end
end

View File

@@ -1,16 +0,0 @@
class CreateProductCommissions < ActiveRecord::Migration[5.1]
# rake db:migrate:down VERSION=20170823034141
def change
create_table :product_commissions do |t|
t.string :product_id
t.integer :commission_id
t.integer :commissioner_id
t.decimal :qty, :precision => 10, :scale => 2, :default => 0.00
t.string :sale_id
t.string :sale_item_id
t.decimal :price, :precision => 10, :scale => 2, :default => 0.00
t.decimal :amount, :precision => 10, :scale => 2, :default => 0.00
t.timestamps
end
end
end

View File

@@ -0,0 +1,17 @@
class CreateProductCommissions < ActiveRecord::Migration[5.1]
# rake db:migrate:down VERSION=20170825034141
def change
create_table :product_commissions do |t|
t.string :product_type
t.string :product_code
t.string :commission_id
t.integer :commissioner_id
t.decimal :qty, precision: 10, scale: 2, default: 0.00
t.string :sale_id
t.string :sale_item_id
t.decimal :price, precision: 10, scale: 2, default: 0.00
t.decimal :amount, precision: 10, scale: 2, default: 0.00
t.timestamps
end
end
end

View File

@@ -0,0 +1,15 @@
class CreateCommissioners < ActiveRecord::Migration[5.1]
# rake db:migrate:down VERSION=20170825090115
def change
create_table :commissioners do |t|
t.string :name
t.string :emp_id
t.string :created_by
t.string :commission_id
t.datetime :joined_date
t.datetime :resigned_date
t.boolean :is_active, default: true
t.timestamps
end
end
end

View File

@@ -0,0 +1,15 @@
class CreateCommissions < ActiveRecord::Migration[5.1]
# rake db:migrate:down VERSION=20170825093252
def change
create_table :commissions, id: false do |t|
t.string :commission_id, limit: 16, primary_key: true # custom primary key
t.string :product_type
t.string :product_code
t.string :commission_type
t.integer :amount
t.boolean :is_active, default: true
t.timestamps
end
end
end

View File

@@ -218,25 +218,26 @@ zone3 = Zone.create({id:3, name: "H3", is_active:true, created_by: "SYSTEM DEFAU
table = Table.create({name:"77", 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"}) 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_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"})
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"}, 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:"RxzaYyAGzm7VqAZ4hKnv",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:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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:"member_discount",gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:6},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",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"}, {membership_type:"get_member_campaign",gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:6},merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"},
{membership_type:"search_paypar_account_no",gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv",auth_token:"code2lab"}
]) ])
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://membership.paypar.ws"}) 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:"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:"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:"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"}) payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://membership.paypar.ws",merchant_account_id:"RxzaYyAGzm7VqAZ4hKnv"})
#Default Order Queue stations #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_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"})

File diff suppressed because it is too large Load Diff

42
vendor/assets/javascripts/pickers.js vendored Normal file
View File

@@ -0,0 +1,42 @@
$(document).on('ready page:change', function() {
$('.datetimepicker').datetimepicker({
// put here your custom picker options, that should be applied for all pickers
icons: {
date: 'fa fa-calendar',
time: 'fa fa-clock-o',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-crosshairs',
clear: 'fa fa-trash-o',
close: 'fa fa-times'
}
});
$('.datetimerange').each(function(){
var $this = $(this)
var range1 = $($this.find('.input-group')[0])
var range2 = $($this.find('.input-group')[1])
if(range1.data("DateTimePicker").date() != null)
range2.data("DateTimePicker").minDate(range1.data("DateTimePicker").date());
if(range2.data("DateTimePicker").date() != null)
range1.data("DateTimePicker").maxDate(range2.data("DateTimePicker").date());
range1.on("dp.change",function (e) {
if(e.date)
range2.data("DateTimePicker").minDate(e.date);
else
range2.data("DateTimePicker").minDate(false);
});
range2.on("dp.change",function (e) {
if(e.date)
range1.data("DateTimePicker").maxDate(e.date);
else
range1.data("DateTimePicker").maxDate(false);
});
})
});

View File

@@ -0,0 +1,366 @@
/*!
* Datetimepicker for Bootstrap 3
* ! version : 4.7.14
* https://github.com/Eonasdan/bootstrap-datetimepicker/
*/
.bootstrap-datetimepicker-widget {
list-style: none;
}
.bootstrap-datetimepicker-widget.dropdown-menu {
margin: 2px 0;
padding: 4px;
width: 19em;
}
@media (min-width: 768px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
@media (min-width: 992px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
@media (min-width: 1200px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
.bootstrap-datetimepicker-widget.dropdown-menu:before,
.bootstrap-datetimepicker-widget.dropdown-menu:after {
content: '';
display: inline-block;
position: absolute;
}
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:before {
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #cccccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
top: -7px;
left: 7px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after {
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
top: -6px;
left: 8px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.top:before {
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #cccccc;
border-top-color: rgba(0, 0, 0, 0.2);
bottom: -7px;
left: 6px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.top:after {
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid white;
bottom: -6px;
left: 7px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:before {
left: auto;
right: 6px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:after {
left: auto;
right: 7px;
}
.bootstrap-datetimepicker-widget .list-unstyled {
margin: 0;
}
.bootstrap-datetimepicker-widget a[data-action] {
padding: 6px 0;
}
.bootstrap-datetimepicker-widget a[data-action]:active {
box-shadow: none;
}
.bootstrap-datetimepicker-widget .timepicker-hour,
.bootstrap-datetimepicker-widget .timepicker-minute,
.bootstrap-datetimepicker-widget .timepicker-second {
width: 54px;
font-weight: bold;
font-size: 1.2em;
margin: 0;
}
.bootstrap-datetimepicker-widget button[data-action] {
padding: 6px;
}
.bootstrap-datetimepicker-widget .btn[data-action="incrementHours"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Increment Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="incrementMinutes"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Increment Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="decrementHours"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Decrement Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="decrementMinutes"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Decrement Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="showHours"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Show Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="showMinutes"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Show Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="togglePeriod"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Toggle AM/PM";
}
.bootstrap-datetimepicker-widget .btn[data-action="clear"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Clear the picker";
}
.bootstrap-datetimepicker-widget .btn[data-action="today"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Set the date to today";
}
.bootstrap-datetimepicker-widget .picker-switch {
text-align: center;
}
.bootstrap-datetimepicker-widget .picker-switch::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Toggle Date and Time Screens";
}
.bootstrap-datetimepicker-widget .picker-switch td {
padding: 0;
margin: 0;
height: auto;
width: auto;
line-height: inherit;
}
.bootstrap-datetimepicker-widget .picker-switch td span {
line-height: 2.5;
height: 2.5em;
width: 100%;
}
.bootstrap-datetimepicker-widget table {
width: 100%;
margin: 0;
}
.bootstrap-datetimepicker-widget table td,
.bootstrap-datetimepicker-widget table th {
text-align: center;
border-radius: 4px;
}
.bootstrap-datetimepicker-widget table th {
height: 20px;
line-height: 20px;
width: 20px;
}
.bootstrap-datetimepicker-widget table th.picker-switch {
width: 145px;
}
.bootstrap-datetimepicker-widget table th.disabled,
.bootstrap-datetimepicker-widget table th.disabled:hover {
background: none;
color: #777777;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget table th.prev::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Previous Month";
}
.bootstrap-datetimepicker-widget table th.next::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Next Month";
}
.bootstrap-datetimepicker-widget table thead tr:first-child th {
cursor: pointer;
}
.bootstrap-datetimepicker-widget table thead tr:first-child th:hover {
background: #eeeeee;
}
.bootstrap-datetimepicker-widget table td {
height: 54px;
line-height: 54px;
width: 54px;
}
.bootstrap-datetimepicker-widget table td.cw {
font-size: .8em;
height: 20px;
line-height: 20px;
color: #777777;
}
.bootstrap-datetimepicker-widget table td.day {
height: 20px;
line-height: 20px;
width: 20px;
}
.bootstrap-datetimepicker-widget table td.day:hover,
.bootstrap-datetimepicker-widget table td.hour:hover,
.bootstrap-datetimepicker-widget table td.minute:hover,
.bootstrap-datetimepicker-widget table td.second:hover {
background: #eeeeee;
cursor: pointer;
}
.bootstrap-datetimepicker-widget table td.old,
.bootstrap-datetimepicker-widget table td.new {
color: #777777;
}
.bootstrap-datetimepicker-widget table td.today {
position: relative;
}
.bootstrap-datetimepicker-widget table td.today:before {
content: '';
display: inline-block;
border: 0 0 7px 7px solid transparent;
border-bottom-color: #337ab7;
border-top-color: rgba(0, 0, 0, 0.2);
position: absolute;
bottom: 4px;
right: 4px;
}
.bootstrap-datetimepicker-widget table td.active,
.bootstrap-datetimepicker-widget table td.active:hover {
background-color: #337ab7;
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget table td.active.today:before {
border-bottom-color: #fff;
}
.bootstrap-datetimepicker-widget table td.disabled,
.bootstrap-datetimepicker-widget table td.disabled:hover {
background: none;
color: #777777;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget table td span {
display: inline-block;
width: 54px;
height: 54px;
line-height: 54px;
margin: 2px 1.5px;
cursor: pointer;
border-radius: 4px;
}
.bootstrap-datetimepicker-widget table td span:hover {
background: #eeeeee;
}
.bootstrap-datetimepicker-widget table td span.active {
background-color: #337ab7;
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget table td span.old {
color: #777777;
}
.bootstrap-datetimepicker-widget table td span.disabled,
.bootstrap-datetimepicker-widget table td span.disabled:hover {
background: none;
color: #777777;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget.usetwentyfour td.hour {
height: 27px;
line-height: 27px;
}
.input-group.date .input-group-addon {
cursor: pointer;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}

View File

@@ -0,0 +1,366 @@
/*!
* Datetimepicker for Bootstrap 3
* ! version : 4.7.14
* https://github.com/Eonasdan/bootstrap-datetimepicker/
*/
.bootstrap-datetimepicker-widget {
list-style: none;
}
.bootstrap-datetimepicker-widget.dropdown-menu {
margin: 2px 0;
padding: 4px;
width: 19em;
}
@media (min-width: 768px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
@media (min-width: 992px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
@media (min-width: 1200px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
.bootstrap-datetimepicker-widget.dropdown-menu:before,
.bootstrap-datetimepicker-widget.dropdown-menu:after {
content: '';
display: inline-block;
position: absolute;
}
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:before {
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #cccccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
top: -7px;
left: 7px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after {
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
top: -6px;
left: 8px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.top:before {
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #cccccc;
border-top-color: rgba(0, 0, 0, 0.2);
bottom: -7px;
left: 6px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.top:after {
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid white;
bottom: -6px;
left: 7px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:before {
left: auto;
right: 6px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:after {
left: auto;
right: 7px;
}
.bootstrap-datetimepicker-widget .list-unstyled {
margin: 0;
}
.bootstrap-datetimepicker-widget a[data-action] {
padding: 6px 0;
}
.bootstrap-datetimepicker-widget a[data-action]:active {
box-shadow: none;
}
.bootstrap-datetimepicker-widget .timepicker-hour,
.bootstrap-datetimepicker-widget .timepicker-minute,
.bootstrap-datetimepicker-widget .timepicker-second {
width: 54px;
font-weight: bold;
font-size: 1.2em;
margin: 0;
}
.bootstrap-datetimepicker-widget button[data-action] {
padding: 6px;
}
.bootstrap-datetimepicker-widget .btn[data-action="incrementHours"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Increment Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="incrementMinutes"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Increment Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="decrementHours"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Decrement Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="decrementMinutes"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Decrement Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="showHours"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Show Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="showMinutes"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Show Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="togglePeriod"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Toggle AM/PM";
}
.bootstrap-datetimepicker-widget .btn[data-action="clear"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Clear the picker";
}
.bootstrap-datetimepicker-widget .btn[data-action="today"]::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Set the date to today";
}
.bootstrap-datetimepicker-widget .picker-switch {
text-align: center;
}
.bootstrap-datetimepicker-widget .picker-switch::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Toggle Date and Time Screens";
}
.bootstrap-datetimepicker-widget .picker-switch td {
padding: 0;
margin: 0;
height: auto;
width: auto;
line-height: inherit;
}
.bootstrap-datetimepicker-widget .picker-switch td span {
line-height: 2.5;
height: 2.5em;
width: 100%;
}
.bootstrap-datetimepicker-widget table {
width: 100%;
margin: 0;
}
.bootstrap-datetimepicker-widget table td,
.bootstrap-datetimepicker-widget table th {
text-align: center;
border-radius: 4px;
}
.bootstrap-datetimepicker-widget table th {
height: 20px;
line-height: 20px;
width: 20px;
}
.bootstrap-datetimepicker-widget table th.picker-switch {
width: 145px;
}
.bootstrap-datetimepicker-widget table th.disabled,
.bootstrap-datetimepicker-widget table th.disabled:hover {
background: none;
color: #777777;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget table th.prev::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Previous Month";
}
.bootstrap-datetimepicker-widget table th.next::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
content: "Next Month";
}
.bootstrap-datetimepicker-widget table thead tr:first-child th {
cursor: pointer;
}
.bootstrap-datetimepicker-widget table thead tr:first-child th:hover {
background: #eeeeee;
}
.bootstrap-datetimepicker-widget table td {
height: 54px;
line-height: 54px;
width: 54px;
}
.bootstrap-datetimepicker-widget table td.cw {
font-size: .8em;
height: 20px;
line-height: 20px;
color: #777777;
}
.bootstrap-datetimepicker-widget table td.day {
height: 20px;
line-height: 20px;
width: 20px;
}
.bootstrap-datetimepicker-widget table td.day:hover,
.bootstrap-datetimepicker-widget table td.hour:hover,
.bootstrap-datetimepicker-widget table td.minute:hover,
.bootstrap-datetimepicker-widget table td.second:hover {
background: #eeeeee;
cursor: pointer;
}
.bootstrap-datetimepicker-widget table td.old,
.bootstrap-datetimepicker-widget table td.new {
color: #777777;
}
.bootstrap-datetimepicker-widget table td.today {
position: relative;
}
.bootstrap-datetimepicker-widget table td.today:before {
content: '';
display: inline-block;
border: 0 0 7px 7px solid transparent;
border-bottom-color: #337ab7;
border-top-color: rgba(0, 0, 0, 0.2);
position: absolute;
bottom: 4px;
right: 4px;
}
.bootstrap-datetimepicker-widget table td.active,
.bootstrap-datetimepicker-widget table td.active:hover {
background-color: #337ab7;
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget table td.active.today:before {
border-bottom-color: #fff;
}
.bootstrap-datetimepicker-widget table td.disabled,
.bootstrap-datetimepicker-widget table td.disabled:hover {
background: none;
color: #777777;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget table td span {
display: inline-block;
width: 54px;
height: 54px;
line-height: 54px;
margin: 2px 1.5px;
cursor: pointer;
border-radius: 4px;
}
.bootstrap-datetimepicker-widget table td span:hover {
background: #eeeeee;
}
.bootstrap-datetimepicker-widget table td span.active {
background-color: #337ab7;
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget table td span.old {
color: #777777;
}
.bootstrap-datetimepicker-widget table td span.disabled,
.bootstrap-datetimepicker-widget table td span.disabled:hover {
background: none;
color: #777777;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget.usetwentyfour td.hour {
height: 27px;
line-height: 27px;
}
.input-group.date .input-group-addon {
cursor: pointer;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}