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

This commit is contained in:
Aung Myo
2017-08-31 13:48:24 +06:30
519 changed files with 20763 additions and 4184 deletions

3
.gitignore vendored
View File

@@ -51,3 +51,6 @@ dump.rdb
# Fonts
public/fonts/*
# Ruby-Mine IDE folder
/.idea

2
.idea/.generators generated
View File

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

2
.idea/.rakeTasks generated

File diff suppressed because one or more lines are too long

134
.idea/sxrestaurant.iml generated
View File

@@ -11,106 +11,6 @@
</component>
<component name="ModuleRunConfigurationManager">
<shared />
<local>
<configuration default="false" name="test: sxrestaurant" type="RakeRunConfigurationType" factoryName="Rake">
<module name="sxrestaurant" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs>
<env name="RAILS_ENV" value="test" />
</envs>
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="spec: sxrestaurant" type="RakeRunConfigurationType" factoryName="Rake">
<module name="sxrestaurant" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="Production: sxrestaurant" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="sxrestaurant" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="production" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="Development: sxrestaurant" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="sxrestaurant" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
</local>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
@@ -124,24 +24,27 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="actioncable (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activejob (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actioncable (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activejob (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="arel (v8.0.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="autoprefixer-rails (v7.1.1.2, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bcrypt (v3.1.11, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bindex (v0.5.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap (v4.0.0.alpha6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap-datepicker-rails (v1.6.4.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap-daterangepicker-rails (v0.0.8, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.14.6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="byebug (v9.0.6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="cancancan (v1.17.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="carrierwave (v1.1.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="chronic (v0.10.2, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-rails (v4.2.2, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script (v2.4.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script-source (v1.12.2, rbenv: 2.3.3) [gem]" level="application" />
@@ -150,7 +53,7 @@
<orderEntry type="library" scope="PROVIDED" name="cups (v0.0.7, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="database_cleaner (v1.6.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.6.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.6.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="execjs (v2.7.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="factory_girl (v4.8.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="factory_girl_rails (v4.8.0, rbenv: 2.3.3) [gem]" level="application" />
@@ -160,8 +63,9 @@
<orderEntry type="library" scope="PROVIDED" name="font-awesome-rails (v4.7.0.2, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="globalid (v0.4.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.15.5, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.8.4, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.8.6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jbuilder (v2.7.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jquery-datetimepicker-rails (v2.4.1.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jquery-rails (v4.3.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jquery-ui-rails (v6.0.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="kaminari (v1.0.1, rbenv: 2.3.3) [gem]" level="application" />
@@ -175,10 +79,12 @@
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.2.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.2, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="momentjs-rails (v2.17.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.12.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mysql2 (v0.4.6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nested_form (v0.3.2, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nio4r (v2.1.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.8.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="pdf-core (v0.7.0, rbenv: 2.3.3) [gem]" level="application" />
@@ -190,10 +96,10 @@
<orderEntry type="library" scope="PROVIDED" name="rack-cors (v0.4.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-protection (v2.0.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="railties (v5.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="railties (v5.1.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rake (v12.0.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.9.8, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.9.10, rbenv: 2.3.3) [gem]" level="application" />
@@ -207,6 +113,7 @@
<orderEntry type="library" scope="PROVIDED" name="sass (v3.4.24, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass-rails (v5.0.6, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="schema_to_scaffold (v0.8.0, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="select2-rails (v4.0.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="shoulda-matchers (v3.1.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sidekiq (v5.0.3, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="simple_form (v3.5.0, rbenv: 2.3.3) [gem]" level="application" />
@@ -228,6 +135,7 @@
<orderEntry type="library" scope="PROVIDED" name="web-console (v3.5.1, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.6.5, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.2, rbenv: 2.3.3) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="whenever (v0.9.7, rbenv: 2.3.3) [gem]" level="application" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />

1595
.idea/workspace.xml generated

File diff suppressed because it is too large Load Diff

16
Gemfile
View File

@@ -31,11 +31,15 @@ gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'simple_form'
gem 'nested_form'
gem 'bootstrap', '~> 4.0.0.alpha3'
gem 'tether-rails'
gem "font-awesome-rails"
gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.2'
gem 'rack-cors'
# image upload
gem 'carrierwave', '~> 1.0'
#Report and Printing gems
gem 'cups', '~> 0.0.7'
gem 'prawn'
@@ -107,8 +111,8 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'httparty', '~> 0.15.5'
# gem 'momentjs-rails', '>= 2.9.0'
# gem 'bootstrap-datepicker-rails'
# # gem 'momentjs-rails', '>= 2.9.0'
# gem 'bootstrap3-datetimepicker-rails'z
gem 'bootstrap-datepicker-rails'
gem 'momentjs-rails' # for date-range selector
gem 'bootstrap-daterangepicker-rails' # date-range picker
gem 'bootstrap-datepicker-rails' # date picker
gem 'jquery-datetimepicker-rails'
gem 'select2-rails' # for multi-select and auto-complete select box

View File

@@ -1,39 +1,39 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.1)
actionpack (= 5.1.1)
actioncable (5.1.3)
actionpack (= 5.1.3)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.1)
actionpack (= 5.1.1)
actionview (= 5.1.1)
activejob (= 5.1.1)
actionmailer (5.1.3)
actionpack (= 5.1.3)
actionview (= 5.1.3)
activejob (= 5.1.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.1)
actionview (= 5.1.1)
activesupport (= 5.1.1)
actionpack (5.1.3)
actionview (= 5.1.3)
activesupport (= 5.1.3)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.1)
activesupport (= 5.1.1)
actionview (5.1.3)
activesupport (= 5.1.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.1.1)
activesupport (= 5.1.1)
activejob (5.1.3)
activesupport (= 5.1.3)
globalid (>= 0.3.6)
activemodel (5.1.1)
activesupport (= 5.1.1)
activerecord (5.1.1)
activemodel (= 5.1.1)
activesupport (= 5.1.1)
activemodel (5.1.3)
activesupport (= 5.1.3)
activerecord (5.1.3)
activemodel (= 5.1.3)
activesupport (= 5.1.3)
arel (~> 8.0)
activesupport (5.1.1)
activesupport (5.1.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
@@ -48,9 +48,15 @@ GEM
sass (>= 3.4.19)
bootstrap-datepicker-rails (1.6.4.1)
railties (>= 3.0)
bootstrap-daterangepicker-rails (0.0.8)
railties (>= 3.1)
builder (3.2.3)
byebug (9.0.6)
cancancan (1.17.0)
carrierwave (1.1.0)
activemodel (>= 4.0.0)
activesupport (>= 4.0.0)
mime-types (>= 1.16)
chronic (0.10.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
@@ -64,7 +70,7 @@ GEM
cups (0.0.7)
database_cleaner (1.6.1)
diff-lcs (1.3)
erubi (1.6.0)
erubi (1.6.1)
execjs (2.7.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
@@ -81,10 +87,11 @@ GEM
activesupport (>= 4.2.0)
httparty (0.15.5)
multi_xml (>= 0.5.2)
i18n (0.8.4)
i18n (0.8.6)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-datetimepicker-rails (2.4.1.0)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
@@ -115,10 +122,13 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.2.0)
minitest (5.10.2)
minitest (5.10.3)
momentjs-rails (2.17.1)
railties (>= 3.1)
multi_json (1.12.1)
multi_xml (0.6.0)
mysql2 (0.4.6)
nested_form (0.3.2)
nio4r (2.1.0)
nokogiri (1.8.0)
mini_portile2 (~> 2.2.0)
@@ -136,26 +146,26 @@ GEM
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.1.1)
actioncable (= 5.1.1)
actionmailer (= 5.1.1)
actionpack (= 5.1.1)
actionview (= 5.1.1)
activejob (= 5.1.1)
activemodel (= 5.1.1)
activerecord (= 5.1.1)
activesupport (= 5.1.1)
bundler (>= 1.3.0, < 2.0)
railties (= 5.1.1)
rails (5.1.3)
actioncable (= 5.1.3)
actionmailer (= 5.1.3)
actionpack (= 5.1.3)
actionview (= 5.1.3)
activejob (= 5.1.3)
activemodel (= 5.1.3)
activerecord (= 5.1.3)
activesupport (= 5.1.3)
bundler (>= 1.3.0)
railties (= 5.1.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.1.1)
actionpack (= 5.1.1)
activesupport (= 5.1.1)
railties (5.1.3)
actionpack (= 5.1.3)
activesupport (= 5.1.3)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
@@ -191,6 +201,8 @@ GEM
tilt (>= 1.1, < 3)
schema_to_scaffold (0.8.0)
activesupport (>= 3.2.1)
select2-rails (4.0.3)
thor (~> 0.14)
shoulda-matchers (3.1.1)
activesupport (>= 4.0.0)
sidekiq (5.0.3)
@@ -248,22 +260,27 @@ DEPENDENCIES
bcrypt (~> 3.1.7)
bootstrap (~> 4.0.0.alpha3)
bootstrap-datepicker-rails
bootstrap-daterangepicker-rails
byebug
cancancan (~> 1.10)
carrierwave (~> 1.0)
coffee-rails (~> 4.2)
cups (~> 0.0.7)
database_cleaner
factory_girl_rails (~> 4.0)
faker
filterrific
font-awesome-rails
font-awesome-rails (~> 4.7, >= 4.7.0.2)
httparty (~> 0.15.5)
jbuilder (~> 2.5)
jquery-datetimepicker-rails
jquery-rails
jquery-ui-rails
kaminari (~> 1.0.1)
listen (~> 3.0.5)
momentjs-rails
mysql2 (>= 0.3.18, < 0.5)
nested_form
pg
prawn
prawn-table
@@ -273,6 +290,7 @@ DEPENDENCIES
rspec-rails (~> 3.5)
sass-rails (~> 5.0)
schema_to_scaffold
select2-rails
shoulda-matchers (~> 3.1)
sidekiq
simple_form
@@ -288,4 +306,4 @@ DEPENDENCIES
whenever
BUNDLED WITH
1.15.1
1.15.3

View File

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

BIN
app/assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -23,8 +23,90 @@ $(document).ready(function(){
// setTimeout(function(){
// window.location.reload(1);
// }, 10000);
$(".nav-completed").on("click", function(){
$("#completed").removeClass('hide')
$(".oqs_append").addClass('hide')
});
$('.queue_station').on('click',function(){
$(".oqs_click").on("click", function(){
$("#completed").addClass('hide')
$(".oqs_append").removeClass('hide')
var oqs_id = $(this).find(".oqs-id").text();
var url = 'oqs/get_items/'+oqs_id;
show_details(url);
}); //End Click
function show_details(url){
var oqs_append = $('.oqs_append');
oqs_append.empty();
var filter = $('.filter').text();
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {'filter':filter},
dataType: "json",
success: function(data) {
for(var field in data) {
var price = parseFloat(data[field].price).toFixed(2);
if (data[field]["options"] == "[]") {
var options = "";
}else{
var options = data.options;
}
var date = new Date(data[field]["created_at"]);
var show_date = date.getDate() + "-" + date.getMonth() + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
row ='<div class="card queue_station">'
+'<div class="card-block">'
+'<h4 class="card-title">'
+'<span class="order-zone-type">'+data[field]["table_type"]+'- </span>'
+'<span class="order-zone">'+ data[field]["zone"] +'</span>'
+'<small class="pull-right">'+ data[field]["order_id"] +'- </small>'
+'</h4>'
+'<h4>'
+'<span class="order-item">'+ data[field]["item_name"] +'- </span>'
+'<span class="order-qty">'+ data[field]["qty"] +'- </span>'
+'</h4>'
+'<p class="card-text item-options">'+ options +'</p>'
+'<p class="card-text">'
+'<small class="text-muted">Order at'
+'<span class="order-at">'+ show_date +'</span> - '
+'<span class="order-by">'+ data[field]["item_order_by"] +'</span> '
+'</small> '
+'</p>'
+'<p class="hidden order-customer">'+ data[field]["customer_name"] +'</p> '
+'<p class="hidden assigned-order-item">'+ data[field]["assigned_order_item_id"] +'</p> '
+'</div>'
+'<div class="card-footer">'
+'<button id="edit_'+ data[field]["assigned_order_item_id"]+'" class="btn btn-warning order-item order-item-edit">EDIT</button>'
+' <button id="assigned_queue_' + data[field]["assigned_order_item_id"] +'" class="btn btn-primary order-item order-complete">COMPLETE</button>'
+'</div>'
+'</div>';
$('.oqs_append').append(row);
}
}
});
//end Ajax
}
$(document).on('click', '.queue_station', function(event){
var orderZone=$(this).children().children().children('.order-zone').text().trim();
// var orderItem=$(this).children().children().children('.order-item').text();
var assigned_item_id = $(this).children().find(".assigned-order-item").text();
@@ -41,7 +123,6 @@ $(document).ready(function(){
$('#order-from').text(orderZone);
// clear order items
$("#oqs-order-details-table").children("tbody").empty();
// Call get_order_items() for Order Items by dining
$.ajax({
type: 'GET',
@@ -68,19 +149,20 @@ $(document).ready(function(){
$(this).addClass('selected-item');
});
$(".order-item-edit").on('click', 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"
});
// complete for queue item
$('.order-complete').on('click',function(e){
$(document).on('click', '.order-complete', function(event){
//e.preventDefault();
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var params = { 'id':assigned_item_id };
// Call update_delivery_status() for changed delivery and move to delivery
$.ajax({
type: 'POST',
@@ -117,10 +199,11 @@ $(document).ready(function(){
});
// Print Order Item
$('#print_order_item').on('click',function(){
$(document).on('click', '#print_order_item', function(event){
var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text();
var options = $('.selected-item').children('.card-block').find('.item-options').text();
var params = { 'options':options };
$.ajax({
type: 'GET',
url: '/oqs/print/print/'+assigned_item_id,
@@ -129,7 +212,8 @@ $(document).ready(function(){
});
// Print Order Summary
$('#print_order_summary').on('click',function(){
// $('#print_order_summary').on('click',function(){
$(document).on('click', '#print_order_summary', function(event){
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'table_name':table_name };

View File

@@ -0,0 +1,623 @@
$(function(){
//click menu sidebar menu category
$(".menu_category").on("click", function(){
var menu_id = $(this).find(".menu-id").text();
var url = $(this).attr('data-ref');
show_menu_item_list(url);
});
//End menu category Click
$(".change_qty").change(function(){
qty = $(this).val();
price = $("#unit_price").text();
$("#total_price").text(qty*price);
});
$("#set_change_qty").change(function(){
qty = $(this).val();
price = $("#set_total_price").text();
$("#set_total_price").text(qty*price);
});
//show menu item list when click menu category
function show_menu_item_list(url_item){
var menu_list = $('.menu_items_list');
menu_list.empty();
//Start Ajax
$.ajax({
type: "GET",
url: url_item,
data: {},
dataType: "json",
success: function(data) {
var menu_items_list = $('.menu_items_list');
menu_items_list.empty();
menu_items = data.menu_items;
for(var field in menu_items) {
if (menu_items[field].is_sub_item == false) {
instances = menu_items[field].instances ;
$(instances).each(function(i){
if (instances[i].is_default === true) {
code = instances[i].code;
name = instances[i].name;
price = parseFloat(instances[i].price).toFixed(2);
is_available = instances[i].is_available ;
is_on_promotion = instances[i].is_on_promotion;
item_attributes = instances[i].values;
promotion_price = instances[i].promotion_price;
code = instances[i].code;
}
});
qty = 1;
options = [];
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
fa_plus = '';
menu_item_box = 'set_item_box';
data_target = 'sx_item_set_detailModal';
}else{
fa_plus = 'fa-plus';
menu_item_box = 'menu_item_box';
data_target = 'sx_item_detailModal'
}
row = '<div class="card custom-card">'
+'<div class="custom-card-head card-head" style="line-height:14px;">'
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
+"<div class='col-md-3 add_icon' 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 +"'>"
+"<i class='fa "+fa_plus+" '"
+ 'style="margin-top:4px;">'
+'</i></div>'
+'</div>'
+"<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' src='/image/logo.png'>"
+"</div>"
+'<div class="card-footer custom-card-footer">'
+'<small>'+ price +'</small>'
+'</div>'
+'</div>';
$('.menu_items_list').append(row);
}
}
}
});
//end Ajax
}
//end show list function
//click item row for item set
$(document).on('click', '.set_item_box', function(event){
$(".instance-list").empty();
$(".options-list").empty();
data = $(this).parent().children().children('.add_icon');
instances = $(this).data('instance');
item_sets = $(this).data('item-sets');
for(var field in item_sets) {
value = item_sets[field]["instances"];
$(value).each(function(i){
$.ajax({
type: "GET",
url: '../../api/restaurant/menu_item_instances/'+value[i]["id"],
data: {id:value[i]},
success:function(result){
row = '<div class="col-md-4 " >'
+"<div class='card custom-card instance_box' data-name='"+result["name"]
+"' data-code='"+result["code"]
+"' data-price='"+result["price"]
+"' data-option='"+JSON.stringify(result["options"])
+"'>"
+'<div class="custom-card-head card-head" style="line-height:14px;">'
+'<small class="">'+result["name"]+'</small>'
+'</div>'
+'<div class="card-block custom-card-block">'
+'<img id="" src="/image/logo.png" height="40px">'
+' <small style="float:" id="instance_option"></small>'
+'</div>'
+'<div class="card-footer custom-card-footer">'
+' <small>'+result["price"]+'</small>'
// +' <small style="float:right" id="instance_option"></small>'
+'</div>'
+'</div>'
+' </div>'
$(".instance-list").append(row);
}
});
});
}
$('#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_unit_price').text(data.attr('data-price'));
});
// click instance for add item set
$(document).on('click', '.instance_box', function(event){
$(".options-list").empty();
item_options = $(this).data('option');
code = $(this).data('code');
for(var field in item_options) {
value = item_options[field]["values"];
type = item_options[field]["type"];
row = "<p style='font-size:16px;margin-bottom:3px'>"+type+"</p>"
$(value).each(function(i){
row +="<button class='btn btn-default btn-sm option_btn "+ type +"' data-type='"
+type+"' data-value='"+value[i]+"' data-code='"+code+"' data-group='set_menu'>"
+value[i]+"</button>";
});
$(".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();
total = qty*price;
var total_price = +sub_total - +total;
$(this).removeClass('selected-instance');
$(".options-list").empty();
$(this).removeAttr('data-options');
$('#instance_option').text('')
}else {
sub_total = $('#set_total_price').text();
name = $(this).data('name');
price = $(this).data('price');
qty = $('#set_change_qty').val();
total = qty*price;
var total_price = +sub_total + +total;
$(this).addClass('selected-instance');
}
$('#set_total_price').text(total_price);
}); //End selecct attribute buttom
// click add order
$(document).on('click', '.set_order', function(event){
total_price = $('#set_total_price').text();
qty = parseInt($('#set_change_qty').val());
item_code = $('#set_item_code').text();
item_name = $('#set_name').text();
var items = $('.selected-instance');
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');
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+ "'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + 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);
rowCount = rowCount + 1;
});
calculate_sub_total();
}); //End add order Click
//click item row for add order
$(document).on('click', '.menu_item_box', function(event){
$('.attributes-list').empty();
$('.options-list').empty();
$('.attr-alert').addClass('hide');
$('.add_to_order').removeAttr('data-instance-code');
$('.add_to_order').removeAttr('data-instance');
$('.add_to_order').removeAttr('data-price');
$('.add_to_order').removeAttr('data-promotion-price');
$('.add_to_order').removeAttr('data-item-code');
$('.add_to_order').removeAttr('data-qty');
$('.add_to_order').removeAttr('data-name');
$('.add_to_order').removeAttr('data-attributes');
$('.add_to_order').removeAttr('data-options');
data = $(this).parent().children().children('.add_icon');
attributes = $(this).data('id');
selected_item = $(this).data('item');
instances = $(this).data('instance');
item_options = $(this).data('option');
instance_attributes = []
for(var field in instances) {
value = instances[field].values;
$(value).each(function(i){
options = value[i];
instance_attributes.push(options);
});
}
for(var field in attributes) {
value = attributes[field]["values"];
type = attributes[field]["type"]
row = "<h4>"+attributes[field]["type"]+"</h4>"
$(value).each(function(i){
disabled = ""
status ="";
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
status = "selected-attribute";
}
if(parseInt(jQuery.inArray(value[i], instance_attributes)) == -1){
disabled = "disabled";
}
row +="<button id='selected-attribute' data-instances='"+JSON.stringify(instances)+"' data-type='"
+type+"' data-value='"+value[i]+"' class='btn btn-default attribute_btn "
+ status +" "+ type +" "+ disabled +" '>"
+value[i]
+"</button>";
});
$(".attributes-list").append(row);
}
for(var field in item_options) {
value = item_options[field]["values"];
type = item_options[field]["type"];
row = "<h4>"+type+"</h4>"
$(value).each(function(i){
row +="<button class='btn btn-default option_btn "+ type +"' data-type='"
+type+"' data-value='"+value[i]+"' data-group='simple_menu'>"+value[i]+"</button>";
});
$(".options-list").append(row);
}
$('#change_qty').val(1);
$('#item_instances').text(instances);
$('#title_name').text(data.attr('data-name'));
$('#item_code').text(data.attr('data-item-code'));
$('#total_price').text(data.attr('data-price'));
$('#unit_price').text(data.attr('data-price'));
});
// click select option icon for add
$(document).on('click', '.attribute_btn', function(event){
value = $(this).data('value');
type = $(this).data('type');
instances = $(this).data('instances');
attributes = $(".attribute_btn");
$(attributes).each(function(i){
if ($(attributes[i]).attr('data-type')==type){
$('.'+type).removeClass("selected-attribute");
}
});
$(this).addClass('selected-attribute');
// if ($(".attribute_btn").attr("data-type")==type){
// $('.'+type).removeClass("selected-attribute");
// }
// $(this).addClass('selected-attribute');
var selected_attr = get_selected_attributes('selected-attribute');
qty = $('#change_qty').val();
for(var field in instances) {
item_attr = instances[field].values;
if(JSON.stringify(item_attr) == JSON.stringify(selected_attr)){
unit_price = instances[field].price ;
total_price = qty * unit_price ;
$('#instance_name').text(instances[field].name);
$('#instance_code').text(instances[field].code);
$('#promotion_price').text(instances[field].promotion_price);
$('#total_price').text(total_price);
$('#unit_price').text(unit_price);
}
}
}); //End selecct attribute buttom
// click select option icon for add
$(document).on('click', '.option_btn', function(event){
value = $(this).data('value');
type = $(this).data('type');
group = $(this).data('group');
options = $(".option_btn");
$(options).each(function(i){
if ($(options[i]).attr('data-type')==type){
$('.'+type).removeClass("selected-option");
}
});
$(this).addClass('selected-option');
if(group == "set_menu"){
code = $(this).data('code');
value = $(this).data('value');
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);
}
});
}
}); //End selecct attribute buttom
// click add order
$(document).on('click', '.add_to_order', function(event){
total_price = $('#total_price').text();
qty = parseInt($('#change_qty').val());
var item_row = $('.selected-attribute');
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
attribute_arr = get_selected_attributes('selected-attribute');
option_arr = get_selected_attributes('selected-option');
for(var field in instances) {
if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values)) {
$('.add_to_order').attr('data-instance-code',instances[field].code);
$('.add_to_order').attr('data-instance',instances[field].name);
$('.add_to_order').attr('data-price',instances[field].price);
$('.add_to_order').attr('data-promotion-price',instances[field].promotion_price);
}
}
$('.add_to_order').attr('data-item-code',$('#item_code').text());
$('.add_to_order').attr('data-qty',qty);
$('.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));
var item_data = $(this);
show_item_detail(item_data);
calculate_sub_total();
}); //End add order Click
// click plus icon for add
$(document).on('click', '.add_icon', function(event){
var item_data = $(this);
show_item_detail(item_data);
calculate_sub_total();
}); //End Add Icon Click
function show_item_detail(data){
console.log(data)
qty = parseInt(data.attr('data-qty'));
append = 0;
price = parseFloat(data.attr('data-price')).toFixed(2);
instance_name = data.attr('data-instance');
if (instance_name == "undefined"){
instance = '';
}else{
instance = "("+data.attr('data-instance')+")";
}
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')) {
if (qty > 1) {
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
}else{
qty = parseInt($(item_row[i]).children('#item_qty').text()) + 1;
}
$(item_row[i]).children('#item_qty').text(qty);
parseFloat($(item_row[i]).children('#item_price').text(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-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
+data.attr('data-instance-code')+"' data-attributes='"
+data.attr('data-attributes')+"' data-options ='"
+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-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(price).toFixed(2)
+'</td>'
+'</tr>';
$(".summary-items tbody").append(row);
}
}
// Pay Discount for Payment
$("#create_order").on('click', function(e){
e.preventDefault();
$("#loading_wrapper").show();
var table_id = $('#table_id').text();
var booking_id = $('#booking_id').text();
if (!booking_id.length > 0) {
var params = {'order_source': "cashier", 'order_type': "dine_in",
'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",
'customer_id': "", 'guest_info': "",
'table_id': table_id,
'order_items': order_items };
$.ajax({
type: "POST",
url: ajax_url,
data: params,
dataType: "json",
success:function(result){
$("#loading_wrapper").hide();
$.confirm({
title: 'Infomation!',
content: "Order has been successfully created",
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
}
else {
window.location.href = "/origami/room/" + table_id
}
}
}
}
});
}
});
});
//click item row for update qty
$('.summary-items').on('click', '.item_box', function(){
$(this).attr('data-active',true);
name = $(this).children('#item_name').text();
qty = $(this).children('#item_qty').text();
$('#modal-item-name').text(name);
$('#modal-qty').val(qty);
});
//click remove buttom in modal box
$('#sx_itemModal').on('click','#remove', function(){
$('.summary-items tr').filter(function(){
if ($(this).attr('data-active') == 'true'){
$(this).remove();
}
});
calculate_sub_total();
});
//click close
$('#sx_itemModal').on('click','#close', function(){
$(".item_box").removeAttr("data-active");
});
//click save buttom after change qty
$('#sx_itemModal').on('click','#save', function(){
summary_items_filter();
calculate_sub_total();
});
//calculate subtotal
function calculate_sub_total(){
var total_price = 0;
var taxable_amount = 0;
var item_row = $('.summary-items tbody tr');
$(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;
});
var fixed_total_price = parseFloat(total_price).toFixed(2);
var fixed_taxable_amount = parseFloat(taxable_amount).toFixed(2);
$('#sub_total').empty();
$('#sub_total').append(fixed_total_price);
if (fixed_total_price > 0) {
$('.create').removeAttr("disabled", false);
}else{
$('.create').attr("disabled", true);
}
}
function summary_items_filter(){
$('.summary-items tr').filter(function(){
if ($(this).attr('data-active') == 'true'){
qty = $('#modal-qty').val();
price = parseFloat($(this).attr('data-price'));
total_price = parseFloat(price*qty).toFixed(2);
$(this).find('#item_qty').text(qty);
$(this).find('.item-cell-price').text(total_price);
$(this).removeAttr('data-active');
}
});
}
/* Get Item rows */
function get_order_item_rows(){
var order_items = [];
var item_row = $('.summary-items tbody tr');
$(item_row).each(function(i){
var order_item = {};
console.log($(item_row[i]).attr('data-options'));
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();
order_item.options = $(item_row[i]).attr('data-options');
order_items.push(order_item);
});
return order_items;
}
// Get Selected Class
function get_selected_attributes(selected_class) {
var item_row = $('.'+selected_class);
var attribute_arr = [];
$(item_row).each(function(i){
value = $(item_row[i]).attr('data-value');
str = value;
attribute_arr.push(str);
});
return attribute_arr;
}
});

