fixed conflict
This commit is contained in:
1
.code2lab.env
Normal file
1
.code2lab.env
Normal file
@@ -0,0 +1 @@
|
||||
RAILS_ENV=production
|
||||
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
.git
|
||||
.dockerignore
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -24,8 +24,10 @@ capybara-*.html
|
||||
/public/image
|
||||
/public/system/*
|
||||
/public/assets/*
|
||||
/public/menus/*
|
||||
/public/uploads/*
|
||||
/public/swf/*
|
||||
/public/receipts/
|
||||
/coverage/
|
||||
/spec/tmp/*
|
||||
*.orig
|
||||
@@ -35,9 +37,11 @@ pickle-email-*.html
|
||||
/gems/*
|
||||
._*.*
|
||||
.rbenv-version
|
||||
|
||||
/config/initializers/*
|
||||
config/deploy/config/*
|
||||
config/puma.rb
|
||||
config/shops.json
|
||||
#config/shops.json
|
||||
!/log/.keep
|
||||
!/tmp/.keep
|
||||
.ruby-version
|
||||
|
||||
31
Capfile
Normal file
31
Capfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# Load DSL and set up stages
|
||||
require "capistrano/setup"
|
||||
|
||||
# Include default deployment tasks
|
||||
require "capistrano/deploy"
|
||||
|
||||
# Include tasks from other gems included in your Gemfile
|
||||
#
|
||||
# For documentation on these, see for example:
|
||||
#
|
||||
# https://github.com/capistrano/rvm
|
||||
# https://github.com/capistrano/rbenv
|
||||
# https://github.com/capistrano/chruby
|
||||
# https://github.com/capistrano/bundler
|
||||
# https://github.com/capistrano/rails
|
||||
# https://github.com/capistrano/passenger
|
||||
#
|
||||
# require "capistrano/rvm"
|
||||
require "capistrano/rbenv"
|
||||
# require "capistrano/chruby"
|
||||
require "capistrano/bundler"
|
||||
require "capistrano/rails"
|
||||
require "capistrano/rails/assets"
|
||||
require "capistrano/rails/migrations"
|
||||
# require "capistrano/passenger"
|
||||
|
||||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
||||
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
|
||||
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
|
||||
Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
|
||||
|
||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM ruby:2.4.1
|
||||
RUN apt-get update -qq && apt-get install -y build-essential libmysqlclient-dev libcups2-dev libpq-dev nodejs
|
||||
RUN mkdir /sxrestaurant
|
||||
RUN mkdir -p /sxrestaurant/tmp/puma
|
||||
ENV RAILS_ENV production
|
||||
WORKDIR /sxrestaurant
|
||||
COPY Gemfile /sxrestaurant/Gemfile
|
||||
COPY Gemfile.lock /sxrestaurant/Gemfile.lock
|
||||
RUN bundle install --without development test
|
||||
RUN bundle exec rails assets:precompile
|
||||
COPY . /sxrestaurant
|
||||
|
||||
18
Gemfile
Executable file → Normal file
18
Gemfile
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
source 'https://rubygems.org'
|
||||
ruby '2.4.0'
|
||||
ruby '2.4.1'
|
||||
git_source(:github) do |repo_name|
|
||||
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
||||
"https://github.com/#{repo_name}.git"
|
||||
@@ -41,14 +41,18 @@ gem 'rack-cors'
|
||||
# image upload
|
||||
gem 'carrierwave', '~> 1.0'
|
||||
gem 'mini_magick'
|
||||
gem 'jquery-fileupload-rails'
|
||||
|
||||
#Report and Printing gems
|
||||
gem 'cups', '~> 0.0.7'
|
||||
gem 'cups'
|
||||
gem 'prawn'
|
||||
gem 'prawn-table'
|
||||
gem 'spreadsheet'
|
||||
gem 'to_xls-rails'
|
||||
|
||||
gem 'rubyzip', '= 1.0.0'
|
||||
gem 'axlsx', '= 2.0.1'
|
||||
gem 'axlsx_rails'
|
||||
gem 'roo'
|
||||
gem 'pdfjs_viewer-rails'
|
||||
#Reporting gem
|
||||
#gem 'compendium'
|
||||
#gem "cancan"
|
||||
@@ -81,7 +85,6 @@ gem 'kaminari', '~> 1.0.1'
|
||||
gem 'filterrific'
|
||||
|
||||
gem 'cancancan', '~> 1.10'
|
||||
|
||||
#pageless no need for current
|
||||
# gem 'will_paginate'
|
||||
# gem 'pageless-rails', github: 'rorlab/pageless-rails'
|
||||
@@ -95,6 +98,9 @@ gem 'cancancan', '~> 1.10'
|
||||
#end
|
||||
|
||||
group :development do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
gem 'byebug', platform: :mri
|
||||
|
||||
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
||||
gem 'web-console', '>= 3.3.0'
|
||||
gem 'listen', '~> 3.0.5'
|
||||
@@ -126,4 +132,4 @@ gem 'momentjs-rails' # for date-range selector
|
||||
# gem 'bootstrap-datepicker-rails' # date picker
|
||||
# gem 'jquery-datetimepicker-rails'
|
||||
# gem 'select2-rails' # for multi-select and auto-complete select box
|
||||
gem "chartkick" #chart lib
|
||||
gem "chartkick" #chart lib
|
||||
37
Gemfile.lock
Executable file → Normal file
37
Gemfile.lock
Executable file → Normal file
@@ -50,9 +50,17 @@ GEM
|
||||
airbrussh (1.3.0)
|
||||
sshkit (>= 1.6.1, != 1.7.0)
|
||||
arel (8.0.0)
|
||||
axlsx (2.0.1)
|
||||
htmlentities (~> 4.3.1)
|
||||
nokogiri (>= 1.4.1)
|
||||
rubyzip (~> 1.0.0)
|
||||
axlsx_rails (0.5.1)
|
||||
actionpack (>= 3.1)
|
||||
axlsx (>= 2.0.1)
|
||||
bcrypt (3.1.11)
|
||||
bindex (0.5.0)
|
||||
builder (3.2.3)
|
||||
byebug (9.1.0)
|
||||
cancancan (1.17.0)
|
||||
capistrano (3.10.1)
|
||||
airbrussh (>= 1.0.0)
|
||||
@@ -81,7 +89,7 @@ GEM
|
||||
concurrent-ruby (1.0.5)
|
||||
connection_pool (2.2.1)
|
||||
crass (1.0.2)
|
||||
cups (0.0.7)
|
||||
cups (0.1.10)
|
||||
database_cleaner (1.6.2)
|
||||
diff-lcs (1.3)
|
||||
erubi (1.7.0)
|
||||
@@ -99,6 +107,7 @@ GEM
|
||||
railties (>= 3.2, < 5.2)
|
||||
globalid (0.4.1)
|
||||
activesupport (>= 4.2.0)
|
||||
htmlentities (4.3.4)
|
||||
httparty (0.15.6)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.9.1)
|
||||
@@ -106,12 +115,17 @@ GEM
|
||||
jbuilder (2.7.0)
|
||||
activesupport (>= 4.2.0)
|
||||
multi_json (>= 1.2)
|
||||
jquery-fileupload-rails (0.4.7)
|
||||
actionpack (>= 3.1)
|
||||
railties (>= 3.1)
|
||||
sass (>= 3.2)
|
||||
jquery-rails (4.3.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (6.0.1)
|
||||
railties (>= 3.2.16)
|
||||
json (2.1.0)
|
||||
kaminari (1.0.1)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.0.1)
|
||||
@@ -155,6 +169,10 @@ GEM
|
||||
nokogiri (1.8.1)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
pdf-core (0.7.0)
|
||||
pdfjs_viewer-rails (0.2.0)
|
||||
json (> 1.8.4)
|
||||
rails (> 4.2.0)
|
||||
sass-rails (~> 5.0)
|
||||
pg (0.21.0)
|
||||
prawn (2.2.2)
|
||||
pdf-core (~> 0.7.0)
|
||||
@@ -196,6 +214,10 @@ GEM
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
redis (3.3.5)
|
||||
roo (1.13.2)
|
||||
nokogiri
|
||||
rubyzip
|
||||
spreadsheet (> 0.6.4)
|
||||
rspec-core (3.7.0)
|
||||
rspec-support (~> 3.7.0)
|
||||
rspec-expectations (3.7.0)
|
||||
@@ -214,6 +236,7 @@ GEM
|
||||
rspec-support (~> 3.7.0)
|
||||
rspec-support (3.7.0)
|
||||
ruby-ole (1.2.12.1)
|
||||
rubyzip (1.0.0)
|
||||
sass (3.5.3)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
@@ -285,7 +308,10 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
aescrypt
|
||||
axlsx (= 2.0.1)
|
||||
axlsx_rails
|
||||
bcrypt (~> 3.1.7)
|
||||
byebug
|
||||
cancancan (~> 1.10)
|
||||
capistrano
|
||||
capistrano-bundler
|
||||
@@ -294,7 +320,7 @@ DEPENDENCIES
|
||||
carrierwave (~> 1.0)
|
||||
chartkick
|
||||
coffee-rails (~> 4.2)
|
||||
cups (~> 0.0.7)
|
||||
cups
|
||||
database_cleaner
|
||||
factory_girl_rails (~> 4.0)
|
||||
faker
|
||||
@@ -302,6 +328,7 @@ DEPENDENCIES
|
||||
font-awesome-rails (~> 4.7, >= 4.7.0.2)
|
||||
httparty (~> 0.15.5)
|
||||
jbuilder (~> 2.5)
|
||||
jquery-fileupload-rails
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
kaminari (~> 1.0.1)
|
||||
@@ -311,6 +338,7 @@ DEPENDENCIES
|
||||
momentjs-rails
|
||||
mysql2 (>= 0.3.18, < 0.5)
|
||||
nested_form
|
||||
pdfjs_viewer-rails
|
||||
pg
|
||||
prawn
|
||||
prawn-table
|
||||
@@ -318,13 +346,14 @@ DEPENDENCIES
|
||||
rack-cors
|
||||
rails (~> 5.1.0)
|
||||
redis (~> 3.0)
|
||||
roo
|
||||
rspec-rails (~> 3.5)
|
||||
rubyzip (= 1.0.0)
|
||||
sass-rails (~> 5.0)
|
||||
schema_to_scaffold
|
||||
shoulda-matchers (~> 3.1)
|
||||
sidekiq
|
||||
simple_form
|
||||
spreadsheet
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
tether-rails
|
||||
@@ -336,7 +365,7 @@ DEPENDENCIES
|
||||
whenever
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.4.0p0
|
||||
ruby 2.4.1p111
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
||||
|
||||
203
README.md
203
README.md
@@ -8,39 +8,194 @@ Things you may want to cover:
|
||||
ruby 2.4.1p111
|
||||
|
||||
* Membership Details
|
||||
Osaka =>
|
||||
Auth Token => wu8YvlLmah0CL => New => v3
|
||||
=> rj0MJ0XI5GsKZehE => Old => v2
|
||||
=> code2lab => Old
|
||||
|
||||
Osaka
|
||||
Merchant account => RxzaYyAGzm7VqAZ4hKnv
|
||||
Campaign Id => {"campaign_type_id": 5}
|
||||
|
||||
Auth Token => rj0MJ0XI5GsKZehE => New
|
||||
BITP
|
||||
Auth Token => pZBHXEFbGNj/G => New => V3
|
||||
=> rj0MJ0XI5GsKZehE => Old => V2
|
||||
=> code2lab => Old
|
||||
|
||||
=> code2lab => Old
|
||||
|
||||
Merchant account => RxzaYyAGzm7VqAZ4hKnv
|
||||
|
||||
Campaign Id => {"campaign_type_id": 5}
|
||||
|
||||
|
||||
|
||||
BITP
|
||||
|
||||
Auth Token => rj0MJ0XI5GsKZehE => New
|
||||
|
||||
=> code2lab => Old
|
||||
|
||||
Merchant account => vWSsseoZCzxd6xcNf_uS
|
||||
|
||||
Campaign Id => {"campaign_type_id": 1}
|
||||
Merchant account => vWSsseoZCzxd6xcNf_uS
|
||||
Campaign Id => {"campaign_type_id": 1}
|
||||
|
||||
java -jar ~/Documents/Jade.jar http://192.168.1.88:3002
|
||||
java -jar ~/Documents/c2l_jade.jar http://192.168.1.151:3002
|
||||
|
||||
Person and Extra Time
|
||||
category_code = SPL... //for menu categories special
|
||||
1) must create Person in settings/accounts
|
||||
2) must create Adult and Child in settings/item_attributes
|
||||
3) must be PSA_[a-z/0-9] for Adult and PSC_[a-z/0-9] for Child in settings/menu_categories/[cat_id]/simple_menu_items
|
||||
3) must be PSAI_[a-z/0-9] for Adult and PSCI_[a-z/0-9] for Child in settings/simple_menu_items/[item_id]/menu_item_instances
|
||||
|
||||
For Extra Time
|
||||
item_instance_code
|
||||
* must start with 'Ext'[a..z]'_'[1..100]
|
||||
* note : don't add character after '_'
|
||||
|
||||
For Order Item & Order Summary Slim
|
||||
*** change OrderItemPdf to OrderItemSlimPdf and OrderSummaryPdf to OrderSummarySlimPdf
|
||||
1) settings/print_settings
|
||||
(a) Font is present => {Header font size:11, Item Font Size:9}
|
||||
(b) Font is blank => {Header font size:12, Item Font Size:10}
|
||||
2) settings/lookups => { type:print_settings, name:OrderSlimPdf, value:1 }
|
||||
* no need to change these files
|
||||
{ app/controllers/oqs/edit_controller.rb
|
||||
app/controllers/oqs/print_controller.rb
|
||||
app/models/order_queue_station.rb
|
||||
app/models/printer/order_queue_printer.rb
|
||||
app/models/printer/receipt_printer.rb
|
||||
}
|
||||
|
||||
For ReceiptBillA5Pdf
|
||||
*** change ReceiptBillPdf to ReceiptBillA5Pdf
|
||||
1) settings/print_settings , width:680, height:1450, Header font Size:16, Item font size:14
|
||||
2) settings/lookups => { type:print_settings, name:ReceiptBillA5Pdf, value:1 }
|
||||
|
||||
For ReceiptBillAltName options
|
||||
1) settings/lookups => { type:print_settings, name:ReceiptBillAltName, value:1 }
|
||||
|
||||
For OrderSetPdf options
|
||||
*** change OrderItemPdf to OrderSetItemPdf and OrderSummaryPdf to OrderSummarySetPdf
|
||||
1) settings/lookups => { type:print_settings, name:OrderSetPdf, value:1 }
|
||||
2) settings/print_settings
|
||||
(a) Font is present => {Header font size:11, Item Font Size:9}
|
||||
(b) Font is blank => {Header font size:12, Item Font Size:10}
|
||||
|
||||
For Bank Integration setting
|
||||
1) rake db:migrate for card_sale_trans, card_settle_trans
|
||||
2) settings/lookups => { type:bank_integration, name: Bank Integration, value:1 }
|
||||
|
||||
For checkout time and checkout alert time
|
||||
1) checkout time => { type: checkout_time, name: 9:00 AM - 12:00 PM, value: 120 }
|
||||
2) checkout alert time => { type: checkout_alert_time, name: 8:00 AM - 12:00 PM, value: 60 }
|
||||
* you can add multiple record for checkout time and checkout alert time
|
||||
* type must be 'checkout_time' and 'checkout_alert_time'
|
||||
* you can change name and value
|
||||
* name must be time range [12hr => 8:30 AM - 1:45 PM, 24hr => 8:00 - 13:45]
|
||||
* value must be minutes[60]
|
||||
|
||||
For call waiter pdf
|
||||
* Backend > Printer > Print Settings > New
|
||||
i) Name : Calling Waiter
|
||||
ii) Unique Code: CallWaiterPdf
|
||||
iii)Template: ...
|
||||
iv) Font: Zawgyi-One
|
||||
v) Printer: #printer name
|
||||
|
||||
Membership Actions SQL
|
||||
* update membership_actions set additional_parameter='{\"campaign_type_id\":5}' where id=10;
|
||||
|
||||
SQL Update after rake clear:data runned
|
||||
* update seed_generators
|
||||
i) TableBooking, Order, OrderItem, sale, SaleOrder, SaleItem, SaleTax, SalePayment, SaleAudit, AssignedOrderItem => { current:0, next:0 }
|
||||
** Note :: do not update Customer
|
||||
|
||||
Change type in mysql
|
||||
*run if you got font error for Myanmar, Chinese, etc...
|
||||
=> ALTER TABLE [table_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for table
|
||||
=> ALTER DATABASE [database_name] CHARACTER SET utf8 COLLATE utf8_unicode_ci #for database
|
||||
|
||||
For split bill
|
||||
1) settings/lookups => { type:split_bill, name:SplitBill, value:1 }
|
||||
|
||||
For Sidekiq
|
||||
1) If you want to use sidekiq
|
||||
=> Create New Lookups => lookup_type = sidekiq, Name = sidekiq , Value = 1 or 0
|
||||
|
||||
For Clear Menu
|
||||
1) rake clear:menu # menu,menu item,menu category,menu item instance,account,item option,item attribute,item set
|
||||
|
||||
For Check CUp status
|
||||
###please open
|
||||
sudo cat /etc/sudoers
|
||||
### cope and parse
|
||||
%superuser ALL=(ALL) NOPASSWD: ALL
|
||||
|
||||
<---- Extra Fields Script ----->
|
||||
DROP TABLE IF EXISTS `display_images`;
|
||||
CREATE TABLE `display_images` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`shop_id` int(11) DEFAULT NULL,
|
||||
`image` blob,
|
||||
`created_by` varchar(255) DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
ALTER TABLE customers
|
||||
ADD COLUMN image_path VARCHAR(255);
|
||||
|
||||
ALTER TABLE employees
|
||||
ADD COLUMN image_path VARCHAR(255);
|
||||
|
||||
ALTER TABLE commissioners
|
||||
ADD COLUMN image_path VARCHAR(255);
|
||||
|
||||
ALTER TABLE sales
|
||||
ADD COLUMN equal_persons INT(11) after rebate_status;
|
||||
|
||||
ALTER TABLE sale_items
|
||||
ADD COLUMN remark VARCHAR(255) after status;
|
||||
|
||||
ALTER TABLE shops
|
||||
ADD COLUMN shop_code VARCHAR(255) after name,
|
||||
ADD COLUMN client_name VARCHAR(255) after shop_code,
|
||||
ADD COLUMN client_code VARCHAR(255) after client_name;
|
||||
|
||||
ALTER TABLE print_settings
|
||||
ADD COLUMN brand_name VARCHAR(255) after api_settings,
|
||||
ADD COLUMN type VARCHAR(255) after brand_name;
|
||||
|
||||
ALTER TABLE tax_profiles
|
||||
ADD COLUMN group_type VARCHAR(255) after name;
|
||||
|
||||
<---- Extra Fields Script ----->
|
||||
For CloseCashierCustomisePdf in lookups
|
||||
*** change CloseCashierPdf to CloseCashierCustomisePdf
|
||||
1) settings/print_settings
|
||||
2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }
|
||||
|
||||
<---- Extra Fields Script ----->
|
||||
For MoveTablePdf in lookups
|
||||
*** Both Table and Room Moving ***
|
||||
1) settings/lookups => { type:print_settings, name: MoveTablePdf, value:1 }
|
||||
|
||||
For MoveTablePdf in print settings
|
||||
* Backend > Printer > Print Settings > New
|
||||
i) Name : Move Table
|
||||
ii) Unique Code: MoveTablePdf
|
||||
iii)Template: ...
|
||||
iv) Font: Zawgyi-One v) Printer: #printer name
|
||||
|
||||
/* Tax Profile Group Types in lookups */
|
||||
1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier }
|
||||
2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service }
|
||||
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
||||
/* Tax Profile Group Types in lookups */
|
||||
|
||||
Add Kitchen Role of Employee
|
||||
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }
|
||||
|
||||
Add Base URL for DOEMAL
|
||||
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
|
||||
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Cloud Sync
|
||||
2. Action Cable
|
||||
3. Shop Setup
|
||||
4. Payment Integation
|
||||
1. Migration
|
||||
2. Quick Service
|
||||
3. Order & Reservation
|
||||
|
||||
|
||||
* System dependencies
|
||||
* System Dependencies
|
||||
|
||||
* Configuration
|
||||
|
||||
|
||||
BIN
app/assets/images/slider/s1.jpg
Normal file
BIN
app/assets/images/slider/s1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 199 KiB |
BIN
app/assets/images/slider/s2.jpg
Normal file
BIN
app/assets/images/slider/s2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
BIN
app/assets/images/slider/s3.jpg
Normal file
BIN
app/assets/images/slider/s3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 120 KiB |
BIN
app/assets/images/slider/s4.jpg
Normal file
BIN
app/assets/images/slider/s4.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -23,6 +23,7 @@
|
||||
//= require bootstrap-notify/bootstrap-notify.js
|
||||
//= require node-waves/waves.js
|
||||
//= require sweetalert/sweetalert.min.js
|
||||
//= require fileinput.min
|
||||
//= require BSBMaterial/turbolink_admin.js
|
||||
//= require BSBMaterial/demo.js
|
||||
//= require custom.js
|
||||
@@ -34,4 +35,24 @@ $(document).on('turbolinks:load', function() {
|
||||
weekStart: 1,
|
||||
time: false
|
||||
});
|
||||
});
|
||||
|
||||
$("#customer_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,34 +25,80 @@
|
||||
//= require custom.js
|
||||
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var oqs_id = "";
|
||||
$(".nav-completed").on("click", function(){
|
||||
$("#completed").removeClass('hide')
|
||||
$(".oqs_append").addClass('hide')
|
||||
});
|
||||
|
||||
$(".tables").on("click", function(){
|
||||
|
||||
var table_id = $(this).val();
|
||||
$('#table_id').val(table_id);
|
||||
oqs_id = $("#oqs_id").val();
|
||||
if (table_id){
|
||||
var table = table_id
|
||||
}else{
|
||||
var table = null
|
||||
}
|
||||
|
||||
if (oqs_id > 0) {
|
||||
$(".oqs_click").removeClass('oqs_active');
|
||||
$(".queue_station").removeClass('queue_station_box');
|
||||
$("#completed").addClass('hide');
|
||||
$(".oqs_append").removeClass('hide');
|
||||
$("#oqs_active").addClass('oqs_active');
|
||||
$(".queue_station").addClass('queue_station_box');
|
||||
// oqs_id = $(this).find(".oqs-id").text();
|
||||
$("#oqs_active").attr('data-id',oqs_id);
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
show_details(url,table);
|
||||
}else{
|
||||
$("#completed").removeClass('hide')
|
||||
$(".oqs_append").addClass('hide')
|
||||
}
|
||||
});
|
||||
|
||||
$(".oqs_click").on("click", function(){
|
||||
$(".oqs_click").removeClass('oqs_active');
|
||||
$(".queue_station").removeClass('queue_station_box');
|
||||
$("#completed").addClass('hide');
|
||||
$(".oqs_append").removeClass('hide');
|
||||
$(this).addClass('oqs_active');
|
||||
$(".queue_station").addClass('queue_station_box');
|
||||
var oqs_id = $(this).find(".oqs-id").text();
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
show_details(url);
|
||||
oqs_id = $(this).val();
|
||||
var table_id = $('#table_id').val();
|
||||
if (table_id){
|
||||
var table = table_id
|
||||
}else{
|
||||
var table = null
|
||||
}
|
||||
|
||||
if (oqs_id > 0) {
|
||||
$(".oqs_click").removeClass('oqs_active');
|
||||
$(".queue_station").removeClass('queue_station_box');
|
||||
$("#completed").addClass('hide');
|
||||
$(".oqs_append").removeClass('hide');
|
||||
$("#oqs_active").addClass('oqs_active');
|
||||
$(".queue_station").addClass('queue_station_box');
|
||||
// oqs_id = $(this).find(".oqs-id").text();
|
||||
$("#oqs_active").attr('data-id',oqs_id);
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
show_details(url,table);
|
||||
}else{
|
||||
$("#completed").removeClass('hide')
|
||||
$(".oqs_append").addClass('hide')
|
||||
}
|
||||
|
||||
|
||||
}); //End Click
|
||||
|
||||
function show_details(url){
|
||||
function show_details(url,table_id){
|
||||
var oqs_append = $('.oqs_append');
|
||||
oqs_append.empty();
|
||||
var filter = $('.filter').text();
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {'filter':filter},
|
||||
data: {'filter':filter,'table_id':table_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
for(var field in data) {
|
||||
@@ -65,12 +111,30 @@ $(document).on('turbolinks:load', function() {
|
||||
}
|
||||
|
||||
var date = new Date(data[field]["created_at"]);
|
||||
var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||
|
||||
// var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||
var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM');
|
||||
var set_menu_items = data[field]["set_menu_items"];
|
||||
var set_instance_items = "";
|
||||
if(set_menu_items!=null){
|
||||
if(set_menu_items.length > 0){
|
||||
$.each(set_menu_items, function(k,val){
|
||||
set_instance_items += '<br><span class="font-12">'+val+'</span>';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var table_type = '';
|
||||
if (data[field]["table_type"]!=null) {
|
||||
table_type = data[field]["table_type"] +'-'+data[field]["zone"]
|
||||
}else{
|
||||
table_type = "No Table"
|
||||
|
||||
}
|
||||
|
||||
row ='<div class="card queue_station animated " data-order-no="'+data[field]["order_id"]+'">'
|
||||
+'<div class="card-block">'
|
||||
+'<div class="row">'
|
||||
+'<span class="col-md-4 order-zone-type font-13">'+data[field]["table_type"]+'-'+ data[field]["zone"] +'</span>'
|
||||
+'<span class="col-md-4 order-zone-type font-13">'+table_type +'</span>'
|
||||
+'<span class="order-zone hidden font-14">'+ data[field]["zone"] +'</span>'
|
||||
+'<span class="col-md-8"><small class="float-right font-13">'+data[field]["order_id"]+'</small></span>'
|
||||
+'</div>'
|
||||
@@ -78,9 +142,10 @@ $(document).on('turbolinks:load', function() {
|
||||
+'<p class="m-b--10">'
|
||||
+'<span class="order-item font-15">'+ data[field]["item_name"] +'- </span>'
|
||||
+'<span class="order-qty"> [x'+ data[field]["qty"] +'] </span>'
|
||||
+set_instance_items
|
||||
+'</p>'
|
||||
|
||||
+'<br/><p class="card-text item-options">'+ options +'</p>'
|
||||
+'<p class="card-text item-options">'+ options +'</p>'
|
||||
|
||||
+'<span class="card-text">'
|
||||
+'<span class="text-muted">Order at - '
|
||||
@@ -132,16 +197,53 @@ $(document).on('turbolinks:load', function() {
|
||||
type: 'GET',
|
||||
url: '/oqs/' + orderNo,
|
||||
data: { 'status' : order_status },
|
||||
success: function(res){
|
||||
|
||||
for (i = 0; i < res.length; i++) {
|
||||
var data = JSON.stringify(res[i]);
|
||||
success: function(res){
|
||||
// console.log(res);
|
||||
for (i = 0; i < res["items"].length; i++) {
|
||||
var data = JSON.stringify(res["items"][i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
var assigned_order_items = [];
|
||||
var assigned_order_item_id = '';
|
||||
if(res["assigned_order_items"]!= undefined && res["assigned_order_items"]!=''){
|
||||
assigned_order_items = JSON.parse(JSON.stringify(res["assigned_order_items"]));
|
||||
$.each(assigned_order_items,function(key,value){
|
||||
if(value[parse_data.order_items_id] != undefined){
|
||||
assigned_order_item_id = value[parse_data.order_items_id];
|
||||
}
|
||||
});
|
||||
}
|
||||
// console.log(assigned_order_item_id);
|
||||
|
||||
var order_item_row = "<tr>" +
|
||||
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + "</td>" +
|
||||
var set_menu_items = parse_data.set_menu_items;
|
||||
var set_instance_items = "";
|
||||
if(set_menu_items!=null){
|
||||
if(set_menu_items.length > 0){
|
||||
$.each(set_menu_items, function(k,val){
|
||||
set_instance_items += '<br><span class="font-12">'+val+'</span>';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (oqs_id > 0){
|
||||
if(assigned_order_item_id != ''){
|
||||
var order_item_row = "<tr id='edit_"+assigned_order_item_id+"' class='order-item-edit'>" +
|
||||
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
||||
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||
"</tr>";
|
||||
}else{
|
||||
var order_item_row = "<tr>" +
|
||||
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
||||
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||
"</tr>";
|
||||
}
|
||||
|
||||
}else{
|
||||
var order_item_row = "<tr>" +
|
||||
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
||||
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||
"</tr>";
|
||||
}
|
||||
|
||||
$("#oqs-order-details-table").children("tbody").append(order_item_row);
|
||||
}
|
||||
}
|
||||
@@ -157,7 +259,7 @@ $(document).on('turbolinks:load', function() {
|
||||
$(document).on('click', '.order-item-edit', function(event){
|
||||
var _self = $(this); // To know in ajax return
|
||||
var assigned_item_id=$(this).attr('id').substr(5);
|
||||
window.location.href = '/oqs/'+ assigned_item_id + "/edit"
|
||||
window.location.href = '/oqs/'+ assigned_item_id + "/edit/oqs";
|
||||
});
|
||||
|
||||
// complete for queue item
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
$(function() {
|
||||
var role = $('#role').val();
|
||||
type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
//click menu sidebar menu category
|
||||
$(".product").on("click", function(){
|
||||
var url = $(this).attr('data-ref');
|
||||
@@ -9,6 +12,16 @@ $(function() {
|
||||
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
if (type != -1 && modify_order != -1) {
|
||||
url_item = '../../../../../'+url_item;
|
||||
}
|
||||
if(modify_order == -1 && type != -1){
|
||||
url_item = '../../../../'+url_item;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
url_item = url_item
|
||||
}
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -28,37 +41,47 @@ $(function() {
|
||||
item_attributes = [];
|
||||
|
||||
if (product[field].image_path) {
|
||||
image_path = product[field].image_path.url;
|
||||
if (type != -1 && modify_order != -1) {
|
||||
image_path = '../../'+product[field].image_path.url;
|
||||
}
|
||||
if(modify_order == -1 && type != -1){
|
||||
image_path = '../../../../'+product[field].image_path.url;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
image_path = product[field].image_path.url;
|
||||
}
|
||||
}else{
|
||||
image_path = "/image/logo.png";
|
||||
}
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
||||
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">'
|
||||
+'<div class="col-md-9">'+ product[field].name +'</div>'
|
||||
+"<div class='col-md-3 add_icon' data-item-code='"
|
||||
+"<div class='col-md-3 menu_item_box' data-item-code='"
|
||||
+ product[field].item_code +"' data-instance = '"
|
||||
+JSON.stringify(item_attributes)+"' data-id = '"
|
||||
+JSON.stringify(item_attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
|
||||
+"<i class='fa fa-bars material-icons'>"
|
||||
+'view_list</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
|
||||
+"<div class='add_icon' data-item-code='"
|
||||
+ product[field].item_code +"' data-name='"
|
||||
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
|
||||
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"'>"
|
||||
+"<i class='fa fa-plus material-icons'>"
|
||||
+'add</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"'>"
|
||||
|
||||
+"<div class='menu_item_box' data-item-code='"
|
||||
+ product[field].item_code +"' data-instance = '"
|
||||
+JSON.stringify(item_attributes)+"' data-id = '"
|
||||
+JSON.stringify(item_attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(item_attributes)+"' data-item-sets = '"
|
||||
+JSON.stringify(item_attributes)+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
|
||||
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' height='125px' src='"+image_path+"'>"
|
||||
+"</div>"
|
||||
// +"<div class='card-block custom-card-block'>"
|
||||
// +"<img id='logo' height='125px' src='"+image_path+"'>"
|
||||
// +"</div>"
|
||||
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+'<span>'+ product[field].unit_price +'</span>'
|
||||
@@ -73,8 +96,8 @@ $(function() {
|
||||
}
|
||||
//end show list function
|
||||
//click menu sidebar menu category
|
||||
// $(".menu_category").on("click", function(){
|
||||
$(document).on('click', '.menu_category', function(event){
|
||||
event.preventDefault();
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var url = "get_menu_category/"+menu_id;
|
||||
show_menu_item_list(url);
|
||||
@@ -83,9 +106,20 @@ $(function() {
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_item_list(url_item){
|
||||
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
if (type != -1 && modify_order != -1) {
|
||||
url_item = '../../../addorders/'+url_item;
|
||||
}if(modify_order == -1 && type != -1){
|
||||
url_item = 'addorders/'+url_item;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
url_item = url_item
|
||||
}
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -102,7 +136,7 @@ $(function() {
|
||||
instances = menu_items[field].instances ;
|
||||
|
||||
if (!instances.length > 0) {
|
||||
swal("Hello Please Check!","doesn't not have instance item in this menu items ("+ menu_items[field].name+")","warning");
|
||||
swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
|
||||
}
|
||||
if (instances.length > 0) {
|
||||
qty = 1;
|
||||
@@ -112,21 +146,31 @@ $(function() {
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||
fa_plus = '';
|
||||
add = '';
|
||||
menu_item_box = 'set_item_box';
|
||||
menu_item_box = 'add_icon';
|
||||
data_target = 'sx_item_set_detailModal';
|
||||
|
||||
data_modal = 'modal'
|
||||
add_icon = "set_item_box"
|
||||
code = menu_items[field].code;
|
||||
name = menu_items[field].name;
|
||||
price = 0;//parseFloat( menu_items[field].price).toFixed(2);
|
||||
instances = menu_items[field].instances;
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default == true) {
|
||||
price = parseFloat(instances[i].price).toFixed(2);
|
||||
}else{
|
||||
price = 0;
|
||||
}
|
||||
});
|
||||
is_available = menu_items[field].is_available ;
|
||||
is_on_promotion = 0;
|
||||
item_attributes = menu_items[field].attributes;
|
||||
promotion_price = menu_items[field].promotion_price;
|
||||
}else{
|
||||
fa_plus = 'material-icons';
|
||||
add = 'add'
|
||||
add = 'view_list'
|
||||
menu_item_box = 'menu_item_box';
|
||||
data_target = 'sx_item_detailModal';
|
||||
data_modal = ''
|
||||
add_icon = "add_icon"
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default === true) {
|
||||
@@ -143,39 +187,52 @@ $(function() {
|
||||
}
|
||||
|
||||
if (menu_items[field].image) {
|
||||
image_path = menu_items[field].image;
|
||||
if (modify_order) {
|
||||
image_path = "../../"+menu_items[field].image;
|
||||
}else{
|
||||
image_path = menu_items[field].image;
|
||||
}
|
||||
|
||||
}else{
|
||||
image_path = "/image/logo.png";
|
||||
if (modify_order) {
|
||||
image_path = "../../image/logo.png";
|
||||
}else{
|
||||
image_path = "image/logo.png";
|
||||
}
|
||||
}
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">'
|
||||
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
||||
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
|
||||
+"<div class='col-md-3 add_icon' data-item-code='"
|
||||
+"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
|
||||
+ menu_items[field].code +"' data-instance = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
|
||||
+"<i class='fa "+fa_plus+" '>"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"'>"
|
||||
+"<i class='fa "+fa_plus+" '>"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
|
||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
|
||||
+"<div class='"+menu_item_box+"' data-item-code='"
|
||||
+ menu_items[field].code +"' data-instance = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"'>"
|
||||
// +"<div class='card-block custom-card-block'>"
|
||||
// +"<img id='logo' height='' src='"+image_path+"'>"
|
||||
// +"</div>"
|
||||
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' height='125px' src='"+image_path+"'>"
|
||||
+"</div>"
|
||||
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
|
||||
+'<span>'+ price +'</span>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
@@ -194,23 +251,41 @@ $(function() {
|
||||
$(document).on('click', '.set_item_box', function(event){
|
||||
$(".instance-list").empty();
|
||||
$(".options-list").empty();
|
||||
$(".selected-set-list").empty();
|
||||
$('.set_change_qty').val(1);
|
||||
change_qty_plus_minus("set_count","set_plus","set_minus");
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
|
||||
instances = $(this).data('instance');
|
||||
// data = $(this).parent().siblings('.add_icon');
|
||||
//instances = $(this).data('instance');
|
||||
item_sets = $(this).data('item-sets');
|
||||
instances = $(this).data('instances');
|
||||
item_options = $(this).data('options');
|
||||
|
||||
for(var field in item_sets) {
|
||||
|
||||
|
||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||
|
||||
value = item_sets[field]["instances"];
|
||||
$(value).each(function(i){
|
||||
if (type != -1 && modify_order != -1) {
|
||||
|
||||
url = '../../../addorders/get_item_instance/'+value[i]["id"];
|
||||
console.log("ssssssss")
|
||||
}
|
||||
if(modify_order == -1 && type != -1){
|
||||
|
||||
url = 'addorders/get_item_instance/'+value[i]["id"] ;
|
||||
console.log("aaaaaa")
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
|
||||
url = '../addorders/get_item_instance/'+value[i]["id"];
|
||||
console.log("cccccccccc")
|
||||
}
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '../../api/restaurant/menu_item_instances/'+value[i]["id"],
|
||||
data: {id:value[i]},
|
||||
url: url,
|
||||
// data: {id:value[i]},
|
||||
success:function(result){
|
||||
|
||||
row = '<div class="col-md-4 " >'
|
||||
@@ -220,6 +295,9 @@ $(function() {
|
||||
+"' data-option='"+JSON.stringify(result["options"])
|
||||
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
|
||||
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
|
||||
+"' data-parent-code='"+instances[0]['code']
|
||||
+"' data-parent-id='"+instances[0]['id']
|
||||
+"' data-sub-item='true"
|
||||
+"'>"
|
||||
+'<div class="custom-card-head card-head" style="line-height:14px;">'
|
||||
+'<span class="">'+result["name"]+'</span>'
|
||||
@@ -241,13 +319,29 @@ $(function() {
|
||||
});
|
||||
}
|
||||
|
||||
for(var j in item_options) {
|
||||
value = item_options[j]["values"];
|
||||
type = item_options[j]["type"];
|
||||
row = "<h4>"+type+"</h4>"
|
||||
$(value).each(function(i){
|
||||
row +="<button class='btn btn- waves-effect option_btn "+ type +"' data-type='"
|
||||
+type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"</button>";
|
||||
});
|
||||
$(".options-list").append(row);
|
||||
}
|
||||
$('.set-item').attr('data-code',instances[0]['code']);
|
||||
$('.set-item').attr('data-name',instances[0]['name']);
|
||||
$('.set-item').attr('data-price',instances[0]['price']);
|
||||
$('.set-item').attr('data-options','');
|
||||
$('.set-item').attr('data-parent',true);
|
||||
|
||||
$('#set_change_qty').val(1);
|
||||
$('#set_item_instances').text(instances);
|
||||
$('#set_name').text(data.attr('data-name'));
|
||||
$('#set_item_code').text(data.attr('data-item-code'));
|
||||
// $('#set_total_price').text(data.attr('data-price'));
|
||||
$('#set_total_price').text(0);
|
||||
$('#set_unit_price').text(data.attr('data-price'));
|
||||
$('#set_name').text($(this).attr('data-name'));
|
||||
$('#set_item_code').text($(this).attr('data-item-code'));
|
||||
$('#set_total_price').text($(this).attr('data-price'));
|
||||
// $('#set_total_price').text(0);
|
||||
$('#set_unit_price').text($(this).attr('data-price'));
|
||||
// $('#set_unit_price').text(0);
|
||||
});
|
||||
// click instance for add item set
|
||||
@@ -256,6 +350,7 @@ $(function() {
|
||||
$(".options-list").empty();
|
||||
|
||||
rowCount = $('.selected-instance');
|
||||
setCount = $('.selected-set');
|
||||
item_options = $(this).data('option');
|
||||
|
||||
min_qty = $(this).data('min-qty');
|
||||
@@ -276,34 +371,79 @@ $(function() {
|
||||
$(".options-list").append(row);
|
||||
}
|
||||
}
|
||||
if($(this).hasClass('selected-instance') == true){
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
price = $(this).data('price');
|
||||
// qty = $('#set_change_qty').val();
|
||||
qty = document.getElementById("set_count").value;
|
||||
total = qty*price;
|
||||
var total_price = +sub_total - +total;
|
||||
$(this).removeClass('selected-instance');
|
||||
$(".options-list").empty();
|
||||
$(this).removeAttr('data-options');
|
||||
$('#instance_option').text('')
|
||||
}else {
|
||||
if (rowCount.length+1 <= max_qty) {
|
||||
// if($(this).hasClass('selected-instance') == true){
|
||||
// sub_total = $('#set_total_price').text();
|
||||
// name = $(this).data('name');
|
||||
// price = $(this).data('price');
|
||||
// // qty = $('#set_change_qty').val();
|
||||
// qty = document.getElementById("set_count").value;
|
||||
// total = qty*price;
|
||||
// var total_price = +sub_total - +total;
|
||||
// $(this).removeClass('selected-instance');
|
||||
// $(".options-list").empty();
|
||||
// $(this).removeAttr('data-options');
|
||||
// $('#instance_option').text('')
|
||||
// }else {
|
||||
if (setCount.length+1 <= max_qty) {
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
price = $(this).data('price');
|
||||
options = $(this).attr('data-options','[]');
|
||||
// qty = $('#set_change_qty').val();
|
||||
qty = document.getElementById("set_count").value;
|
||||
total = qty*price;
|
||||
var total_price = +sub_total + +total;
|
||||
$(this).addClass('selected-instance');
|
||||
|
||||
set = "<div class='selected-set card custom-card' style='margin-bottom:10px !important'"
|
||||
+"' data-name='"+$(this).data('name')
|
||||
+"' data-code='"+code
|
||||
+"' data-price='"+$(this).data('price')
|
||||
+"' data-option='[]"
|
||||
+"' data-options='"+JSON.stringify($(this).data('options'))
|
||||
+"' data-min-qty='"+$(this).data('min-qty')
|
||||
+"' data-max-qty='"+$(this).data('max-qty')
|
||||
+"' data-parent-code='"+$(this).data('parent-code')
|
||||
+"' data-parent-id='"+$(this).data('parent-id')
|
||||
+"' data-sub-item='true"
|
||||
+"'>"
|
||||
|
||||
+'<div class="card-block" style="background-color:#54A5AF;">'
|
||||
+' <button type="button" class="close" id="remove_set" style="font-size: 20px;">×</button>'
|
||||
+'<span style="color:#fff">'+$(this).data('name')+'</span>'
|
||||
+'</div>'
|
||||
+'<div class="card-block custom-card-block">'
|
||||
|
||||
+' <small style="float:" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
// +'<div class="card-footer custom-card-footer">'
|
||||
// +' <span>'+$(this).data('price')+'</span>'
|
||||
// // +' <small style="float:right" id="instance_option"></small>'
|
||||
// +'</div>'
|
||||
+'</div>'
|
||||
$(".selected-set-list").append(set);
|
||||
}else{
|
||||
swal("Alert !", 'Maximum Select is ' + max_qty + " items", "warning");
|
||||
}
|
||||
}
|
||||
// }
|
||||
$('#set_unit_price').text(price);
|
||||
$('#set_total_price').text(total_price);
|
||||
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
// click add order
|
||||
$(document).on('click', '#remove_set', function(event){
|
||||
code = $(this).parent().parent('.selected-set').attr('data-code');
|
||||
instance = $(".selected-instance");
|
||||
console.log(code)
|
||||
$(instance).each(function(i){
|
||||
if ($(instance[i]).attr('data-code')==code){
|
||||
console.log($(instance[i]))
|
||||
$(instance[i]).removeClass("selected-instance")
|
||||
}
|
||||
});
|
||||
$(this).parent().parent('.selected-set').remove();
|
||||
});
|
||||
|
||||
// click add order
|
||||
$(document).on('click', '.set_order', function(event){
|
||||
@@ -313,27 +453,58 @@ $(function() {
|
||||
item_name = $('#set_name').text();
|
||||
min_qty = $(this).data('min-qty');
|
||||
|
||||
var items = $('.selected-instance');
|
||||
default_instance = $('.set-item');
|
||||
|
||||
var items = $('.selected-set');
|
||||
if (items.length >= min_qty) {
|
||||
|
||||
item = get_set_item(items);
|
||||
customer_display_view(item,"set_add");
|
||||
var option = []
|
||||
attribute_arr = []
|
||||
option_arr = []
|
||||
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
$(items).each(function(i){
|
||||
code = $(items[i]).attr('data-code');
|
||||
name = $(items[i]).attr('data-name');
|
||||
price = $(items[i]).attr('data-price');
|
||||
option = $(items[i]).attr('data-options');
|
||||
code = $('.set-item').attr('data-code');
|
||||
name = $('.set-item').attr('data-name');
|
||||
price = $('.set-item').attr('data-price');
|
||||
option_name = ($('.set-item').attr('data-options') === 'undefined') ? ' ' :$('.set-item').attr('data-options');
|
||||
option = ($('.set-item').attr('data-options') === '') ? '[]' :$('.set-item').attr('data-options');
|
||||
parent = $('.set-item').attr('data-parent');
|
||||
total = qty * price ;
|
||||
option_arr.push(option);
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||
+code+"' data-attributes='"
|
||||
+attribute_arr+"' data-options ='"
|
||||
+option_arr+"' data-row ='"+rowCount+ "'>"
|
||||
+option+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + option_name +'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(total).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".summary-items tbody").append(row);
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
var set_option = []
|
||||
$(items).each(function(i){
|
||||
console.log($(items[0]).attr('data-name'))
|
||||
code = $(items[i]).attr('data-code');
|
||||
name = $(items[i]).attr('data-name');
|
||||
price = $(items[i]).attr('data-price');
|
||||
set_option_name = ($(items[i]).attr('data-options') === 'undefined') ? '' :$(items[i]).attr('data-options');
|
||||
set_option = ($(items[i]).attr('data-options') === 'undefined') ? '[]' :$(items[i]).attr('data-options');
|
||||
sub_item = $(items[i]).attr('data-sub-item');
|
||||
total = qty * price ;
|
||||
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||
+code+"' data-attributes='"
|
||||
+attribute_arr+"' data-options ='"
|
||||
+set_option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + set_option_name +'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(total).toFixed(2)
|
||||
@@ -342,6 +513,7 @@ $(function() {
|
||||
$(".summary-items tbody").append(row);
|
||||
rowCount = rowCount + 1;
|
||||
});
|
||||
|
||||
calculate_sub_total();
|
||||
$(".sx_item_set_detailModal").css({ 'display': "none" });
|
||||
}else{
|
||||
@@ -378,7 +550,8 @@ $(function() {
|
||||
|
||||
change_qty_plus_minus("count","plus","minus");
|
||||
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
// data = $(this).parent().children().children('.add_icon');
|
||||
data = $(this).parent().siblings('.add_icon');
|
||||
|
||||
$('#total_price').text(data.attr('data-price'));
|
||||
attributes = $(this).data('id');
|
||||
@@ -387,9 +560,19 @@ $(function() {
|
||||
item_options = $(this).data('option');
|
||||
|
||||
if (data.attr('data-image')) {
|
||||
image = "<img id='' width='200px' src='"+data.attr('data-image')+"'>";
|
||||
if (modify_order) {
|
||||
image = "<img id='' width='200px' src='../../"+data.attr('data-image')+"'>";
|
||||
}else{
|
||||
image = "<img id='' width='200px' src='"+data.attr('data-image')+"'>";
|
||||
}
|
||||
|
||||
}else{
|
||||
image = "<img id='' width='200px' src='/image/logo.png'>";
|
||||
if (modify_order) {
|
||||
image = "<img id='' width='200px' src='../../image/logo.png'>";
|
||||
}else{
|
||||
image = "<img id='' width='200px' src='/image/logo.png'>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('#modal_box_img').append(image);
|
||||
@@ -533,17 +716,23 @@ $(function() {
|
||||
|
||||
|
||||
if(group == "set_menu"){
|
||||
code = $(this).data('code');
|
||||
value = $(this).data('value');
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
$(".selected-set:last").attr('data-options',JSON.stringify(option_arr));
|
||||
$(".selected-set:last").children().children('#instance_option').text(option_arr);
|
||||
// instance = $(".selected-instance");
|
||||
// $(instance).each(function(i){
|
||||
// if ($(instance[i]).attr('data-code')==code){
|
||||
// option_arr = get_selected_attributes('selected-option');
|
||||
// $(instance[i]).attr('data-options',JSON.stringify(option_arr));
|
||||
// $(instance[i]).children().children('#instance_option').text(option_arr);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
instance = $(".selected-instance");
|
||||
$(instance).each(function(i){
|
||||
if ($(instance[i]).attr('data-code')==code){
|
||||
if(group == "set_menu_default"){
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
$(instance[i]).attr('data-options',JSON.stringify(option_arr));
|
||||
$(instance[i]).children().children('#instance_option').text(option_arr);
|
||||
}
|
||||
});
|
||||
$('.set-item').attr('data-options',JSON.stringify(option_arr));
|
||||
$('.set_default_option').text(option_arr);
|
||||
}
|
||||
|
||||
}); //End selecct attribute buttom
|
||||
@@ -557,7 +746,7 @@ $(function() {
|
||||
|
||||
attribute_arr = get_selected_attributes('selected-attribute');
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
|
||||
console.log(option_arr)
|
||||
if (item_row.length>0) {
|
||||
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
|
||||
|
||||
@@ -595,8 +784,11 @@ $(function() {
|
||||
$('.add_to_order').attr('data-name',$('#title_name').text());
|
||||
$('.add_to_order').attr('data-attributes',JSON.stringify(attribute_arr));
|
||||
$('.add_to_order').attr('data-options',JSON.stringify(option_arr));
|
||||
$('.add_to_order').attr('data-opt',JSON.stringify(option_arr));
|
||||
var item_data = $(this);
|
||||
show_item_detail(item_data);
|
||||
item = get_item(item_data,"add_to_order");
|
||||
customer_display_view(item,"add");
|
||||
show_item_detail(item_data,"add_to_order");
|
||||
calculate_sub_total();
|
||||
|
||||
}); //End add order Click
|
||||
@@ -604,30 +796,42 @@ $(function() {
|
||||
// click plus icon for add
|
||||
$(document).on('click', '.add_icon', function(event){
|
||||
var item_data = $(this);
|
||||
show_item_detail(item_data);
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
show_item_detail(item_data,"add_icon");
|
||||
calculate_sub_total();
|
||||
}); //End Add Icon Click
|
||||
|
||||
function show_item_detail(data){
|
||||
function show_item_detail(data,click_type){
|
||||
|
||||
qty = parseInt(data.attr('data-qty'));
|
||||
append = 0;
|
||||
price = parseFloat(data.attr('data-price')).toFixed(2);
|
||||
price = data.attr('data-price');
|
||||
|
||||
instance_name = data.attr('data-instance');
|
||||
if (instance_name == "undefined"){
|
||||
instance = '';
|
||||
}else{
|
||||
instance = "("+data.attr('data-instance')+")";
|
||||
}
|
||||
|
||||
d_option = data.attr('data-opt');
|
||||
if (click_type != "add_icon"){
|
||||
option_name = "-"+data.attr('data-options');
|
||||
data_option = data.attr('data-options') ;
|
||||
}else{
|
||||
option_name = ' ';
|
||||
data_option = '[]';
|
||||
}
|
||||
console.log(d_option)
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
var item_row = $('.summary-items tbody tr');
|
||||
|
||||
$(item_row).each(function(i){
|
||||
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')) {
|
||||
r_option = $(item_row[i]).attr('data-opt');
|
||||
console.log(r_option)
|
||||
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) {
|
||||
if (qty > 1) {
|
||||
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
|
||||
}else{
|
||||
@@ -635,9 +839,9 @@ $(function() {
|
||||
}
|
||||
|
||||
$(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(parseFloat(price*qty).toFixed(2)));
|
||||
append =1;
|
||||
}else{
|
||||
}else{
|
||||
if (qty > 1) {
|
||||
qty = qty;
|
||||
}else{
|
||||
@@ -651,9 +855,10 @@ $(function() {
|
||||
+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
|
||||
+data.attr('data-instance-code')+"' data-attributes='"
|
||||
+data.attr('data-attributes')+"' data-options ='"
|
||||
+data_option+"' data-opt ='"
|
||||
+data.attr('data-options')+"' data-row ='"+rowCount+ "'>"
|
||||
+'<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 +''+option_name+'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(price).toFixed(2)
|
||||
@@ -663,54 +868,135 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Pay Discount for Payment
|
||||
// Create Order
|
||||
$("#create_order").on('click', function(e){
|
||||
|
||||
$(this).attr('disabled', 'disabled');
|
||||
e.preventDefault();
|
||||
$("#oqs_loading_wrapper").show();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var booking_id = $('#booking_id').text();
|
||||
if (!booking_id.length > 0) {
|
||||
|
||||
quick_service = window.location.href.indexOf("quick_service");
|
||||
if (quick_service != -1) {
|
||||
type = 'quick_service'
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').val();
|
||||
var customer_id = $('#customer_id').val();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var ajax_url = 'addorders/create';
|
||||
}else{
|
||||
type = 'cashier'
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var ajax_url = '../addorders/create';
|
||||
}
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
if (booking_id.length > 0) {
|
||||
|
||||
var params = {'order_source': "cashier", 'order_type': "dine_in",
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
}
|
||||
var table_type = $('#table_type').text();
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
|
||||
var ajax_url = '../addorders/create';
|
||||
|
||||
var params = {'order_source': "cashier", 'order_type': "dine_in",
|
||||
'order_items': order_items,'create_type' : "create_only" };
|
||||
}else{
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
'order_items': order_items,'create_type' : "create_only" };
|
||||
}
|
||||
|
||||
// if (table_id.length>0 || role == 'waiter') {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (type == "quick_service") {
|
||||
window.location.href = "/origami/quick_service"
|
||||
}else{
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
});
|
||||
// }else{
|
||||
// $(this).removeAttr('disabled', '');
|
||||
// $("#oqs_loading_wrapper").hide();
|
||||
|
||||
// swal("Opps","Please Select Table or Room","warning");
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
// Pay Discount for Payment
|
||||
$("#create_pay_order").on('click', function(e){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
e.preventDefault();
|
||||
type = "quick_service"
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
$("#oqs_loading_wrapper").show();
|
||||
if (modify_order !=-1) {
|
||||
var ajax_url = '../../../quick_service/update_modify_order';
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
}else{
|
||||
var ajax_url = 'addorders/create';
|
||||
var table_type = $('#table_id').find("option:selected").data('type');
|
||||
var table_id = $('#table_id').val();
|
||||
var customer_id = $('#customer_id').val();
|
||||
var booking_id = $('#booking_id').text();
|
||||
var sale_id = ""
|
||||
}
|
||||
var order_items = JSON.stringify(get_order_item_rows());
|
||||
if (booking_id.length > 0) {
|
||||
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
|
||||
}else{
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
// $("#oqs_loading_wrapper").hide();
|
||||
// swal({
|
||||
// title: "Information !",
|
||||
// text: 'Order has been successfully created',
|
||||
// confirmButtonColor: "green",
|
||||
// confirmButtonText: "Yes!",
|
||||
// closeOnConfirm: false,
|
||||
// }, function (isConfirm) {
|
||||
// if (isConfirm) {
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
success:function(result){
|
||||
if (result.status) {
|
||||
console.log(result)
|
||||
if (result.data == null){
|
||||
swal({
|
||||
title: "Please Open Shift !",
|
||||
text: result.status,
|
||||
type: "warning",
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Ok",
|
||||
closeOnConfirm: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
|
||||
});
|
||||
|
||||
}else if(result.data == 'OK'){
|
||||
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
|
||||
}else{
|
||||
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -796,6 +1082,14 @@ $(function() {
|
||||
order_item.order_item_id = $(item_row[i]).attr('data-row');
|
||||
order_item.item_instance_code = $(item_row[i]).attr('data-instance-code');
|
||||
order_item.quantity = $(item_row[i]).children('#item_qty').text();
|
||||
//parent id
|
||||
if ($(item_row[i]).attr('data-parent')=="true") {
|
||||
parent_id = $(item_row[i]).attr('data-row');
|
||||
}
|
||||
if ($(item_row[i]).attr('data-sub-item')=="true") {
|
||||
order_item.parent_order_item_id = parent_id
|
||||
}
|
||||
//end parent id
|
||||
order_item.options = $(item_row[i]).attr('data-options');
|
||||
order_items.push(order_item);
|
||||
});
|
||||
@@ -817,11 +1111,21 @@ $(function() {
|
||||
$("#back").on("click", function(){
|
||||
var table_id = $('#table_id').text();
|
||||
var table_type = $('#table_type').text();
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
type = window.location.href.includes("quick_service");
|
||||
if (type == true) {
|
||||
var table_type = $('#table_id').find("option:selected").data('type');
|
||||
var table_id = $('#table_id').val();
|
||||
window.location.href = "/origami/dashboard";
|
||||
}else{
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id;
|
||||
}else {
|
||||
window.location.href = "/origami/room/" + table_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get Selected Class
|
||||
@@ -921,7 +1225,8 @@ $(function() {
|
||||
|
||||
//click menu sidebar menu category
|
||||
|
||||
$(".sub_click").on("click", function(){
|
||||
$(document).on('click', '.sub_click', function(event){
|
||||
event.preventDefault();
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var url = "get_menu_sub_category/"+menu_id;
|
||||
sub_category = $(this).find('.sub_category_list');
|
||||
@@ -932,6 +1237,15 @@ $(function() {
|
||||
//show menu item list when click menu category
|
||||
function show_sub_category_list(url,sub_category){
|
||||
|
||||
if (type != -1 && modify_order != -1) {
|
||||
var url = "../../../addorders/"+url;
|
||||
}if(modify_order== -1 && type != -1){
|
||||
var url = 'addorders/'+url;
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
var url = url;
|
||||
}
|
||||
|
||||
var menu_list = $('.sub_category_list');
|
||||
menu_list.empty();
|
||||
//Start Ajax
|
||||
@@ -946,10 +1260,15 @@ $(function() {
|
||||
data = data.sub_category;
|
||||
|
||||
if (data.length>0) {
|
||||
$(sub_category).removeClass('hidden');
|
||||
if ((sub_category.hasClass('hidden'))) {
|
||||
$(sub_category).removeClass('hidden');
|
||||
}else{
|
||||
$(sub_category).addClass('hidden');
|
||||
}
|
||||
|
||||
for(var i in data) {
|
||||
|
||||
row = '<li class="menu_category fadeInTop animated" data-id="'+data[i].id+'">'
|
||||
row = '<li class="menu_category fadeInTop" data-id="'+data[i].id+'">'
|
||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
||||
+'</li>' ;
|
||||
$(sub_category).append(row);
|
||||
@@ -960,6 +1279,78 @@ $(function() {
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
/* Get Item rows */
|
||||
function get_item(data,click_type){
|
||||
var sale_items = [];
|
||||
|
||||
var sale_item = {};
|
||||
sale_item.qty = parseInt(data.attr('data-qty'))
|
||||
sale_item.name = data.attr('data-name');
|
||||
sale_item.price = data.attr('data-price');
|
||||
sale_item.item_code = data.attr('data-item-code')
|
||||
sale_item.instance_code = data.attr('data-instance-code')
|
||||
sale_item.attributes = data.attr('data-attributes')
|
||||
sale_item.options = data.attr('data-options')
|
||||
sale_item.opt = data.attr('data-opt')
|
||||
sale_item.click_type = click_type
|
||||
sale_item.instance = data.attr('data-instance')
|
||||
sale_items.push(sale_item);
|
||||
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get Item rows */
|
||||
function get_set_item(items){
|
||||
var sale_items = [];
|
||||
var item = {};
|
||||
item.code = $('.set-item').attr('data-code');
|
||||
item.name = $('.set-item').attr('data-name');
|
||||
item.item_name = $('#set_name').text();
|
||||
item.qty = parseInt($('#set_count').val());
|
||||
item.item_code = $('#set_item_code').text();
|
||||
item.price = $('.set-item').attr('data-price');
|
||||
item.option = $('.set-item').attr('data-options');
|
||||
item.parent = $('.set-item').attr('data-parent');
|
||||
|
||||
sale_items.push(item);
|
||||
|
||||
$(items).each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.code = $(items[i]).attr('data-code');
|
||||
sale_item.name = $(items[i]).attr('data-name');
|
||||
sale_item.item_name = $('#set_name').text();
|
||||
sale_item.qty = parseInt($('#set_count').val());
|
||||
sale_item.item_code = $('#set_item_code').text();
|
||||
sale_item.price = $(items[i]).attr('data-price');
|
||||
sale_item.option = $(items[i]).attr('data-options');
|
||||
sale_item.sub_item = $(items[i]).attr('data-sub-item');
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
|
||||
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
function customer_display_view(data,status) {
|
||||
if (type != -1 && modify_order != -1) {
|
||||
url = '../../../../origami/customer_view';
|
||||
}
|
||||
if(modify_order == -1 && type != -1){
|
||||
url = '../../origami/customer_view';
|
||||
}
|
||||
if (type ==-1 && modify_order == -1){
|
||||
url = '../../origami/customer_view';
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {"data":data,"status":status},
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
}
|
||||
/* $("input").keypress(function(){
|
||||
$("span").text(i += 1);
|
||||
});*/
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -28,11 +28,12 @@
|
||||
//= require raphael/raphael.min
|
||||
//= require Chart.bundle
|
||||
//= require chartkick
|
||||
//= require fileinput.min
|
||||
//= require fileinput.min.js
|
||||
//= require settings/processing_items
|
||||
//= require BSBMaterial/admin.js
|
||||
//= require BSBMaterial/demo.js
|
||||
//= require custom.js
|
||||
//= require jquery-fileupload/basic
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.count-to').countTo();
|
||||
@@ -104,6 +105,86 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$("#shop_logo").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
$("#commissioner_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
$("#employee_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
$("#shop_image").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
// first input focus for all form
|
||||
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ App.order = App.cable.subscriptions.create('BillChannel', {
|
||||
$('.table_'+data.table.id).addClass('red');
|
||||
}
|
||||
$('.new_text_'+data.table.id).removeClass('hide');
|
||||
$('.new_text_'+data.table.id).text('billed');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -7,15 +7,27 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
||||
|
||||
received: function(data) {
|
||||
table = data.table
|
||||
time = data.time
|
||||
|
||||
// for Notificaiotn message
|
||||
var element = "#notify-wrapper"
|
||||
var placementFrom = "top";
|
||||
var placementAlign = "center";
|
||||
var animateEnter = "";
|
||||
var animateExit = "";
|
||||
var colorName = "alert-warning";
|
||||
var text = " Calling Waiter <br> "+table.name ;
|
||||
|
||||
if (time == 'print_error') {
|
||||
var colorName = "alert-danger";
|
||||
var placementFrom = "center";
|
||||
var placementAlign = "center";
|
||||
var text = " Hello <br> "+table ;
|
||||
style =""
|
||||
}else{
|
||||
var colorName = "alert-warning";
|
||||
var placementFrom = "top";
|
||||
var placementAlign = "center";
|
||||
var text = " Calling Waiter <br> "+table.name ;
|
||||
style ="width:180px !important;"
|
||||
}
|
||||
|
||||
|
||||
if (text != null || colorName != null){
|
||||
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
||||
@@ -43,7 +55,7 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
||||
enter: animateEnter,
|
||||
exit: animateExit
|
||||
},
|
||||
template: '<div data-notify="container" style="width:180px !important;" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
||||
template: '<div data-notify="container" style="'+style+'" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
||||
'<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' +
|
||||
'<span data-notify="icon"></span> ' +
|
||||
'<span data-notify="title">{1}</span> ' +
|
||||
|
||||
@@ -5,10 +5,17 @@ App.order = App.cable.subscriptions.create('OrderChannel', {
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
$('.table_'+data.table.id).removeClass('green');
|
||||
$('.table_'+data.table.id).addClass('blue');
|
||||
$('.new_text_'+data.table.id).removeClass('hide')
|
||||
received: function(data) {
|
||||
if (data.type == 'order') {
|
||||
$('.table_'+data.table.id).removeClass('green');
|
||||
$('.table_'+data.table.id).addClass('blue');
|
||||
$('.new_text_'+data.table.id).removeClass('hide')
|
||||
}else{
|
||||
$('.table_'+data.table.id).removeClass('red');
|
||||
$('.table_'+data.table.id).addClass('green');
|
||||
$('.new_text_'+data.table.id).html('');
|
||||
$('.new_text_'+data.table.id).removeClass('hide')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
// console.log(data.order);
|
||||
received: function(data) {
|
||||
var oqs_id = $('.oqs_active').attr('data-id');
|
||||
items = data.order;
|
||||
for(var field in items) {
|
||||
|
||||
38
app/assets/javascripts/channels/order_reservation.js
Normal file
38
app/assets/javascripts/channels/order_reservation.js
Normal file
@@ -0,0 +1,38 @@
|
||||
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
||||
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
var rowCount = $('.order_reserve_cable tbody tr').length+1;
|
||||
|
||||
var date = new Date(order.requested_time);
|
||||
var requested_time = date.getHours()+ ':' + date.getMinutes()+ '-' + date.getMinutes();
|
||||
|
||||
var isPM = date.getHours() >= 12;
|
||||
var isMidday = date.getHours() == 12;
|
||||
var result = document.querySelector('#result');
|
||||
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||
date.getMinutes() || '00'].join(':') +
|
||||
(isPM ? ' PM' : 'AM');
|
||||
|
||||
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+order.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
||||
+'<td width ="5%" class="align-left">'+rowCount
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'+time
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'+order.grand_total
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="align-center">'
|
||||
+'<span class="font-10 col-blue">'+ order.status +'</span>'
|
||||
+'</td>'
|
||||
+' </tr>'
|
||||
|
||||
$('.order_reserve_cable tbody').append(row);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
38
app/assets/javascripts/channels/second_display.js
Normal file
38
app/assets/javascripts/channels/second_display.js
Normal file
@@ -0,0 +1,38 @@
|
||||
App.checkin = App.cable.subscriptions.create('SecondDisplayChannel', {
|
||||
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
||||
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var data_obj = data.data;
|
||||
var status = data.status;
|
||||
var count = 0
|
||||
var sub_total = 0
|
||||
if (data.status == "order") {
|
||||
for(var i in data_obj) {
|
||||
|
||||
sub_total = sub_total + (data_obj[i].price * data_obj[i].qty)
|
||||
count += 1
|
||||
row ='<tr>'
|
||||
+'<td>'+count+'</td>'
|
||||
+'<td class="item-name">'+data_obj[i].item_name+'</td>'
|
||||
+'<td class="item-attr">'+data_obj[i].qty +'</td>'
|
||||
+ '<td class="item-attr">'+data_obj[i].qty*data_obj[i].price +'</td>'
|
||||
+'</tr>'
|
||||
$(".second_display_items").append(row);
|
||||
}//end looping
|
||||
}else{
|
||||
$('#s_sub_total').empty();
|
||||
$('#s_sub_total').append(data_obj.total_amount);
|
||||
$('#s_total_discount').empty();
|
||||
$('#s_total_discount').append(data_obj.total_discount);
|
||||
$('#s_tatal_tax').empty();
|
||||
$('#s_tatal_tax').append(data_obj.total_tax);
|
||||
$('#s_grand_total').empty();
|
||||
$('#s_grand_total').append(data_obj.grand_total);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
166
app/assets/javascripts/channels/second_display_view.js
Normal file
166
app/assets/javascripts/channels/second_display_view.js
Normal file
@@ -0,0 +1,166 @@
|
||||
App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
||||
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
||||
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var items = data.data;
|
||||
var tax = data.tax_profiles;
|
||||
var status= data.status
|
||||
if (status == "reload") {
|
||||
jQuery('#s_reload').click();
|
||||
}
|
||||
$('#second_display_slider').addClass("hidden")
|
||||
$('#second_display_items').removeClass("hidden")
|
||||
|
||||
|
||||
// append items
|
||||
if (status == "add") {
|
||||
for(var i in items) {
|
||||
qty = parseInt(items[i].qty);
|
||||
append = 0;
|
||||
price = items[i].price;
|
||||
|
||||
instance_name = items[i].instance;
|
||||
if (instance_name == "undefined"){
|
||||
instance = '';
|
||||
}else{
|
||||
instance = "("+items[i].instance+")";
|
||||
}
|
||||
|
||||
// d_option = items[i].options;
|
||||
// if (d_option){
|
||||
// option_name = "-"+items[i].options;
|
||||
// }else{
|
||||
// option_name = '';
|
||||
// }
|
||||
|
||||
d_option = items[i].opt;
|
||||
if (items[i].click_type != "add_icon"){
|
||||
option_name = "-"+items[i].options;
|
||||
data_option = items[i].options ;
|
||||
}else{
|
||||
option_name = ' ';
|
||||
data_option = '[]';
|
||||
}
|
||||
|
||||
var rowCount = $('.second_display_items tbody tr').length+1;
|
||||
var item_row = $('.second_display_items tbody tr');
|
||||
|
||||
$(item_row).each(function(j){
|
||||
var item_code = $(item_row[j]).attr('data-code');
|
||||
var instance_code = $(item_row[j]).attr('data-instance-code');
|
||||
var r_option = $(item_row[j]).attr('data-options');
|
||||
if (item_code == items[i].item_code && instance_code == items[i].instance_code && r_option==d_option) {
|
||||
if (qty > 1) {
|
||||
qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty;
|
||||
}else{
|
||||
qty = parseInt($(item_row[j]).children('#item_qty').text()) + 1;
|
||||
}
|
||||
|
||||
$(item_row[j]).children('#item_qty').text(qty);
|
||||
parseFloat($(item_row[j]).children('#item_price').text(parseFloat(price*qty).toFixed(2)));
|
||||
append =1;
|
||||
}else{
|
||||
if (qty > 1) {
|
||||
qty = qty;
|
||||
}else{
|
||||
qty = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (append===0) {
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' 'data-instance ='"
|
||||
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
|
||||
+items[i].instance_code+"' data-attributes='"
|
||||
+items[i].attributes+"' data-options ='"
|
||||
+data_option+"' data-opt ='"
|
||||
+items[i].options+"' data-row ='"+rowCount+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + items[i].name+ ' ' + instance + ' ' + option_name +'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(price).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".second_display_items tbody").append(row);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (status == "set_add") {
|
||||
// var option_arr = [];
|
||||
var attribute_arr = [];
|
||||
var rowCount = $('.second_display_items tbody tr').length+1;
|
||||
for(var i in items) {
|
||||
code = items[i].code;
|
||||
item_code = items[i].item_code;
|
||||
name = items[i].name;
|
||||
item_name = items[i].item_name;
|
||||
qty = items[i].qty;
|
||||
price = items[i].price;
|
||||
option = items[i].option;
|
||||
sub_item = items[i].sub_item;
|
||||
total = qty * price ;
|
||||
// option_arr.push(option);
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||
+code+"' data-attributes='"
|
||||
+attribute_arr+"' data-options ='"
|
||||
+option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name + ''+option+'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(total).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".second_display_items tbody").append(row);
|
||||
rowCount = rowCount + 1;
|
||||
|
||||
}
|
||||
}
|
||||
//end apend items
|
||||
var total_price = 0;
|
||||
var taxable_amount = 0;
|
||||
var total_discount = 0
|
||||
var total_tax_amount = 0
|
||||
var item_row = $('.second_display_items tbody tr');
|
||||
//calculate Sub Total
|
||||
$(item_row).each(function(i){
|
||||
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||
total_price += qty*unit_price;
|
||||
});
|
||||
//calculate Tax Amount
|
||||
for(var i in tax) {
|
||||
// substract , to give after discount
|
||||
var total_tax = total_price - total_discount
|
||||
// include or execulive
|
||||
if (tax[i].inclusive){
|
||||
rate = tax[i].rate
|
||||
divided_value = (100 + rate)/rate
|
||||
total_tax_amount = total_tax_amount + (total_tax / divided_value)
|
||||
}else{
|
||||
total_tax_amount = total_tax_amount + (total_tax * tax[i].rate / 100)
|
||||
}
|
||||
}
|
||||
//end calculate Tax amount
|
||||
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||
var fixed_taxable_amount = parseFloat(total_tax_amount).toFixed(2);
|
||||
var fixed_grand_total = parseFloat(total_price + total_tax_amount).toFixed(2);
|
||||
|
||||
$('#s_sub_total').empty();
|
||||
$('#s_sub_total').append(fixed_total_price);
|
||||
$('#s_tatal_tax').empty();
|
||||
$('#s_tatal_tax').append(fixed_taxable_amount);
|
||||
$('#s_grand_total').empty();
|
||||
$('#s_grand_total').append(fixed_grand_total);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -9,7 +9,8 @@ $(document).ready(function() {
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0'
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#order-detail-slimscroll').slimScroll({
|
||||
@@ -18,36 +19,67 @@ $(document).ready(function() {
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0'
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('.delete').click(function(){
|
||||
var method = $(this).attr('data-method');
|
||||
var url = $(this).attr('data-ref');
|
||||
var html_text = $(this).siblings( "#delete_text" ).html();
|
||||
//var page = url.substring(url.lastIndexOf('/') + 1);
|
||||
swal({
|
||||
title: "Confirmation",
|
||||
text: html_text,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
html: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
type: method,
|
||||
url: url ,
|
||||
success: function(data) {
|
||||
location.href = data.url;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
swal("Cancelled", "Your imaginary file is safe :)", "error");
|
||||
}
|
||||
});
|
||||
$('#menu-slimscroll').slimScroll({
|
||||
height: height-$('#menu-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#modal-slimscroll').slimScroll({
|
||||
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 45
|
||||
});
|
||||
|
||||
$('#modal-set-slimscroll').slimScroll({
|
||||
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 45
|
||||
});
|
||||
|
||||
// $('.delete').click(function(){
|
||||
// var method = $(this).attr('data-method');
|
||||
// var url = $(this).attr('data-ref');
|
||||
// var html_text = $(this).siblings( "#delete_text" ).html();
|
||||
// //var page = url.substring(url.lastIndexOf('/') + 1);
|
||||
// swal({
|
||||
// title: "Confirmation",
|
||||
// text: html_text,
|
||||
// type: "warning",
|
||||
// showCancelButton: true,
|
||||
// confirmButtonColor: "#DD6B55",
|
||||
// html: true
|
||||
// }, function (isConfirm) {
|
||||
// if (isConfirm) {
|
||||
// $.ajax({
|
||||
// type: method,
|
||||
// url: url ,
|
||||
// success: function(data) {
|
||||
// location.href = data.url;
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// swal("Cancelled", "Your imaginary file is safe :)", "error");
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// for Notificaiotn message
|
||||
var placementFrom = $("#notify_message").attr('data-placement-from');
|
||||
var placementAlign = $("#notify_message").attr('data-placement-align');
|
||||
|
||||
192
app/assets/javascripts/order_reservation.js
Normal file
192
app/assets/javascripts/order_reservation.js
Normal file
@@ -0,0 +1,192 @@
|
||||
|
||||
$(function() {
|
||||
|
||||
$(".nav-item").on("click", function(){
|
||||
type = $(this).attr("data-type");
|
||||
refreshDetailData();
|
||||
if (type == "pending") {
|
||||
$(".first-1").click();
|
||||
$('#accepted').text("Accepted");
|
||||
$('#accepted').attr("data-value","accepted");
|
||||
}else if(type == "processing"){
|
||||
$(".second-1").click();
|
||||
$('#accepted').text("SEND TO KITCHEN");
|
||||
$('#accepted').attr("data-value","processed");
|
||||
}else if(type == "delivery"){
|
||||
$(".third-1").click();
|
||||
$('#accepted').text("READY TO DELIVERY");
|
||||
$('#accepted').attr("data-value","delivery");
|
||||
}else if(type == "completed"){
|
||||
$(".fourth-1").click();
|
||||
$('#accepted').text("PICK-UP");
|
||||
$('#accepted').attr("data-value","completed");
|
||||
}
|
||||
// console.log(type);
|
||||
});
|
||||
|
||||
jQuery(function(){
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
|
||||
$(".custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
$(this).addClass("tr-active");
|
||||
var order_id = $(this).attr("data-id");
|
||||
var sr_no = $(this).attr("data-sr-no");
|
||||
var url = "order_reservation/get_order/"+order_id;
|
||||
show_order_detail(url,sr_no);
|
||||
});
|
||||
|
||||
function refreshDetailData(){
|
||||
$("#sr_number").text("");
|
||||
$("#delivery_info").text("");
|
||||
$("#contact_info").text("");
|
||||
$('.summary-items').html("");
|
||||
$('#sub_total').text("0.00");
|
||||
$('#delivery_fee').text("0.00");
|
||||
$('#total_charges').text("0.00");
|
||||
$('#total_tax').text("0.00");
|
||||
$('#grand_total').text("0.00");
|
||||
}
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url,sr_no){
|
||||
$('.summary-items').html("");
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
var item_list = $('.summary-items');
|
||||
item_list.empty();
|
||||
|
||||
if(items!=undefined && items!=""){
|
||||
if(items.length > 0){
|
||||
for(var i in items) {
|
||||
var item_price = 0;
|
||||
if(items[i].price > 0){
|
||||
item_price = items[i].price;
|
||||
}else{
|
||||
item_price = items[i].unit_price;
|
||||
}
|
||||
var total = items[i].qty * item_price;
|
||||
row = '<tr>'
|
||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||
+'</tr>';
|
||||
$('.summary-items').append(row);
|
||||
}
|
||||
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text(delivery.delivery_fee);
|
||||
$('#total_charges').text(0);
|
||||
$('#total_tax').text(data.total_tax);
|
||||
$('#grand_total').text(data.grand_total);
|
||||
|
||||
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
if(delivery.provider == "direct_delivery"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}else if(delivery.provider == "self_pick_up"){
|
||||
$("#delivery_info").text("(PICK-UP)");
|
||||
}
|
||||
|
||||
if(data.order_remark!=null && data.order_remark!=""){
|
||||
$("#order_remark").text(data.order_remark);
|
||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||
$("#order_remark").text(data.reservation_remark);
|
||||
}
|
||||
$("#sr_number").text("No."+sr_no);
|
||||
if (data["receipt_no"]) {
|
||||
$("#contact_info").text(data["receipt_no"]);
|
||||
}else{
|
||||
$("#contact_info").text(data["order_reservation_id"]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
$("#accepted").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
var callback = $('#callback_url').text();
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
});
|
||||
|
||||
function callback_url(callback,ref_no,order_id,status){
|
||||
var url = 'order_reservation/update';
|
||||
var post_url = "order_reservation/send_status";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: post_url,
|
||||
data: {url: callback, ref_no: ref_no, status: status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
text: "Order has been "+data.message,
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,12 +9,62 @@
|
||||
//= require bootstrap-notify/bootstrap-notify.js
|
||||
//= require node-waves/waves.js
|
||||
//= require sweetalert/sweetalert.min.js
|
||||
//= require fileinput.min
|
||||
//= require cable
|
||||
//= require turbolinks
|
||||
//= require BSBMaterial/turbolink_admin.js
|
||||
//= require BSBMaterial/demo.js
|
||||
//= require custom.js
|
||||
|
||||
/* Constant Varaibles */
|
||||
_CREDIT_PAYMENTS_ = "/ CREDIT PAYMENTS";
|
||||
_CUSTOMERS_ = "/ CUSTOMERS";
|
||||
_DISCOUNTS_ = "/ DISCOUNTS";
|
||||
_IN_DUTIES_ = "/ IN DUTIES";
|
||||
_JCB_ = "/ JCB PAYMENT";
|
||||
_MASTER_ = "/ MASTER PAYMENT";
|
||||
_MPU_ = "/ MPU PAYMENT";
|
||||
_ALIPAY_ = "/ Alipay";
|
||||
_JUNCTIONPAY_ = "/ JunctionPay";
|
||||
_PAYMAL_ = "/ PAYMAL";
|
||||
_DINGA_ = "/ DINGA PAYMENT";
|
||||
_OTHER_CHARGES_ = "/ CHARGES";
|
||||
_OTHER_PAYMENTS_ = "/ OTHER PAYMENT";
|
||||
_PAYMENTS_ = "/ PAYMENT";
|
||||
_PAYPAR_PAYMENT_ = "/ PAYPAR PAYMENT";
|
||||
_COMMISSIONS_ = "/ COMMISSIONS";
|
||||
_REDEEM_PAYMENT_ = "/ REDEEM PAYMENT";
|
||||
_SALE_EDIT_ = "/ SALE EDIT";
|
||||
_SPLIT_BILL_ = "/ SPLIT BILL";
|
||||
_UNION_ = "/ UNION PAYMENT";
|
||||
_VISA_ = "/ VISA PAYMENT";
|
||||
_VOUCHER_ = "/ VOUCHER";
|
||||
_SURVEY_ = "/ SURVEY";
|
||||
/* Constant Varaibles */
|
||||
|
||||
$(document).on('turbolinks:load', function() {
|
||||
|
||||
$("#customer_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.datetimepicker').bootstrapMaterialDatePicker({
|
||||
format: 'DD-MM-YYYY - HH:mm',
|
||||
@@ -148,13 +198,14 @@ $(document).on('turbolinks:load', function() {
|
||||
function checkReceiptNoInFirstBillData(receipt_no,payment) {
|
||||
// localStorage.removeItem('receipt_lists');
|
||||
var status = false;
|
||||
var json_data = [];
|
||||
if((receipt_no!=undefined) && (receipt_no!="")){
|
||||
if(localStorage.hasOwnProperty("receipt_lists")===true){
|
||||
var arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||
if (payment) {
|
||||
var json_data = arr_data.filter(function(e) { return e.receipt_no == receipt_no });
|
||||
json_data = arr_data.filter(function(e) { return e.receipt_no == receipt_no });
|
||||
}else{
|
||||
var json_data = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||
json_data = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||
}
|
||||
|
||||
if((arr_data.length) > (json_data.length)){
|
||||
@@ -162,8 +213,13 @@ function checkReceiptNoInFirstBillData(receipt_no,payment) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (payment) {
|
||||
return json_data[0]["payment"];
|
||||
if (json_data.length>0) {
|
||||
return json_data[0]["payment"];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return status;
|
||||
}
|
||||
@@ -194,4 +250,176 @@ function deleteReceiptNoInFirstBillData(receipt_no) {
|
||||
localStorage.setItem("receipt_lists",JSON.stringify(json_data));
|
||||
}
|
||||
}
|
||||
/* end check first bill or not funs: */
|
||||
/* end check first bill or not funs: */
|
||||
|
||||
//start CB ECR integration
|
||||
//set CB com port data
|
||||
function setCommPorts(comPortLists) {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
$('#com_port_name').html("");
|
||||
var jsonPortLists = $.parseJSON(comPortLists);
|
||||
// alert(jsonPortLists);
|
||||
if((jsonPortLists!=undefined && jsonPortLists!='') && (jsonPortLists.length > 0)){
|
||||
$.each(jsonPortLists,function(key,value){
|
||||
$('#com_port_name').append("<option value='"+value+"'>"+value+"</option>");
|
||||
});
|
||||
}
|
||||
else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: 'Payment device has been disconnected! Please plug it in.',
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** pay with CB bank **/
|
||||
function pay_withBank(cmd_type, payment_type, bnk_bill_amount,sale_id,receipt_no,cashier_type) {
|
||||
$("#loading_wrapper").show();
|
||||
var com_port = $("#com_port_name").val();
|
||||
reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, receipt_no, com_port,cashier_type);
|
||||
}
|
||||
|
||||
//add req data to card_sale_trans table
|
||||
function reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, receipt_no, com_port,cashier_type) {
|
||||
var jobj = {"cmd_type" : cmd_type, "payment_type" : "CARD", "amt" : bnk_bill_amount, "sale_id" : sale_id, "inv_no" : receipt_no, "com_port" : com_port};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/bank_integration/sale_trans",
|
||||
data: {type:"request", data: jobj},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status == "success"){
|
||||
card_sale_trans_id = data.card_sale_trans_id;
|
||||
resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amount, sale_id, receipt_no,com_port,cashier_type);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//add res data to card_sale_trans table
|
||||
function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amount, sale_id, receipt_no,com_port,cashier_type) {
|
||||
|
||||
var resMsg = "";
|
||||
var card_payment_type="";
|
||||
if($("#loading_wrapper").is(":visible")){
|
||||
if(payment_type=="mpu" || payment_type=="visa" || payment_type=="master" || payment_type=="jcb" || payment_type=="unionpay"){
|
||||
card_payment_type = "CARD";
|
||||
}
|
||||
else if(payment_type == "alipay"){
|
||||
card_payment_type = "EWALLET";
|
||||
}
|
||||
|
||||
bnk_bill_amount = parseFloat(bnk_bill_amount);
|
||||
|
||||
resMsg = code2lab.reqBankPayment(cmd_type,card_payment_type,bnk_bill_amount,receipt_no,com_port);
|
||||
}
|
||||
|
||||
if(resMsg.includes("STATUS")){
|
||||
var jobj = $.parseJSON(resMsg);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/bank_integration/sale_trans",
|
||||
data: {type:"response", card_sale_trans_id: card_sale_trans_id, data: jobj},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == "success"){
|
||||
resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
if(payment_type!="master"){
|
||||
payment_type = payment_type.toUpperCase();
|
||||
}else{
|
||||
payment_type = "Master";
|
||||
}
|
||||
|
||||
$("#loading_wrapper").hide();
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: resMsg.toString(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/"+payment_type;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type) {
|
||||
$("#loading_wrapper").hide();
|
||||
var jobj = $.parseJSON(resMsg);
|
||||
if(jobj.STATUS == "Approved"){
|
||||
$.ajax({type: "POST",
|
||||
url: "/origami/payment/"+payment_type,
|
||||
data: "amount="+ bnk_bill_amount + "&sale_id="+ sale_id + "&ref_no=" + jobj.REFNUM,
|
||||
success:function(result){
|
||||
if(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Payment Successfully",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
if(payment_type!="master"){
|
||||
payment_type = payment_type.toUpperCase();
|
||||
}else{
|
||||
payment_type = "Master";
|
||||
}
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: "Transaction is " + (jobj.STATUS).toLowerCase(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/"+payment_type;
|
||||
});
|
||||
}
|
||||
}
|
||||
//end CB ECR integration
|
||||
|
||||
function setHeaderBreadCrumb(params){
|
||||
$("#others_payment").html(params);
|
||||
}
|
||||
|
||||
//show hide nav bar for webview
|
||||
function showHideNavbar(webview,page){
|
||||
if(webview){
|
||||
$("nav.navbar").addClass("hidden");
|
||||
$("section").addClass("section-margin");
|
||||
$(".page-loader-wrapper").addClass("hidden");
|
||||
if(page!=undefined){
|
||||
$("#back").hide();
|
||||
}
|
||||
}else{
|
||||
$("nav.navbar").removeClass("hidden");
|
||||
$("section").removeClass("section-margin");
|
||||
$(".page-loader-wrapper").removeClass("hidden");
|
||||
if(page!=undefined){
|
||||
$("#back").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3
app/assets/javascripts/origami/bank_integration.coffee
Normal file
3
app/assets/javascripts/origami/bank_integration.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/origami/paymal.coffee
Normal file
3
app/assets/javascripts/origami/paymal.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/origami/split_bill.coffee
Normal file
3
app/assets/javascripts/origami/split_bill.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/origami/unionpay.coffee
Normal file
3
app/assets/javascripts/origami/unionpay.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/reports/product_sale.coffee
Normal file
3
app/assets/javascripts/reports/product_sale.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
6
app/assets/javascripts/settings/display_images.js.coffee
Normal file
6
app/assets/javascripts/settings/display_images.js.coffee
Normal file
@@ -0,0 +1,6 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
||||
jQuery ->
|
||||
$('#new_display_image').fileupload
|
||||
dataType: "script"
|
||||
1
app/assets/javascripts/wow_script.js
Normal file
1
app/assets/javascripts/wow_script.js
Normal file
@@ -0,0 +1 @@
|
||||
jQuery("#wowslider-container").wowSlider({effect:"rotate",prev:"",next:"",duration:20*100,delay:20*100,width:580,height:212,autoPlay:true,stopOnHover:false,loop:false,bullets:true,caption:true,captionEffect:"slide",controls:true,logo:"",images:0});
|
||||
337
app/assets/javascripts/wowslider.js
Normal file
337
app/assets/javascripts/wowslider.js
Normal file
@@ -0,0 +1,337 @@
|
||||
// -----------------------------------------------------------------------------------
|
||||
// http://wowslider.com/
|
||||
// JavaScript Wow Slider is a free software that helps you easily generate delicious
|
||||
// slideshows with gorgeous transition effects, in a few clicks without writing a single line of code.
|
||||
// Generated by WOW Slider 2.7
|
||||
jQuery.fn.wowSlider = function (d) {
|
||||
var e = jQuery;
|
||||
var h = this;
|
||||
var t = h.get(0);
|
||||
d = e.extend({
|
||||
prev: "",
|
||||
next: "",
|
||||
duration: 1000,
|
||||
delay: 20 * 100,
|
||||
width: 960,
|
||||
height: 360,
|
||||
controls: true,
|
||||
autoPlay: true,
|
||||
bullets: true,
|
||||
}, d);
|
||||
var a = e(".ws_images", h);
|
||||
var l = a.find("ul");
|
||||
|
||||
function u(D) {
|
||||
l.css({
|
||||
left: -D + "00%"
|
||||
})
|
||||
}
|
||||
e("<div>")
|
||||
.css({
|
||||
width: "100%",
|
||||
visibility: "hidden",
|
||||
"font-size": 0,
|
||||
"line-height": 0
|
||||
})
|
||||
.append(a.find("li:first img:first")
|
||||
.clone()
|
||||
.css({
|
||||
width: "100%"
|
||||
}))
|
||||
.prependTo(a);
|
||||
l.css({
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
animation: "none",
|
||||
"-moz-animation": "none",
|
||||
"-webkit-animation": "none"
|
||||
});
|
||||
var m = a.find("li");
|
||||
var v = m.length;
|
||||
|
||||
function i(D) {
|
||||
return ((D || 0) + v) % v
|
||||
}
|
||||
var C = navigator.userAgent;
|
||||
if ((e.browser.msie && parseInt(e.browser.version, 10) < 8) || (/Safari/.test(C))) {
|
||||
var b = Math.pow(10, Math.ceil(Math.LOG10E * Math.log(v)));
|
||||
l.css({
|
||||
width: b + "00%"
|
||||
});
|
||||
m.css({
|
||||
width: 100 / b + "%"
|
||||
})
|
||||
} else {
|
||||
l.css({
|
||||
width: v + "00%",
|
||||
display: "table"
|
||||
});
|
||||
m.css({
|
||||
display: "table-cell",
|
||||
"float": "none",
|
||||
width: "auto"
|
||||
})
|
||||
}
|
||||
u(0);
|
||||
var k = [];
|
||||
m.each(function (D) {
|
||||
var F = e(">img:first,>a:first,>div:first", this)
|
||||
.get(0);
|
||||
var G = e("<div></div>");
|
||||
for (var E = 0; E < this.childNodes.length;) {
|
||||
if (this.childNodes[E] != F) {
|
||||
G.append(this.childNodes[E])
|
||||
} else {
|
||||
E++
|
||||
}
|
||||
}
|
||||
if (!e(this)
|
||||
.data("descr")) {
|
||||
e(this)
|
||||
.data("descr", G.html()
|
||||
.replace(/^\s+|\s+$/g, ""))
|
||||
}
|
||||
e(this)
|
||||
.css({
|
||||
"font-size": 0
|
||||
});
|
||||
k[k.length] = e(">a>img", this)
|
||||
.get(0) || e(">*", this)
|
||||
.get(0)
|
||||
});
|
||||
k = e(k);
|
||||
k.css("visibility", "visible");
|
||||
|
||||
function f(F, D, E) {
|
||||
this.go = function (G) {
|
||||
E.find("ul")
|
||||
.stop(true)
|
||||
.animate({
|
||||
left: (G ? -G + "00%" : (/Safari/.test(navigator.userAgent) ? "0%" : 0))
|
||||
}, F.duration, "easeInOutExpo");
|
||||
return G
|
||||
}
|
||||
}
|
||||
var o = new f(d, k, a);
|
||||
var c = 0;
|
||||
|
||||
function r(F, E, D) {
|
||||
if (isNaN(F)) {
|
||||
F = c + 1
|
||||
}
|
||||
F = i(F);
|
||||
if (c == F) {
|
||||
return
|
||||
}
|
||||
s(F, E, D)
|
||||
}
|
||||
function s(F, E, D) {
|
||||
var F = o.go(F, c, E, D);
|
||||
if (F < 0) {
|
||||
return
|
||||
}
|
||||
q(F);
|
||||
j(m[F]);
|
||||
c = F;
|
||||
z()
|
||||
}
|
||||
var B = h.find(".ws_bullets");
|
||||
|
||||
function q(D) {
|
||||
if (B.length) {
|
||||
n(D)
|
||||
}
|
||||
}
|
||||
var p;
|
||||
|
||||
function z(D) {
|
||||
w();
|
||||
if (d.autoPlay) {
|
||||
p = setTimeout(function () {
|
||||
r()
|
||||
}, d.delay + (D ? 0 : d.duration))
|
||||
}
|
||||
}
|
||||
function w() {
|
||||
if (p) {
|
||||
clearTimeout(p)
|
||||
}
|
||||
p = null
|
||||
}
|
||||
function y(G, F, E, D) {
|
||||
w();
|
||||
G.preventDefault();
|
||||
r(F, E, D);
|
||||
z()
|
||||
}
|
||||
if (d.controls) {
|
||||
var x = e('<a href="#" class="ws_next">' + d.next + "</a>");
|
||||
var g = e('<a href="#" class="ws_prev">' + d.prev + "</a>");
|
||||
h.append(x);
|
||||
h.append(g);
|
||||
x.bind("click", function (D) {
|
||||
y(D, c + 1)
|
||||
});
|
||||
g.bind("click", function (D) {
|
||||
y(D, c - 1)
|
||||
})
|
||||
}
|
||||
function A() {
|
||||
h.find(".ws_bullets a")
|
||||
.click(function (L) {
|
||||
y(L, e(this)
|
||||
.index())
|
||||
});
|
||||
if (B.length) {
|
||||
var F = B.find(">div");
|
||||
var K = e("a", B);
|
||||
var I = K.find("IMG");
|
||||
if (I.length) {
|
||||
var H = e('<div class="ws_bulframe"/>')
|
||||
.appendTo(F);
|
||||
var E = e("<div/>")
|
||||
.css({
|
||||
width: I.length + 1 + "00%"
|
||||
})
|
||||
.appendTo(e("<div/>")
|
||||
.appendTo(H));
|
||||
I.appendTo(E);
|
||||
e("<span/>")
|
||||
.appendTo(H);
|
||||
var G = -1;
|
||||
|
||||
function J(N) {
|
||||
if (N < 0) {
|
||||
N = 0
|
||||
}
|
||||
e(K.get(G))
|
||||
.removeClass("ws_overbull");
|
||||
e(K.get(N))
|
||||
.addClass("ws_overbull");
|
||||
H.show();
|
||||
var O = {
|
||||
left: K.get(N)
|
||||
.offsetLeft - H.width() / 2,
|
||||
"margin-top": K.get(N)
|
||||
.offsetTop - K.get(0)
|
||||
.offsetTop + "px",
|
||||
"margin-bottom": -K.get(N)
|
||||
.offsetTop + K.get(K.length - 1)
|
||||
.offsetTop + "px"
|
||||
};
|
||||
var M = I.get(N);
|
||||
var L = {
|
||||
left: -M.offsetLeft + (e(M)
|
||||
.outerWidth(true) - e(M)
|
||||
.outerWidth()) / 2
|
||||
};
|
||||
if (G < 0) {
|
||||
H.css(O);
|
||||
E.css(L)
|
||||
} else {
|
||||
if (!document.all) {
|
||||
O.opacity = 1
|
||||
}
|
||||
H.stop()
|
||||
.animate(O, "fast");
|
||||
E.stop()
|
||||
.animate(L, "fast")
|
||||
}
|
||||
G = N
|
||||
}
|
||||
K.hover(function () {
|
||||
J(e(this)
|
||||
.index())
|
||||
});
|
||||
var D;
|
||||
F.hover(function () {
|
||||
if (D) {
|
||||
clearTimeout(D);
|
||||
D = 0
|
||||
}
|
||||
J(G)
|
||||
}, function () {
|
||||
K.removeClass("ws_overbull");
|
||||
if (document.all) {
|
||||
if (!D) {
|
||||
D = setTimeout(function () {
|
||||
H.hide();
|
||||
D = 0
|
||||
}, 400)
|
||||
}
|
||||
} else {
|
||||
H.stop()
|
||||
.animate({
|
||||
opacity: 0
|
||||
}, {
|
||||
duration: "fast",
|
||||
complete: function () {
|
||||
H.hide()
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
F.click(function (L) {
|
||||
y(L, e(L.target)
|
||||
.index())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
function n(D) {
|
||||
e("A", B)
|
||||
.each(function (E) {
|
||||
if (E == D) {
|
||||
e(this)
|
||||
.addClass("ws_selbull")
|
||||
} else {
|
||||
e(this)
|
||||
.removeClass("ws_selbull")
|
||||
}
|
||||
})
|
||||
}
|
||||
h.append("<div class='ws-title' style='display:none'></div>");
|
||||
|
||||
function j(E) {
|
||||
var G = e("img", E)
|
||||
.attr("title");
|
||||
var F = e(E)
|
||||
.data("descr");
|
||||
var D = e(".ws-title", h);
|
||||
D.stop(1, 1)
|
||||
.stop(1, 1)
|
||||
.fadeOut(1000 / 3, function () {
|
||||
if (G || F) {
|
||||
D.html((G ? "<span>" + G + "</span>" : "") + (F ? "<div>" + F + "</div>" : ""));
|
||||
D.fadeIn(400, function () {
|
||||
if (e.browser.msie) {
|
||||
e(this)
|
||||
.get(0)
|
||||
.style.removeAttribute("filter")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (B.length) {
|
||||
A()
|
||||
}
|
||||
q(c);
|
||||
j(m[c]);
|
||||
z(1);
|
||||
return this
|
||||
};
|
||||
jQuery.extend(jQuery.easing, {
|
||||
easeInOutExpo: function (e, f, a, h, g) {
|
||||
if (f == 0) {
|
||||
return a
|
||||
}
|
||||
if (f == g) {
|
||||
return a + h
|
||||
}
|
||||
if ((f /= g / 2) < 1) {
|
||||
return h / 2 * Math.pow(2, 10 * (f - 1)) + a
|
||||
}
|
||||
return h / 2 * (-Math.pow(2, - 10 * --f) + 2) + a
|
||||
}
|
||||
});
|
||||
@@ -13,6 +13,7 @@
|
||||
@import "BSBMaterial/style";
|
||||
@import "BSBMaterial/themes/all-themes";
|
||||
@import "reset";
|
||||
@import "fileinput.min";
|
||||
|
||||
.sx-margin-0 {
|
||||
margin: 0 !important;
|
||||
|
||||
@@ -3,9 +3,11 @@ section .content{
|
||||
}
|
||||
.custom-card-head{
|
||||
height: 40px;
|
||||
background-color: #54A5AF;
|
||||
#background-color: #54A5AF;
|
||||
background-color: #a1aade;
|
||||
opacity: 0.8;
|
||||
padding:5px;
|
||||
color :#fff;
|
||||
color :#000000;
|
||||
|
||||
}
|
||||
.custom-card {
|
||||
@@ -53,8 +55,13 @@ section .content{
|
||||
|
||||
.nav-tabs .nav-item {
|
||||
border-bottom: 1px solid #fff;
|
||||
border-left: 1px solid #54A5AF;
|
||||
border-right: 1px solid #54A5AF;
|
||||
margin-left:2px;
|
||||
|
||||
}
|
||||
#ul-navbar{
|
||||
border-left: 1px solid #54A5AF;
|
||||
border-right: 1px solid #54A5AF;
|
||||
|
||||
}
|
||||
.nav > li > a{
|
||||
color:#54A5AF;
|
||||
@@ -62,6 +69,9 @@ section .content{
|
||||
.nav-tabs {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
.nav-tabs .nav-link {
|
||||
padding: 0.7286rem 0.2575
|
||||
}
|
||||
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
|
||||
background-color: #fff;
|
||||
border-left: 6px solid #111;
|
||||
@@ -165,7 +175,7 @@ section.content{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.add_icon{
|
||||
.menu_item_box{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -173,4 +183,68 @@ section.content{
|
||||
i.logout_icon{
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.text-white{
|
||||
color: #fff;
|
||||
}
|
||||
/* Colors */
|
||||
.purple {
|
||||
background-color:#7a62d3;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color:#FF7F50;
|
||||
}
|
||||
|
||||
.red {
|
||||
background-color:#F44336;
|
||||
}
|
||||
|
||||
.green{
|
||||
background-color: #009900;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color: #FF8C00;
|
||||
}
|
||||
|
||||
.blue{
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
/*For Menu List*/
|
||||
.dropdown-toggle:after{
|
||||
margin-left:15px;
|
||||
}
|
||||
.my-toggle{
|
||||
padding: 15px 20px 10px 10px;
|
||||
line-height:2;
|
||||
|
||||
}
|
||||
.list-menu{
|
||||
list-style: none;
|
||||
margin-top:5px;
|
||||
background-color: #eee;
|
||||
border-bottom: 1px solid #fff;
|
||||
}
|
||||
.list-menu > a:focus{
|
||||
background-color:initial;
|
||||
}
|
||||
.menu_list{
|
||||
display: block;
|
||||
background-color: #eeeeee;
|
||||
border-bottom: .014rem solid #fff;
|
||||
border-left: 1px solid #54A5AF;
|
||||
border-right: 1px solid #54A5AF;
|
||||
margin-bottom: -1px;
|
||||
margin-top: 5px
|
||||
}
|
||||
.menu_click{
|
||||
list-style: none;
|
||||
margin-left:-40px;
|
||||
border-bottom: .014rem solid #fff;
|
||||
}
|
||||
.list-menu > a:hover{
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the app/controllers/origami/BankIntegration controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -98,4 +98,9 @@ nav.pagination .page a:hover,
|
||||
i.logout_icon{
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
/* Second display image */
|
||||
.second-display{
|
||||
margin : 12px;
|
||||
}
|
||||
@@ -8,6 +8,11 @@
|
||||
background-color: #2790a5;
|
||||
}
|
||||
|
||||
.active_tab{
|
||||
border-style: solid;
|
||||
border-color: #2790a5;
|
||||
}
|
||||
|
||||
.login-page {
|
||||
margin: 0% auto;
|
||||
background-color: #2790a5;
|
||||
@@ -75,3 +80,32 @@
|
||||
background-color: #fff;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.p-card{
|
||||
margin: 20px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.p-name{
|
||||
padding-bottom: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.style_image{
|
||||
height : 138px;
|
||||
padding : 20px 0 20px 0;
|
||||
width : 70%;
|
||||
}
|
||||
|
||||
.style_icon{
|
||||
font-size: 111px;
|
||||
padding : 20px 0 20px 0;
|
||||
}
|
||||
|
||||
/* Shop Name in Login Page */
|
||||
.current-shop-name{
|
||||
color : #FFFFFF;
|
||||
font-size: 21px;
|
||||
font-weight: bold;
|
||||
margin : 0 0 20px 0;
|
||||
}
|
||||
88
app/assets/stylesheets/order_reservation.scss
Normal file
88
app/assets/stylesheets/order_reservation.scss
Normal file
@@ -0,0 +1,88 @@
|
||||
.nav-tabs > li.active > a,
|
||||
.nav-tabs > li.active > a:hover,
|
||||
.nav-tabs > li.active > a:focus {
|
||||
border-bottom: 2px solid #2196F3 ;
|
||||
bottom: 2px ;
|
||||
}
|
||||
|
||||
.nav-tabs .nav-link {
|
||||
padding: 0.5286em .33em;
|
||||
}
|
||||
.nav-tabs li a.active {
|
||||
color: #111 !important;
|
||||
border-bottom: 0px solid #fff !important;
|
||||
}
|
||||
.nav-tabs .nav-link.active {
|
||||
color: #111;
|
||||
border-color: #fff;
|
||||
}
|
||||
.nav-tabs > li > a {
|
||||
margin-right: 0px;
|
||||
color:#fff !important;
|
||||
}
|
||||
|
||||
.nav-tabs > li > a {
|
||||
border-bottom: 2px solid #2196F3;
|
||||
bottom: 2px;
|
||||
}
|
||||
.nav-tabs.tab-col-teal > li > a:before {
|
||||
border-bottom: 0px solid #009688;
|
||||
}
|
||||
.nav-tabs .nav-item{
|
||||
margin-bottom: 2px ;
|
||||
}
|
||||
.num{
|
||||
color:#fff;
|
||||
text-align: center;
|
||||
margin-bottom: -1px !important;
|
||||
}
|
||||
.nav-tabs .nav-link.active > p{
|
||||
color: #111;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
/*Custosm Class*/
|
||||
.table .header-td{
|
||||
border-top:0px solid !important;
|
||||
border-bottom: 0px solid !important;
|
||||
padding:3px 7px !important;
|
||||
border-top:0px solid !important;
|
||||
border-bottom: 0px solid !important;
|
||||
}
|
||||
.custom-card-block .table td:first-child,
|
||||
.custom-card-block .table td:nth-child(2),
|
||||
.custom-card-footer .table td:first-child,
|
||||
.custom-card-footer .table td:nth-child(2){
|
||||
border-top:0px solid !important;
|
||||
}
|
||||
|
||||
.custom-card-footer .footer-td ,
|
||||
.grand-card-footer .footer-td {
|
||||
border-top:0px solid !important;
|
||||
border-bottom:0px solid !important;
|
||||
font-weight: bold;
|
||||
padding:6px 10px;
|
||||
}
|
||||
.custom-card-header{
|
||||
border-bottom: 1px solid #F8BBD0 !important;
|
||||
padding:13px 5px !important;
|
||||
}
|
||||
.custom-card-footer{
|
||||
border-top: 1px solid #F8BBD0 !important;
|
||||
}
|
||||
.custom-card-block,
|
||||
.grand-card-footer,
|
||||
.custom-card-footer{
|
||||
padding :5px !important;
|
||||
}
|
||||
.custom-table{
|
||||
background-color:#F3E5F5;
|
||||
}
|
||||
.custom-table tbody tr td,
|
||||
.custom-table tbody tr th{
|
||||
border-top: 1px solid #FFEBEE;
|
||||
border-bottom: 1px solid #FFEBEE;
|
||||
}
|
||||
.tr-active{
|
||||
background-color : #FFCDD2;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ select.form-control {
|
||||
}
|
||||
|
||||
.credit-color{
|
||||
background-color:#FF5722;
|
||||
background-color:#FFA500;
|
||||
}
|
||||
|
||||
.other-payment-color{
|
||||
@@ -198,6 +198,18 @@ select.form-control {
|
||||
background-color: blue !important;
|
||||
}
|
||||
|
||||
.selected-payment {
|
||||
color: #fff !important;
|
||||
background-color: blue !important;
|
||||
}
|
||||
.payment_btn {
|
||||
white-space: normal !important;
|
||||
margin-bottom: 15px;
|
||||
margin-right: 15px;
|
||||
color:#fff !important;
|
||||
# background-color: green !important;
|
||||
}
|
||||
|
||||
/* Reciept Style */
|
||||
#order-charges-table td {
|
||||
border-top: none !important;
|
||||
@@ -314,7 +326,7 @@ tr.discount-item-row:hover {
|
||||
position: relative;
|
||||
left: 42%;
|
||||
top: 30%;
|
||||
background-color: #d9534f;
|
||||
background-color: #32ad1a;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
width: 200px;
|
||||
@@ -390,3 +402,46 @@ i.logout_icon{
|
||||
}
|
||||
|
||||
/* End Notify */
|
||||
|
||||
/* selected color for split bills */
|
||||
.selected-split-item {
|
||||
color: #fff !important;
|
||||
background-color: #5DADE2 !important;
|
||||
}
|
||||
|
||||
/* Start Is Member Modal */
|
||||
#is_memberModal .modal-body {
|
||||
height: 260px !important;
|
||||
}
|
||||
|
||||
#is_memberModal .btn {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#is_paymemberModal .modal-body {
|
||||
height: 150px !important;
|
||||
}
|
||||
|
||||
#is_paymemberModal .btn {
|
||||
width: 80%;
|
||||
}
|
||||
/* End Is Member Modal */
|
||||
|
||||
/* Start iframe */
|
||||
iframe {
|
||||
border: none;
|
||||
overflow: hidden !important;
|
||||
width: 400px;
|
||||
height: 550px;
|
||||
}
|
||||
|
||||
#pdfModal .btn {
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
}
|
||||
/* End iframe */
|
||||
|
||||
/* section class for webview */
|
||||
.section-margin {
|
||||
margin-top: -50px;
|
||||
}
|
||||
3
app/assets/stylesheets/origami/bank_integration.scss
Normal file
3
app/assets/stylesheets/origami/bank_integration.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/BankIntegration controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/origami/paymal.scss
Normal file
3
app/assets/stylesheets/origami/paymal.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/Paymal controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/origami/split_bill.scss
Normal file
3
app/assets/stylesheets/origami/split_bill.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/split_bill controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/origami/unionpay.scss
Normal file
3
app/assets/stylesheets/origami/unionpay.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/unionpay controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/reports/product_sale.scss
Normal file
3
app/assets/stylesheets/reports/product_sale.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the reports/ProductSale controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -68,6 +68,15 @@
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
/*Shop Info color in navbar*/
|
||||
.shopinfo {
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.link-buttoon {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px){
|
||||
.dropdown-menu {
|
||||
padding: .3rem 0;
|
||||
|
||||
220
app/assets/stylesheets/wow_style.css
Normal file
220
app/assets/stylesheets/wow_style.css
Normal file
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* generated by WOW Slider 2.5
|
||||
* template Quiet
|
||||
*/
|
||||
@import url("http://fonts.googleapis.com/css?family=Oswald");
|
||||
#wowslider-container {
|
||||
zoom: 1;
|
||||
position: relative;
|
||||
max-width:580px;
|
||||
margin:0 auto;
|
||||
z-index:100;
|
||||
border:none;
|
||||
text-align:left; /* reset align=center */
|
||||
}
|
||||
* html #wowslider-container{ width:580px }
|
||||
#wowslider-container ul{
|
||||
position:relative;
|
||||
width: 10000%;
|
||||
height:auto;
|
||||
left:0;
|
||||
list-style:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
border-spacing:0;
|
||||
overflow: visible;
|
||||
/*table-layout:fixed;*/
|
||||
}
|
||||
#wowslider-container .ws_images ul li{
|
||||
width:1%;
|
||||
line-height:0; /*opera*/
|
||||
float:left;
|
||||
font-size:0;
|
||||
padding:0 0 0 0;
|
||||
margin:0 0 0 0;
|
||||
}
|
||||
|
||||
#wowslider-container .ws_images{
|
||||
position: relative;
|
||||
left:0;
|
||||
top:0;
|
||||
width:100%;
|
||||
height:100%;
|
||||
overflow:hidden;
|
||||
}
|
||||
#wowslider-container .ws_images a{
|
||||
width:100%;
|
||||
display:block;
|
||||
color:transparent;
|
||||
}
|
||||
|
||||
#wowslider-container .ws_images img{
|
||||
width:100%;
|
||||
border:none 0;
|
||||
max-width: none;
|
||||
}
|
||||
#wowslider-container a{
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#wowslider-container .ws_bullets {
|
||||
font-size: 0px;
|
||||
float: left;
|
||||
position:absolute;
|
||||
z-index:70;
|
||||
}
|
||||
#wowslider-container .ws_bullets div{
|
||||
position:relative;
|
||||
float:left;
|
||||
}
|
||||
#wowslider-container a.wsl{
|
||||
display:none;
|
||||
}
|
||||
#wowslider-container .ws_bullets {
|
||||
padding: 10px;
|
||||
}
|
||||
#wowslider-container .ws_bullets a {
|
||||
width:15px;
|
||||
height:15px;
|
||||
background: url(./bullet.png) left top;
|
||||
float: left;
|
||||
text-indent: -4000px;
|
||||
position:relative;
|
||||
margin-left:3px;
|
||||
color:transparent;
|
||||
}
|
||||
#wowslider-container .ws_bullets a:hover{
|
||||
background-position: 0 50%;
|
||||
}
|
||||
#wowslider-container .ws_bullets a.ws_selbull{
|
||||
background-position: 0 100%;
|
||||
}
|
||||
#wowslider-container a.ws_next, #wowslider-container a.ws_prev {
|
||||
position:absolute;
|
||||
display:none;
|
||||
top:50%;
|
||||
margin-top:-50px;
|
||||
z-index:60;
|
||||
height: 100px;
|
||||
width: 60px;
|
||||
background-image: url(./arrows.png);
|
||||
}
|
||||
#wowslider-container a.ws_next{
|
||||
background-position: 100% 0;
|
||||
right:0;
|
||||
}
|
||||
#wowslider-container a.ws_prev {
|
||||
left:0;
|
||||
background-position: 0 0;
|
||||
}
|
||||
* html #wowslider-container a.ws_next,* html #wowslider-container a.ws_prev{display:block}
|
||||
#wowslider-container:hover a.ws_next, #wowslider-container:hover a.ws_prev {display:block}
|
||||
/* bottom center */
|
||||
#wowslider-container .ws_bullets {
|
||||
top: 5px;
|
||||
right: 10px;
|
||||
}
|
||||
#wowslider-container .ws_bullets .ws_bulframe {
|
||||
top: 20px;
|
||||
}
|
||||
#wowslider-container .ws_bullets .ws_bulframe {
|
||||
top: 20px;
|
||||
}
|
||||
#wowslider-container .ws-title{
|
||||
position: absolute;
|
||||
bottom: 10%;
|
||||
left: 7%;
|
||||
z-index: 50;
|
||||
padding:12px;
|
||||
color: #000000;
|
||||
background:#fff;
|
||||
font-family:Oswald,Impact,Charcoal,sans-serif;
|
||||
font-size: 30px;
|
||||
text-shadow: 1px 1px 1px #BBBBBB;
|
||||
line-height: 30px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
opacity:0.5;
|
||||
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);
|
||||
}
|
||||
#wowslider-container .ws-title div{
|
||||
font-size: 25px;
|
||||
text-shadow: 1px 1px 1px #000000;
|
||||
}#wowslider-container ul{
|
||||
animation: wsBasic 12s infinite;
|
||||
-moz-animation: wsBasic 12s infinite;
|
||||
-webkit-animation: wsBasic 12s infinite;
|
||||
}
|
||||
@keyframes wsBasic{0%{left:-0%} 16.67%{left:-0%} 33.33%{left:-100%} 50%{left:-100%} 66.67%{left:-200%} 83.33%{left:-200%} }
|
||||
@-moz-keyframes wsBasic{0%{left:-0%} 16.67%{left:-0%} 33.33%{left:-100%} 50%{left:-100%} 66.67%{left:-200%} 83.33%{left:-200%} }
|
||||
@-webkit-keyframes wsBasic{0%{left:-0%} 16.67%{left:-0%} 33.33%{left:-100%} 50%{left:-100%} 66.67%{left:-200%} 83.33%{left:-200%} }
|
||||
|
||||
#wowslider-container .ws_shadow{
|
||||
background: url(./shadow.png) left 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-size:100%;
|
||||
width:100%;
|
||||
height:20%;
|
||||
position: absolute;
|
||||
left:0;
|
||||
bottom:-20%;
|
||||
z-index:-1;
|
||||
}
|
||||
* html #wowslider-container .ws_shadow{/*ie6*/
|
||||
background:none;
|
||||
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader( src='wowslider/install/shadow.png', sizingMethod='scale');
|
||||
}
|
||||
*+html #wowslider-container .ws_shadow{/*ie7*/
|
||||
background:none;
|
||||
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader( src='wowslider/install/shadow.png', sizingMethod='scale');
|
||||
}
|
||||
#wowslider-container .ws_bullets a img{
|
||||
text-indent:0;
|
||||
display:block;
|
||||
top:15px;
|
||||
left:-123px;
|
||||
visibility:hidden;
|
||||
position:absolute;
|
||||
-moz-box-shadow: 0 0 5px #999999;
|
||||
box-shadow: 0 0 5px #999999;
|
||||
border: 5px solid #FFFFFF;
|
||||
max-width:none;
|
||||
}
|
||||
#wowslider-container .ws_bullets a:hover img{
|
||||
visibility:visible;
|
||||
}
|
||||
|
||||
#wowslider-container .ws_bulframe div div{
|
||||
height:90px;
|
||||
overflow:visible;
|
||||
position:relative;
|
||||
}
|
||||
#wowslider-container .ws_bulframe div {
|
||||
left:0;
|
||||
overflow:hidden;
|
||||
position:relative;
|
||||
width:246px;
|
||||
background-color:#FFFFFF;
|
||||
}
|
||||
#wowslider-container .ws_bullets .ws_bulframe{
|
||||
display:none;
|
||||
overflow:visible;
|
||||
position:absolute;
|
||||
cursor:pointer;
|
||||
-moz-box-shadow: 0 0 5px #999999;
|
||||
box-shadow: 0 0 5px #999999;
|
||||
border: 5px solid #FFFFFF;
|
||||
}
|
||||
#wowslider-container .ws_bulframe span{
|
||||
display:block;
|
||||
position:absolute;
|
||||
top:-11px;
|
||||
margin-left:-5px;
|
||||
left:123px;
|
||||
background:url(./triangle.png);
|
||||
width:15px;
|
||||
height:6px;
|
||||
}
|
||||
10
app/channels/order_reservation_channel.rb
Normal file
10
app/channels/order_reservation_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class OrderReservationChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from "order_reservation_channel"
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
stop_all_streams
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
end
|
||||
end
|
||||
11
app/channels/second_display_channel.rb
Normal file
11
app/channels/second_display_channel.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class SecondDisplayChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from "second_display_channel"
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
stop_all_streams
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
end
|
||||
|
||||
end
|
||||
11
app/channels/second_display_view_channel.rb
Normal file
11
app/channels/second_display_view_channel.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class SecondDisplayViewChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from "second_display_view_channel"
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
stop_all_streams
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,7 +1,8 @@
|
||||
class Api::ApiController < ActionController::API
|
||||
include TokenVerification
|
||||
helper_method :current_token, :current_login_employee, :get_cashier
|
||||
|
||||
# before_action :lookup_domain
|
||||
helper_method :current_token, :current_login_employee, :get_cashier
|
||||
|
||||
private
|
||||
#this is base api base controller to need to inherit.
|
||||
@@ -21,4 +22,46 @@ class Api::ApiController < ActionController::API
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(current_token)
|
||||
end
|
||||
|
||||
# def lookup_domain
|
||||
# if request.subdomain.present? && request.subdomain != "www"
|
||||
# from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
# @license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
# if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.dbhost
|
||||
# ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# # authenticate_session_token
|
||||
# # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
# else
|
||||
# # reconnect_default_db
|
||||
# logger.info 'License is nil'
|
||||
# # redirect_to root_url(:host => request.domain) + "store_error"
|
||||
# render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# def website_connection(license)
|
||||
# default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
||||
# :username => license.dbusername, :password => license.dbpassword)
|
||||
# end
|
||||
|
||||
# def reconnect_default_db
|
||||
# ActiveRecord::Base.establish_connection(Rails.env)
|
||||
# end
|
||||
|
||||
# # Regular database.yml configuration hash
|
||||
# def default_connection
|
||||
# @default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
||||
# end
|
||||
|
||||
# def cache_license(url, lookup)
|
||||
# @license = License.new(url, lookup)
|
||||
|
||||
# if (@license.detail_with_local_cache(lookup) == true)
|
||||
# return @license
|
||||
# else
|
||||
# return nil
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -7,8 +7,7 @@ class Api::AuthenticateController < Api::ApiController
|
||||
|
||||
if emp_id && password
|
||||
@employee = Employee.login(emp_id, password)
|
||||
|
||||
if @employee
|
||||
if @employee && @employee.role == "waiter"
|
||||
render json: JSON.generate({:status => true, :session_token => @employee.token_session, :name => @employee.name, :role => @employee.role})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Bad Emp_ID or Password."})
|
||||
|
||||
@@ -5,8 +5,8 @@ class Api::BillController < Api::ApiController
|
||||
def create
|
||||
@status = false
|
||||
@error_message = "Order ID or Booking ID is require to request for a bill."
|
||||
|
||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
# if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
if !ShiftSale.current_shift.nil?
|
||||
#create Bill by Booking ID
|
||||
table = 0
|
||||
if (params[:booking_id])
|
||||
@@ -41,12 +41,15 @@ class Api::BillController < Api::ApiController
|
||||
end
|
||||
|
||||
# Bind shift sale id to sale
|
||||
@sale_data.shift_sale_id = shift_by_terminal.id
|
||||
@sale_data.save
|
||||
# @sale_data.shift_sale_id = shift_by_terminal.id
|
||||
# @sale_data.save
|
||||
|
||||
Promotion.promo_activate(@sale)
|
||||
|
||||
BillBroadcastJob.perform_later(table)
|
||||
#BillBroadcastJob.perform_later(table)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Api::BookingsController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
# skip_before_action :authenticate
|
||||
#Show customer by ID
|
||||
def index
|
||||
@customer = Customer.find_by(params[:id])
|
||||
|
||||
@@ -5,15 +5,16 @@ class Api::CallWaitersController < ActionController::API
|
||||
@table_id = params[:dining_id]
|
||||
@time = params[:time]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
CallWaiterJob.perform_later(@table,@time)
|
||||
|
||||
# CallWaiterJob.perform_later(@table,@time)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
|
||||
end
|
||||
# get printer info
|
||||
# @shop = Shop::ShopDetail
|
||||
# unique_code = "CallWaiterPdf"
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# printer.print_call_waiter(print_settings,@table,@time,@shop)
|
||||
|
||||
@shop = Shop.first
|
||||
unique_code = "CallWaiterPdf"
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_call_waiter(print_settings,@table,@time,@shop)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Api::CheckInProcessController < Api::ApiController
|
||||
|
||||
# before_action :authenticate
|
||||
def check_in_time
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
@@ -11,17 +11,24 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
extra_minutes = (booking.checkout_at - booking.reserved_at) / 1.minutes
|
||||
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
alert_time_min = 0
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'min'
|
||||
alert_time_min = (lookup_checkout_time[0][1]).to_i
|
||||
else
|
||||
alert_time_min = 15
|
||||
end
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
if start_time <= now && now <= end_time
|
||||
alert_time_min = checkout_time[1].to_i
|
||||
end
|
||||
end
|
||||
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes }
|
||||
else
|
||||
render :json => { :status => true }
|
||||
end
|
||||
|
||||
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min }
|
||||
else
|
||||
render :json => { :status => false, :error_message => "No current booking!" }
|
||||
end
|
||||
@@ -33,31 +40,41 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
if dining_facility.status == "available"
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
|
||||
checkout_at = Time.now.utc
|
||||
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
|
||||
dining_facility.status = "occupied"
|
||||
dining_facility.save!
|
||||
|
||||
if dining_facility.type == "Table"
|
||||
type = "TableBooking"
|
||||
else
|
||||
type = "RoomBooking"
|
||||
end
|
||||
|
||||
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
booking.save!
|
||||
if !lookup_checkout_time.empty?
|
||||
today = Time.now.utc.getlocal
|
||||
checkout_at = Time.now.utc.getlocal
|
||||
|
||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p")
|
||||
if start_time <= today.strftime("%H:%M%p") && today.strftime("%H:%M%p") <= end_time
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
|
||||
if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
|
||||
dining_facility.status = "occupied"
|
||||
dining_facility.save!
|
||||
|
||||
if dining_facility.type == "Table"
|
||||
type = "TableBooking"
|
||||
else
|
||||
type = "RoomBooking"
|
||||
end
|
||||
|
||||
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
booking.save!
|
||||
|
||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
||||
else
|
||||
render :json => { :status => true }
|
||||
end
|
||||
else
|
||||
render :json => { :status => true }
|
||||
end
|
||||
else
|
||||
error_message = "#{dining_facility.type} is not available!"
|
||||
render :json => { :status => false, :error_message => error_message }
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
# skip_before_action :authenticate
|
||||
ORDER = "order"
|
||||
RESERVATION = "reservation"
|
||||
ORDER_RESERVATION = "order_and_reservation"
|
||||
|
||||
def check_customer
|
||||
customer_id = 0
|
||||
if !params[:name]
|
||||
render :json => { :status => false, :message => "name is required!" }
|
||||
elsif !params[:email]
|
||||
render :json => { :status => false, :message => "email is required!" }
|
||||
elsif !params[:membership_id]
|
||||
render :json => { :status => false, :message => "membership_id is required!" }
|
||||
end
|
||||
|
||||
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
|
||||
if !check_customer.nil?
|
||||
customer_id = check_customer.customer_id
|
||||
else
|
||||
customer = Customer.addCustomer(params)
|
||||
customer_id = customer.id
|
||||
end
|
||||
|
||||
render :json => { :status => true, :data => { :customer_id => customer_id} }
|
||||
end
|
||||
|
||||
def create
|
||||
status = false
|
||||
if !params[:cus_info]
|
||||
render :json => { :status => false, :message => "cus_info is required!" }
|
||||
elsif !params[:requested_time]
|
||||
render :json => { :status => false, :message => "requested_time is required!" }
|
||||
elsif !params[:callback_url]
|
||||
render :json => { :status => false, :message => "callback_url is required!" }
|
||||
elsif !params[:reference]
|
||||
render :json => { :status => false, :message => "reference is required!" }
|
||||
elsif !params[:order_type]
|
||||
render :json => { :status => false, :message => "order_type is required!" }
|
||||
elsif params[:order_type] == ORDER || params[:order_type] == ORDER_RESERVATION
|
||||
if !params[:order_info]
|
||||
render :json => { :status => false, :message => "order_info is required!" }
|
||||
else
|
||||
status = true
|
||||
end
|
||||
elsif params[:order_type] == RESERVATION || params[:order_type] == ORDER_RESERVATION
|
||||
if !params[:reservation_info]
|
||||
render :json => { :status => false, :message => "reservation_info is required!" }
|
||||
else
|
||||
status = true
|
||||
end
|
||||
elsif !params[:payment_info]
|
||||
render :json => { :status => false, :message => "payment_info is required!" }
|
||||
elsif !params[:delivery_info]
|
||||
render :json => { :status => false, :message => "delivery_info is required!" }
|
||||
end
|
||||
|
||||
if status == true
|
||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(params)
|
||||
|
||||
order_reservation = OrderReservation.find(order_reservation_id)
|
||||
# if ENV["SERVER_MODE"] != 'cloud'
|
||||
# ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
# end
|
||||
if flag
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||
else
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
class Api::OrdersController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
# skip_before_action :authenticate
|
||||
#Description
|
||||
# This API show current order details
|
||||
# Input Params - order_id
|
||||
@@ -50,64 +50,89 @@ class Api::OrdersController < Api::ApiController
|
||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
@order.items = params[:order_items]
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
#Create Table Booking or Room Booking
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
sale_status = check_order_with_booking(booking)
|
||||
if checkin_checkout_time(params[:booking_id])
|
||||
#for extratime
|
||||
is_extra_time = false
|
||||
extra_time = ''
|
||||
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
params[:order_items].each { |i|
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
}
|
||||
#end extra time
|
||||
puts params[:order_items]
|
||||
puts "ORDER ITEMS"
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
@order.items = params[:order_items]
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
#Create Table Booking or Room Booking
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
sale_status = check_order_with_booking(booking)
|
||||
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
else
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
end #booking exists
|
||||
else
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
if sale_status
|
||||
# return false , @message = "bill requested"
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end #booking exists
|
||||
else
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
|
||||
if sale_status
|
||||
# return false , @message = "bill requested"
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
# # for parallel order
|
||||
# remoteIP = ""
|
||||
# begin
|
||||
# @status, @booking = @order.generate
|
||||
# remoteIP = request.remote_ip
|
||||
# end while request.remote_ip != remoteIP
|
||||
@status, @booking = @order.generate
|
||||
# # for parallel order
|
||||
# remoteIP = ""
|
||||
# begin
|
||||
# @status, @booking = @order.generate
|
||||
# remoteIP = request.remote_ip
|
||||
# end while request.remote_ip != remoteIP
|
||||
else
|
||||
return return_json_status_with_code(406, "Checkout time is over!")
|
||||
end
|
||||
end
|
||||
|
||||
# render json for http status code
|
||||
def return_json_status_with_code(code, msg)
|
||||
render status: code, json: {
|
||||
message: msg,
|
||||
booking_id: booking_id
|
||||
message: msg
|
||||
# booking_id: booking_id
|
||||
}.to_json
|
||||
end
|
||||
|
||||
@@ -147,13 +172,86 @@ class Api::OrdersController < Api::ApiController
|
||||
# Update customer info, Guest Info
|
||||
# Input Params
|
||||
# order_id , order_items {[item_code, item_instance_code , qty, option, variants]}
|
||||
def update
|
||||
# def update
|
||||
|
||||
end
|
||||
# end
|
||||
|
||||
def order_params
|
||||
params.permits(:order_source, :booking_id,:order_type,
|
||||
:customer_id,:guest_info, :table_id, :room_id,
|
||||
order_items: [:item_code, :qty, :option, :remark])
|
||||
end
|
||||
|
||||
#checked checkin and checkout time
|
||||
def checkin_checkout_time(booking_id)
|
||||
status = true
|
||||
if !booking_id.nil?
|
||||
today = Time.now.utc
|
||||
booking = Booking.find(booking_id)
|
||||
if !booking.nil?
|
||||
if !booking.checkout_at.nil?
|
||||
checkout_time = booking.checkout_at.utc
|
||||
if checkout_time <= today
|
||||
status = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return status
|
||||
end
|
||||
|
||||
def update
|
||||
Rails.logger.debug "Booking ID - " + params[:booking_id].to_s
|
||||
if checkin_checkout_time(params[:booking_id])
|
||||
Rails.logger.debug "Order Item ID - " + params[:order_item_id].to_s
|
||||
|
||||
order_items_id = params[:order_item_id]
|
||||
qty_weight = params[:quantity].to_f
|
||||
remarks = params[:remark]
|
||||
|
||||
order_item = OrderItem.find(order_items_id)
|
||||
before_updated_qty = order_item.qty
|
||||
|
||||
order_item.item_order_by = current_login_employee.name
|
||||
order_item.qty = qty_weight
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
order_slim_pdf.each do |order_item_slim|
|
||||
if order_item_slim[0] == 'OrderSlimPdf'
|
||||
if order_item_slim[1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
else
|
||||
unique_code="OrderItemPdf"
|
||||
end
|
||||
elsif order_item_slim[0] == 'OrderSetPdf'
|
||||
if order_item_slim[1] == '1'
|
||||
unique_code="OrderSetItemPdf"
|
||||
else
|
||||
unique_code="OrderItemPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
|
||||
end
|
||||
|
||||
return return_json_status_with_code(200, "updated successfully!")
|
||||
else
|
||||
return return_json_status_with_code(406, "Checkout time is over!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,6 +84,17 @@ class Api::PaymentsController < ActionController::API
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
#TODO: implement paypar implementation
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
when "JunctionPay"
|
||||
sale_payment.payment_method = "JunctionPay"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.customer_id = params[:customer_id]
|
||||
sale_payment.payment_reference = params[:vochure_no]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
when "alipay"
|
||||
sale_payment.payment_method = "alipay"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Api::Restaurant::ItemSetsController < Api::ApiController
|
||||
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Api::Restaurant::MenuCategoriesController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
class Api::Restaurant::MenuCategoriesController < Api::ApiController
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Api::Restaurant::MenuController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Api::Restaurant::MenuItemAttributesController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
class Api::Restaurant::MenuItemAttributesController < Api::ApiController
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Api::Restaurant::MenuItemInstancesController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
class Api::Restaurant::MenuItemInstancesController < Api::ApiController
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
|
||||
48
app/controllers/api/survey_controller.rb
Normal file
48
app/controllers/api/survey_controller.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
class Api::SurveyController < Api::ApiController
|
||||
|
||||
# before_action :authenticate
|
||||
|
||||
def index
|
||||
dining_facility = DiningFacility.find(params[:id])
|
||||
survey_data = Survey.find_by_dining_name(dining_facility.name)
|
||||
countries = Lookup.collection_of("country")
|
||||
if !countries.nil? || !survey_data.nil?
|
||||
render :json => { :status => true, :data => { :countries => countries, :survey_data => survey_data} }
|
||||
else
|
||||
render :json => { :status => true, :error_message => "There is no data" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
dining_facility = DiningFacility.find(params[:id])
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
|
||||
if params[:survey_id]
|
||||
survey = Survey.find(params[:survey_id])
|
||||
else
|
||||
survey = Survey.new
|
||||
end
|
||||
survey.dining_name = dining_facility.name
|
||||
survey.shift_id = shift_by_terminal.id
|
||||
survey.child = params[:child]
|
||||
survey.adult = params[:adult]
|
||||
survey.male = params[:male]
|
||||
survey.female = params[:female]
|
||||
survey.local = params[:local]
|
||||
survey.created_by = current_login_employee.name
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.foreigner = params[:foreigner].to_json
|
||||
survey.save!
|
||||
|
||||
render :json => { :status => true }
|
||||
end
|
||||
|
||||
# private
|
||||
# def survey_params
|
||||
# params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner,
|
||||
# :dining_name,:created_by,:total_customer,:total_amount)
|
||||
# end
|
||||
|
||||
end
|
||||
@@ -1,118 +1,25 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
include LoginVerification
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
# lookup domain for db from provision
|
||||
before_action :lookup_domain, :set_locale
|
||||
|
||||
helper_method :current_company,:current_login_employee,:current_user
|
||||
# before_action :set_locale
|
||||
# helper_method :current_company,:current_login_employee,:current_user
|
||||
# alias_method :current_user, :current_login_employee,:current_user
|
||||
#this is base api base controller to need to inherit.
|
||||
#all token authentication must be done here
|
||||
#response format must be set to JSON
|
||||
|
||||
#change locallization
|
||||
def set_locale
|
||||
I18n.locale = params[:locale] || I18n.default_locale
|
||||
end
|
||||
|
||||
# RESTful url for localize
|
||||
def default_url_options
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
else
|
||||
# check for license file
|
||||
# if check_license
|
||||
# current_license(ENV["SX_PROVISION_URL"])
|
||||
# else
|
||||
# redirect_to activate_path
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url)
|
||||
@license = License.new(url)
|
||||
flag = @license.detail_with_local_file()
|
||||
if (flag == 0)
|
||||
flash[:notice] = 'Expired or No License!'
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
puts "RUN SAY BYAR"
|
||||
end
|
||||
end
|
||||
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
|
||||
if (@license.detail_with_local_cache(lookup) == true)
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def website_connection(license)
|
||||
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
||||
:username => license.dbusername, :password => license.dbpassword)
|
||||
|
||||
end
|
||||
|
||||
def reconnect_default_db
|
||||
ActiveRecord::Base.establish_connection(Rails.env)
|
||||
end
|
||||
|
||||
# Regular database.yml configuration hash
|
||||
def default_connection
|
||||
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
||||
end
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
def current_company
|
||||
begin
|
||||
return Company.first
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
if (!session[:session_token].nil?)
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_license
|
||||
if License.check_license_file
|
||||
return true
|
||||
end
|
||||
return false
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
class BaseController < ActionController::Base
|
||||
layout "installation"
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
class BaseCrmController < ActionController::Base
|
||||
include LoginVerification
|
||||
include LoginVerification
|
||||
layout "CRM"
|
||||
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
@@ -20,8 +24,14 @@ class BaseCrmController < ActionController::Base
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
class BaseInventoryController < ActionController::Base
|
||||
include LoginVerification
|
||||
include LoginVerification
|
||||
layout "inventory"
|
||||
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,8 +2,12 @@ class BaseOqsController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "OQS"
|
||||
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
@@ -19,9 +23,15 @@ class BaseOqsController < ActionController::Base
|
||||
def default_url_options
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,20 +2,61 @@ class BaseOrigamiController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "origami"
|
||||
|
||||
# before_action :checkin_process
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail, :current_token
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to origami_root_path
|
||||
# redirect_to origami_root_path
|
||||
redirect_to origami_dashboard_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
def check_user
|
||||
if check_mobile
|
||||
if current_user.nil?
|
||||
return render status: 401, json: {
|
||||
message: "User using other device!"
|
||||
}.to_json
|
||||
end
|
||||
else
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# def checkin_process
|
||||
# CheckinJob.set(wait: 1.minute).perform_later()
|
||||
# end
|
||||
|
||||
# Get current Cashier
|
||||
def get_cashier
|
||||
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
#check webview
|
||||
def check_mobile
|
||||
status = false
|
||||
authenticate_with_http_token do |token, options|
|
||||
if token
|
||||
session[:webview] = true
|
||||
session[:session_token] = token
|
||||
end
|
||||
end
|
||||
|
||||
if session[:webview] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i
|
||||
status = true
|
||||
end
|
||||
|
||||
return status
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
class BaseReportController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "application"
|
||||
include LoginVerification
|
||||
layout "application"
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
PERIOD = {
|
||||
"today" => 0,
|
||||
"yesterday" => 1,
|
||||
@@ -83,8 +83,16 @@ class BaseReportController < ActionController::Base
|
||||
end
|
||||
|
||||
return from, to
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
class BaseWaiterController < ActionController::Base
|
||||
include LoginVerification
|
||||
include LoginVerification
|
||||
layout "waiter"
|
||||
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
88
app/controllers/concerns/license_verification.rb
Normal file
88
app/controllers/concerns/license_verification.rb
Normal file
@@ -0,0 +1,88 @@
|
||||
module LicenseVerification
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_action :lookup_domain
|
||||
end
|
||||
|
||||
protected
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# authenticate_session_token
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
else
|
||||
# check for license file
|
||||
# if check_license
|
||||
# current_license(ENV["SX_PROVISION_URL"])
|
||||
# else
|
||||
# redirect_to activate_path
|
||||
# end
|
||||
end
|
||||
authenticate_session_token
|
||||
end
|
||||
|
||||
def authenticate_session_token
|
||||
token = session[:session_token]
|
||||
if (token)
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
#Rails.logger.debug "token - " + token.to_s
|
||||
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
else
|
||||
flash[:notice] = 'Invalid Access!'
|
||||
# return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url)
|
||||
@license = License.new(url)
|
||||
flag = @license.detail_with_local_file()
|
||||
if (flag == 0)
|
||||
flash[:notice] = 'Expired or No License!'
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
puts "RUN SAY BYAR"
|
||||
end
|
||||
end
|
||||
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
|
||||
if (@license.detail_with_local_cache(lookup) == true)
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def website_connection(license)
|
||||
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
||||
:username => license.dbusername, :password => license.dbpassword)
|
||||
|
||||
end
|
||||
|
||||
def reconnect_default_db
|
||||
ActiveRecord::Base.establish_connection(Rails.env)
|
||||
end
|
||||
|
||||
# Regular database.yml configuration hash
|
||||
def default_connection
|
||||
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
||||
end
|
||||
end
|
||||
@@ -2,37 +2,10 @@ module LoginVerification
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_action :authenticate
|
||||
helper_method :current_company,:current_login_employee
|
||||
|
||||
before_action :authenticate_session_token
|
||||
helper_method :current_company, :current_login_employee, :current_user, :get_cashier
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
# Authenticate the user with token based authentication
|
||||
def authenticate
|
||||
authenticate_session_token || render_unauthorized
|
||||
end
|
||||
|
||||
def authenticate_session_token
|
||||
token = session[:session_token]
|
||||
if (token)
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
Rails.logger.debug "token - " + token.to_s
|
||||
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def render_unauthorized()
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
|
||||
#this is base api base controller to need to inherit.
|
||||
#all token authentication must be done here
|
||||
#response format must be set to JSON
|
||||
@@ -42,18 +15,42 @@ module LoginVerification
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
end
|
||||
|
||||
private
|
||||
def check_installation
|
||||
if current_company.nil?
|
||||
redirect_to install_path
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
# Get current Cashiers
|
||||
def get_cashier
|
||||
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||
end
|
||||
|
||||
protected
|
||||
# Authenticate the user with token based authentication
|
||||
def authenticate
|
||||
authenticate_session_token || render_unauthorized
|
||||
end
|
||||
|
||||
def authenticate_session_token
|
||||
token = session[:session_token]
|
||||
if (token)
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
#Rails.logger.debug "token - " + token.to_s
|
||||
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def render_unauthorized
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,15 +9,23 @@ module TokenVerification
|
||||
|
||||
protected
|
||||
# Authenticate the user with token based authentication
|
||||
def authenticate
|
||||
def authenticate
|
||||
authenticate_token || render_unauthorized
|
||||
end
|
||||
|
||||
def authenticate_token
|
||||
authenticate_with_http_token do |token, options|
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
Rails.logger.debug "token - " + token.to_s
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
def authenticate_token
|
||||
authenticate_with_http_token do |token, options|
|
||||
# Rails.logger.debug "token - " + token.to_s
|
||||
if(options.length !=0 && options["from"] == "DOEMAL")
|
||||
if(ENV["SERVER_MODE"] === "cloud")
|
||||
from = "local" #request.subdomain.downcase + "." + request.domain.downcase
|
||||
aes = MyAesCrypt.new
|
||||
return aes.checkKeyForAuth(from, token)
|
||||
end
|
||||
end
|
||||
|
||||
@user = Employee.
|
||||
(token)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
|
||||
@@ -14,5 +14,5 @@ class Crm::BookingsController < BaseCrmController
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -37,6 +37,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
@membership_types = Lookup.collection_of("member_group_type")
|
||||
|
||||
@taxes = TaxProfile.all.order("order_by asc")
|
||||
|
||||
@filter = filter
|
||||
@@ -141,7 +143,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=2'
|
||||
'Accept' => 'application/json; version=3'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -165,7 +167,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' }
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
||||
end
|
||||
@@ -184,21 +186,21 @@ class Crm::CustomersController < BaseCrmController
|
||||
if response["message"] == "Account has not exist."
|
||||
customer.destroy
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer cannot created.' + response["message"]}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer cannot created.' + response["message"]}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
|
||||
end
|
||||
end
|
||||
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response["message"]}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' + response["message"]}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response["message"] }
|
||||
end
|
||||
end
|
||||
else
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. noted'}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created. noted'}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
|
||||
end
|
||||
@@ -207,7 +209,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
if params[:sale_id]
|
||||
flash[:errors] = @crm_customers.errors
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page]}
|
||||
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
||||
else
|
||||
flash[:errors] = @crm_customers.errors
|
||||
@@ -267,7 +269,7 @@ end
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=2'
|
||||
'Accept' => 'application/json; version=3'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -326,7 +328,7 @@ end
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=2'
|
||||
'Accept' => 'application/json; version=3'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -394,6 +396,7 @@ end
|
||||
def customer_params
|
||||
|
||||
params.require(:customer).permit(:id, :name, :company, :contact_no, :email,
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type)
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -45,13 +45,13 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
respond_to do |format|
|
||||
if @dining_queue.save
|
||||
|
||||
unique_code = "QueueNoPdf"
|
||||
# unique_code = "QueueNoPdf"
|
||||
|
||||
# get printer info
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# # get printer info
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_queue_no(print_settings,@dining_queue)
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# printer.print_queue_no(print_settings,@dining_queue)
|
||||
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Queue was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @dining_queue }
|
||||
@@ -142,4 +142,5 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
def dining_queue_params
|
||||
params.require(:dining_queue).permit(:customer_id, :name, :contact_no, :queue_no,:status,:seater,:remark)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -33,13 +33,13 @@ class Crm::HomeController < BaseCrmController
|
||||
|
||||
end
|
||||
|
||||
unique_code="CrmOrderPdf"
|
||||
# unique_code="CrmOrderPdf"
|
||||
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_crm_order(@booking,order_items,print_settings)
|
||||
# printer.print_crm_order(@booking,order_items,print_settings)
|
||||
|
||||
end
|
||||
|
||||
@@ -55,6 +55,6 @@ class Crm::HomeController < BaseCrmController
|
||||
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
class HomeController < ApplicationController
|
||||
class HomeController < ApplicationController
|
||||
# layout "application", except: [:index, :show]
|
||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||
# skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||
|
||||
before_action :check_user, only: :dashboard
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
# Special check for only dashboard
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
def index
|
||||
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
||||
@employees = Employee.all.order("name asc")
|
||||
@login_form = LoginForm.new()
|
||||
@login_form = LoginForm.new()
|
||||
render "layouts/login_dashboard", layout: false
|
||||
end
|
||||
|
||||
@@ -46,73 +61,103 @@ class HomeController < ApplicationController
|
||||
elsif @employee.role == "manager"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "supervisor" || @employee.role == "waiter"
|
||||
elsif @employee.role == "supervisor"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "waiter"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_dashboard_path
|
||||
elsif @employee.role == "account"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to reports_dailysale_index_path
|
||||
elsif @employee.role == "kitchen"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to oqs_root_path
|
||||
else
|
||||
render :index
|
||||
end
|
||||
else
|
||||
redirect_to origami_root_path, :notice => "Username and Password doesn't match!"
|
||||
redirect_to root_path, :notice => "Username and Password doesn't match!"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def dashboard
|
||||
@from, @to, @from_time, @to_time = get_date_range_from_params
|
||||
|
||||
@shop = Shop.first
|
||||
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
|
||||
@top_products = Sale.top_products(today).sum('i.qty')
|
||||
@bottom_products = Sale.bottom_products(today).sum('i.qty')
|
||||
@hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
|
||||
if !@from.nil? && !@to.nil?
|
||||
if !@from_time.nil? && @to_time.nil?
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count()
|
||||
else
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count()
|
||||
end
|
||||
else
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
end
|
||||
if !@from.nil? && !@to.nil?
|
||||
if !@from_time.nil? && @to_time.nil?
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count()
|
||||
else
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count()
|
||||
end
|
||||
else
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
end
|
||||
@top_products = Sale.top_products(today,current_user,@from,@to,@from_time,@to_time).sum('i.qty')
|
||||
@bottom_products = Sale.bottom_products(today,current_user,@from,@to,@from_time,@to_time).sum('i.qty')
|
||||
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time).sum(:grand_total)
|
||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||
# .sum(:grand_total)
|
||||
@employee_sales = Sale.employee_sales(today)
|
||||
@employee_sales = Sale.employee_sales(today,current_user,@from,@to,@from_time,@to_time)
|
||||
.sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
|
||||
@inventories = StockJournal.inventory_balances(today).sum(:balance)
|
||||
@inventories = StockJournal.inventory_balances(today,@from,@to,@from_time,@to_time).sum(:balance)
|
||||
|
||||
@total_sale = Sale.total_sale(today)
|
||||
@total_count = Sale.total_count(today)
|
||||
@total_card = Sale.total_card_sale(today)
|
||||
@total_credit = Sale.credit_payment(today)
|
||||
@total_sale = Sale.total_sale(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_count = Sale.total_count(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_card = Sale.total_card_sale(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_credit = Sale.credit_payment(today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
@sale_data = Array.new
|
||||
@total_payment_methods = Sale.total_payment_methods(today)
|
||||
@total_payment_methods = Sale.total_payment_methods(today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
||||
pay = Sale.payment_sale('card', today)
|
||||
@sale_data.push({'card' => pay.payment_amount})
|
||||
else
|
||||
pay = Sale.payment_sale(payment.payment_method, today)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
if !@total_payment_methods.nil?
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" || payment.payment_method == "unionpay" || payment.payment_method == "alipay" || payment.payment_method == "paymal" || payment.payment_method == "dinga" || payment.payment_method == "JunctionPay"
|
||||
pay = Sale.payment_sale('card', today, current_user,@from,@to,@from_time,@to_time)
|
||||
@sale_data.push({'card' => pay.payment_amount})
|
||||
else
|
||||
pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to,@from_time,@to_time)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
end
|
||||
end
|
||||
end
|
||||
@summ_sale = Sale.summary_sale_receipt(today)
|
||||
@total_customer = Sale.total_customer(today)
|
||||
@total_dinein = Sale.total_dinein(today)
|
||||
@total_takeaway = Sale.total_takeaway(today)
|
||||
@total_other_customer = Sale.total_other_customer(today)
|
||||
@total_membership = Sale.total_membership(today)
|
||||
@summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_customer = Sale.total_customer(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_dinein = Sale.total_dinein(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_takeaway = Sale.total_takeaway(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_other_customer = Sale.total_other_customer(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_membership = Sale.total_membership(today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
@total_order = Sale.total_order(today)
|
||||
@total_accounts = Sale.total_account(today)
|
||||
@total_order = Sale.total_order(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_accounts = Sale.total_account(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@account_data = Array.new
|
||||
@total_accounts.each do |account|
|
||||
acc = Sale.account_data(account.account_id, today)
|
||||
if !acc.nil?
|
||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||
if !@total_accounts.nil?
|
||||
@total_accounts.each do |account|
|
||||
acc = Sale.account_data(account.account_id, today,current_user,@from,@to,@from_time,@to_time)
|
||||
if !acc.nil?
|
||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@top_items = Sale.top_items(today)
|
||||
@total_foc_items = Sale.total_foc_items(today)
|
||||
@top_items = Sale.top_items(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_foc_items = Sale.total_foc_items(today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
end
|
||||
|
||||
def destroy
|
||||
@@ -143,14 +188,15 @@ class HomeController < ApplicationController
|
||||
#check if cashier has existing open cashier
|
||||
shift = ShiftSale.current_open_shift(employee.id)
|
||||
if !shift.nil?
|
||||
redirect_to origami_root_path
|
||||
redirect_to origami_dashboard_path
|
||||
# redirect_to origami_root_path
|
||||
else
|
||||
redirect_to new_origami_shift_path
|
||||
end
|
||||
elsif employee.role == "manager"
|
||||
redirect_to dashboard_path
|
||||
elsif employee.role == "waiter"
|
||||
redirect_to oqs_root_path
|
||||
redirect_to origami_dashboard_path
|
||||
elsif employee.role == "crm"
|
||||
redirect_to crm_root_path
|
||||
elsif @employee.role == "supervisor"
|
||||
@@ -159,4 +205,30 @@ class HomeController < ApplicationController
|
||||
redirect_to reports_dailysale_index_path
|
||||
end
|
||||
end
|
||||
|
||||
def get_date_range_from_params
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
from_time = params[:from_time]
|
||||
to_time = params[:to_time]
|
||||
|
||||
if from.present? && to.present?
|
||||
# f_date = DateTime.parse(from)
|
||||
# t_date = DateTime.parse(to)
|
||||
# f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
# t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
# from = f_time.beginning_of_day.utc.getlocal
|
||||
# to = t_time.end_of_day.utc.getlocal
|
||||
|
||||
from = DateTime.parse(from).utc.getlocal.strftime('%Y-%m-%d')
|
||||
to = DateTime.parse(to).utc.getlocal.strftime('%Y-%m-%d')
|
||||
end
|
||||
|
||||
return from, to, from_time, to_time
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
class InstallController < BaseController
|
||||
skip_before_action :lookup_domain
|
||||
skip_before_action :verify_authenticity_token
|
||||
# before_action :check_license
|
||||
|
||||
helper_method :shop_detail
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
@@ -30,7 +33,7 @@ class InstallController < BaseController
|
||||
# end
|
||||
|
||||
@license = License.new(ENV["SX_PROVISION_URL"])
|
||||
response = @license.license_activate(restaurant, license_key, db_host, db_schema, db_user, db_password)
|
||||
response = @license.license_activate(restaurant, license_key, db_host, db_schema, db_user, db_password)
|
||||
if response[:status]
|
||||
redirect_to root_url, notice: response["message"]
|
||||
else
|
||||
@@ -74,4 +77,9 @@ class InstallController < BaseController
|
||||
# return nil
|
||||
# end
|
||||
# end
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,4 +3,10 @@ class Inventory::InventoryController < BaseInventoryController
|
||||
def index
|
||||
@products = InventoryDefinition.all.active.order('created_at desc')
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,6 +61,12 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_inventory_definition
|
||||
|
||||
@@ -61,6 +61,12 @@ class Inventory::StockCheckItemsController < BaseInventoryController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_stock_check_item
|
||||
|
||||
@@ -38,6 +38,12 @@ class Inventory::StockChecksController < BaseInventoryController
|
||||
printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, shop_details)
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /stock_checks
|
||||
|
||||
@@ -61,6 +61,12 @@ class StockJournalsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_stock_journal
|
||||
|
||||
75
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
75
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
@@ -1,8 +1,24 @@
|
||||
class Oqs::EditController < BaseOqsController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
|
||||
@link_type = params[:type]
|
||||
@dining_type = nil
|
||||
@booking = nil
|
||||
if params[:type] == 'oqs'
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")
|
||||
elsif params[:type] == "pending"
|
||||
assigned_item = OrderItem.find(assigned_item_id)
|
||||
@booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id")
|
||||
.where("bko.order_id = '#{assigned_item.order_id}'").first()
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.item_instance_code }'")
|
||||
else
|
||||
assigned_item = OrderItem.find(assigned_item_id)
|
||||
dining = DiningFacility.find_by_id(params[:type])
|
||||
@dining_type = dining.type
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.item_instance_code }'")
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -10,21 +26,56 @@ class Oqs::EditController < BaseOqsController
|
||||
qty_weight = params[:qty_weight]
|
||||
remarks = params[:remarks]
|
||||
|
||||
order_item = OrderItem.find(order_items_id);
|
||||
order_item = OrderItem.find(order_items_id)
|
||||
before_updated_qty = order_item.qty
|
||||
|
||||
order_item.item_order_by = current_user.name
|
||||
order_item.qty = qty_weight
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||
|
||||
if !assigned_items.nil?
|
||||
assigned_items.each do |assign_item|
|
||||
# order queue stations
|
||||
oqs = assign_item.order_queue_station
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
|
||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
order_slim_pdf.each do |order_item_slim|
|
||||
if order_item_slim[0] == 'OrderSlimPdf'
|
||||
if order_item_slim[1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
else
|
||||
unique_code="OrderItemPdf"
|
||||
end
|
||||
elsif order_item_slim[0] == 'OrderSetPdf'
|
||||
if order_item_slim[1] == '1'
|
||||
unique_code="OrderSetItemPdf"
|
||||
else
|
||||
unique_code="OrderItemPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,22 +1,37 @@
|
||||
class Oqs::HomeController < BaseOqsController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
|
||||
@queue_stations = OrderQueueStation.all
|
||||
|
||||
# Query for OQS with delivery status false
|
||||
# @queue_items_details = queue_items_query(false)
|
||||
|
||||
# Query for OQS with delivery status true
|
||||
|
||||
@tables = DiningFacility.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@filter = params[:filter]
|
||||
|
||||
@queue_stations = OrderQueueStation.all
|
||||
|
||||
@queue_completed_item = completed_order(@filter)
|
||||
if !@queue_completed_item.empty?
|
||||
@queue_completed_item.each do |queue_item|
|
||||
if !queue_item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(JSON.parse(queue_item.set_menu_items))
|
||||
arr_instance_item_sets = Array.new
|
||||
instance_item_sets.each do |instance_item|
|
||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||
arr_instance_item_sets.push(item_instance_name)
|
||||
end
|
||||
queue_item.set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if !@filter.nil?
|
||||
@count = queue_items_count_query(false,@filter)
|
||||
@count.each do |count|
|
||||
#@count.each do |count|
|
||||
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
# @queue_stations_items=Array.new
|
||||
@@ -44,6 +59,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
# Get Order items
|
||||
def get_order_items
|
||||
items = []
|
||||
assigned_items = []
|
||||
order_no = params[:order_no]
|
||||
status = params[:status]
|
||||
# dining = DiningFacility.find_by_name(table_name);
|
||||
@@ -72,13 +88,48 @@ class Oqs::HomeController < BaseOqsController
|
||||
items.push(oi)
|
||||
end
|
||||
|
||||
render :json => items.to_json
|
||||
if !items.empty?
|
||||
items.each do |item|
|
||||
assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||
if !assigned_order_items.nil?
|
||||
assigned_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id})
|
||||
end
|
||||
|
||||
if !item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||
arr_instance_item_sets = Array.new
|
||||
instance_item_sets.each do |instance_item|
|
||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||
arr_instance_item_sets.push(item_instance_name)
|
||||
end
|
||||
item.set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
end
|
||||
end
|
||||
render :json => {'items' => items, 'assigned_order_items' => assigned_items }
|
||||
end
|
||||
|
||||
def get_items_by_oqs
|
||||
oqs_id = params[:id]
|
||||
filter = params[:filter]
|
||||
items = queue_items_query(false,oqs_id,filter)
|
||||
table_id = params[:table_id]
|
||||
puts params
|
||||
puts table_id
|
||||
puts "sssssssssssss"
|
||||
items = queue_items_query(false,oqs_id,filter,table_id)
|
||||
if !items.empty?
|
||||
items.each do |item|
|
||||
if !item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(JSON.parse(item.set_menu_items))
|
||||
arr_instance_item_sets = Array.new
|
||||
instance_item_sets.each do |instance_item|
|
||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||
arr_instance_item_sets.push(item_instance_name)
|
||||
end
|
||||
item.set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
end
|
||||
end
|
||||
render :json => items.to_json
|
||||
end
|
||||
|
||||
@@ -103,19 +154,26 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status,oqs_id=nil,filter)
|
||||
def queue_items_query(status,oqs_id=nil,filter,table_id)
|
||||
if oqs_id == nil
|
||||
oqs = ''
|
||||
else
|
||||
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
|
||||
end
|
||||
|
||||
if table_id.to_i>0
|
||||
table = "and df.id = '#{table_id}' "
|
||||
|
||||
else
|
||||
table = ''
|
||||
end
|
||||
|
||||
query = AssignedOrderItem.select("assigned_order_items.assigned_order_item_id,
|
||||
oqs.id as station_id, oqs.station_name,
|
||||
oqs.is_active, oqpz.zone_id,
|
||||
df.name as zone, df.type as table_type,
|
||||
odt.order_id, odt.item_code, odt.item_name,
|
||||
odt.price, odt.qty, odt.item_order_by, odt.options,
|
||||
odt.price, odt.qty, odt.item_order_by, odt.options, odt.set_menu_items,
|
||||
cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
@@ -125,7 +183,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} ")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} #{table}")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.order("assigned_order_items.assigned_order_item_id desc")
|
||||
.group("odt.order_items_id")
|
||||
@@ -134,7 +192,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
# Completed Order
|
||||
def completed_order(filter)
|
||||
query = AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
query = AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, odt.set_menu_items, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
@@ -153,19 +211,35 @@ class Oqs::HomeController < BaseOqsController
|
||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||
end
|
||||
|
||||
# def queue_items_count_query(status,filter)
|
||||
# query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
|
||||
# .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
# left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
# left join order_items as odt ON odt.item_instance_code = assigned_order_items.instance_code AND odt.order_id = assigned_order_items.order_id
|
||||
# left join customers as cus ON cus.customer_id = od.customer_id
|
||||
# left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
# left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
# left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
# .where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
# query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
# .group("oqs.id")
|
||||
|
||||
# end
|
||||
|
||||
def queue_items_count_query(status,filter)
|
||||
query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_instance_code = assigned_order_items.instance_code AND odt.order_id = assigned_order_items.order_id
|
||||
# query = OrderQueueStation.all
|
||||
query = OrderQueueStation.select("order_queue_stations.id as station_id,
|
||||
(case when (count(odt.item_code)>0) then count(odt.item_code) else 0 end) as total")
|
||||
.joins(" left join assigned_order_items as aoi on aoi.order_queue_station_id= order_queue_stations.id
|
||||
left join orders as od ON od.order_id = aoi.order_id
|
||||
left join order_items as odt ON odt.item_instance_code = aoi.instance_code AND odt.order_id = aoi.order_id
|
||||
left join customers as cus ON cus.customer_id = od.customer_id
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join booking_orders as bo on bo.order_id = aoi.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
.where("aoi.delivery_status = #{status} AND aoi.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("oqs.id")
|
||||
|
||||
.group("order_queue_stations.id")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,61 +1,106 @@
|
||||
class Oqs::PrintController < ApplicationController
|
||||
authorize_resource :class => false
|
||||
# Print Order Item
|
||||
def print
|
||||
unique_code="OrderItemPdf"
|
||||
assigned_item_id = params[:id]
|
||||
options = params[:options]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||
unique_code="OrderItemPdf"
|
||||
|
||||
if !order_slim_pdf.empty?
|
||||
order_slim_pdf.each do |order_item_slim|
|
||||
if order_item_slim[0] == 'OrderSlimPdf'
|
||||
if order_item_slim[1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
else
|
||||
unique_code="OrderItemPdf"
|
||||
end
|
||||
elsif order_item_slim[0] == 'OrderSetPdf'
|
||||
if order_item_slim[1] == '1'
|
||||
unique_code="OrderSetItemPdf"
|
||||
else
|
||||
unique_code="OrderItemPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
options = params[:options]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
end
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, "", options )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Print Order Details with booking id
|
||||
def print_order_summary
|
||||
unique_code="OrderSummaryPdf"
|
||||
assigned_item_id = params[:id]
|
||||
table_name = params[:table_name]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||
unique_code="OrderSummaryPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
order_slim_pdf.each do |order_summary_slim|
|
||||
if order_summary_slim[0] == 'OrderSlimPdf'
|
||||
if order_summary_slim[1] == '1'
|
||||
unique_code="OrderSummarySlimPdf"
|
||||
else
|
||||
unique_code="OrderSummaryPdf"
|
||||
end
|
||||
elsif order_summary_slim[0] == 'OrderSetPdf'
|
||||
if order_summary_slim[1] == '1'
|
||||
unique_code="OrderSummarySetPdf"
|
||||
else
|
||||
unique_code="OrderSummaryPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
table_name = params[:table_name]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# get dining
|
||||
# dining = DiningFacility.find_by_name(table_name);
|
||||
# booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
# get dining
|
||||
# dining = DiningFacility.find_by_name(table_name);
|
||||
# booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
|
||||
# Get Booking ID
|
||||
booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
|
||||
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
# Get Booking ID
|
||||
booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
|
||||
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status = true
|
||||
ai.save
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status = true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,15 +1,28 @@
|
||||
class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
class Origami::AddordersController < BaseOrigamiController
|
||||
# before_action :set_dining, only: [:detail]
|
||||
|
||||
|
||||
def index
|
||||
@tables = Table.all.active.order('zone_id asc').group("zone_id")
|
||||
@rooms = Room.all.active.order('zone_id asc').group("zone_id")
|
||||
@all_table = Table.all.active.order('status desc')
|
||||
@all_room = Room.all.active.order('status desc')
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
@tables = Table.all.active.order('zone_id asc').group("zone_id")
|
||||
@rooms = Room.all.active.order('zone_id asc').group("zone_id")
|
||||
@all_table = Table.all.active.order('status desc')
|
||||
@all_room = Room.all.active.order('status desc')
|
||||
end
|
||||
|
||||
def detail
|
||||
@menu = MenuCategory.all.active
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
@menus = Menu.all
|
||||
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||
@table_id = params[:id]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
@booking = @table.get_booking
|
||||
@@ -34,9 +47,10 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
|
||||
def get_menu_category ()
|
||||
if (params[:id])
|
||||
puts params[:id]
|
||||
|
||||
#Pull this menu
|
||||
@menu = MenuCategory.find_by_id(params[:id])
|
||||
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
@@ -44,12 +58,30 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def get_item_instance
|
||||
@id = MenuItemInstance.find(params[:id])
|
||||
end
|
||||
|
||||
def get_menu()
|
||||
if (params[:id])
|
||||
#Pull this menu
|
||||
@menu = Menu.find_by_id(params[:id])
|
||||
@menu_category = MenuCategory.where("menu_id='#{@menu.id}'").order("order_by asc")
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
Menu.current_menu
|
||||
end
|
||||
end
|
||||
|
||||
def get_menu_sub_category ()
|
||||
|
||||
id = params[:id]
|
||||
|
||||
if (id)
|
||||
#Pull this menu
|
||||
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
|
||||
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @sub_menu
|
||||
end
|
||||
@@ -62,62 +94,109 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
def create
|
||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||
puts params[:order_items]
|
||||
is_extra_time = false
|
||||
extra_time = ''
|
||||
|
||||
items_arr = []
|
||||
JSON.parse(params[:order_items]).each { |i|
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
if i["parent_order_item_id"];
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])}
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
puts items_arr.to_json
|
||||
puts "sssssssssssssssssssssss"
|
||||
# begin
|
||||
# if params[:order_source] == "quick_service"
|
||||
# customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||
# else
|
||||
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
# end
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
@order.customer_id = customer_id
|
||||
@order.items = items_arr
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
#Create Table Booking or Room Booking
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
sale_status = check_order_with_booking(booking)
|
||||
# puts "WWwwWWWWWWww"
|
||||
# puts sale_status
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if params[:table_id].to_i > 0
|
||||
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
|
||||
else
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
# puts "OOOOOOOOO"
|
||||
# puts sale_status
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
table_status = true
|
||||
end
|
||||
end #booking exists
|
||||
if booking
|
||||
if table_status && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
sale_status = check_order_with_booking(booking)
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
else
|
||||
if params[:table_id].to_i > 0
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
if sale_status
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
end
|
||||
end #booking exists
|
||||
else
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
# puts "MMMMMMMM"
|
||||
# puts sale_status
|
||||
if sale_status
|
||||
# return false , @message = "bill requested"
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
if params[:table_id].to_i > 0
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
if sale_status
|
||||
# return false , @message = "bill requested"
|
||||
return return_json_status_with_code(400, "bill requested")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
|
||||
# Order.send_customer_view(@booking)
|
||||
|
||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||
if @status && @booking && @order.source == 'quick_service'
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
# for second display
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
|
||||
|
||||
end
|
||||
result = {:status=> @status, :data => @sale }
|
||||
render :json => result.to_json
|
||||
end
|
||||
else
|
||||
result = {:status=> @status, :data => 0 }
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# render json for http status code
|
||||
|
||||
77
app/controllers/origami/alipay_controller.rb
Normal file
77
app/controllers/origami/alipay_controller.rb
Normal file
@@ -0,0 +1,77 @@
|
||||
class Origami::AlipayController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
# limit alipay_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = 0
|
||||
@alipaycount = 0
|
||||
@shop = Shop.first
|
||||
@rounding_adj = 0
|
||||
@can_alipay = 0
|
||||
@member_discount = 0
|
||||
@sub_total = 0
|
||||
@membership_id = nil
|
||||
@receipt_no = nil
|
||||
if !sale_data.nil?
|
||||
total = sale_data.grand_total
|
||||
|
||||
others = 0
|
||||
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "alipay"
|
||||
@alipaycount = @alipaycount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_alipay = total - @alipaycount - others
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
end
|
||||
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@bank_integration = bank_integration[0][1]
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
ref_no = params[:ref_no]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop.first
|
||||
|
||||
# rounding adjustment
|
||||
# if shop_details.is_rounding_adj
|
||||
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
# rounding_adj = new_total-saleObj.grand_total
|
||||
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||
# end
|
||||
|
||||
# saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "alipay",ref_no)
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
99
app/controllers/origami/bank_integration_controller.rb
Normal file
99
app/controllers/origami/bank_integration_controller.rb
Normal file
@@ -0,0 +1,99 @@
|
||||
class Origami::BankIntegrationController < ApplicationController #BaseOrigamiController
|
||||
|
||||
def settle_trans
|
||||
if(params[:type] == 'request')
|
||||
card_settle_trans = CardSettleTran.new()
|
||||
card_settle_trans.req_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_settle_trans.req_time = Time.now.utc
|
||||
card_settle_trans.req_cmd = params[:data][:cmd_type]
|
||||
card_settle_trans.req_type = params[:data][:payment_type]
|
||||
card_settle_trans.save()
|
||||
|
||||
card_settle_trans_id = card_settle_trans.id
|
||||
response = {status: 'success', card_settle_trans_id: card_settle_trans_id}
|
||||
else
|
||||
card_settle_trans = CardSettleTran.find(params[:card_settle_trans_id])
|
||||
card_settle_trans.res_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_settle_trans.res_time = Time.now.utc
|
||||
card_settle_trans.res_cmd = params[:data][:CMD]
|
||||
card_settle_trans.res_type = params[:data][:TYPE]
|
||||
card_settle_trans.status = params[:data][:STATUS]
|
||||
card_settle_trans.sale_cnt = params[:data][:SALECNT]
|
||||
card_settle_trans.sale_amt = params[:data][:SALEAMT].to_f
|
||||
card_settle_trans.void_cnt = params[:data][:VOIDCNT]
|
||||
card_settle_trans.void_amt = params[:data][:VOIDAMT].to_f
|
||||
card_settle_trans.refund_cnt = params[:data][:REFUNDCNT]
|
||||
card_settle_trans.refund_amt = params[:data][:REFUNDAMT].to_f
|
||||
card_settle_trans.print_text_part1_type = params[:data][:PRINTTEXTPART1TYPE]
|
||||
card_settle_trans.print_text_part1_value = params[:data][:PRINTTEXTPART1VALUE]
|
||||
card_settle_trans.print_text_part2_type = params[:data][:PRINTTEXTPART2TYPE]
|
||||
card_settle_trans.print_text_part2_value = params[:data][:PRINTTEXTPART2VALUE]
|
||||
card_settle_trans.print_text_part3_type = params[:data][:PRINTTEXTPART3TYPE]
|
||||
card_settle_trans.print_text_part3_value = params[:data][:PRINTTEXTPART3VALUE]
|
||||
card_settle_trans.print_text_part4_type = params[:data][:PRINTTEXTPART4TYPE]
|
||||
card_settle_trans.print_text_part4_value = params[:data][:PRINTTEXTPART4VALUE]
|
||||
card_settle_trans.save()
|
||||
response = {status: 'success'}
|
||||
end
|
||||
render json: response
|
||||
end
|
||||
|
||||
def sale_trans
|
||||
if(params[:type] == 'request')
|
||||
card_sale_trans = CardSaleTran.new()
|
||||
card_sale_trans.sale_id = params[:data][:sale_id]
|
||||
card_sale_trans.req_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_sale_trans.req_time = Time.now.utc
|
||||
card_sale_trans.req_amt = params[:data][:amt]
|
||||
card_sale_trans.req_inv_no = params[:data][:inv_no]
|
||||
card_sale_trans.req_cmd = params[:data][:cmd_type]
|
||||
card_sale_trans.req_type = params[:data][:payment_type]
|
||||
card_sale_trans.save()
|
||||
|
||||
card_sale_trans_id = card_sale_trans.id
|
||||
response = {status: 'success', card_sale_trans_id: card_sale_trans_id}
|
||||
else
|
||||
card_sale_trans = CardSaleTran.find(params[:card_sale_trans_id])
|
||||
card_sale_trans.res_date = params[:data][:DATE]
|
||||
card_sale_trans.res_time = params[:data][:TIME]
|
||||
card_sale_trans.res_amt = params[:data][:AMT].to_f / 100
|
||||
card_sale_trans.res_inv_no = params[:data][:ECRREF]
|
||||
card_sale_trans.res_cmd = params[:data][:CMD]
|
||||
card_sale_trans.res_type = params[:data][:TYPE]
|
||||
card_sale_trans.status = params[:data][:STATUS]
|
||||
card_sale_trans.resp = params[:data][:RESP]
|
||||
card_sale_trans.trace = params[:data][:TRACE]
|
||||
card_sale_trans.app_code = params[:data][:APPCODE]
|
||||
card_sale_trans.pan = params[:data][:PAN]
|
||||
card_sale_trans.exp_date = params[:data][:EXPDATE]
|
||||
card_sale_trans.tips = params[:data][:TIPS]
|
||||
card_sale_trans.entry_mode = params[:data][:ENTRYMODE]
|
||||
card_sale_trans.terminal_id = params[:data][:TERMINALID]
|
||||
card_sale_trans.merchant_id = params[:data][:MERCHANTID]
|
||||
card_sale_trans.card_holder = params[:data][:CARDHOLDERNAME]
|
||||
card_sale_trans.batch_no = params[:data][:BATCHNO]
|
||||
card_sale_trans.ref_no = params[:data][:REFNUM]
|
||||
card_sale_trans.app = params[:data][:APP]
|
||||
card_sale_trans.emv_app_id = params[:data][:AID]
|
||||
card_sale_trans.emv_cyptrogram = params[:data][:TC]
|
||||
card_sale_trans.curr_code = params[:data][:CURRCODE]
|
||||
card_sale_trans.fx_rate = params[:data][:FXRATE]
|
||||
card_sale_trans.foreign_amt = params[:data][:FOREIGNAMT]
|
||||
card_sale_trans.dcc_msg = params[:data][:DCCMSG]
|
||||
card_sale_trans.tender = params[:data][:TENDER]
|
||||
card_sale_trans.print_text_part1_type = params[:data][:PRINTTEXTPART1TYPE]
|
||||
card_sale_trans.print_text_part1_value = params[:data][:PRINTTEXTPART1VALUE]
|
||||
card_sale_trans.print_text_part2_type = params[:data][:PRINTTEXTPART2TYPE]
|
||||
card_sale_trans.print_text_part2_value = params[:data][:PRINTTEXTPART2VALUE]
|
||||
card_sale_trans.print_text_part3_type = params[:data][:PRINTTEXTPART3TYPE]
|
||||
card_sale_trans.print_text_part3_value = params[:data][:PRINTTEXTPART3VALUE]
|
||||
card_sale_trans.print_text_part4_type = params[:data][:PRINTTEXTPART4TYPE]
|
||||
card_sale_trans.print_text_part4_value = params[:data][:PRINTTEXTPART4VALUE]
|
||||
card_sale_trans.save()
|
||||
|
||||
response = {status: 'success'}
|
||||
end
|
||||
render json: response
|
||||
end
|
||||
|
||||
end
|
||||
@@ -14,4 +14,5 @@ class Origami::CashInsController < BaseOrigamiController
|
||||
shift.cash_in = shift.cash_in + amount.to_i
|
||||
shift.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -7,4 +7,5 @@ class Origami::CashMgmtController < ApplicationController
|
||||
|
||||
def create
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -12,4 +12,5 @@ class Origami::CashOutsController < BaseOrigamiController
|
||||
shift.cash_out = shift.cash_out + amount.to_i
|
||||
shift.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,32 +2,38 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
|
||||
def check_in_process
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
checkout_at = Time.now.utc
|
||||
today = Time.now.utc.getlocal
|
||||
checkout_at = Time.now.utc.getlocal
|
||||
if !lookup_checkout_time.empty?
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p")
|
||||
if start_time <= checkout_at.strftime("%H:%M%p") && checkout_at.strftime("%H:%M%p") <= end_time
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
|
||||
if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
|
||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||
@dining_facility.status = "occupied"
|
||||
@dining_facility.save!
|
||||
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
if @dining_facility.type == "Table"
|
||||
type = "TableBooking"
|
||||
else
|
||||
type = "RoomBooking"
|
||||
end
|
||||
|
||||
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
@booking.save!
|
||||
end
|
||||
end
|
||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||
@dining_facility.status = "occupied"
|
||||
@dining_facility.save!
|
||||
|
||||
if @dining_facility.type == "Table"
|
||||
type = "TableBooking"
|
||||
else
|
||||
type = "RoomBooking"
|
||||
end
|
||||
|
||||
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
@booking.save!
|
||||
|
||||
respond = {:status => 'ok'}
|
||||
respond_to do |format|
|
||||
format.json { render json: respond }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@@ -8,7 +9,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
@shop = Shop.first
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
@@ -31,7 +32,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
shop_details = Shop.first
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user