fixed conflict
This commit is contained in:
8
.idea/.generators
generated
Normal file
8
.idea/.generators
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Settings><!--This file was automatically generated by Ruby plugin.
|
||||
You are allowed to:
|
||||
1. Reorder generators
|
||||
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>
|
||||
7
.idea/.rakeTasks
generated
Normal file
7
.idea/.rakeTasks
generated
Normal file
File diff suppressed because one or more lines are too long
4
.idea/misc.xml
generated
Normal file
4
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.3.3" project-jdk-type="RUBY_SDK" />
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/sxrestaurant.iml" filepath="$PROJECT_DIR$/.idea/sxrestaurant.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
236
.idea/sxrestaurant.iml
generated
Normal file
236
.idea/sxrestaurant.iml
generated
Normal file
@@ -0,0 +1,236 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="RUBY_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="RailsFacetType" name="Ruby on Rails">
|
||||
<configuration>
|
||||
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
|
||||
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
|
||||
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</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$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/components" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/public/system" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle" />
|
||||
</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="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="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="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" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.5, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="connection_pool (v2.2.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<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="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" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="faker (v1.7.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.18, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="filterrific (v2.1.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<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="jbuilder (v2.7.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" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kaminari-actionview (v1.0.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kaminari-activerecord (v1.0.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kaminari-core (v1.0.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="listen (v3.0.8, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.0.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="mail (v2.6.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.8.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<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="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="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" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="pg (v0.20.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="prawn (v2.2.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="prawn-table (v0.2.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="puma (v3.9.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rack (v2.0.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<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-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="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" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="redis (v3.3.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.6.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.6.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.6.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rspec-rails (v3.6.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.6.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="ruby-ole (v1.2.12.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="sass (v3.4.24, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="sass-rails (v5.0.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="schema_to_scaffold (v0.8.0, 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" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="spreadsheet (v1.1.4, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="spring (v2.0.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="spring-watcher-listen (v2.0.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="sprockets (v3.7.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="sprockets-rails (v3.2.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="tether-rails (v1.4.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.4, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.7, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="to_xls-rails (v1.3.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="ttfunk (v1.5.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="turbolinks (v5.0.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="turbolinks-source (v5.0.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.3, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="uglifier (v3.2.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<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" />
|
||||
</component>
|
||||
<component name="RModuleSettingsStorage">
|
||||
<LOAD_PATH number="0" />
|
||||
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
1262
.idea/workspace.xml
generated
Normal file
1262
.idea/workspace.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
Gemfile
2
Gemfile
@@ -66,6 +66,8 @@ gem 'kaminari', '~> 1.0.1'
|
||||
# Datatable
|
||||
gem 'filterrific'
|
||||
|
||||
gem 'cancancan', '~> 1.10'
|
||||
|
||||
# Use Capistrano for deployment
|
||||
# gem 'capistrano-rails', group: :development
|
||||
|
||||
|
||||
10
Gemfile.lock
10
Gemfile.lock
@@ -39,7 +39,7 @@ GEM
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (8.0.0)
|
||||
autoprefixer-rails (7.1.1)
|
||||
autoprefixer-rails (7.1.1.2)
|
||||
execjs
|
||||
bcrypt (3.1.11)
|
||||
bindex (0.5.0)
|
||||
@@ -50,6 +50,7 @@ GEM
|
||||
railties (>= 3.0)
|
||||
builder (3.2.3)
|
||||
byebug (9.0.6)
|
||||
cancancan (1.17.0)
|
||||
coffee-rails (4.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0)
|
||||
@@ -159,8 +160,8 @@ GEM
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (12.0.0)
|
||||
rb-fsevent (0.9.8)
|
||||
rb-inotify (0.9.8)
|
||||
ffi (>= 0.5.0)
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
redis (3.3.3)
|
||||
rspec-core (3.6.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
@@ -191,7 +192,7 @@ GEM
|
||||
activesupport (>= 3.2.1)
|
||||
shoulda-matchers (3.1.1)
|
||||
activesupport (>= 4.0.0)
|
||||
sidekiq (5.0.2)
|
||||
sidekiq (5.0.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
connection_pool (~> 2.2, >= 2.2.0)
|
||||
rack-protection (>= 1.5.0)
|
||||
@@ -245,6 +246,7 @@ DEPENDENCIES
|
||||
bootstrap (~> 4.0.0.alpha3)
|
||||
bootstrap-datepicker-rails
|
||||
byebug
|
||||
cancancan (~> 1.10)
|
||||
coffee-rails (~> 4.2)
|
||||
cups (~> 0.0.7)
|
||||
database_cleaner
|
||||
|
||||
BIN
app/assets/images/profile-1.png
Normal file
BIN
app/assets/images/profile-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
app/assets/images/profile-2.png
Normal file
BIN
app/assets/images/profile-2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
app/assets/images/profile-3.png
Normal file
BIN
app/assets/images/profile-3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -26,7 +26,7 @@ $(document).ready(function(){
|
||||
$('.queue_station').on('click',function(){
|
||||
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();
|
||||
var assigned_item_id = $(this).children().find(".assigned-order-item").text();
|
||||
var orderQty = $(this).children().children().children('.order-qty').text();
|
||||
var orderBy = $(this).children().children().children().children('.order-by').text();
|
||||
var orderAt = $(this).children().children().children().children('.order-at').text();
|
||||
@@ -67,6 +67,12 @@ $(document).ready(function(){
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
$(".order-item-edit").on('click', function(){
|
||||
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){
|
||||
//e.preventDefault();
|
||||
@@ -111,8 +117,9 @@ $(document).ready(function(){
|
||||
|
||||
// Print Order Item
|
||||
$('#print_order_item').on('click',function(){
|
||||
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||
var params = { 'id':assigned_item_id };
|
||||
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,
|
||||
@@ -122,12 +129,31 @@ $(document).ready(function(){
|
||||
|
||||
// Print Order Summary
|
||||
$('#print_order_summary').on('click',function(){
|
||||
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 = { 'id':assigned_item_id };
|
||||
var params = { 'table_name':table_name };
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/oqs/print/print_order_summary/'+assigned_item_id,
|
||||
data: params,
|
||||
success: function(data){ }
|
||||
});
|
||||
});
|
||||
|
||||
// Qty update for OQS Edit Controller
|
||||
$('#qty-update').on('click', function(){
|
||||
var qty_weight = $("input[name='qty_weight']").val();
|
||||
var remarks = $("textarea[name='remarks']").val();
|
||||
var order_items_id = $(this).attr('data-id');
|
||||
var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks }
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/oqs/' + order_items_id,
|
||||
data: params,
|
||||
success: function(result){
|
||||
alert("Updated!");
|
||||
window.location.href = '/oqs';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,6 +25,12 @@ $(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
$('.dropdown-toggle').dropdown();
|
||||
});
|
||||
|
||||
function export_to(path)
|
||||
{
|
||||
var form_params = $("#frm_report").serialize();
|
||||
window.location = path+"?"+ form_params;
|
||||
}
|
||||
|
||||
/*
|
||||
* ToDo Move to here from pages
|
||||
*
|
||||
|
||||
3
app/assets/javascripts/cash_mgmt.coffee
Normal file
3
app/assets/javascripts/cash_mgmt.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
10
app/assets/javascripts/jquery-confirm.js
vendored
Normal file
10
app/assets/javascripts/jquery-confirm.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,15 +1,3 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require tether
|
||||
//= require bootstrap
|
||||
@@ -55,7 +43,7 @@ $(document).ready(function(){
|
||||
|
||||
var cashier="";
|
||||
var receipt_date="";
|
||||
var sub_total=0;
|
||||
var sub_total=0.0;
|
||||
var discount_amount=0;
|
||||
var tax_amount=0;
|
||||
var grand_total_amount=0;
|
||||
@@ -69,11 +57,11 @@ $(document).ready(function(){
|
||||
type: "POST",
|
||||
url: "/origami/" + unique_id,
|
||||
data: { 'booking_id' : unique_id },
|
||||
success:function(result){
|
||||
success:function(result){
|
||||
for (i = 0; i < result.length; i++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
var show_date = "";
|
||||
var show_date = "";
|
||||
|
||||
// Receipt Header
|
||||
receipt_no = result[i].receipt_no;
|
||||
@@ -81,36 +69,37 @@ $(document).ready(function(){
|
||||
if(result[i].receipt_date != null){
|
||||
receipt_date = new Date(result[i].receipt_date);
|
||||
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
|
||||
}
|
||||
|
||||
$("#receipt_no").text(receipt_no);
|
||||
$("#cashier").text(cashier == null ? "" : cashier);
|
||||
$("#receipt_date").text(show_date);
|
||||
|
||||
}
|
||||
|
||||
//Receipt Charges
|
||||
sub_total += (parse_data.qty*parse_data.price);
|
||||
sub_total += parseFloat(parse_data.price);
|
||||
|
||||
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
||||
tax_amount = parse_data.tax_amount;
|
||||
grand_total_amount = parse_data.grand_total_amount;
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
// $("#order-food").text('');
|
||||
// $("#order-beverage").text('');
|
||||
$("#order-discount").text(discount_amount);
|
||||
$("#order-Tax").text(tax_amount);
|
||||
$("#order-grand-total").text(grand_total_amount);
|
||||
grand_total_amount = parse_data.grand_total_amount;
|
||||
|
||||
// Ordered Items
|
||||
var order_items_rows = "<tr>" +
|
||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.price + "</td>" +
|
||||
"</tr>";
|
||||
|
||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||
}
|
||||
|
||||
// Cashier Info
|
||||
$("#receipt_no").text(receipt_no);
|
||||
$("#cashier").text(cashier == null ? "" : cashier);
|
||||
$("#receipt_date").text(show_date);
|
||||
|
||||
// Payment Info
|
||||
$("#order-sub-total").text(sub_total);
|
||||
// $("#order-food").text('');
|
||||
// $("#order-beverage").text('');
|
||||
$("#order-discount").text(discount_amount);
|
||||
$("#order-Tax").text(tax_amount);
|
||||
$("#order-grand-total").text(grand_total_amount);
|
||||
}
|
||||
});
|
||||
// End AJAX Call
|
||||
@@ -303,49 +292,9 @@ $(document).ready(function(){
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
// $(".orders").on('click', function(){
|
||||
// var dining_id = $(this).attr("data-id");
|
||||
// window.location.href = '/origami/' + dining_id;
|
||||
// })
|
||||
|
||||
});
|
||||
|
||||
/* Button Control by Status */
|
||||
function control_button(order_status){
|
||||
if(order_status=="billed"){
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', false);
|
||||
$("#pay-bill").prop('disabled', false);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
else if(order_status=="new") {
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', false);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}else if(order_status=="completed"){
|
||||
$("#re-print").prop('disabled', false);
|
||||
}
|
||||
else {
|
||||
$("#customer").prop('disabled', true);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* For Receipt - Update Balance */
|
||||
function update_balance(){
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_amount = $('#discount-amount').val();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var tax = $('#order-Tax').text();
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_amount)/100;
|
||||
}
|
||||
|
||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
||||
$('#order-discount').text(discount_amount);
|
||||
$('#order-grand-total').text(total);
|
||||
}
|
||||
|
||||
3
app/assets/javascripts/origami/shifts.coffee
Normal file
3
app/assets/javascripts/origami/shifts.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
352
app/assets/javascripts/origami_bk.js
Normal file
352
app/assets/javascripts/origami_bk.js
Normal file
@@ -0,0 +1,352 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require tether
|
||||
//= require bootstrap
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
//= require jquery-ui
|
||||
//= require bootstrap-datepicker
|
||||
|
||||
$(document).ready(function(){
|
||||
// auto refresh every 60 seconds
|
||||
// setTimeout(function(){
|
||||
// window.location.reload(1);
|
||||
// }, 60000);
|
||||
|
||||
// For selected order return
|
||||
var order_status = "";
|
||||
order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim();
|
||||
|
||||
// Enable/Disable Button
|
||||
control_button(order_status);
|
||||
|
||||
$(".orders").on('click', function(){
|
||||
$("#order-sub-total").text('');
|
||||
// $("#order-food").text('');
|
||||
// $("#order-beverage").text('');
|
||||
$("#order-discount").text('');
|
||||
$("#order-Tax").text('');
|
||||
$("#order-grand-total").text('');
|
||||
|
||||
var zone_name=$(this).find(".orders-table").text();
|
||||
var receipt_no=$(this).find(".orders-receipt-no").text();
|
||||
var unique_id = $(this).find(".orders-id").text();
|
||||
var order_status=$(this).find(".orders-order-status").text().trim();
|
||||
|
||||
// Enable/Disable Button
|
||||
control_button(order_status);
|
||||
|
||||
var customer_id=$(this).find(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
|
||||
$("#re-print").val(unique_id);
|
||||
|
||||
var cashier="";
|
||||
var receipt_date="";
|
||||
var sub_total=0.0;
|
||||
var discount_amount=0;
|
||||
var tax_amount=0;
|
||||
var grand_total_amount=0;
|
||||
|
||||
$("#order-title").text("ORDER DETAILS - " + zone_name);
|
||||
// clear order items
|
||||
$("#order-items-table").children("tbody").empty();
|
||||
|
||||
// AJAX call for order
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + unique_id,
|
||||
data: { 'booking_id' : unique_id },
|
||||
success:function(result){
|
||||
for (i = 0; i < result.length; i++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
var show_date = "";
|
||||
|
||||
// Receipt Header
|
||||
receipt_no = result[i].receipt_no;
|
||||
cashier = result[i].cashier_name;
|
||||
if(result[i].receipt_date != null){
|
||||
receipt_date = new Date(result[i].receipt_date);
|
||||
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
|
||||
}
|
||||
|
||||
//Receipt Charges
|
||||
sub_total += parseFloat(parse_data.price);
|
||||
|
||||
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
||||
tax_amount = parse_data.tax_amount;
|
||||
grand_total_amount = parse_data.grand_total_amount;
|
||||
|
||||
// Ordered Items
|
||||
var order_items_rows = "<tr>" +
|
||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.price + "</td>" +
|
||||
"</tr>";
|
||||
|
||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||
}
|
||||
|
||||
// Cashier Info
|
||||
$("#receipt_no").text(receipt_no);
|
||||
$("#cashier").text(cashier == null ? "" : cashier);
|
||||
$("#receipt_date").text(show_date);
|
||||
|
||||
// Payment Info
|
||||
$("#order-sub-total").text(sub_total);
|
||||
// $("#order-food").text('');
|
||||
// $("#order-beverage").text('');
|
||||
$("#order-discount").text(discount_amount);
|
||||
$("#order-Tax").text(tax_amount);
|
||||
$("#order-grand-total").text(grand_total_amount);
|
||||
}
|
||||
});
|
||||
// End AJAX Call
|
||||
|
||||
$('.orders').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
if(order_id!=""){
|
||||
window.location.href = '/origami/' + order_id + '/request_bills'
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Discount for Payment
|
||||
$('#discount').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
|
||||
if(order_id!=""){
|
||||
window.location.href = '/origami/' + order_id + '/discount'
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
$("#pay-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sale_item_id = $('.selected-item').attr('id').substr(0,16);
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var grand_total = $('#order-grand-total').text();
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var discount_amount = discount_value;
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
if(sale_item_id != null){
|
||||
ajax_url = "/origami/" + sale_item_id + "/discount";
|
||||
sub_total = $("#"+sale_item_id).children().find("#item-total-price").text();
|
||||
}
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_value)/100;
|
||||
}
|
||||
|
||||
var params = {'sale_id': sale_id, 'sale_item_id': sale_item_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){ }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Payment for Bill
|
||||
$('#pay-bill').click(function() {
|
||||
var sale_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
if(sale_id!=""){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#customer').click(function() {
|
||||
var sale = $(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
if (sale.substring(0, 3)=="SAL") {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $(".selected-item").find(".order-cid").text();
|
||||
}
|
||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function show_customer_details(customer_id){
|
||||
|
||||
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
|
||||
var url = customer_id+"/get_customer/"
|
||||
}else{
|
||||
var url = "origami/"+customer_id+"/get_customer/"
|
||||
}
|
||||
|
||||
$('.customer_detail').removeClass('hide');
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$("#customer_name").text(data["customer"].name);
|
||||
if (data["response_data"]["data"].length) {
|
||||
$.each(data["response_data"]["data"], function (i) {
|
||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||
var balance = data["response_data"]["data"][i]["balance"];
|
||||
if (data["response_data"]["status"]==true) {
|
||||
$('.rebate_amount').removeClass('hide');
|
||||
row =
|
||||
'<td class="charges-name">' + data["response_data"]["data"][i]["accountable_type"] +'</td>'
|
||||
+'<td class="item-attr">' + balance + '</td>';
|
||||
|
||||
$(".rebate_amount").html(row);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$('.rebate_amount').addClass('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
//End Ajax
|
||||
}
|
||||
|
||||
/* For Receipt - Calculate discount or tax */
|
||||
$('.cashier_number').on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#discount-amount').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
update_balance();
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
update_balance();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#discount-amount').val(amount);
|
||||
$('#discount-type').val(1);
|
||||
update_balance();
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
update_balance();
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.discount-item-row').on('click',function(){
|
||||
$('.discount-item-row').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* Button Control by Status */
|
||||
function control_button(order_status){
|
||||
if(order_status=="billed"){
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', false);
|
||||
$("#pay-bill").prop('disabled', false);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
else if(order_status=="new") {
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', false);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}else if(order_status=="completed"){
|
||||
$("#re-print").prop('disabled', false);
|
||||
}
|
||||
else {
|
||||
$("#customer").prop('disabled', true);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* For Receipt - Update Balance */
|
||||
function update_balance(){
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_amount = $('#discount-amount').val();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var tax = $('#order-Tax').text();
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_amount)/100;
|
||||
}
|
||||
|
||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
||||
$('#order-discount').text(discount_amount);
|
||||
$('#order-grand-total').text(total);
|
||||
}
|
||||
3
app/assets/javascripts/reports/daily_sales.coffee
Normal file
3
app/assets/javascripts/reports/daily_sales.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/reports/dailysales.coffee
Normal file
3
app/assets/javascripts/reports/dailysales.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/reports/sale_items.coffee
Normal file
3
app/assets/javascripts/reports/sale_items.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -40,7 +40,7 @@ $(document).on('turbolinks:load', function() {
|
||||
items.push($(value).attr("data-id"));
|
||||
});
|
||||
|
||||
$("#order_queue_station_processing_items").val(items);
|
||||
$("#order_queue_station_processing_items").val(JSON.stringify(items));
|
||||
//$(this).submit();
|
||||
})
|
||||
})
|
||||
|
||||
@@ -23,3 +23,17 @@
|
||||
.assign .text-muted{
|
||||
color: #fff !important;
|
||||
}
|
||||
.red{
|
||||
color: #fff !important;
|
||||
background-color: red;
|
||||
}
|
||||
.green{
|
||||
color: #fff !important;
|
||||
background-color: green;
|
||||
}
|
||||
.required abbr{
|
||||
color: red !important;
|
||||
}
|
||||
.jconfirm-box-container{
|
||||
margin-left:-40px !important
|
||||
}
|
||||
@@ -19,3 +19,9 @@
|
||||
color: #fff !important;
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
width: 49%;
|
||||
font-size: 18px;
|
||||
margin: 0px 0px 5px 0px;
|
||||
}
|
||||
3
app/assets/stylesheets/cash_mgmt.scss
Normal file
3
app/assets/stylesheets/cash_mgmt.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the cash_mgmt controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
10
app/assets/stylesheets/jquery-confirm.scss
Normal file
10
app/assets/stylesheets/jquery-confirm.scss
Normal file
File diff suppressed because one or more lines are too long
@@ -9,6 +9,9 @@
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
.card-columns {
|
||||
font-size: 18px !important;}
|
||||
|
||||
.others-payment{
|
||||
line-height:100px;
|
||||
text-align:center;
|
||||
@@ -41,17 +44,50 @@
|
||||
|
||||
.pay{
|
||||
width: 98%;
|
||||
height:211px;
|
||||
height:211px;
|
||||
line-height:211px;
|
||||
text-align:center;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.payment{
|
||||
height:70px;line-height:70px;align:center;color:white;font-size:16px;margin-bottom:1px;
|
||||
}
|
||||
|
||||
.cash-color{
|
||||
background-color:#80CBC4;
|
||||
}
|
||||
|
||||
.credit-color{
|
||||
background-color:#FFCCBC;
|
||||
}
|
||||
|
||||
.other-payment-color{
|
||||
background-color:#E1BEE7;
|
||||
}
|
||||
|
||||
.cashier_number:hover{
|
||||
background:#A9F5F2;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
height: 60px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.bottom-5 {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.fluid {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.style2 {
|
||||
border-top: 3px double #8c8b8b;
|
||||
}
|
||||
|
||||
.long{
|
||||
width:49%;
|
||||
}
|
||||
@@ -69,6 +105,11 @@
|
||||
background-color: blue !important;
|
||||
}
|
||||
|
||||
.selected-account {
|
||||
color: #fff !important;
|
||||
background-color: blue !important;
|
||||
}
|
||||
|
||||
/* Reciept Style */
|
||||
#order-charges-table td {
|
||||
border-top: none !important;
|
||||
@@ -89,6 +130,18 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.item-attr-edit{
|
||||
width: 10%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.display-none{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.text-white{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Colors */
|
||||
.purple {
|
||||
@@ -107,6 +160,14 @@
|
||||
background-color: #009900
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color: #FF8C00
|
||||
}
|
||||
|
||||
.blue{
|
||||
background-color: blue
|
||||
}
|
||||
|
||||
.left{
|
||||
margin-left:1px;
|
||||
}
|
||||
@@ -133,3 +194,11 @@ select.form-control {
|
||||
tr.discount-item-row:hover {
|
||||
background-color: #e3e3e3 !important;
|
||||
}
|
||||
.required abbr{
|
||||
color: red !important;
|
||||
}
|
||||
/* Jquery Confirm */
|
||||
|
||||
.jconfirm-box-container{
|
||||
margin-left:-40px !important
|
||||
}
|
||||
|
||||
3
app/assets/stylesheets/origami/shifts.scss
Normal file
3
app/assets/stylesheets/origami/shifts.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/shifts controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/reports/daily_sales.scss
Normal file
3
app/assets/stylesheets/reports/daily_sales.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the reports/daily_sales controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/reports/dailysales.scss
Normal file
3
app/assets/stylesheets/reports/dailysales.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the reports/dailysales controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/reports/sale_items.scss
Normal file
3
app/assets/stylesheets/reports/sale_items.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the reports/sale_items controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -9,15 +9,17 @@ class Api::BillController < Api::ApiController
|
||||
#create Bill by Booking ID
|
||||
if (params[:booking_id])
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
|
||||
@@ -27,17 +29,16 @@ class Api::BillController < Api::ApiController
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.where('customer_id=' + @sale_data.customer_id)
|
||||
customer= Customer.find(@sale_data.customer_id)
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# Calculate Food and Beverage Total
|
||||
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)
|
||||
# Calculate Price by accounts
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@ class Api::BookingsController < Api::ApiController
|
||||
end
|
||||
|
||||
def show
|
||||
@booking = Booking.find(params[:id])
|
||||
booking = Booking.find(params[:id])
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i
|
||||
@booking = booking
|
||||
end
|
||||
end
|
||||
|
||||
# private
|
||||
# def Bookings_params
|
||||
# params.permit(:id, :order_id)
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -7,11 +7,37 @@ class Api::OrdersController < Api::ApiController
|
||||
order = Order.find(params[:order_id])
|
||||
order.order_items
|
||||
end
|
||||
|
||||
def get_order
|
||||
order = Order.find(params[:order_id])
|
||||
order.order_items
|
||||
end
|
||||
|
||||
# API - This api will retrive current booking for android with table or room id
|
||||
def view_orders
|
||||
booking_id = params[:booking_id]
|
||||
table_id = params[:table_id]
|
||||
if Booking.exists?(booking_id)
|
||||
booking = Booking.find(booking_id)
|
||||
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == table_id.to_i
|
||||
if booking.booking_status == 'assign'
|
||||
if booking.sale_id.nil?
|
||||
@booking = booking
|
||||
end
|
||||
end
|
||||
else
|
||||
table = DiningFacility.find(table_id)
|
||||
@booking = table.get_booking
|
||||
end
|
||||
end
|
||||
else
|
||||
table = DiningFacility.find(table_id)
|
||||
@booking = table.get_booking
|
||||
end
|
||||
end
|
||||
|
||||
# Description
|
||||
# This API allow new order creation
|
||||
# Input Params
|
||||
@@ -38,23 +64,48 @@ class Api::OrdersController < Api::ApiController
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
check_order_with_booking(booking)
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
check_order_with_table(params[:table_id])
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
puts "booking sale is null"
|
||||
end
|
||||
end
|
||||
end #booking exists
|
||||
else
|
||||
check_order_with_table(params[:table_id])
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
end
|
||||
|
||||
def check_order_with_table(table_id)
|
||||
table = DiningFacility.find(table_id)
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
if booking
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def check_order_with_booking(booking)
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
end
|
||||
# Description
|
||||
# This API - allow order to add new items to existing orders, does not allow you to remove confirm items
|
||||
# Update customer info, Guest Info
|
||||
|
||||
@@ -3,11 +3,23 @@ class ApplicationController < ActionController::Base
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :current_company,:current_login_employee
|
||||
|
||||
helper_method :current_company,:current_login_employee,:current_user
|
||||
# alias_method :current_user, :current_login_employee,:current_user
|
||||
#this is base api base controller to need to inherit.
|
||||
#all token authentication must be done here
|
||||
#response format must be set to JSON
|
||||
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
def current_company
|
||||
begin
|
||||
return Company.first
|
||||
@@ -18,7 +30,9 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
if (!session[:session_token].nil?)
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
class BaseCrmController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "CRM"
|
||||
include LoginVerification
|
||||
layout "CRM"
|
||||
|
||||
#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
|
||||
|
||||
@@ -5,5 +5,13 @@ class BaseOqsController < ActionController::Base
|
||||
#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
|
||||
|
||||
@@ -5,5 +5,14 @@ class BaseOrigamiController < ActionController::Base
|
||||
#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
|
||||
|
||||
@@ -5,6 +5,15 @@ class BaseReportController < ActionController::Base
|
||||
#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
|
||||
|
||||
PERIOD = {
|
||||
"today" => 0,
|
||||
"yesterday" => 1,
|
||||
@@ -23,55 +32,117 @@ class BaseReportController < ActionController::Base
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
day_ref = Time.now
|
||||
if period_type.to_i == 1
|
||||
if params[:from] && params[:to]
|
||||
if params[:from] != "" && params[:to] !=""
|
||||
from = DateTime.strptime(params[:from], "%m/%d/%Y")
|
||||
to = DateTime.strptime(params[:to], "%m/%d/%Y")
|
||||
else
|
||||
day_ref = Time.now.utc.getlocal
|
||||
|
||||
if params[:report_type] == "daily_sale"
|
||||
|
||||
if from != "" && to != ""
|
||||
|
||||
f_date = DateTime.parse(params[:from])
|
||||
t_date = DateTime.parse(params[:to])
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
|
||||
else
|
||||
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
end
|
||||
end
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
else # end daily sale report
|
||||
if period_type.to_i == 1
|
||||
|
||||
if params[:from] && params[:to]
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
if params[:from] != "" && params[:to] !=""
|
||||
|
||||
f_date = DateTime.parse(params[:from])
|
||||
t_date = DateTime.parse(params[:to])
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
else
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
end
|
||||
end
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return from, to
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Crm::BookingsController < BaseCrmController
|
||||
|
||||
load_and_authorize_resource
|
||||
def update_booking
|
||||
booking = Booking.find(params[:booking_id])
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Crm::CustomersController < BaseCrmController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_crm_customer, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /crm/customers
|
||||
@@ -7,23 +8,19 @@ class Crm::CustomersController < BaseCrmController
|
||||
filter = params[:filter]
|
||||
|
||||
if filter.nil?
|
||||
@crm_customers = Customer.order("customer_id").page(params[:page])
|
||||
#@products = Product.order("name").page(params[:page]).per(5)
|
||||
@crm_customers = Customer.all
|
||||
else
|
||||
@crm_customers = Customer.search(filter)
|
||||
|
||||
end
|
||||
#@crm_customers = Customer.all
|
||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
# @membership = Customer.get_member_group
|
||||
# if @membership["status"] == true
|
||||
# @member_group = @membership["data"]
|
||||
# end
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @crm_customers }
|
||||
@@ -50,15 +47,9 @@ class Crm::CustomersController < BaseCrmController
|
||||
end
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
if(response["status"] == true)
|
||||
@membership = response["data"]
|
||||
else
|
||||
@membership = 0
|
||||
end
|
||||
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
# @response = ""
|
||||
#end customer amount
|
||||
|
||||
end
|
||||
@@ -74,54 +65,64 @@ class Crm::CustomersController < BaseCrmController
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers.json
|
||||
def create
|
||||
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
puts @crm_customers.errors.to_json
|
||||
if @crm_customers.save
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
dob = customer_params[:date_of_birth]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
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
|
||||
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,
|
||||
member_group_id: member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
|
||||
if response["status"] == true
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
|
||||
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
||||
end
|
||||
# format.json { render :index, status: :created, location: @crm_customers }
|
||||
else
|
||||
|
||||
# @crm_customers.destroy
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||
if !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
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => {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,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
||||
end
|
||||
# format.json { render :index, status: :created, location: @crm_customers }
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
# @crm_customers.destroy
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -139,7 +140,6 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /crm/customers/1
|
||||
# PATCH/PUT /crm/customers/1.json
|
||||
def update
|
||||
@@ -151,30 +151,80 @@ end
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
id = @crm_customer.membership_id
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
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
|
||||
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
if id.nil? && !member_group_id.nil?
|
||||
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @crm_customer }
|
||||
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
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => { 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,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
|
||||
customer = Customer.find(@crm_customer.customer_id)
|
||||
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
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
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
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @crm_customer }
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
flash[:errors] = @crm_customers.errors
|
||||
flash[:errors] = @crm_customer.errors
|
||||
format.html { redirect_to crm_customers_path}
|
||||
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
|
||||
end
|
||||
@@ -201,6 +251,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)
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Crm::DiningQueuesController < BaseCrmController
|
||||
load_and_authorize_resource
|
||||
before_action :set_dining_queue, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /crm/dining_queues
|
||||
@@ -84,12 +85,15 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
queue = DiningQueue.find(params[:id])
|
||||
table_id = params[:table_id]
|
||||
|
||||
queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
respond_to do |format|
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Table was successfully assigned.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
status = queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
status = DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true , notice: 'Dining queue was successfully assigned .'})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -101,6 +105,6 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def dining_queue_params
|
||||
params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status)
|
||||
params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status,:seater,:remark)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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')
|
||||
|
||||
# @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
|
||||
|
||||
@@ -1,10 +1,34 @@
|
||||
class HomeController < ApplicationController
|
||||
skip_before_action :authenticate, only: [:index, :create, :destroy]
|
||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||
|
||||
def index
|
||||
@employees = Employee.all_emp_except_waiter.order("name asc")
|
||||
@login_form = LoginForm.new()
|
||||
end
|
||||
|
||||
def show
|
||||
@login_form = LoginForm.new()
|
||||
@login_form.emp_id = params[:emp_id]
|
||||
end
|
||||
|
||||
def update
|
||||
@login_form = LoginForm.new()
|
||||
@login_form.emp_id = params[:emp_id]
|
||||
@login_form.password = params[:login_form][:password]
|
||||
@employee = Employee.login(@login_form.emp_id, @login_form.password)
|
||||
|
||||
if @employee != nil
|
||||
session[:session_token] = @employee.token_session
|
||||
|
||||
#if cashier => already opening cahshier?
|
||||
|
||||
redirect_to origami_root_path
|
||||
route_by_role(@employee)
|
||||
else
|
||||
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@login_form = LoginForm.new()
|
||||
@login_form.emp_id = params[:login_form][:emp_id]
|
||||
@@ -18,12 +42,18 @@ class HomeController < ApplicationController
|
||||
elsif @employee.role == "cashier"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "manager"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "accountant"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
else
|
||||
render :index
|
||||
end
|
||||
else
|
||||
else
|
||||
redirect_to origami_root_path, :notice => "Username and Password dosn't match!"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -48,4 +78,25 @@ class HomeController < ApplicationController
|
||||
def settings_home_params
|
||||
params.require(:login_form).permit(:emp_id, :password)
|
||||
end
|
||||
|
||||
def route_by_role(employee)
|
||||
if employee.role == "administrator"
|
||||
redirect_to dashboard_path
|
||||
elsif employee.role == "cashier"
|
||||
#check if cashier has existing open cashier
|
||||
|
||||
# if !ShiftSale.current_open_shift(employee).nil?
|
||||
# redirect_to origami_root_path
|
||||
# else
|
||||
redirect_to new_origami_shift_path
|
||||
# end
|
||||
elsif employee.role == "checker"
|
||||
redirect_to oqs_root_path
|
||||
elsif employee.role == "waiter"
|
||||
redirect_to oqs_root_path
|
||||
elsif employee.role == "crm"
|
||||
redirect_to crm_root_path
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
18
app/controllers/oqs/edit_controller.rb
Normal file
18
app/controllers/oqs/edit_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Oqs::EditController < BaseOqsController
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'");
|
||||
end
|
||||
|
||||
def update
|
||||
order_items_id = params[:order_items_id]
|
||||
qty_weight = params[:qty_weight]
|
||||
remarks = params[:remarks]
|
||||
|
||||
order_item = OrderItem.find(order_items_id);
|
||||
order_item.qty = qty_weight
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
end
|
||||
end
|
||||
@@ -2,9 +2,11 @@ class Oqs::HomeController < BaseOqsController
|
||||
def index
|
||||
queue_stations=OrderQueueStation.all
|
||||
|
||||
@queue_items_details = queue_items_query(0)
|
||||
# Query for OQS with delivery status false
|
||||
@queue_items_details = queue_items_query(false)
|
||||
|
||||
@queue_completed_item = queue_items_query(1)
|
||||
# Query for OQS with delivery status true
|
||||
@queue_completed_item = queue_items_query(true)
|
||||
|
||||
@queue_stations_items=Array.new
|
||||
|
||||
@@ -30,14 +32,14 @@ class Oqs::HomeController < BaseOqsController
|
||||
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)
|
||||
# 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)
|
||||
# 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
|
||||
|
||||
@@ -49,7 +51,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
end
|
||||
end
|
||||
|
||||
# booking_id = dining.get_new_booking
|
||||
# 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|
|
||||
@@ -79,27 +81,43 @@ class Oqs::HomeController < BaseOqsController
|
||||
render :json => removed_item.to_json
|
||||
end
|
||||
|
||||
# Query for OQS with status
|
||||
def queue_items_query(status)
|
||||
# AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||
# .joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
||||
# left join dining_facilities as df on df.zone_id = oqpz.zone_id
|
||||
# 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
|
||||
# left join customers as cus ON cus.customer_id = od.customer_id")
|
||||
# .where("assigned_order_items.delivery_status = #{status}")
|
||||
# .group("assigned_order_items.assigned_order_item_id")
|
||||
# .order("odt.item_name DESC")
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status)
|
||||
# queue_items = []
|
||||
# AssignedOrderItem.all.each do |aoi|
|
||||
# oqs = OrderQueueStation.find(aoi.order_queue_station_id)
|
||||
# order = Order.find(aoi.order_id)
|
||||
# order_items = OrderItem.find_by_order_id(aoi.order_id)
|
||||
# booking_orders = BookingOrder.find_by_order_id(aoi.order_id)
|
||||
# booking = Booking.find(booking_orders.booking_id)
|
||||
# dining = DiningFacility.find(booking.dining_facility_id)
|
||||
# customer = Customer.find_by_customer_id(order.customer_id)
|
||||
# queue_item = {
|
||||
# :assigned_order_item_id => aoi.assigned_order_item_id,
|
||||
# :station_name => oqs.station_name,
|
||||
# :is_active => oqs.is_active,
|
||||
# :zone => dining.name,
|
||||
# :item_code => aoi.item_code,
|
||||
# :item_name => order_items.item_name,
|
||||
# :price => order_items.price,
|
||||
# :qty => order_items.qty,
|
||||
# :item_order_by => order_items.item_order_by,
|
||||
# :options => order_items.options,
|
||||
# :customer_name => customer.name,
|
||||
# :created_at => order_items.created_at
|
||||
# }
|
||||
# queue_items.push(queue_item)
|
||||
# end
|
||||
# return queue_items
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, 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 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
|
||||
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}")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,17 +2,21 @@ class Oqs::PrintController < ApplicationController
|
||||
# Print Order Item
|
||||
def print
|
||||
unique_code="OrderItemPdf"
|
||||
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 + "'");
|
||||
assigned_item_id = params[:id]
|
||||
options = params[:options]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# print when complete click
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(oqs,assigned_item.order_id, assigned_item.item_code )
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(oqs, assigned_item.order_id, assigned_item.item_code, print_status, options )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
@@ -21,24 +25,32 @@ class Oqs::PrintController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# Print Order Details
|
||||
# Print Order Details with booking id
|
||||
def print_order_summary
|
||||
unique_code="OrderSummaryPdf"
|
||||
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 + "'");
|
||||
assigned_item_id = params[:id]
|
||||
table_name = params[:table_name]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# get dining
|
||||
dining = DiningFacility.find_by_name(table_name);
|
||||
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
|
||||
# print when complete click
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_summary(oqs,assigned_item.order_id)
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_booking_summary(oqs, booking.booking_id, print_status)
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status=true
|
||||
ai.print_status = true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
|
||||
10
app/controllers/origami/cash_mgmt_controller.rb
Normal file
10
app/controllers/origami/cash_mgmt_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class Origami::CashMgmtController < ApplicationController
|
||||
def index
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
end
|
||||
end
|
||||
@@ -2,9 +2,31 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
@creditcount = @creditcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_credit = total - @creditcount - others
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "creditnote")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class Origami::CustomersController < BaseOrigamiController
|
||||
#Form to add customer -
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
|
||||
|
||||
end
|
||||
|
||||
# GET /crm/customers/1
|
||||
@@ -12,8 +10,17 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
|
||||
def add_customer
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
filter = params[:filter]
|
||||
@sale_id = params[:sale_id]
|
||||
if(@sale_id[0,3] == "SAL")
|
||||
@booking = Booking.find_by_sale_id(@sale_id)
|
||||
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
|
||||
else
|
||||
@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]
|
||||
|
||||
filter = params[:filter]
|
||||
|
||||
@@ -39,5 +46,33 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def update_sale_by_customer
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
sale.sale_orders.each do |sale_order|
|
||||
order = Order.find(sale_order.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
end
|
||||
else
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
|
||||
|
||||
@orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Origami::DiscountsController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
def index
|
||||
@@ -6,52 +7,96 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
end
|
||||
|
||||
@accounts = Account.all
|
||||
end
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
discount_items = JSON.parse(params[:discount_items])
|
||||
overall_discount = params[:overall_discount]
|
||||
sub_total = params[:sub_total]
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
sale.total_discount = overall_discount.to_f
|
||||
sale.total_amount = sub_total.to_f
|
||||
sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
||||
sale.save
|
||||
if discount_items.length > 0
|
||||
#save sale item for discount
|
||||
discount_items.each do |di|
|
||||
puts di
|
||||
origin_sale_item = SaleItem.find(di["id"])
|
||||
sale_item = SaleItem.new
|
||||
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
sale_item.product_name = di["name"]
|
||||
sale_item.remark = "Discount"
|
||||
|
||||
sale_item.qty = 1
|
||||
sale_item.unit_price = di["price"]
|
||||
sale_item.taxable_price = di["price"]
|
||||
sale_item.is_taxable = 0
|
||||
|
||||
sale_item.price = di["price"]
|
||||
sale_item.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
render :json => dining.to_json
|
||||
end
|
||||
|
||||
#discount for selected order
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
sale_item_id = params[:sale_item_id]
|
||||
discount_type = params[:discount_type]
|
||||
discount_value = params[:discount_value]
|
||||
discount_amount = params[:discount_amount]
|
||||
grand_total = params[:grand_total]
|
||||
product_name = "Overall Discount"
|
||||
# def create
|
||||
# sale_id = params[:sale_id]
|
||||
# sale_item_id = params[:sale_item_id]
|
||||
# discount_type = params[:discount_type]
|
||||
# discount_value = params[:discount_value]
|
||||
# discount_amount = params[:discount_amount]
|
||||
# grand_total = params[:grand_total]
|
||||
# product_name = "Overall Discount"
|
||||
|
||||
if discount_type == 0
|
||||
remark="Discount " + discount_amount + " as net"
|
||||
else
|
||||
remark="Discount " + discount_amount + " as percentage"
|
||||
end
|
||||
# if discount_type == 0
|
||||
# remark="Discount " + discount_amount + " as net"
|
||||
# else
|
||||
# remark="Discount " + discount_amount + " as percentage"
|
||||
# end
|
||||
|
||||
#update discount for sale
|
||||
sale = Sale.find(sale_id)
|
||||
sale.total_discount = sale.total_discount + discount_amount.to_f
|
||||
sale.grand_total = grand_total
|
||||
sale.save
|
||||
# #update discount for sale
|
||||
# sale = Sale.find(sale_id)
|
||||
# sale.total_discount = sale.total_discount + discount_amount.to_f
|
||||
# sale.grand_total = grand_total
|
||||
# sale.save
|
||||
|
||||
#save sale item for discount
|
||||
if sale_item_id != nil
|
||||
origin_sale_item = SaleItem.find(sale_item_id)
|
||||
product_name = origin_sale_item.product_name + "-Disocunt"
|
||||
end
|
||||
sale_item = SaleItem.new
|
||||
# #save sale item for discount
|
||||
# if sale_item_id != nil
|
||||
# origin_sale_item = SaleItem.find(sale_item_id)
|
||||
# product_name = origin_sale_item.product_name + "-Disocunt"
|
||||
# end
|
||||
# sale_item = SaleItem.new
|
||||
|
||||
#pull
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
sale_item.product_name = product_name
|
||||
sale_item.remark = remark
|
||||
# #pull
|
||||
# sale_item.sale_id = sale_id
|
||||
# sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
# sale_item.product_name = product_name
|
||||
# sale_item.remark = remark
|
||||
|
||||
sale_item.qty = 1
|
||||
sale_item.unit_price = (0-discount_amount.to_f)
|
||||
sale_item.taxable_price = discount_amount
|
||||
sale_item.is_taxable = 0
|
||||
# sale_item.qty = 1
|
||||
# sale_item.unit_price = (0-discount_amount.to_f)
|
||||
# sale_item.taxable_price = discount_amount
|
||||
# sale_item.is_taxable = 0
|
||||
|
||||
sale_item.price = sale_item.qty * sale_item.unit_price
|
||||
sale_item.save
|
||||
# sale_item.price = sale_item.qty * sale_item.unit_price
|
||||
# sale_item.save
|
||||
|
||||
redirect_to origami_path(sale_id)
|
||||
end
|
||||
# redirect_to origami_path(sale_id)
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,84 +1,59 @@
|
||||
class Origami::HomeController < BaseOrigamiController
|
||||
before_action :set_dining, only: [:show]
|
||||
|
||||
def index
|
||||
if params[:booking_id] != nil
|
||||
type=params[:booking_id].split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@selected_item = Sale.find(params[:booking_id])
|
||||
@selected_item_type="Sale"
|
||||
# Booking
|
||||
else
|
||||
@selected_item = Order.find(params[:booking_id])
|
||||
@selected_item_type="Order"
|
||||
end
|
||||
end
|
||||
|
||||
@completed_orders = Order.get_completed_order()
|
||||
@booking_orders = Order.get_booking_order_table()
|
||||
@booking_rooms = Order.get_booking_order_rooms()
|
||||
@orders = Order.get_orders()
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
end
|
||||
|
||||
def item_show
|
||||
selection(params[:booking_id],1)
|
||||
end
|
||||
# origami table detail
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
|
||||
def selection(selected_id, is_ajax)
|
||||
str = []
|
||||
type=selected_id.split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@order_details = SaleItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
# Booking
|
||||
else
|
||||
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
end
|
||||
|
||||
if is_ajax == 1
|
||||
render :json => str.to_json
|
||||
else
|
||||
str
|
||||
end
|
||||
end
|
||||
|
||||
def update_sale_by_customer
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
else
|
||||
sale = Order.find(params[:sale_id])
|
||||
end
|
||||
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def get_customer
|
||||
|
||||
@customer = Customer.find(params[:customer_id])
|
||||
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
respond_to do |format|
|
||||
format.js do
|
||||
render :json => {
|
||||
:response_data => response.as_json,
|
||||
:customer => @customer}
|
||||
end
|
||||
@dining.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)
|
||||
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 = 'order'
|
||||
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'
|
||||
end
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
@customer = sale.customer
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_dining
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
84
app/controllers/origami/home_controller_bk.rb
Normal file
84
app/controllers/origami/home_controller_bk.rb
Normal file
@@ -0,0 +1,84 @@
|
||||
class Origami::HomeController < BaseOrigamiController
|
||||
def index
|
||||
if params[:booking_id] != nil
|
||||
type=params[:booking_id].split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@selected_item = Sale.find(params[:booking_id])
|
||||
@selected_item_type="Sale"
|
||||
# Booking
|
||||
else
|
||||
@selected_item = Order.find(params[:booking_id])
|
||||
@selected_item_type="Order"
|
||||
end
|
||||
end
|
||||
|
||||
@completed_orders = Order.get_completed_order()
|
||||
@booking_orders = Order.get_booking_order_table()
|
||||
@booking_rooms = Order.get_booking_order_rooms()
|
||||
@orders = Order.get_orders()
|
||||
end
|
||||
|
||||
def item_show
|
||||
selection(params[:booking_id],1)
|
||||
end
|
||||
|
||||
def selection(selected_id, is_ajax)
|
||||
str = []
|
||||
type=selected_id.split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@order_details = SaleItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
# Booking
|
||||
else
|
||||
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
end
|
||||
|
||||
if is_ajax == 1
|
||||
render :json => str.to_json
|
||||
else
|
||||
str
|
||||
end
|
||||
end
|
||||
|
||||
def update_sale_by_customer
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
else
|
||||
sale = Order.find(params[:sale_id])
|
||||
end
|
||||
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def get_customer
|
||||
|
||||
@customer = Customer.find(params[:customer_id])
|
||||
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
respond_to do |format|
|
||||
format.js do
|
||||
render :json => {
|
||||
:response_data => response.as_json,
|
||||
:customer => @customer}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
39
app/controllers/origami/moveroom_controller.rb
Normal file
39
app/controllers/origami/moveroom_controller.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
class Origami::MoveroomController < BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
|
||||
@status_order = ""
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
@dining.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 = order
|
||||
@date = order.created_at
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
55
app/controllers/origami/movetable_controller.rb
Normal file
55
app/controllers/origami/movetable_controller.rb
Normal file
@@ -0,0 +1,55 @@
|
||||
class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
@dining.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 = order
|
||||
@date = order.created_at
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def moving
|
||||
change_to = params[:change_to] #new
|
||||
change_from = params[:change_from] #original
|
||||
bookings = Booking.where('dining_facility_id=?',change_from)
|
||||
booking_array = Array.new
|
||||
bookings.each do | booking |
|
||||
if booking.sale_id.nil? || booking.sale.sale_status != 'completed' || booking.booking_status != 'moved'
|
||||
booking_array.push(booking)
|
||||
end
|
||||
end
|
||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||
end
|
||||
end
|
||||
17
app/controllers/origami/orders_controller.rb
Normal file
17
app/controllers/origami/orders_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Origami::OrdersController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('status desc')
|
||||
@order = Order.find(params[:order_id])
|
||||
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
||||
if sale_order
|
||||
unless sale_order.sale_id.nil?
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
@sale_status = sale.sale_status
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
end
|
||||
|
||||
@@ -10,21 +10,25 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
|
||||
rebate_amount = nil
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,6 +41,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@visacount= 0.0
|
||||
@jcbcount= 0.0
|
||||
@mastercount = 0.0
|
||||
@credit = 0.0
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
#get customer amount
|
||||
@@ -49,9 +54,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@accountable_type = ''
|
||||
if response["status"]==true
|
||||
response["data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount"
|
||||
@balance = res["balance"]
|
||||
@accountable_type = res["accountable_type"]
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@balance += res["balance"]
|
||||
# @accountable_type = res["accountable_type"]
|
||||
@accountable_type = "Rebate Balance"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -72,6 +78,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@jcbcount += spay.payment_amount
|
||||
elsif spay.payment_method == "master"
|
||||
@mastercount += spay.payment_amount
|
||||
elsif spay.payment_method == "creditnote"
|
||||
@credit += spay.payment_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -86,17 +94,19 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# Calculate Food and Beverage Total
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||
# Calculate price_by_accounts
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,24 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
|
||||
# limit redeem_amount
|
||||
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
||||
# rebate_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
||||
# nonrebate_prices = sale_data.total_amount - rebate_prices
|
||||
# @payparcount = 0
|
||||
# others = 0
|
||||
# sale_data.sale_payments.each do |sale_payment|
|
||||
# if sale_payment.payment_method == "paypar"
|
||||
# @payparcount = @payparcount + sale_payment.payment_amount
|
||||
# else
|
||||
# others = others + sale_payment.payment_amount
|
||||
# end
|
||||
# end
|
||||
# non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax)
|
||||
# if non_rebate_exceed < 0
|
||||
# @redeem_prices = rebate_prices - @payparcount
|
||||
# else
|
||||
# @redeem_prices = rebate_prices - @payparcount -non_rebate_exceed
|
||||
# end
|
||||
|
||||
@payparcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
@@ -16,12 +33,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
is_bervage_exceed = others - (beverage_prices + sale_data.total_tax)
|
||||
if is_bervage_exceed < 0
|
||||
@food_prices = food_prices - @payparcount
|
||||
else
|
||||
@food_prices = food_prices - @payparcount -is_bervage_exceed
|
||||
end
|
||||
@redeem_prices = sale_data.grand_total - @payparcount -others
|
||||
|
||||
|
||||
if sale_data
|
||||
if sale_data.customer_id
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
# Print Request Bill and add to sale tables
|
||||
def print
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
booking_id = params[:id]
|
||||
check_booking = Booking.find_by_booking_id(booking_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)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
puts "current_login_employee"
|
||||
@@ -19,19 +21,25 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.where('customer_id=' + @sale_data.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
customer= Customer.find(@sale_data.customer_id)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# find order id by sale id
|
||||
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||
|
||||
# Calculate Food and Beverage Total
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)
|
||||
# Calculate price_by_accounts
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
|
||||
redirect_to origami_path(@sale_data.sale_id)
|
||||
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
||||
# redirect_to origami_path(@sale_data.sale_id)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
40
app/controllers/origami/room_invoices_controller.rb
Normal file
40
app/controllers/origami/room_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
class Origami::RoomInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
puts "room bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@sale = Sale.find(params[:invoice_id])
|
||||
@date = @sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@customer = @sale.customer
|
||||
end
|
||||
|
||||
end
|
||||
35
app/controllers/origami/rooms_controller.rb
Normal file
35
app/controllers/origami/rooms_controller.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
class Origami::RoomsController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@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"
|
||||
@status = 'sale'
|
||||
@obj = sale
|
||||
@customer = sale.customer
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
58
app/controllers/origami/sale_edit_controller.rb
Normal file
58
app/controllers/origami/sale_edit_controller.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
class Origami::SaleEditController < BaseOrigamiController
|
||||
|
||||
# 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.product_name = saleitemObj.product_name + " - void"
|
||||
@newsaleitem.save
|
||||
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
|
||||
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
|
||||
end
|
||||
|
||||
def apply_void
|
||||
sale_id = params[:sale_id]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
end
|
||||
44
app/controllers/origami/sales_controller.rb
Normal file
44
app/controllers/origami/sales_controller.rb
Normal file
@@ -0,0 +1,44 @@
|
||||
class Origami::SalesController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
end
|
||||
|
||||
def add_to_existing_invoice
|
||||
dining = params[:dining_id]
|
||||
sale_id = params[:sale_id]
|
||||
table = DiningFacility.find(dining)
|
||||
table.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
booking.booking_orders.each do |booking_order|
|
||||
booking.booking_status = 'moved'
|
||||
order = Order.find(booking_order.order_id)
|
||||
order.status = 'billed'
|
||||
order.order_items.each do |item|
|
||||
item.order_item_status = 'billed'
|
||||
end
|
||||
# create sale item
|
||||
saleobj = Sale.find(sale_id)
|
||||
order.order_items.each do |orer_item|
|
||||
saleobj.add_item (orer_item)
|
||||
end
|
||||
saleobj.save
|
||||
order.save
|
||||
booking.save
|
||||
end
|
||||
existing_booking = Booking.find_by_sale_id(sale_id)
|
||||
booking_order = BookingOrder.where('booking_id=?',booking)
|
||||
booking_order.each do |bo|
|
||||
bo.booking_id = existing_booking.booking_id
|
||||
bo.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
13
app/controllers/origami/shifts_controller.rb
Normal file
13
app/controllers/origami/shifts_controller.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class Origami::ShiftsController < ApplicationController
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
end
|
||||
40
app/controllers/origami/table_invoices_controller.rb
Normal file
40
app/controllers/origami/table_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
class Origami::TableInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
puts "table bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@table.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@sale_array = Array.new
|
||||
@table.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@sale = Sale.find(params[:invoice_id])
|
||||
@date = @sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@customer = @sale.customer
|
||||
end
|
||||
|
||||
end
|
||||
36
app/controllers/origami/void_controller.rb
Normal file
36
app/controllers/origami/void_controller.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
def overall_void
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
bookings = sale.bookings
|
||||
bookings.each do |booking|
|
||||
orders = booking.orders
|
||||
orders.each do |order|
|
||||
# order.status = 'void'
|
||||
end
|
||||
end
|
||||
|
||||
table_avaliable = true
|
||||
table = sale.bookings[0].dining_facility
|
||||
table.bookings.each do |booking|
|
||||
if booking.sale.sale_status == 'new'
|
||||
table_avaliable = false
|
||||
end
|
||||
end
|
||||
|
||||
if table_avaliable == true
|
||||
table.status = 'available'
|
||||
table.save
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class PrintSettingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /print_settings
|
||||
|
||||
19
app/controllers/reports/bksale_items_controller.rb
Normal file
19
app/controllers/reports/bksale_items_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Reports::SaleItemsController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
class Reports::DailySaleController < BaseReportController
|
||||
|
||||
def index
|
||||
from, to = get_date_range_from_params
|
||||
@sale_data = Sale.get_receipt_no_list(from,to)
|
||||
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
|
||||
end
|
||||
|
||||
end
|
||||
17
app/controllers/reports/daily_sales_controller.rb
Normal file
17
app/controllers/reports/daily_sales_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Reports::DailySalesController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
from, to ,report_type = get_date_range_from_params
|
||||
@sale_data = Sale.daily_sales_list(from,to)
|
||||
@tax = SaleTax.get_tax(from,to)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
17
app/controllers/reports/daily_salesbk_controller.rb
Normal file
17
app/controllers/reports/daily_salesbk_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Reports::DailySalesController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
from, to ,report_type = get_date_range_from_params
|
||||
@sale_data = Sale.daily_sales_list(from,to)
|
||||
@tax = SaleTax.get_tax(from,to)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class Reports::ReceiptNoController < BaseReportController
|
||||
|
||||
def index
|
||||
from, to = get_date_range_from_params
|
||||
puts "from..."
|
||||
@@ -7,6 +8,10 @@ class Reports::ReceiptNoController < BaseReportController
|
||||
puts to
|
||||
@sale_data = Sale.get_receipt_no_list(from,to)
|
||||
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
19
app/controllers/reports/sale_items_controller.rb
Normal file
19
app/controllers/reports/sale_items_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Reports::SaleItemsController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::AccountsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_account, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/accounts
|
||||
@@ -68,6 +69,6 @@ class Settings::AccountsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def account_params
|
||||
params.require(:account).permit(:title, :account_type)
|
||||
params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::CashierTerminalsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_cashier_terminal, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/cashier_terminals
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
class Settings::EmployeesController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
before_action :set_employee, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
|
||||
# GET /employees
|
||||
# GET /employees.json
|
||||
def index
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MembershipActionsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_membership_action, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/membership_actions
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MembershipSettingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_membership_setting, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/membership_settings
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuCategoriesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_category, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_menu, only: [:new]
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuItemAttributesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_item_attribute, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/menu_item_attributes
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuItemInstancesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_item_instance, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_menu_item, only: [ :show, :edit, :new, :update]
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuItemOptionsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_item_option, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/menu_item_options
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenusController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/menus
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::OrderQueueStationsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/order_queue_stations
|
||||
@@ -27,6 +28,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
def create
|
||||
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
|
||||
@settings_order_queue_station.created_by = current_login_employee.name
|
||||
@settings_order_queue_station.processing_items = "[]"
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.save
|
||||
format.html { redirect_to settings_order_queue_stations_path, notice: 'Order queue station was successfully created.' }
|
||||
@@ -41,7 +43,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
# PATCH/PUT /settings/order_queue_stations/1
|
||||
# PATCH/PUT /settings/order_queue_stations/1.json
|
||||
def update
|
||||
params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect
|
||||
# params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.update(settings_order_queue_station_params)
|
||||
format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::PaymentMethodSettingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_payment_method_setting, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/payment_method_settings
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Settings::RoomsController < ApplicationController
|
||||
before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create]
|
||||
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create,:destroy]
|
||||
# GET /settings/rooms
|
||||
# GET /settings/rooms.json
|
||||
def index
|
||||
@@ -28,9 +28,10 @@ class Settings::RoomsController < ApplicationController
|
||||
@settings_room = Room.new(settings_room_params)
|
||||
@settings_room.type = DiningFacility::ROOM_TYPE
|
||||
@settings_room.zone_id = params[:zone_id]
|
||||
@settings_room.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_room.save
|
||||
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully created.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_room }
|
||||
else
|
||||
puts "abc"
|
||||
@@ -43,9 +44,10 @@ class Settings::RoomsController < ApplicationController
|
||||
# PATCH/PUT /settings/rooms/1
|
||||
# PATCH/PUT /settings/rooms/1.json
|
||||
def update
|
||||
@settings_room.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_room.update(settings_room_params)
|
||||
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully updated.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_room }
|
||||
else
|
||||
format.html { render :edit }
|
||||
@@ -59,7 +61,7 @@ class Settings::RoomsController < ApplicationController
|
||||
def destroy
|
||||
@settings_room.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_zones_path, notice: 'Room was successfully destroyed.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,12 +28,12 @@ class Settings::TablesController < ApplicationController
|
||||
@settings_table = Table.new(settings_table_params)
|
||||
@settings_table.type = DiningFacility::TABLE_TYPE
|
||||
@settings_table.zone_id = params[:zone_id]
|
||||
@settings_table.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_table.save
|
||||
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully created.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_table }
|
||||
else
|
||||
puts "abc"
|
||||
format.html { render :new }
|
||||
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
|
||||
end
|
||||
@@ -43,9 +43,10 @@ class Settings::TablesController < ApplicationController
|
||||
# PATCH/PUT /settings/tables/1
|
||||
# PATCH/PUT /settings/tables/1.json
|
||||
def update
|
||||
@settings_table.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_table.update(settings_table_params)
|
||||
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully updated.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_table }
|
||||
else
|
||||
format.html { render :edit }
|
||||
@@ -59,7 +60,7 @@ class Settings::TablesController < ApplicationController
|
||||
def destroy
|
||||
@settings_table.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_zones_path, notice: 'Table was successfully destroyed.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::TaxProfilesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_tax_profile, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/tax_profiles
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::ZonesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_zone, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/zones
|
||||
@@ -27,7 +28,7 @@ class Settings::ZonesController < ApplicationController
|
||||
# POST /settings/zones.json
|
||||
def create
|
||||
@settings_zone = Zone.new(settings_zone_params)
|
||||
|
||||
@settings_zone.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_zone.save
|
||||
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' }
|
||||
@@ -43,6 +44,7 @@ class Settings::ZonesController < ApplicationController
|
||||
# PATCH/PUT /settings/zones/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
@settings_zone.created_by = current_login_employee.name
|
||||
if @settings_zone.update(settings_zone_params)
|
||||
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_zone }
|
||||
@@ -56,6 +58,8 @@ class Settings::ZonesController < ApplicationController
|
||||
# DELETE /settings/zones/1
|
||||
# DELETE /settings/zones/1.json
|
||||
def destroy
|
||||
@settings_zone.rooms.destroy
|
||||
@settings_zone.tables.destroy
|
||||
@settings_zone.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' }
|
||||
|
||||
18
app/controllers/transactions/credit_notes_controller.rb
Normal file
18
app/controllers/transactions/credit_notes_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Transactions::CreditNotesController < ApplicationController
|
||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /transactions/sales
|
||||
# GET /transactions/sales.json
|
||||
def index
|
||||
|
||||
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sales }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class Transactions::OrdersController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Transactions::SalesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /transactions/sales
|
||||
@@ -53,13 +54,7 @@ class Transactions::SalesController < ApplicationController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale.customer_id)
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
if(response["status"] == true)
|
||||
@membership = response["data"]
|
||||
else
|
||||
@membership = 0
|
||||
end
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
#end customer amount
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
16
app/forms/open_shift_form.rb
Normal file
16
app/forms/open_shift_form.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class LoginForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Validations
|
||||
|
||||
attr_accessor :float_amount
|
||||
validates_presence_of :float_amount
|
||||
|
||||
def persisted?
|
||||
false
|
||||
end
|
||||
|
||||
def initialize(attributes={})
|
||||
super
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,2 +1,11 @@
|
||||
module ApplicationHelper
|
||||
|
||||
def flash_class(level)
|
||||
case level
|
||||
when :notice then "alert alert-info fade-in"
|
||||
when :success then "alert alert-success fade-in"
|
||||
when :error then "alert alert-error fade-in"
|
||||
when :alert then "alert alert-error fade-in"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
2
app/helpers/cash_mgmt_helper.rb
Normal file
2
app/helpers/cash_mgmt_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module CashMgmtHelper
|
||||
end
|
||||
2
app/helpers/origami/shifts_helper.rb
Normal file
2
app/helpers/origami/shifts_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Origami::ShiftsHelper
|
||||
end
|
||||
2
app/helpers/reports/daily_sales_helper.rb
Normal file
2
app/helpers/reports/daily_sales_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Reports::DailySalesHelper
|
||||
end
|
||||
2
app/helpers/reports/dailysales_helper.rb
Normal file
2
app/helpers/reports/dailysales_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Reports::DailysalesHelper
|
||||
end
|
||||
2
app/helpers/reports/sale_items_helper.rb
Normal file
2
app/helpers/reports/sale_items_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Reports::SaleItemsHelper
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user