View File

@@ -11,6 +11,7 @@
// about supported directives.
//
//= require jquery
//= require jquery_nested_form
//= require tether
//= require bootstrap
//= require jquery_ujs
@@ -19,145 +20,28 @@
//= require settings/processing_items
//= require jquery-ui
//= require bootstrap-datepicker
//= require moment
//= require daterangepicker
//= require select2
//= require jquery.datetimepicker
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
$(document).on('turbolinks:load', function() {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
$('.dropdown-toggle').dropdown();
$('.dropdown-toggle').dropdown();
});
function export_to(path)
{
var form_params = $("#frm_report").serialize();
window.location = path+"?"+ form_params;
var form_params = $("#frm_report").serialize();
window.location = path+"?"+ form_params;
}
/*
* ToDo Move to here from pages
*
*
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
//Reset the form to pervious values
$("#branch").val(<%=params[:branch]%>);
$("#waiter").val("<%=params[:waiter]%>");
$("#cashier").val(<%=params[:cashier]%>);
$("#product").val(<%=params[:product]%>);
$("#singer").val(<%=params[:singer]%>);
$("#item").val('<%=params[:item]%>');
$("#guest_role").val('<%=params[:guest_role]%>');
$("#from").val("<%=params[:from]%>");
$("#to").val("<%=params[:to]%>");
$("#sel_period").val(<%=params[:period]%>);
$("#sel_sale_type").val(<%=params[:sale_type]%>);
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
$(function(){
var check_arr = [];
var search = '<%= params[:period_type] %>';
if(search){
if(parseInt(search) == 0){
search_by_period();
}
else{
search_by_date();
}
}else{
search_by_period();
}
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
var period = $('#sel_period').val();
var period_type = 0;
var from = "";
var to = "";
}
$('#from').change(function(){
search_by_date();
});
$('#to').change(function(){
search_by_date();
});
function search_by_date(){
var from = $('#from').val();
var to = $('#to').val();
var period = 0;
var period_type = 1;
if(to != '' && from != ''){
shift_name = from + ',' + to;
check_arr.push(to);
// console.log(check_arr.length)
if(check_arr.length == 1){
}
if(check_arr.length == 3){
check_arr = [];
}
}
}
});
*/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the 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/

12
app/assets/javascripts/fileinput.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

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

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,152 @@
@import "bootstrap";
@import "font-awesome";
@import "theme";
@import "jquery-ui";
@import "bootstrap-datepicker3";
.custom-card-head{
height: 40px;
background-color: #54A5AF;
padding:5px;
color :#fff;
}
.custom-card {
border: 2px solid rgba(0, 0, 0, 0.125) !important;
}
.custom-card-footer{
padding:0.35rem 1.25rem !important;
}
.custom-card-block {
padding: 0.3rem !important;
}
@media (min-width: 34em) {
.custom-card-columns {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
}
@media (min-width: 48em) {
.custom-card-columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
}
}
@media (min-width: 62em) {
.custom-card-columns {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
}
}
@media (min-width: 75em) {
.custom-card-columns {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
}
}
.nav-tabs .nav-item {
border-bottom: 1px solid #fff;
border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;
}
.nav > li > a{
color:#54A5AF;
}
.nav-tabs {
background-color: #eeeeee;
}
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
background-color: #fff;
border-left: 6px solid #111;
color:#54A5AF;
font-weight: bold;
border-color: #fff #fff #fff #54A5AF;
}
.custom-modal-dialog {
left:auto;
right: auto;
width: 100%;
}
element.style {
padding-top: 0px !important;
}
.selected-attribute {
color: #fff !important;
background-color: green !important;
}
.selected-option {
color: #fff !important;
background-color: green !important;
}
.selected-instance {
border: 2px solid #7a62d3 !important;
}
.attribute_btn {
white-space: normal !important;
margin-bottom: 5px;
margin-right: 5px;
}
.option_btn {
white-space: normal !important;
margin-bottom: 5px;
margin-right: 5px;
}
#logo{
margin: auto;
width: 50%;
border: 1px solid #54A5AF;
padding: 10px;
}
#instance_img{
margin: auto;
width: 80px;
height: 80px;
border: 1px solid #54A5AF;
padding: 10px;
}
.instance_box{
margin-bottom:10px;
}
/*Loading gif for payment*/
#loading_wrapper{
position: fixed;
background-color: #C8C8C8 ;
height: 100%;
width: 100%;
left: 0;
opacity: 0.6;
top: 0;
z-index: 9999999;
}
#loading{
position: relative;
height: 100%;
width: 100%;
background-image: url('../../../image/loading-ajax.gif');
background-position: center center;
background-repeat: no-repeat;
opacity: 1;
filter: alpha(opacity=100); /* ie */
-moz-opacity: 1; /* mozilla */
}

View File

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

View File

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

View File

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

View File

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

12
app/assets/stylesheets/fileinput.min.css vendored Executable file

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -4,15 +4,45 @@
@import "jquery-ui";
@import "bootstrap-datepicker3";
@import "jquery.datetimepicker";
/* Show it is fixed to the top */
// body {
// min-height: 75rem;
// padding-top: 4.5rem;
// }
/* Reset */
.table {
margin-bottom: 0px;
}
select.form-control {
height: inherit !important;
}
.form-horizontal .form-group {
margin-right: 0px !important;
}
.card-columns {
font-size: 18px !important;
}
/* End Reset */
.dining {
min-height:470px;
max-height:570px;
overflow:auto
}
.order-info {
min-height:300px;
max-height:500px;
overflow:auto
}
.others-payment{
line-height:100px;
text-align:center;
@@ -60,6 +90,10 @@
margin-top:5px;
}
.font-12 {
font-size: 12px;
}
.cash-color{
background-color:#80CBC4;
}
@@ -82,6 +116,12 @@
margin-bottom: 5px;
}
.radius-btn {
border-radius:5px;
color:#fff;
background-color:red;
}
.bottom-5 {
margin-bottom: 5px;
}
@@ -184,16 +224,6 @@
margin-bottom: 1px;
}
/*----- Reset -----*/
select.form-control {
height: inherit !important;
}
.form-horizontal .form-group {
margin-right: 0px !important;
}
/* Discount */
.discount-item-row {
@@ -246,7 +276,6 @@ tr.discount-item-row:hover {
/*Loading gif for payment*/
#loading_wrapper{
position: fixed;
background-color: #C8C8C8 ;
height: 100%;
@@ -256,6 +285,7 @@ tr.discount-item-row:hover {
top: 0;
z-index: 9999999;
}
#loading{
position: relative;
height: 100%;
@@ -268,4 +298,3 @@ tr.discount-item-row:hover {
-moz-opacity: 1; /* mozilla */
}

View File

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

View File

@@ -26,7 +26,175 @@ ul.dropdown-menu li a{
background-color: transparent !important;
margin-bottom: 0px !important;
}
.page-header{
border-bottom :0px solid #000 !important;
margin :0px !important;
}
.center-text {
text-align:center;
background-color:#ddd;
}
.footer {
position: fixed;
bottom: 0;
left: 0;
height: auto;
background-color: #ef404a;
width: 100%;
}
.footer-header {
color : #ef404a;
font-weight:bold;
font-style:italic;
margin-bottom:0px;
}
.menu-item-img {
margin: 10px;
text-align: center;
}
.padding-10 {
padding: 10px;
}
/* Colors */
.white {
color: #fff;
}
.purple {
background-color:#7a62d3;
}
.orange{
background-color:#FF7F50;
}
.red {
background-color:#ff0000;
}
.green{
background-color: #009900;
}
.yellow {
background-color: #FF8C00;
}
.blue{
background-color: blue;
}
/* End Colors */
.pin_pad {
width: 33%;
height: 70px;
line-height: 70px;
text-align: center;
background: #54A5AF;
font-size: 20px;
color: white;
}
.bottom {
margin-bottom: 1px;
}
.left {
margin-left: 1px;
}
.card {
margin-top: 10px;
box-sizing: border-box;
border-radius: 2px;
background-clip: padding-box;
transition: 0.3s ease;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}
.card-footer {
padding: 0;
background-color: #fff;
border-top: none;
}
.dashboard-nav {
cursor: pointer;
color: #7a62d3;
padding: 10px;
font-size: 24px;
font-weight: bold;
border-radius: 0 0 2px 2px;
background-clip: padding-box;
box-sizing: border-box;
transition: color 0.3s ease;
text-align: center;
}
.card:hover {
box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.16), 0 10px 20px 0 rgba(0, 0, 0, 0.12);
}
#admin ul {
line-height: 25px;
}
.panel-body {
padding: 5px !important;
}
.panel-title .glyphicon {
float: right;
}
@media screen and (min-height: 800px){
.card .card-content {
padding: 30px !important;
}
}
@media screen and (min-height: 540px){
.card .card-content {
padding: 20px !important;
}
}
@media (min-width: 34em) {
.card-columns {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
}
@media (min-width: 48em) {
.card-columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
}
}
@media (min-width: 62em) {
.card-columns {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
}
}
@media (min-width: 75em) {
.card-columns {
-webkit-column-count: 5;
-moz-column-count: 5;
column-count: 5;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,6 +24,7 @@ class Api::BillController < Api::ApiController
@sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
end
Promotion.promo_activate(@sale)
else
@status = false
@error_message = "No Current Open Shift"

View File

@@ -1,5 +1,5 @@
class Api::OrdersController < Api::ApiController
skip_before_action :authenticate
#Description
# This API show current order details
# Input Params - order_id

View File

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

View File

@@ -1,11 +1,11 @@
class Api::Restaurant::MenuController < Api::ApiController
class Api::Restaurant::MenuCategoriesController < Api::ApiController
skip_before_action :authenticate
#Description
# Pull the default menu details and also other available (active) menus
# Input Params - order_id
def index
@menus = Menu.all
@current_menu = Menu.current_menu
@menus = MenuCategory.all
@current_menu = MenuCategory.current_menu
end
@@ -21,10 +21,10 @@ class Api::Restaurant::MenuController < Api::ApiController
def menu_detail (menu_id)
if (menu_id)
#Pull this menu
menu = Menu.find_by_id(menu_id)
menu = MenuCategory.find_by_id(menu_id)
return menu
else
Menu.current_menu
MenuCategory.current_menu
end
end

View File

@@ -1,12 +1,28 @@
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
def index
@menus = Menu.all
@current_menu = Menu.current_menu
param_checksum = params[:checksum]
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
all_menu = Menu.all
# to hash
menu_array = []
all_menu.each do |m|
menu_array.push(m.to_json(:include => {:menu_categories => { :include => { :menu_items => { :include => [:menu_item_sets, :menu_item_instances => {:include => :menu_instance_item_sets}]} } }}))
end
#export Checksum file generate by md5
menu_checksum = Digest::MD5.hexdigest(menu_array.to_json)
if menu_checksum != param_checksum
response.headers['CHECKSUM'] = menu_checksum
@menus = all_menu
end
# @current_menu = Menu.current_menu
end
#Description

View File

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

View File

@@ -0,0 +1,9 @@
class Api::Restaurant::MenuItemInstancesController < Api::ApiController
skip_before_action :authenticate
#Description
# Pull the default menu details and also other available (active) menus
# Input Params - order_id
def show
@id = MenuItemInstance.find(params[:id])
end
end

View File

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

View File

@@ -0,0 +1,17 @@
class BaseInventoryController < ActionController::Base
include LoginVerification
layout "inventory"
#before_action :check_installation
protect_from_forgery with: :exception
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
end

View File

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

View File

@@ -6,17 +6,39 @@ class Crm::CustomersController < BaseCrmController
# GET /crm/customers.json
def index
filter = params[:filter]
type = params[:type]
if filter.nil?
@crm_customers = Customer.all
else
@crm_customers = Customer.search(filter)
# search account no from paypar
if !@crm_customers.present? && type == "card"
response = Customer.search_paypar_account_no(filter)
if response["status"] == true
@crm_customers = Customer.new
@crm_customers.name = response["customer_data"]["name"]
@crm_customers.contact_no = response["customer_data"]["phone"]
@crm_customers.email = response["customer_data"]["email"]
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
@crm_customers.nrc_no = response["customer_data"]["NRC"]
@crm_customers.address = response["customer_data"]["address"]
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
@crm_customers.paypar_account_no = filter
@crm_customers.membership_id = response["customer_data"]["id"]
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save
@crm_customers = Customer.search(filter)
end
end
end
#@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new
@count_customer = Customer.count_customer
@taxes = TaxProfile.all.order("order_by asc")
# if flash["errors"]
# @crm_customer.valid?
# end
@@ -63,16 +85,21 @@ class Crm::CustomersController < BaseCrmController
# GET /crm/customers/1/edit
def edit
@customer = Customer.find(params[:id])
end
# POST /crm/customers
# POST /crm/customers.json
def create
def create
# Remove "" default first
params[:customer][:tax_profiles].delete_at(0)
@crm_customers = Customer.new(customer_params)
respond_to do |format|
if @crm_customers.save
# update tax profile
customer = Customer.find(@crm_customers.customer_id)
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
name = customer_params[:name]
phone = customer_params[:contact_no]
email = customer_params[:email]
@@ -81,7 +108,7 @@ class Crm::CustomersController < BaseCrmController
nrc = customer_params[:nrc_no]
card_no = customer_params[:card_no]
paypar_account_no = customer_params[:paypar_account_no]
member_group_id = params[:member_group_id]
member_group_id = params[:member_group_id]
if member_group_id.present?
membership = MembershipSetting.find_by_membership_type("paypar_url")
@@ -90,13 +117,24 @@ class Crm::CustomersController < BaseCrmController
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
:body => {name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
@@ -128,8 +166,25 @@ class Crm::CustomersController < BaseCrmController
end
# format.json { render :index, status: :created, location: @crm_customers }
else
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
customer = Customer.find(@crm_customers.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
# When paypar account no not exist in paypar
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"]}
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"]}
else
@@ -161,10 +216,12 @@ end
# PATCH/PUT /crm/customers/1
# PATCH/PUT /crm/customers/1.json
def update
# Remove "" default first
params[:customer][:tax_profiles].delete_at(0)
respond_to do |format|
if @crm_customer.update(customer_params)
# update tax profile
@crm_customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
name = customer_params[:name]
phone = customer_params[:contact_no]
email = customer_params[:email]
@@ -174,23 +231,33 @@ end
card_no = customer_params[:card_no]
paypar_account_no = customer_params[:paypar_account_no]
id = @crm_customer.membership_id
member_group_id = params[:member_group_id]
member_group_id = params[:member_group_id]
if id.nil? && !member_group_id.nil?
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
:body => { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,
paypar_account_no: paypar_account_no,
card_no:card_no,member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
@@ -207,34 +274,47 @@ end
response = { status: false}
end
if response["status"] == true
customer = Customer.find(@crm_customer.customer_id)
customer = Customer.find(@crm_customer.customer_id)
if response["status"] == true
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
else
customer = Customer.find(@crm_customer.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
format.html { redirect_to crm_customers_path, notice: response["error"] }
end
else
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
:body => {name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
@@ -255,6 +335,13 @@ end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
else
customer = Customer.find(@crm_customer.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: response["message"] }
end
@@ -289,7 +376,7 @@ end
# Never trust parameters from the scary internet, only allow the white list through.
def customer_params
params.require(:customer).permit(:name, :company, :contact_no, :email,
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no)
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)
end
end

View File

@@ -1,13 +1,13 @@
class Crm::HomeController < BaseCrmController
def index
@booking = Booking.all
@customer = Customer.all
from = Time.now.beginning_of_day.utc
to = Time.now.end_of_day.utc
@queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC')
# redirect_to crm_customers_path
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
@booking = Booking.all
@customer = Customer.all
from = Time.now.beginning_of_day.utc
to = Time.now.end_of_day.utc
@queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC')
redirect_to crm_customers_path
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
end

View File

@@ -42,9 +42,12 @@ class HomeController < ApplicationController
elsif @employee.role == "manager"
session[:session_token] = @employee.token_session
redirect_to dashboard_path
elsif @employee.role == "accountant"
elsif @employee.role == "supervisour"
session[:session_token] = @employee.token_session
redirect_to dashboard_path
redirect_to origami_root_path
elsif @employee.role == "account"
session[:session_token] = @employee.token_session
redirect_to reports_dailysale_index_path
else
render :index
end
@@ -96,12 +99,15 @@ class HomeController < ApplicationController
redirect_to new_origami_shift_path
end
elsif employee.role == "manager"
redirect_to oqs_root_path
redirect_to dashboard_path
elsif employee.role == "waiter"
redirect_to oqs_root_path
elsif employee.role == "crm"
redirect_to crm_root_path
elsif @employee.role == "supervisour"
redirect_to origami_root_path
elsif @employee.role == "account"
redirect_to reports_dailysale_index_path
end
end
end

View File

@@ -0,0 +1,6 @@
class Inventory::InventoryController < BaseInventoryController
def index
@products = InventoryDefinition.all.active.order('created_at desc')
end
end

View File

@@ -0,0 +1,74 @@
class Inventory::InventoryDefinitionsController < BaseInventoryController
before_action :set_inventory_definition, only: [:show, :edit, :update, :destroy]
# GET /inventory_definitions
# GET /inventory_definitions.json
def index
@inventory_definitions = InventoryDefinition.all
end
# GET /inventory_definitions/1
# GET /inventory_definitions/1.json
def show
end
# GET /inventory_definitions/new
def new
@inventory_definition = InventoryDefinition.new
end
# GET /inventory_definitions/1/edit
def edit
end
# POST /inventory_definitions
# POST /inventory_definitions.json
def create
@inventory_definition = InventoryDefinition.new(inventory_definition_params)
respond_to do |format|
if @inventory_definition.save
format.html { redirect_to inventory_path, notice: 'Inventory definition was successfully created.' }
format.json { render :show, status: :created, location: @inventory_definition }
else
format.html { render :new }
format.json { render json: @inventory_definition.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /inventory_definitions/1
# PATCH/PUT /inventory_definitions/1.json
def update
respond_to do |format|
if @inventory_definition.update(inventory_definition_params)
format.html { redirect_to @inventory_definition, notice: 'Inventory definition was successfully updated.' }
format.json { render :show, status: :ok, location: @inventory_definition }
else
format.html { render :edit }
format.json { render json: @inventory_definition.errors, status: :unprocessable_entity }
end
end
end
# DELETE /inventory_definitions/1
# DELETE /inventory_definitions/1.json
def destroy
@inventory_definition.destroy
respond_to do |format|
format.html { redirect_to inventory_definitions_url, notice: 'Inventory definition was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_inventory_definition
@inventory_definition = InventoryDefinition.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def inventory_definition_params
params.require(:inventory_definition).permit(:item_code, :min_order_level, :max_stock_level)
end
end

View File

@@ -0,0 +1,74 @@
class Inventory::StockCheckItemsController < BaseInventoryController
before_action :set_stock_check_item, only: [:show, :edit, :update, :destroy]
# GET /stock_check_items
# GET /stock_check_items.json
def index
@stock_check_items = StockCheckItem.all
end
# GET /stock_check_items/1
# GET /stock_check_items/1.json
def show
end
# GET /stock_check_items/new
def new
@stock_check_item = StockCheckItem.new
end
# GET /stock_check_items/1/edit
def edit
end
# POST /stock_check_items
# POST /stock_check_items.json
def create
@stock_check_item = StockCheckItem.new(stock_check_item_params)
respond_to do |format|
if @stock_check_item.save
format.html { redirect_to inventory_stock_checks_path, notice: 'Stock check item was successfully created.' }
format.json { render :show, status: :created, location: @stock_check_item }
else
format.html { render :new }
format.json { render json: @stock_check_item.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /stock_check_items/1
# PATCH/PUT /stock_check_items/1.json
def update
respond_to do |format|
if @stock_check_item.update(stock_check_item_params)
format.html { redirect_to @stock_check_item, notice: 'Stock check item was successfully updated.' }
format.json { render :show, status: :ok, location: @stock_check_item }
else
format.html { render :edit }
format.json { render json: @stock_check_item.errors, status: :unprocessable_entity }
end
end
end
# DELETE /stock_check_items/1
# DELETE /stock_check_items/1.json
def destroy
@stock_check_item.destroy
respond_to do |format|
format.html { redirect_to stock_check_items_url, notice: 'Stock check item was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_stock_check_item
@stock_check_item = StockCheckItem.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def stock_check_item_params
params.require(:stock_check_item).permit(:item_code, :stock_count)
end
end

View File

@@ -0,0 +1,98 @@
class Inventory::StockChecksController < BaseInventoryController
def index
@check = StockCheck.new
end
def create
item_list = JSON.parse(params[:stock_item])
reason = params[:reason]
check = StockCheck.new
@check = check.create(current_user, reason, item_list)
end
def show
@check = StockCheck.find(params[:id])
end
def save_to_journal
check = params[:data]
stockCheck = StockCheck.find(check)
stockCheck.stock_check_items.each do |item|
StockJournal.from_stock_check(item)
end
end
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
# GET /stock_checks
# GET /stock_checks.json
# def index
# @stock_checks = StockCheck.all
# end
#
# # GET /stock_checks/1
# # GET /stock_checks/1.json
# def show
# end
#
# # GET /stock_checks/new
# def new
# @stock_check = StockCheck.new
# end
#
# # GET /stock_checks/1/edit
# def edit
# end
#
# # POST /stock_checks
# # POST /stock_checks.json
# def create
# @stock_check = StockCheck.new(stock_check_params)
#
# respond_to do |format|
# if @stock_check.save
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully created.' }
# format.json { render :show, status: :created, location: @stock_check }
# else
# format.html { render :new }
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
# end
# end
# end
#
# # PATCH/PUT /stock_checks/1
# # PATCH/PUT /stock_checks/1.json
# def update
# respond_to do |format|
# if @stock_check.update(stock_check_params)
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully updated.' }
# format.json { render :show, status: :ok, location: @stock_check }
# else
# format.html { render :edit }
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
# end
# end
# end
#
# # DELETE /stock_checks/1
# # DELETE /stock_checks/1.json
# def destroy
# @stock_check.destroy
# respond_to do |format|
# format.html { redirect_to stock_checks_url, notice: 'Stock check was successfully destroyed.' }
# format.json { head :no_content }
# end
# end
#
# private
# # Use callbacks to share common setup or constraints between actions.
# def set_stock_check
# @stock_check = StockCheck.find(params[:id])
# end
#
# # Never trust parameters from the scary internet, only allow the white list through.
# def stock_check_params
# params.fetch(:stock_check, {})
# end
end

View File

@@ -0,0 +1,74 @@
class StockJournalsController < ApplicationController
before_action :set_stock_journal, only: [:show, :edit, :update, :destroy]
# GET /stock_journals
# GET /stock_journals.json
def index
@stock_journals = StockJournal.all
end
# GET /stock_journals/1
# GET /stock_journals/1.json
def show
end
# GET /stock_journals/new
def new
@stock_journal = StockJournal.new
end
# GET /stock_journals/1/edit
def edit
end
# POST /stock_journals
# POST /stock_journals.json
def create
@stock_journal = StockJournal.new(stock_journal_params)
respond_to do |format|
if @stock_journal.save
format.html { redirect_to @stock_journal, notice: 'Stock journal was successfully created.' }
format.json { render :show, status: :created, location: @stock_journal }
else
format.html { render :new }
format.json { render json: @stock_journal.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /stock_journals/1
# PATCH/PUT /stock_journals/1.json
def update
respond_to do |format|
if @stock_journal.update(stock_journal_params)
format.html { redirect_to @stock_journal, notice: 'Stock journal was successfully updated.' }
format.json { render :show, status: :ok, location: @stock_journal }
else
format.html { render :edit }
format.json { render json: @stock_journal.errors, status: :unprocessable_entity }
end
end
end
# DELETE /stock_journals/1
# DELETE /stock_journals/1.json
def destroy
@stock_journal.destroy
respond_to do |format|
format.html { redirect_to stock_journals_url, notice: 'Stock journal was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_stock_journal
@stock_journal = StockJournal.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def stock_journal_params
params.fetch(:stock_journal, {})
end
end

View File

@@ -0,0 +1,126 @@
class Oqs::HomeController < BaseOqsController
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
@queue_completed_item = completed_order
@queue_stations_items=Array.new
# Calculate Count for each station tab
queue_stations.each do |que|
i = 0
zone_id = 0
@queue_items_details.each do |qid|
dining = DiningFacility.find_by_name(qid.zone)
que.order_queue_process_by_zones.each do |qz|
if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
zone_id = qid.zone_id
i=i+1
end
end
end
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
end
# @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
@queue_stations_items
end
# Get Order items
def get_order_items
items = []
table_name = params[:table_id]
status = params[:status]
dining = DiningFacility.find_by_name(table_name);
# oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
# if status == ""
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
# oi = OrderItem.find_by_item_code(aoi.item_code)
# items.push(oi)
# end
# else
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
# oi = OrderItem.find_by_item_code(aoi.item_code)
# items.push(oi)
# end
# end
booking = Booking.find_by_dining_facility_id(dining.id)
BookingOrder.where("booking_id='#{ booking.booking_id }'").find_each do |bo|
order=Order.find(bo.order_id)
order.order_items.each do |oi|
items.push(oi)
end
end
# booking_id = dining.get_new_booking
# BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
# order=Order.find(bo.order_id);
# order.order_items.each do |oi|
# items.push(oi)
# end
# end
render :json => items.to_json
end
def show
end
# update delivery status when complete click
def update_delivery_status
removed_item = []
assigned_item_id = params[:id]
assigned_item=AssignedOrderItem.find(assigned_item_id)
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
# update delivery status for completed same order items
assigned_items.each do |ai|
ai.delivery_status=true
ai.save
removed_item.push(ai.assigned_order_item_id)
end
render :json => removed_item.to_json
end
# Query for OQS with delivery status
def queue_items_query(status)
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 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")
.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
left join order_items as odt ON odt.item_code = assigned_order_items.item_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 = 0 AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
.group("assigned_order_items.assigned_order_item_id")
.order("assigned_order_items.created_at")
end
# Completed Order
def completed_order
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")
.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
left join order_items as odt ON odt.item_code = assigned_order_items.item_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 = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
.group("assigned_order_items.order_id")
.limit(20)
.order("assigned_order_items.created_at")
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
end
end

View File

@@ -1,33 +1,44 @@
class Oqs::HomeController < BaseOqsController
def index
queue_stations=OrderQueueStation.all
@queue_stations = OrderQueueStation.all
# Query for OQS with delivery status false
@queue_items_details = queue_items_query(false)
# @queue_items_details = queue_items_query(false)
# Query for OQS with delivery status true
@queue_completed_item = completed_order
@queue_stations_items=Array.new
@filter = params[:filter]
@queue_completed_item = completed_order(@filter)
if !@filter.nil?
@count = queue_items_count_query(false,@filter)
@count.each do |count|
# Calculate Count for each station tab
queue_stations.each do |que|
i = 0
zone_id = 0
@queue_items_details.each do |qid|
dining = DiningFacility.find_by_name(qid.zone)
que.order_queue_process_by_zones.each do |qz|
if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
zone_id = qid.zone_id
i=i+1
end
end
end
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
end
# @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
@queue_stations_items
# @queue_stations_items=Array.new
# Calculate Count for each station tab
# @queue_stations.each do |que|
# i = 0
# zone_id = 0
# @queue_items_details.each do |qid|
# dining = DiningFacility.find_by_name(qid.zone)
# que.order_queue_process_by_zones.each do |qz|
# if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
# zone_id = qid.zone_id
# i=i+1
# end
# end
# end
# @queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
# end
# # @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
# @queue_stations_items
end
# Get Order items
@@ -68,6 +79,13 @@ class Oqs::HomeController < BaseOqsController
render :json => items.to_json
end
def get_items_by_oqs
oqs_id = params[:id]
filter = params[:filter]
items = queue_items_query(false,oqs_id,filter)
render :json => items.to_json
end
def show
end
@@ -87,9 +105,22 @@ class Oqs::HomeController < BaseOqsController
render :json => removed_item.to_json
end
# Query for OQS with delivery status
def queue_items_query(status)
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")
def queue_items_query(status,oqs_id=nil,filter)
if oqs_id == nil
oqs = ''
else
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
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,
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
@@ -98,14 +129,15 @@ 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 odt.price <> 0")
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} ")
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
.group("assigned_order_items.assigned_order_item_id")
.order("assigned_order_items.created_at")
end
# Completed Order
def completed_order
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")
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")
.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
@@ -115,12 +147,28 @@ class Oqs::HomeController < BaseOqsController
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 = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
.group("assigned_order_items.order_id")
.limit(20)
.order("assigned_order_items.created_at")
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
.group("assigned_order_items.order_id")
.limit(20)
.order("assigned_order_items.created_at")
# 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_code = assigned_order_items.item_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 odt.price <> 0 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
end

View File

@@ -0,0 +1,142 @@
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')
end
def detail
@menu = MenuCategory.all
@table_id = params[:id]
@table = DiningFacility.find(@table_id)
@booking = @table.get_booking
if @booking
@booking_id = @booking.booking_id
@order_items = Array.new
@booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if (order.status == "new")
@obj_order = order
@customer = order.customer
@date = order.created_at
order.order_items.each do |item|
@order_items.push(item)
end
end
end
else
@booking = nil
end
end
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]
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"]}
items_arr.push(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 = items_arr
@order.guest = params[:guest_info]
@order.table_id = params[:table_id] # this is dining facilities's id
@order.new_booking = true
@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)
# 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
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
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")
end
end
@status, @booking = @order.generate
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
}.to_json
end
def check_order_with_table(table_id)
table = DiningFacility.find(table_id)
if table
booking = table.get_current_booking
# puts booking
if booking
if !booking.sale_id.nil?
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return false
end
else
@order.new_booking = false
@order.booking_id = booking.booking_id
return false
end
end
end
end
# this can always true
def check_order_with_booking(booking)
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return false
else
@order.new_booking = false
@order.booking_id = params[:booking_id]
return false
end
end
private
# def set_dining
# @dining = DiningFacility.find(params[:id])
# end
end

View File

@@ -8,6 +8,44 @@ class Origami::CustomersController < BaseOrigamiController
def show
end
def get_customer
filter = params[:filter]
type = params[:type]
if filter.nil?
@crm_customers = Customer.order("customer_id").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else
@crm_customers = Customer.search(filter)
# search account no from paypar
if !@crm_customers.present? && type == "card"
response = Customer.search_paypar_account_no(filter)
if response["status"] == true
@crm_customers = Customer.new
@crm_customers.name = response["customer_data"]["name"]
@crm_customers.contact_no = response["customer_data"]["phone"]
@crm_customers.email = response["customer_data"]["email"]
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
@crm_customers.nrc_no = response["customer_data"]["NRC"]
@crm_customers.address = response["customer_data"]["address"]
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
@crm_customers.paypar_account_no = filter
@crm_customers.membership_id = response["customer_data"]["id"]
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save
@crm_customers = Customer.search(filter)
else
@crm_customers = [{"customer_id": response["status"],"message": response["message"] }]
end
end
end
render :json => @crm_customers.to_json
end
def add_customer
@sale_id = params[:sale_id]
@@ -18,9 +56,7 @@ class Origami::CustomersController < BaseOrigamiController
@booking_order = BookingOrder.find_by_order_id(@sale_id)
@booking = Booking.find(@booking_order.booking_id)
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
end
filter = params[:filter]
end
filter = params[:filter]
@@ -28,14 +64,14 @@ class Origami::CustomersController < BaseOrigamiController
@crm_customers = Customer.order("customer_id").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else
@crm_customers = Customer.search(filter)
@crm_customers = Customer.search(filter)
end
#@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new
@count_customer = Customer.count_customer
@taxes = TaxProfile.all.order("order_by asc")
# if flash["errors"]
# @crm_customer.valid?
# end
@@ -51,21 +87,22 @@ class Origami::CustomersController < BaseOrigamiController
id = params[:sale_id][0,3]
customer_id = params[:customer_id]
customer = Customer.find(customer_id)
# Check and find with card no
if(!customer_id.include? "CUS")
customer = Customer.find_by_paypar_account_no(customer_id)
if(customer != nil)
customer_id = customer.customer_id
end
end
# if(!customer_id.include? "CUS")
# customer = Customer.find_by_paypar_account_no(customer_id)
# if(customer != nil)
# customer_id = customer.customer_id
# end
# end
if(id == "SAL")
sale = Sale.find(params[:sale_id])
status = sale.update_attributes(customer_id: customer_id)
sale.sale_orders.each do |sale_order|
order = Order.find(sale_order.order_id)
status = order.update_attributes(customer_id: customer_id)
status = order.update_attributes(customer_id: customer_id,order_type:customer.customer_type)
end
else
@booking = BookingOrder.find_by_order_id(params[:sale_id])
@@ -73,13 +110,15 @@ class Origami::CustomersController < BaseOrigamiController
@orders.each do |bo|
order = Order.find(bo.order_id)
status = order.update_attributes(customer_id: customer_id)
status = order.update_attributes(customer_id: customer_id,order_type:customer.customer_type)
end
end
if status == true
render json: JSON.generate({:status => true})
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount)
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end

View File

@@ -155,31 +155,35 @@ class Origami::DiscountsController < BaseOrigamiController
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
# Control for Paypar Cloud
begin
response = HTTParty.post(url,
:body => { account_no: nil,
generic_customer_id:generic_customer_id ,
campaign_type_id: campaign_type_id,
receipt_no: receipt_no,
merchant_uid:merchant_uid,
campaign_method:arr.to_json,
total_sale_transaction_amount: sale.grand_total,
auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}, :timeout => 10)
rescue HTTParty::Error
response = {:status=> false, :message => "Can't open membership server " }
# Check for items for Paypar Cloud
if arr.length > 0
begin
response = HTTParty.post(url,
:body => { account_no: nil,
generic_customer_id:generic_customer_id ,
campaign_type_id: campaign_type_id,
receipt_no: receipt_no,
merchant_uid:merchant_uid,
campaign_method:arr.to_json,
total_sale_transaction_amount: sale.grand_total,
auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}, :timeout => 10)
rescue HTTParty::Error
response = {:status=> false, :message => "Can't open membership server " }
rescue Net::OpenTimeout
response = {:status=> false, :message => "Can't open membership server " }
rescue OpenURI::HTTPError
response = {:status=> false, :message => "Can't open membership server " }
rescue Net::OpenTimeout
response = {:status=> false, :message => "Can't open membership server " }
rescue OpenURI::HTTPError
response = {:status=> false, :message => "Can't open membership server " }
rescue SocketError
response = {:status=> false, :message => "Can't open membership server " }
rescue SocketError
response = {:status=> false, :message => "Can't open membership server " }
end
else
response = {:status=> false, :message => "You have no selected discount item" }
end
table_id = sale.bookings[0].dining_facility_id

View File

@@ -2,10 +2,12 @@ class Origami::HomeController < BaseOrigamiController
before_action :set_dining, only: [:show]
def index
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
@orders = Order.all.order('date desc')
@shop = Shop.find_by_id(1)
# @shift = ShiftSale.current_open_shift(current_user.id)
end
@@ -15,6 +17,7 @@ class Origami::HomeController < BaseOrigamiController
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
@status_order = ""
@status_sale = ""
@sale_array = Array.new
@@ -37,7 +40,6 @@ class Origami::HomeController < BaseOrigamiController
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" && sale.sale_status != 'void'
puts "enter"
@sale_array.push(sale)
if @status_order == 'order'
@status_order = 'sale'

View File

@@ -0,0 +1,172 @@
class Origami::InJutiesController < BaseOrigamiController
before_action :set_in_juty, only: %i[show edit update edit_in_juty update_for_in_juty destroy destroy_in_juty]
# GET /in_juties
# GET /in_juties.json
def index
@in_juties = InJuty.all
end
def index_in_juty
@juty_in = InJuty.where('dinning_id=?', params[:table_id])
@table = DiningFacility.find(params[:table_id])
@in_juty = InJuty.new
@juties_in = Kaminari.paginate_array(@juty_in).page(params[:page]).per(10)
end
# GET /in_juties/1
# GET /in_juties/1.json
def show
end
# GET /in_juties/new
def new
# this one use for new
@in_juty = InJuty.new
@table = DiningFacility.find(params[:table_id])
@commissioner = @in_juty.commissioner
render partial: 'form'
end
# GET /in_juties/1/edit
def edit
end
def edit_in_juty
@in_juty = InJuty.find(params[:id])
@table = DiningFacility.find(params[:table_id])
@commissioner = @in_juty.commissioner
# render json: {in_juty: @in_juty, commissioner: @commissioner}
render partial: 'form'
end
def assign_in_juty
@in_juty = InJuty.new
@table = DiningFacility.find(params[:table_id])
end
# POST /in_juties
# POST /in_juties.json
def create
@in_juty = InJuty.new(in_juty_params)
respond_to do |format|
if @in_juty.save
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully created.' }
format.json { render :show, status: :created, location: @in_juty }
else
format.html { render :new }
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
end
end
end
def create_for_in_juty
# this one use for create and update
in_juty = in_juty_params
in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i
in_time = in_time.change(offset: '+06:30')
out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i
out_time = out_time.change(offset: '+06:30')
@in_juty = InJuty.new
in_juty_id = in_juty[:id]
unless in_juty_id.nil?
@in_juty = InJuty.find(in_juty_id.to_i)
end
@in_juty.dinning_id = in_juty_params[:dinning_id]
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
@in_juty.in_time = in_time
@in_juty.out_time = out_time
respond_to do |format|
if @in_juty.save
if in_juty_id.nil?
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully created.' }
format.json { render :show, status: :created, location: @in_juty }
else
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' }
format.json { render :show, status: :created, location: @in_juty }
end
else
format.html { render :new }
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /in_juties/1
# PATCH/PUT /in_juties/1.json
def update
in_juty = in_juty_params
in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i
in_time = in_time.change(offset: '+06:30')
out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i
out_time = out_time.change(offset: '+06:30')
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
@in_juty.in_time = in_time
@in_juty.out_time = out_time
respond_to do |format|
if @in_juty.save
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' }
format.json { render :show, status: :ok, location: @in_juty }
else
format.html { render :edit }
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
end
end
end
def update_for_in_juty
in_juty = in_juty_params
in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i
in_time = in_time.change(offset: '+06:30')
out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i
out_time = out_time.change(offset: '+06:30')
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
@in_juty.in_time = in_time
@in_juty.out_time = out_time
respond_to do |format|
if @in_juty.save
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' }
format.json { render :show, status: :ok, location: @in_juty }
else
format.html { render :edit }
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
end
end
end
# DELETE /in_juties/1
# DELETE /in_juties/1.json
def destroy
@in_juty.destroy
respond_to do |format|
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully removed.' }
format.json { head :no_content }
end
end
def destroy_in_juty
@table_id = params[:table_id]
@in_juty.destroy
respond_to do |format|
format.html { redirect_to origami_index_in_juty_path(@table_id), notice: 'In juty was successfully removed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_in_juty
@in_juty = InJuty.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def in_juty_params
params.require(:in_juty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time)
end
end

View File

@@ -163,10 +163,46 @@ class Origami::PaymentsController < BaseOrigamiController
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
end
def foc
cash = params[:cash]
sale_id = params[:sale_id]
sub_total = params[:sub_total]
member_info = nil
rebate_amount = nil
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "foc")
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
#shop detail
shop_details = Shop.find(1)
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
end
end
def rounding_adj
saleObj = Sale.find(params[:sale_id])
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@shop = Shop.find_by_id(1)
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
else
new_total = saleObj.grand_total
end
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)

View File

@@ -0,0 +1,119 @@
class Origami::ProductCommissionsController < ApplicationController
before_action :set_product_commission, only: [:show, :edit, :update, :destroy]
# GET /product_commissions
# GET /product_commissions.json
def index
@product_commissions = ProductCommission.all
end
# GET /product_commissions/1
# GET /product_commissions/1.json
def show
end
# GET /product_commissions/new
def new
@product_commission = ProductCommission.new
end
# GET /product_commissions/1/edit
def edit
end
# POST /product_commissions
# POST /product_commissions.json
def create
@product_commission = ProductCommission.new(product_commission_params)
respond_to do |format|
if @product_commission.save
format.html {redirect_to @product_commission, notice: 'Product commission was successfully created.'}
format.json {render :show, status: :created, location: @product_commission}
else
format.html {render :new}
format.json {render json: @product_commission.errors, status: :unprocessable_entity}
end
end
end
# PATCH/PUT /product_commissions/1
# PATCH/PUT /product_commissions/1.json
def update
respond_to do |format|
if @product_commission.update(product_commission_params)
format.html {redirect_to @product_commission, notice: 'Product commission was successfully updated.'}
format.json {render :show, status: :ok, location: @product_commission}
else
format.html {render :edit}
format.json {render json: @product_commission.errors, status: :unprocessable_entity}
end
end
end
# DELETE /product_commissions/1
# DELETE /product_commissions/1.json
def destroy
@product_commission.destroy
respond_to do |format|
format.html {redirect_to product_commissions_url, notice: 'Product commission was successfully destroyed.'}
format.json {head :no_content}
end
end
def set_commissioner_to_sale_item
# byebug
deselect = false
sale_item_id = params[:sale_item_id]
commissioner_id = params[:commissioner_id]
@sale_item = SaleItem.find(sale_item_id)
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
@commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.id, true).take
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
if !@product_commission.nil?
if @product_commission.commissioner_id == @commissioner.id
@product_commission.destroy
deselect = true
else
@product_commission.commissioner_id = @commissioner.id
deselect = false
end
else
@product_commission = ProductCommission.new
@product_commission.product_code = @menu_item.id
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
unless @commission.nil?
@product_commission.commission_id = @commission.id
if @commission.commission_type == 'Percentage'
@product_commission.price = @sale_item.unit_price * (@commission.amount / 100.0)
@product_commission.amount = @product_commission.price * @sale_item.qty
elsif @commission.commission_type == 'Net Amount'
@product_commission.price = @commission.amount
@product_commission.amount = @product_commission.price * @sale_item.qty
end
end
@product_commission.commissioner_id = @commissioner.id
@product_commission.qty = @sale_item.qty
@product_commission.sale_id = @sale_item.sale_id
@product_commission.sale_item_id = @sale_item.sale_item_id
end
if @product_commission.save
render json: {status: true, deselect: deselect}
else
render json: {status: false, deselect: deselect}
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_product_commission
@product_commission = ProductCommission.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def product_commission_params
params.fetch(:product_commission, {})
end
end

View File

@@ -5,7 +5,7 @@ class Origami::RequestBillsController < BaseOrigamiController
@sale = Sale.new
sale_order=SaleOrder.new
if ShiftSale.current_open_shift(current_user.id)
if shift = ShiftSale.current_open_shift(current_user.id)
order_id = params[:id] # order_id
bk_order = BookingOrder.find_by_order_id(order_id)
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
@@ -20,6 +20,10 @@ class Origami::RequestBillsController < BaseOrigamiController
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
end
# Bind shift sale id to sale
@sale_data.shift_sale_id = shift.id
@sale_data.save
else
@status = false
@error_message = "No Current Open Shift for This Employee"

View File

@@ -1,36 +1,80 @@
class Origami::RoomsController < BaseOrigamiController
def index
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id)
end
def show
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
@room = DiningFacility.find(params[:room_id])
@status_order = ""
@status_sale = ""
@sale_array = Array.new
@room.bookings.each do |booking|
if booking.sale_id.nil?
@room.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
@obj = order
@customer = order.customer
order.order_items.each do |item|
@order_items.push(item)
if (order.status == "new")
@obj_order = order
@customer = order.customer
@date = order.created_at
order.order_items.each do |item|
@order_items.push(item)
end
end
end
@status = 'order'
@status_order = 'order'
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed"
@sale_array.push(sale)
@status = 'sale'
@obj = sale
if sale.sale_status != "completed" && sale.sale_status != 'void'
puts "enter"
@sale_array.push(sale)
if @status_order == 'order'
@status_order = 'sale'
end
@date = sale.created_at
@status_sale = 'sale'
@obj_sale = sale
@customer = sale.customer
end
end
end
end
# @room.bookings.each do |booking|
# if booking.sale_id.nil?
# @order_items = Array.new
# booking.booking_orders.each do |booking_order|
# order = Order.find(booking_order.order_id)
# @obj = order
# @customer = order.customer
# order.order_items.each do |item|
# @order_items.push(item)
# end
# end
# @status = 'order'
# else
# sale = Sale.find(booking.sale_id)
# if sale.sale_status != "completed"
# @sale_array.push(sale)
# @status = 'sale'
# @obj = sale
# @customer = sale.customer
# end
# end
# end
end

View File

@@ -1,31 +1,50 @@
class Origami::SaleEditController < BaseOrigamiController
authorize_resource :class => false
# Index for sale item void OR edit
def edit
sale_id = params[:sale_id]
@table_id = params[:table_id]
@saleobj = Sale.find(sale_id)
end
# Index for sale item void OR edit
def edit
sale_id = params[:sale_id]
@table_id = params[:table_id]
@saleobj = Sale.find(sale_id)
end
# create item void. make duplicate old record and update qty and price
def item_void
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.remark = 'void'
saleitemObj.save
@newsaleitem = SaleItem.new
@newsaleitem = saleitemObj.dup
@newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 1
@newsaleitem.product_name = saleitemObj.product_name + " - void"
@newsaleitem.save
# create item void. make duplicate old record and update qty and price
def item_void
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.remark = 'void'
saleitemObj.save
@newsaleitem = SaleItem.new
@newsaleitem = saleitemObj.dup
@newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 1
@newsaleitem.product_name = saleitemObj.product_name + " - void"
@newsaleitem.save
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
def item_foc
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.remark = 'foc'
saleitemObj.save
@newsaleitem = SaleItem.new
@newsaleitem = saleitemObj.dup
@newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 1
@newsaleitem.product_name = saleitemObj.product_name + ' foc'
@newsaleitem.save
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# def item_edit
# saleitemId = params[:sale_item_id]
@@ -48,63 +67,63 @@ class Origami::SaleEditController < BaseOrigamiController
# end
def item_edit
saleitemId = params[:sale_item_id]
update_qty = params[:update_qty]
saleitemId = params[:sale_item_id]
update_qty = params[:update_qty]
update_price = params[:update_price]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.qty = update_qty
saleitemObj.price = update_qty.to_f * update_price.to_f
saleitemObj.unit_price = update_price
saleitemObj.qty = update_qty
saleitemObj.price = update_qty.to_f * update_price.to_f
saleitemObj.unit_price = update_price
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
# saleitemObj.remark = 'edit'
saleitemObj.product_name = saleitemObj.product_name + " - updated"
saleitemObj.product_name = saleitemObj.product_name + " - updated"
saleitemObj.save
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# make cancel void item
def item_void_cancel
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
both = SaleItem.where('product_code=?',saleitemObj.product_code)
both.each do |item|
if item.qty.to_i > 0
item.remark = nil
item.save
end
end
saleitemObj.destroy
# make cancel void item
def item_void_cancel
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
both = SaleItem.where('product_code=?', saleitemObj.product_code)
both.each do |item|
if item.qty.to_i > 0
item.remark = nil
item.save
end
end
saleitemObj.destroy
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# remove all void items
def cancel_all_void
sale_id = params[:sale_id]
saleobj = Sale.find(sale_id)
saleobj.sale_items.each do |item|
if item.qty.to_i < 0
item.destroy
else
item.remark = nil
end
item.save
end
# remove all void items
def cancel_all_void
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.sale_items.each do |item|
if item.qty.to_i < 0
item.destroy
else
item.remark = nil
end
item.save
end
# re-calc tax
saleObj.compute_without_void
end
# re-calc tax
saleObj.compute_without_void
end
def apply_void
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.compute_without_void
end
def apply_void
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.compute_without_void
end
end

View File

@@ -31,15 +31,21 @@ class Origami::ShiftsController < BaseOrigamiController
unique_code = "CloseCashierPdf"
shop_details = Shop.find(1)
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
# Calculate price_by_accounts
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes)
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
end
@@ -52,6 +58,21 @@ class Origami::ShiftsController < BaseOrigamiController
def sale_summary
@shift = ShiftSale.current_open_shift(current_user.id)
# @shift = ShiftSale.find_by_id(shift_id)
if @shift
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
# Calculate price_by_accounts
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
end
end

View File

@@ -6,18 +6,19 @@ class Origami::VoidController < BaseOrigamiController
if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id)
sale.payment_status = 'void'
sale.sale_status = 'void'
sale.save
# update count for shift sale
if(sale.sale_status == "void")
if(sale.sale_status == "completed")
if sale.shift_sale_id != nil
shift = ShiftSale.find(sale.shift_sale_id)
shift.calculate(sale_id, "void")
end
end
sale.payment_status = 'void'
sale.sale_status = 'void'
sale.save
bookings = sale.bookings
bookings.each do |booking|
orders = booking.orders

View File

@@ -0,0 +1,73 @@
class Origami::VoucherController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
# limit voucher_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
@vouchercount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "voucher"
@vouchercount = @vouchercount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_voucher = total - @vouchercount - others
end
def create
cash = params[:amount]
sale_id = params[:sale_id]
voucher_no = params[:refnumber]
if(Sale.exists?(sale_id))
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
if customer_data
membership_id = customer_data.membership_id
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance") #need to modify here
if member_actions.gateway_url
campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
merchant_uid= member_actions.merchant_account_id
auth_token = member_actions.auth_token.to_s
# membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
# if membership_data["status"]==true
# app_token: token,membership_id:membership_id,
# campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
# auth_token:auth_token
begin
response = HTTParty.get(url,
:body => { voucher_no: voucher_no,membership_id:membership_id
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}, :timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError
response = { status: false}
end
# end
end
end
end
if( response["status"]==true )
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "voucher")
end
end
end
end

View File

@@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def print_setting_params
params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
end
end

View File

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

View File

@@ -0,0 +1,61 @@
class Reports::CreditPaymentController < BaseReportController
authorize_resource :class => false
def index
from, to = get_date_range_from_params
@shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@shift = ''
if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@sale_data = Sale.get_by_shift_sale_credit_payment(@shift_sale_range,@shift,from,to)
@from = from
@to = to
if @shift.present?
@shift.each do |sh|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_data = sh
end
end
respond_to do |format|
format.html
format.xls
end
end
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
shift_id = sale.id.nil? ? '-' : sale.id
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
date_arr.push(str)
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end

View File

@@ -19,7 +19,7 @@ authorize_resource :class => false
end
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@from = from
@to = to

View File

@@ -0,0 +1,60 @@
class Reports::VoidSaleController < BaseReportController
authorize_resource :class => false
def index
from, to = get_date_range_from_params
# @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@shift = ''
if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@sale_data = Sale.get_void_sale(@shift,from,to)
@from = from
@to = to
if @shift.present?
@shift.each do |sh|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_data = sh
end
end
respond_to do |format|
format.html
format.xls
end
end
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
shift_id = sale.id.nil? ? '-' : sale.id
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
date_arr.push(str)
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end

View File

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

View File

@@ -0,0 +1,102 @@
class Settings::CommissionsController < ApplicationController
before_action :set_commission, only: [:show, :edit, :update, :destroy]
# GET /commissions
# GET /commissions.json
def index
@commissions = Commission.all
end
# GET /commissions/1
# GET /commissions/1.json
def show
end
# GET /commissions/new
def new
@commission = Commission.new
@products = MenuItem.all
end
# GET /commissions/1/edit
def edit
@products = MenuItem.all
end
# POST /commissions
# POST /commissions.json
def create
@commission = Commission.new(commission_params)
@commission.product_type = 'menu_item'
respond_to do |format|
if @commission.save
format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully created.'}
format.json {render :show, status: :created, location: @commission}
else
format.html {render :new}
format.json {render json: @commission.errors, status: :unprocessable_entity}
end
end
end
# PATCH/PUT /commissions/1
# PATCH/PUT /commissions/1.json
def update
respond_to do |format|
if @commission.update(commission_params)
format.html {redirect_to settings_commission_path(@commission), notice: 'Commission was successfully updated.'}
format.json {render :show, status: :ok, location: @commission}
else
format.html {render :edit}
format.json {render json: @commission.errors, status: :unprocessable_entity}
end
end
end
# DELETE /commissions/1
# DELETE /commissions/1.json
def destroy
@commission.destroy
respond_to do |format|
format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully destroyed.'}
format.json {head :no_content}
end
end
def load_commissioners
sale_id = params[:sale_id]
@table_id = params[:table_id]
@saleobj = Sale.find(sale_id)
@commissioners = []
end
def select_sale_item
# byebug
sale_item_id = params[:sale_item_id]
@selected_sale_item = SaleItem.find_by_sale_item_id(sale_item_id)
@product_commission = ProductCommission.find_by_sale_item_id(@selected_sale_item.id)
unless @product_commission.nil?
selected_commissioner = @product_commission.commissioner
end
@commissioners = Commissioner.active.all
# respond_to do |format|
# format.json {render json: {[@commissioners],[@selected_sale_item]}}
# # format.html {render @commissioners}
# end
render json: {commissioner: @commissioners, selected_commissioner: selected_commissioner}
end
private
# Use callbacks to share common setup or constraints between actions.
def set_commission
@commission = Commission.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def commission_params
params.require(:commission).permit(:product_type, :product_code, :amount, :commission_type, :is_active)
end
end

View File

@@ -0,0 +1,106 @@
class Settings::DiningChargesController < ApplicationController
before_action :set_dining_charge, only: [:show, :edit, :update, :destroy]
before_action :set_settings_facility
before_action :set_settings_zone
# GET /dining_charges
# GET /dining_charges.json
def index
@dining_charges = DiningCharge.all
end
# GET /dining_charges/1
# GET /dining_charges/1.json
def show
end
# GET /dining_charges/new
def new
@dining_charge = DiningCharge.new
@dining_charge.minimum_free_time="00:30"
@dining_charge.charge_block="02:00"
@dining_charge.time_rounding_block="00:15"
end
# GET /dining_charges/1/edit
def edit
end
# POST /dining_charges
# POST /dining_charges.json
def create
@dining_charge = DiningCharge.new(dining_charge_params)
@dining_charge.dining_facility_id = @settings_dining_facility.id
respond_to do |format|
if @dining_charge.save
if @table
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
else
format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
end
format.json { render :show, status: :created, location: @dining_charge }
else
format.html { render :new }
format.json { render json: @dining_charge.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /dining_charges/1
# PATCH/PUT /dining_charges/1.json
def update
respond_to do |format|
@dining_charge.dining_facility_id = @settings_dining_facility.id
if @dining_charge.update(dining_charge_params)
# @dining_charge.minimum_free_time = @dining_charge.minimum_free_time.to_datetime.advance(hours: +6, minutes: +30)
# @dining_charge.charge_block = @dining_charge.charge_block.to_datetime.advance(hours: +6, minutes: +30)
# @dining_charge.time_rounding_block = @dining_charge.time_rounding_block.to_datetime.advance(hours: +6, minutes: +30)
# @dining_charge.save
if @table
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
else
format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
end
format.json { render :show, status: :ok, location: @dining_charge }
else
format.html { render :edit }
format.json { render json: @dining_charge.errors, status: :unprocessable_entity }
end
end
end
# DELETE /dining_charges/1
# DELETE /dining_charges/1.json
def destroy
@dining_charge.destroy
respond_to do |format|
format.html { redirect_to dining_charges_url, notice: 'Dining charge was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_dining_charge
@dining_charge = DiningCharge.find(params[:id])
end
def set_settings_facility
if params[:table_id]
@table = true
@settings_dining_facility = Table.find(params[:table_id])
elsif params[:room_id]
@room = true
@settings_dining_facility = Room.find(params[:room_id])
end
end
def set_settings_zone
@zone = Zone.find(params[:zone_id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def dining_charge_params
# params.fetch(:dining_charge, {})
params.require(:dining_charge).permit(:item_code, :unit_price, :taxable, :charge_type,:minimum_free_time ,:charge_block,:time_rounding,:time_rounding_block, :zone_id, :time_rounding_block_price)
end
end

View File

@@ -0,0 +1,74 @@
class Settings::ItemSetsController < ApplicationController
before_action :set_settings_item_set, only: [:show, :edit, :update, :destroy]
load_and_authorize_resource except: [:create]
# GET /settings/item_sets
# GET /settings/item_sets.json
def index
@settings_item_sets = ItemSet.all
end
# GET /settings/item_sets/1
# GET /settings/item_sets/1.json
def show
end
# GET /settings/item_sets/new
def new
@settings_item_set = ItemSet.new
end
# GET /settings/item_sets/1/edit
def edit
end
# POST /settings/item_sets
# POST /settings/item_sets.json
def create
@settings_item_set = ItemSet.new(settings_item_set_params)
respond_to do |format|
if @settings_item_set.save
format.html { redirect_to settings_item_sets_path, notice: 'Item set was successfully created.' }
format.json { render :show, status: :created, location: @settings_item_set }
else
format.html { render :new }
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/item_sets/1
# PATCH/PUT /settings/item_sets/1.json
def update
respond_to do |format|
if @settings_item_set.update(settings_item_set_params)
format.html { redirect_to settings_item_sets_path, notice: 'Item set was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_item_set }
else
format.html { render :edit }
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/item_sets/1
# DELETE /settings/item_sets/1.json
def destroy
@settings_item_set.destroy
respond_to do |format|
format.html { redirect_to settings_item_sets_url, notice: 'Item set was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_settings_item_set
@settings_item_set = ItemSet.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_item_set_params
params.require(:item_set).permit(:name, :alt_name, :min_selectable_qty, :max_selectable_qty)
end
end

View File

@@ -28,11 +28,11 @@ class Settings::LookupsController < ApplicationController
respond_to do |format|
if @settings_lookup.save
format.html { redirect_to @settings_lookup, notice: 'Lookup was successfully created.' }
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully created.' }
format.json { render :show, status: :created, location: @settings_lookup }
else
format.html { render :new }
format.json { render json: @settings_lookup.errors, status: :unprocessable_entity }
format.json { render json: settings_lookups_path.errors, status: :unprocessable_entity }
end
end
end
@@ -42,11 +42,11 @@ class Settings::LookupsController < ApplicationController
def update
respond_to do |format|
if @settings_lookup.update(settings_lookup_params)
format.html { redirect_to @settings_lookup, notice: 'Lookup was successfully updated.' }
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_lookup }
else
format.html { render :edit }
format.json { render json: @settings_lookup.errors, status: :unprocessable_entity }
format.json { render json: settings_lookups_path.errors, status: :unprocessable_entity }
end
end
end
@@ -56,7 +56,7 @@ class Settings::LookupsController < ApplicationController
def destroy
@settings_lookup.destroy
respond_to do |format|
format.html { redirect_to settings_lookups_url, notice: 'Lookup was successfully destroyed.' }
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully destroyed.' }
format.json { head :no_content }
end
end

View File

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

View File

@@ -21,12 +21,20 @@ class Settings::MenuItemInstancesController < ApplicationController
id = MenuItemInstance.findParentCategory(@item)
@category = MenuCategory.find(id)
@settings_menu_item_instances = MenuItemInstance.new
@item_sets = ItemSet.all
end
def get_instance
@id = MenuItemInstance.find(params[:id])
puts "iddddddddd"
puts @id.to_json
end
# GET /settings/menu_item_instances/1/edit
def edit
id = MenuItemInstance.findParentCategory(@item)
@category = MenuCategory.find(id)
@item_sets = ItemSet.all
end
# POST /settings/menu_item_instances
@@ -45,6 +53,18 @@ class Settings::MenuItemInstancesController < ApplicationController
id = MenuItemInstance.findParentCategory(catID)
category = MenuCategory.find(id)
# Bind for Item Sets
if params[:menu_item_instance][:item_sets].count > 1
params[:menu_item_instance][:item_sets].delete_at(0)
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
if sets.count > 0
@settings_menu_item_instances.item_sets = sets
end
end
respond_to do |format|
if @settings_menu_item_instances.save
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
@@ -70,6 +90,18 @@ class Settings::MenuItemInstancesController < ApplicationController
id = MenuItemInstance.findParentCategory(catID)
category = MenuCategory.find(id)
# Bind for Item Sets
if params[:menu_item_instance][:item_sets].count > 1
params[:menu_item_instance][:item_sets].delete_at(0)
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
if sets.count > 0
@settings_menu_item_instances.item_sets = sets
end
end
respond_to do |format|
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
@@ -122,8 +154,6 @@ class Settings::MenuItemInstancesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_instance_params
params.require(:menu_item_instance).permit(:item_instance_code, :item_instance_name, :price, :item_attributes, :is_on_promotion, :promotion_price, :is_available,:menu_category_id,:menu_item_id)
params.require(:menu_item_instance).permit(:item_instance_code, :item_instance_name, :price, :item_attributes, :is_on_promotion, :promotion_price, :is_available,:menu_category_id,:menu_item_id, :is_default, :item_sets)
end
end

View File

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

View File

@@ -0,0 +1,74 @@
class Settings::MenuItemSetsController < ApplicationController
before_action :set_settings_menu_item_set, only: [:show, :edit, :update, :destroy]
load_and_authorize_resource except: [:create]
# GET /settings/menu_item_sets
# GET /settings/menu_item_sets.json
def index
@settings_menu_item_sets = MenuItemSet.all
end
# GET /settings/menu_item_sets/1
# GET /settings/menu_item_sets/1.json
def show
end
# GET /settings/menu_item_sets/new
def new
@settings_menu_item_set = MenuItemSet.new
end
# GET /settings/menu_item_sets/1/edit
def edit
end
# POST /settings/menu_item_sets
# POST /settings/menu_item_sets.json
def create
@settings_menu_item_set = MenuItemSet.new(settings_menu_item_set_params)
respond_to do |format|
if @settings_menu_item_set.save
format.html { redirect_to settings_menu_item_sets_path, notice: 'Menu item set was successfully created.' }
format.json { render :show, status: :created, location: @settings_menu_item_set }
else
format.html { render :new }
format.json { render json: @settings_menu_item_set.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/menu_item_sets/1
# PATCH/PUT /settings/menu_item_sets/1.json
def update
respond_to do |format|
if @settings_menu_item_set.update(settings_menu_item_set_params)
format.html { redirect_to settings_menu_item_sets_path, notice: 'Menu item set was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_menu_item_set }
else
format.html { render :edit }
format.json { render json: @settings_menu_item_set.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/menu_item_sets/1
# DELETE /settings/menu_item_sets/1.json
def destroy
@settings_menu_item_set.destroy
respond_to do |format|
format.html { redirect_to settings_menu_item_sets_url, notice: 'Menu item set was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_settings_menu_item_set
@settings_menu_item_set = MenuItemSet.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_set_params
params.require(:menu_item_set).permit(:item_set_id, :menu_item_id)
end
end

View File

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

View File

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

View File

@@ -0,0 +1,101 @@
class Settings::PromotionsController < ApplicationController
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
# GET /promotions
# GET /promotions.json
def index
@promotions = Promotion.all.order("created_at asc")
end
# GET /promotions/1
# GET /promotions/1.json
def show
end
# GET /promotions/new
def new
@promotion = Promotion.new
@promotion.promo_start_date = DateTime.now
@promotion.promo_end_date = DateTime.now
end
# GET /promotions/1/edit
def edit
end
# POST /promotions
# POST /promotions.json
def create
@promotion = Promotion.new(promotion_params)
@promotion.created_by = current_login_employee.id
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
respond_to do |format|
if @promotion.save
promo_pros = @promotion.promotion_products
promo_pros.each do |promo_pro|
promo_pro.save
end
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully created.' }
format.json { render :show, status: :created, location: @promotion }
else
format.html { render :new }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /promotions/1
# PATCH/PUT /promotions/1.json
def update
respond_to do |format|
if @promotion.update(promotion_params)
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
@promotion.save
promo_pros = @promotion.promotion_products
promo_pros.each do |promo_pro|
promo_pro.save
end
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully updated.' }
format.json { render :show, status: :ok, location: @promotion }
else
format.html { render :edit }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# DELETE /promotions/1
# DELETE /promotions/1.json
def destroy
@promotion.destroy
respond_to do |format|
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' }
format.json { head :no_content }
end
end
def find_item_instance
item = MenuItem.find_by_item_code(params[:item_code])
if item.nil?
product = Product.where("item_code = ?",params[:item_code]).pluck(:name,:item_code)
render json: product
else
menu_instance = MenuItemInstance.where("menu_item_id = ?",item.id).pluck(:item_instance_name,:item_instance_code)
render json: menu_instance
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_promotion
@promotion = Promotion.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def promotion_params
params.require(:promotion).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by,
:promotion_products_attributes => [:id,:item_code, :min_qty, :net_off, :net_price, :percentage, :_destroy])
end
end

View File

@@ -1,6 +1,8 @@
class Settings::SetMenuItemsController < ApplicationController
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy]
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update]
before_action :set_settings_item_attribute, only: [:index, :show, :edit, :new, :update ,:create]
before_action :set_settings_item_option, only: [:index, :show, :edit, :new, :update ,:create]
# GET /settings/menu_items
# GET /settings/menu_items.json
def index
@@ -10,32 +12,52 @@ class Settings::SetMenuItemsController < ApplicationController
# GET /settings/menu_items/1
# GET /settings/menu_items/1.json
def show
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
end
# GET /settings/menu_items/new
def new
@settings_menu_item = MenuItem.new
@settings_menu_item.type = "SetMenuItem"
@item_sets = ItemSet.all
end
# GET /settings/menu_items/1/edit
def edit
@item_sets = ItemSet.all
end
# POST /settings/menu_items
# POST /settings/menu_items.json
def create
@settings_menu_item = MenuItem.new(settings_menu_item_params)
if params[:simple_menu_item][:menu_item_id] == ''
@settings_menu_item.menu_category_id = params[:menu_category_id]
end
# if params[:set_menu_item][:menu_item_id] == ''
@settings_menu_item.menu_category_id = params[:menu_category_id]
# end
@settings_menu_item.created_by = current_login_employee.name
# Remove "" default first
params[:set_menu_item][:item_attributes].delete_at(0)
params[:set_menu_item][:item_options].delete_at(0)
# Bind for Item Sets
if params[:set_menu_item][:item_sets].count > 1
params[:set_menu_item][:item_sets].delete_at(0)
sets = ItemSet.find(params[:set_menu_item][:item_sets])
if sets.count > 0
@settings_menu_item.item_sets = sets
end
end
respond_to do |format|
if @settings_menu_item.save
menu_item = MenuItem.find(@settings_menu_item.id)
menu_item.update_attributes(item_attributes: params[:set_menu_item][:item_attributes], item_options: params[:set_menu_item][:item_options])
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully created.' }
format.json { render :show, status: :created, location: @settings_menu_item }
else
@@ -48,8 +70,27 @@ class Settings::SetMenuItemsController < ApplicationController
# PATCH/PUT /settings/menu_items/1
# PATCH/PUT /settings/menu_items/1.json
def update
# Remove "" default first
params[:set_menu_item][:item_attributes].delete_at(0)
params[:set_menu_item][:item_options].delete_at(0)
# Bind for Item Sets
if params[:set_menu_item][:item_sets].count > 1
params[:set_menu_item][:item_sets].delete_at(0)
sets = ItemSet.find(params[:set_menu_item][:item_sets])
if sets.count > 0
@settings_menu_item.item_sets = sets
end
end
@settings_menu_item.menu_category_id = params[:menu_category_id]
respond_to do |format|
if @settings_menu_item.update(settings_menu_item_params)
@settings_menu_item.update_attributes(item_attributes: params[:set_menu_item][:item_attributes], item_options: params[:set_menu_item][:item_options])
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_menu_item }
else
@@ -62,6 +103,8 @@ class Settings::SetMenuItemsController < ApplicationController
# DELETE /settings/menu_items/1
# DELETE /settings/menu_items/1.json
def destroy
path_to_file = @settings_menu_item.image_path.to_s
File.delete(path_to_file) if File.exist?(path_to_file)
abc = MenuItem.deleteRecursive(@settings_menu_item)
respond_to do |format|
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully destroyed.' }
@@ -79,8 +122,16 @@ class Settings::SetMenuItemsController < ApplicationController
@category = MenuCategory.find(params[:menu_category_id])
end
def set_settings_item_attribute
@item_attributes = MenuItemAttribute.all.order("id asc").map{|a| [a.name, a.value]}
end
def set_settings_item_option
@item_options = MenuItemOption.all
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_params
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id,:account_id , :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
end
end

View File

@@ -1,6 +1,8 @@
class Settings::SimpleMenuItemsController < ApplicationController
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy ]
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update ,:create]
before_action :set_settings_item_attribute, only: [:index, :show, :edit, :new, :update ,:create]
before_action :set_settings_item_option, only: [:index, :show, :edit, :new, :update ,:create]
# GET /settings/menu_items
# GET /settings/menu_items.json
def index
@@ -10,29 +12,75 @@ class Settings::SimpleMenuItemsController < ApplicationController
# GET /settings/menu_items/1
# GET /settings/menu_items/1.json
def show
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
end
# GET /settings/menu_items/new
def new
@settings_menu_item = MenuItem.new
@settings_menu_item = MenuItem.new
@item_sets = ItemSet.all
end
# GET /settings/menu_items/1/edit
def edit
def edit
@item_sets = ItemSet.all
end
# POST /settings/menu_items
# POST /settings/menu_items.json
def create
@settings_menu_item = MenuItem.new(settings_menu_item_params)
if params[:simple_menu_item][:menu_item_id] == ''
@settings_menu_item.menu_category_id = params[:menu_category_id]
end
# if params[:simple_menu_item][:menu_item_id] == ''
@settings_menu_item.menu_category_id = params[:menu_category_id]
# end
@settings_menu_item.created_by = current_login_employee.name
# Remove "" default first
params[:simple_menu_item][:item_attributes].delete_at(0)
params[:simple_menu_item][:item_options].delete_at(0)
# attr_format = []
# param_count = params[:simple_menu_item][:item_attributes].count
# # Format for attributes json
# params[:simple_menu_item][:item_attributes].each do|attr_id|
# menu_attr = MenuItemAttribute.find(attr_id)
# if attr_format.count == 0
# attr_format.push({ type: menu_attr.attribute_type, value: [] })
# end
# attr_format.each do |af|
# if menu_attr.attribute_type == af[:type]
# af[:value].push(menu_attr.value)
# else
# new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
# attr_format.push(new_attr)
# end
# break if attr_format.count > param_count
# end
# param_count -= 1
# end
# @settings_menu_item.item_attributes = attr_format
# Bind for Item Sets
if params[:simple_menu_item][:item_sets].count > 1
params[:simple_menu_item][:item_sets].delete_at(0)
sets = ItemSet.find(params[:simple_menu_item][:item_sets])
if sets.count > 0
@settings_menu_item.item_sets = sets
end
end
respond_to do |format|
if @settings_menu_item.save
menu_item = MenuItem.find(@settings_menu_item.id)
menu_item.update_attributes(item_attributes: params[:simple_menu_item][:item_attributes], item_options: params[:simple_menu_item][:item_options])
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' }
format.json { render :show, status: :created, location: @settings_menu_item }
else
@@ -45,8 +93,26 @@ class Settings::SimpleMenuItemsController < ApplicationController
# PATCH/PUT /settings/menu_items/1
# PATCH/PUT /settings/menu_items/1.json
def update
# Remove "" default first
params[:simple_menu_item][:item_attributes].delete_at(0)
params[:simple_menu_item][:item_options].delete_at(0)
# Bind for Item Sets
if params[:simple_menu_item][:item_sets].count > 1
params[:simple_menu_item][:item_sets].delete_at(0)
sets = ItemSet.find(params[:simple_menu_item][:item_sets])
if sets.count > 0
@settings_menu_item.item_sets = sets
end
end
@settings_menu_item.menu_category_id = params[:menu_category_id]
respond_to do |format|
if @settings_menu_item.update(settings_menu_item_params)
@settings_menu_item.update_attributes(item_attributes: params[:simple_menu_item][:item_attributes], item_options: params[:simple_menu_item][:item_options])
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_menu_item }
else
@@ -59,6 +125,8 @@ class Settings::SimpleMenuItemsController < ApplicationController
# DELETE /settings/menu_items/1
# DELETE /settings/menu_items/1.json
def destroy
path_to_file = @settings_menu_item.image_path.to_s
File.delete(path_to_file) if File.exist?(path_to_file)
abc = MenuItem.deleteRecursive(@settings_menu_item)
respond_to do |format|
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully destroyed.' }
@@ -76,8 +144,16 @@ class Settings::SimpleMenuItemsController < ApplicationController
@category = MenuCategory.find(params[:menu_category_id])
end
def set_settings_item_attribute
@item_attributes = MenuItemAttribute.all.order("id asc") #.map{|a| [a.name, a.value]}
end
def set_settings_item_option
@item_options = MenuItemOption.all
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_menu_item_params
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id,:account_id,:item_attributes, :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
end
end

View File

@@ -5,9 +5,25 @@ class Transactions::CreditNotesController < ApplicationController
# GET /transactions/sales.json
def index
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
@customers = Customer.all
filter = params[:filter]
customer = params[:customer]
from = params[:from]
to = params[:to]
if filter.nil? && from.nil? && to.nil? && customer.nil?
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
puts "cccccccccccc"
else
sale = Sale.search_credit_sales(customer,filter,from,to)
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
else
@sales = 0
end
end
respond_to do |format|
format.html # index.html.erb

View File

@@ -3,6 +3,7 @@ class Transactions::ManualSalesController < ApplicationController
def void
@sale = params[:sale_id]
@reason = Lookup.where("lookup_type = 'void_reason'")
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sales }

View File

@@ -2,23 +2,30 @@ class Transactions::OrdersController < ApplicationController
load_and_authorize_resource except: [:create]
def index
filter = params[:filter]
if filter.nil?
filter = params[:filter]
count = params[:count]
from = params[:from]
to = params[:to]
if filter.nil? && from.nil? && to.nil? && count.nil?
orders = Order.order("order_id desc")
puts "ssssss"
else
order = Order.search(filter)
if order.count > 0
orders = order
else
orders = Order.order("order_id desc")
end
orders = Order.search(filter,from,to,count)
puts "aaaaa"
end
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
if !orders.nil?
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
else
@orders = []
end
puts @orders.to_json
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
end
def show

View File

@@ -6,28 +6,41 @@ class Transactions::SalesController < ApplicationController
# GET /transactions/sales.json
def index
search_date = params[:date]
receipt_no = params[:receipt_no]
today = Date.today
if receipt_no.nil? && search_date.nil?
@sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500)
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
receipt_no = params[:receipt_no]
from = params[:from]
to = params[:to]
if receipt_no.nil? && from.nil? && to.nil?
@sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500)
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
else
if !search_date.blank? && receipt_no.blank?
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') = ? and NOT sale_status = 'void' ", search_date).order("sale_id desc").limit(500).page(params[:page])
elsif !search_date.blank? && !receipt_no.blank?
sale = Sale.where("receipt_no LIKE ? or DATE_FORMAT(receipt_date,'%d-%m-%Y') = ? and NOT sale_status = 'void' ", "%#{receipt_no}%", search_date).order("sale_id desc").limit(500).page(params[:page])
else
sale = Sale.where("receipt_no LIKE ? and NOT sale_status = 'void' ", receipt_no).order("sale_id desc").limit(500).page(params[:page])
end
sale = Sale.search(receipt_no,from,to)
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
else
@sales = 0
end
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
else
@sales = 0
end
end
# if receipt_no.nil? && search_date.nil?
# @sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500)
# @sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
# else
# if !search_date.blank? && receipt_no.blank?
# sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') = ? and NOT sale_status = 'void' ", search_date).order("sale_id desc").limit(500).page(params[:page])
# elsif !search_date.blank? && !receipt_no.blank?
# sale = Sale.where("receipt_no LIKE ? or DATE_FORMAT(receipt_date,'%d-%m-%Y') = ? and NOT sale_status = 'void' ", "%#{receipt_no}%", search_date).order("sale_id desc").limit(500).page(params[:page])
# else
# sale = Sale.where("receipt_no LIKE ? and NOT sale_status = 'void' ", receipt_no).order("sale_id desc").limit(500).page(params[:page])
# end
# if sale.count > 0
# @sales = sale
# @sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
# else
# @sales = 0
# end
# end
respond_to do |format|
format.html # index.html.erb

View File

@@ -1,5 +1,4 @@
module ApplicationHelper
def flash_class(level)
case level
when :notice then "alert alert-info fade-in"

View File

@@ -0,0 +1,2 @@
module CommissionersHelper
end

View File

@@ -0,0 +1,2 @@
module CommissionsHelper
end

View File

@@ -0,0 +1,2 @@
module DiningChargesHelper
end

View File

@@ -0,0 +1,2 @@
module InventoryDefinitionsHelper
end

Some files were not shown because too many files have changed in this diff Show More