Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring
This commit is contained in:
2
.idea/.generators
generated
2
.idea/.generators
generated
@@ -5,4 +5,4 @@ You are allowed to:
|
||||
2. Remove generators
|
||||
3. Add installed generators
|
||||
To add new installed generators automatically delete this file and reload the project.
|
||||
--><GeneratorsGroup><Generator name="assets" /><Generator name="cancan:ability" /><Generator name="channel" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="factory_girl:model" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="kaminari:config" /><Generator name="kaminari:views" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="resource" /><Generator name="rspec:controller" /><Generator name="rspec:feature" /><Generator name="rspec:helper" /><Generator name="rspec:install" /><Generator name="rspec:integration" /><Generator name="rspec:job" /><Generator name="rspec:mailer" /><Generator name="rspec:model" /><Generator name="rspec:observer" /><Generator name="rspec:request" /><Generator name="rspec:scaffold" /><Generator name="rspec:view" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="sidekiq:worker" /><Generator name="simple_form:install" /><Generator name="system_test" /><Generator name="task" /><Generator name="test_unit:controller" /><Generator name="test_unit:generator" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:job" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /><Generator name="test_unit:system" /></GeneratorsGroup></Settings>
|
||||
--><GeneratorsGroup><Generator name="assets" /><Generator name="cancan:ability" /><Generator name="channel" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="factory_girl:model" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="kaminari:config" /><Generator name="kaminari:views" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="resource" /><Generator name="rspec:controller" /><Generator name="rspec:feature" /><Generator name="rspec:helper" /><Generator name="rspec:install" /><Generator name="rspec:integration" /><Generator name="rspec:job" /><Generator name="rspec:mailer" /><Generator name="rspec:model" /><Generator name="rspec:observer" /><Generator name="rspec:request" /><Generator name="rspec:scaffold" /><Generator name="rspec:view" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="sidekiq:worker" /><Generator name="simple_form:install" /><Generator name="system_test" /><Generator name="task" /><Generator name="test_unit:controller" /><Generator name="test_unit:generator" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:job" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /><Generator name="test_unit:system" /><Generator name="uploader" /></GeneratorsGroup></Settings>
|
||||
|
||||
1
.idea/sxrestaurant.iml
generated
1
.idea/sxrestaurant.iml
generated
@@ -142,6 +142,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.14.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="byebug (v9.0.6, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="cancancan (v1.17.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="carrierwave (v1.1.0, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="chronic (v0.10.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="coffee-rails (v4.2.2, rbenv: 2.3.3) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="coffee-script (v2.4.1, rbenv: 2.3.3) [gem]" level="application" />
|
||||
|
||||
467
.idea/workspace.xml
generated
467
.idea/workspace.xml
generated
@@ -2,11 +2,25 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/controllers/commissioners_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/origami/commissioners_controller.rb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/controllers/commissions_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/_commissioner.json.jbuilder" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/_commissioner.json.jbuilder" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/_form.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/_form.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/edit.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/edit.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/index.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/index.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/index.json.jbuilder" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/index.json.jbuilder" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/new.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/new.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/show.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/show.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissioners/show.json.jbuilder" afterPath="$PROJECT_DIR$/app/views/origami/commissioners/show.json.jbuilder" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/_commission.json.jbuilder" afterPath="$PROJECT_DIR$/app/views/origami/commissions/_commission.json.jbuilder" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/_form.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissions/_form.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/edit.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissions/edit.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/index.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissions/index.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/index.json.jbuilder" afterPath="$PROJECT_DIR$/app/views/origami/commissions/index.json.jbuilder" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/new.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissions/new.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/show.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissions/show.html.erb" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/app/views/commissions/show.json.jbuilder" afterPath="$PROJECT_DIR$/app/views/origami/commissions/show.json.jbuilder" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/sale.rb" afterPath="$PROJECT_DIR$/app/models/sale.rb" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config/routes.rb" afterPath="$PROJECT_DIR$/config/routes.rb" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.bundle/" />
|
||||
@@ -21,53 +35,104 @@
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="sale_edit_controller.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb">
|
||||
<file leaf-file-name="20170821093252_create_commissions.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/db/migrate/20170821093252_create_commissions.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="372">
|
||||
<caret line="40" column="60" lean-forward="true" selection-start-line="40" selection-start-column="60" selection-end-line="40" selection-end-column="60" />
|
||||
<state relative-caret-position="36">
|
||||
<caret line="2" column="36" lean-forward="true" selection-start-line="2" selection-start-column="36" selection-end-line="2" selection-end-column="36" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<file leaf-file-name="commissioners_controller.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/commissioners_controller.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="254">
|
||||
<caret line="51" column="8" lean-forward="true" selection-start-line="51" selection-start-column="8" selection-end-line="51" selection-end-column="8" />
|
||||
<state relative-caret-position="36">
|
||||
<caret line="2" column="0" lean-forward="true" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="sale.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/models/sale.rb">
|
||||
<file leaf-file-name="commissions_controller.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="321">
|
||||
<caret line="270" column="45" lean-forward="true" selection-start-line="270" selection-start-column="45" selection-end-line="270" selection-end-column="45" />
|
||||
<state relative-caret-position="1010">
|
||||
<caret line="59" column="38" lean-forward="true" selection-start-line="59" selection-start-column="38" selection-end-line="59" selection-end-column="38" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="edit.html.erb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb">
|
||||
<file leaf-file-name="new.html.erb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/new.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="213">
|
||||
<caret line="58" column="112" lean-forward="false" selection-start-line="58" selection-start-column="112" selection-end-line="58" selection-end-column="112" />
|
||||
<state relative-caret-position="36">
|
||||
<caret line="2" column="14" lean-forward="false" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="routes.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/config/routes.rb">
|
||||
<file leaf-file-name="_form.html.erb" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/_form.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="83" column="43" lean-forward="false" selection-start-line="83" selection-start-column="43" selection-end-line="83" selection-end-column="43" />
|
||||
<state relative-caret-position="126">
|
||||
<caret line="7" column="27" lean-forward="true" selection-start-line="7" selection-start-column="27" selection-end-line="7" selection-end-column="27" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="index.html.erb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/index.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="234">
|
||||
<caret line="13" column="10" lean-forward="true" selection-start-line="13" selection-start-column="10" selection-end-line="13" selection-end-column="10" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="cash_outs_controller.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/cash_outs_controller.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="57" lean-forward="false" selection-start-line="0" selection-start-column="36" selection-end-line="0" selection-end-column="57" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="commissioner.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/models/commissioner.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="38" lean-forward="false" selection-start-line="0" selection-start-column="38" selection-end-line="0" selection-end-column="38" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="booking_order.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/models/booking_order.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="commission.rb" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/app/models/commission.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -104,11 +169,19 @@
|
||||
<option value="$PROJECT_DIR$/app/views/home/show.html.erb" />
|
||||
<option value="$PROJECT_DIR$/app/models/ability.rb" />
|
||||
<option value="$PROJECT_DIR$/app/views/home/dashboard.html.erb" />
|
||||
<option value="$PROJECT_DIR$/config/routes.rb" />
|
||||
<option value="$PROJECT_DIR$/app/models/sale.rb" />
|
||||
<option value="$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb" />
|
||||
<option value="$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb" />
|
||||
<option value="$PROJECT_DIR$/.gitignore" />
|
||||
<option value="$PROJECT_DIR$/db/migrate/20170818051922_create_commissioner.rb" />
|
||||
<option value="$PROJECT_DIR$/app/models/sale.rb" />
|
||||
<option value="$PROJECT_DIR$/db/migrate/20170818090115_create_commissioners.rb" />
|
||||
<option value="$PROJECT_DIR$/db/migrate/20170821093252_create_commissions.rb" />
|
||||
<option value="$PROJECT_DIR$/config/routes.rb" />
|
||||
<option value="$PROJECT_DIR$/app/controllers/origami/commissioners_controller.rb" />
|
||||
<option value="$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb" />
|
||||
<option value="$PROJECT_DIR$/app/views/origami/commissions/index.html.erb" />
|
||||
<option value="$PROJECT_DIR$/app/views/origami/commissions/new.html.erb" />
|
||||
<option value="$PROJECT_DIR$/app/views/origami/commissions/_form.html.erb" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -142,6 +215,7 @@
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scratches" />
|
||||
<pane id="RailsProjectView" />
|
||||
<pane id="Scope">
|
||||
<subPane subId="Project Files">
|
||||
@@ -157,7 +231,6 @@
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scratches" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<PATH>
|
||||
@@ -170,6 +243,70 @@
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="lib" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="lib" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="tasks" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="db" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="db" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="migrate" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
@@ -183,6 +320,90 @@
|
||||
<option name="myItemId" value="app" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="views" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="app" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="views" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="origami" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="app" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="views" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="origami" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="commissioners" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="app" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="sxrestaurant" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="app" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="models" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
@@ -233,6 +454,12 @@
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="add_unversioned_files" value="$PROJECT_DIR$/config/database.yml" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/app/views/origami" />
|
||||
<recent name="$PROJECT_DIR$/app/controllers/origami" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
@@ -556,18 +783,19 @@
|
||||
<workItem from="1498458295318" duration="2552000" />
|
||||
<workItem from="1498465879846" duration="18792000" />
|
||||
<workItem from="1502681128282" duration="12098000" />
|
||||
<workItem from="1502780405774" duration="2251000" />
|
||||
<workItem from="1502780405774" duration="8876000" />
|
||||
<workItem from="1503287439872" duration="5377000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="40110000" />
|
||||
<option name="totallyTimeSpent" value="52112000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1440" y="22" width="1920" height="724" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17518637" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1773163" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32978722" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
@@ -598,23 +826,6 @@
|
||||
<watches-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/rooms/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sales_controller.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/models/sale_payment.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/application_controller.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/customers/index.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/master_controller.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/models/dining_facility.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/movetable_controller.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/orders_controller.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/payments/create.json.jbuilder" />
|
||||
<entry file="file://$PROJECT_DIR$/app/models/printer/receipt_printer.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/request_bills_controller.rb" />
|
||||
@@ -656,42 +867,168 @@
|
||||
<entry file="file://$PROJECT_DIR$/app/views/home/show.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/home/dashboard.html.erb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/models/ability.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/config/routes.rb">
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="83" column="43" lean-forward="false" selection-start-line="83" selection-start-column="43" selection-end-line="83" selection-end-column="43" />
|
||||
<state relative-caret-position="344">
|
||||
<caret line="56" column="0" lean-forward="false" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/db/migrate/20170818051922_create_commissioner.rb" />
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="218">
|
||||
<caret line="38" column="17" lean-forward="true" selection-start-line="38" selection-start-column="17" selection-end-line="38" selection-end-column="17" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/models/sale.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="321">
|
||||
<caret line="270" column="45" lean-forward="true" selection-start-line="270" selection-start-column="45" selection-end-line="270" selection-end-column="45" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="213">
|
||||
<caret line="58" column="112" lean-forward="false" selection-start-line="58" selection-start-column="112" selection-end-line="58" selection-end-column="112" />
|
||||
<folding />
|
||||
<state relative-caret-position="303">
|
||||
<caret line="269" column="45" lean-forward="false" selection-start-line="269" selection-start-column="45" selection-end-line="269" selection-end-column="45" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="372">
|
||||
<caret line="40" column="60" lean-forward="true" selection-start-line="40" selection-start-column="60" selection-end-line="40" selection-end-column="60" />
|
||||
<caret line="40" column="60" lean-forward="false" selection-start-line="40" selection-start-column="60" selection-end-line="40" selection-end-column="60" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/db/migrate/20170403155230_create_employees.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="270">
|
||||
<caret line="15" column="0" lean-forward="false" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<entry file="file://$PROJECT_DIR$/db/migrate/20170818090115_create_commissioners.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="254">
|
||||
<caret line="51" column="8" lean-forward="true" selection-start-line="51" selection-start-column="8" selection-end-line="51" selection-end-column="8" />
|
||||
<state relative-caret-position="126">
|
||||
<caret line="7" column="26" lean-forward="true" selection-start-line="3" selection-start-column="6" selection-end-line="7" selection-end-column="26" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/config/routes.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="241">
|
||||
<caret line="171" column="26" lean-forward="false" selection-start-line="171" selection-start-column="15" selection-end-line="171" selection-end-column="26" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/models/cashier_terminal.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/models/booking_order.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/models/commission.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/models/commissioner.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="38" lean-forward="false" selection-start-line="0" selection-start-column="38" selection-end-line="0" selection-end-column="38" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/db/migrate/20170821093252_create_commissions.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="36">
|
||||
<caret line="2" column="36" lean-forward="true" selection-start-line="2" selection-start-column="36" selection-end-line="2" selection-end-column="36" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissioners/index.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissioners/edit.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/cash_outs_controller.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="57" lean-forward="false" selection-start-line="0" selection-start-column="36" selection-end-line="0" selection-end-column="57" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissioners/_form.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/commissioners_controller.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="36">
|
||||
<caret line="2" column="0" lean-forward="true" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/index.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="234">
|
||||
<caret line="13" column="10" lean-forward="true" selection-start-line="13" selection-start-column="10" selection-end-line="13" selection-end-column="10" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1010">
|
||||
<caret line="59" column="38" lean-forward="true" selection-start-line="59" selection-start-column="38" selection-end-line="59" selection-end-column="38" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/new.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="36">
|
||||
<caret line="2" column="14" lean-forward="false" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/_form.html.erb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="126">
|
||||
<caret line="7" column="27" lean-forward="true" selection-start-line="7" selection-start-column="27" selection-end-line="7" selection-end-column="27" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
||||
3
Gemfile
3
Gemfile
@@ -37,6 +37,9 @@ gem 'tether-rails'
|
||||
gem "font-awesome-rails"
|
||||
gem 'rack-cors'
|
||||
|
||||
# image upload
|
||||
gem 'carrierwave', '~> 1.0'
|
||||
|
||||
#Report and Printing gems
|
||||
gem 'cups', '~> 0.0.7'
|
||||
gem 'prawn'
|
||||
|
||||
@@ -51,6 +51,10 @@ GEM
|
||||
builder (3.2.3)
|
||||
byebug (9.0.6)
|
||||
cancancan (1.17.0)
|
||||
carrierwave (1.1.0)
|
||||
activemodel (>= 4.0.0)
|
||||
activesupport (>= 4.0.0)
|
||||
mime-types (>= 1.16)
|
||||
chronic (0.10.2)
|
||||
coffee-rails (4.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
@@ -251,6 +255,7 @@ DEPENDENCIES
|
||||
bootstrap-datepicker-rails
|
||||
byebug
|
||||
cancancan (~> 1.10)
|
||||
carrierwave (~> 1.0)
|
||||
coffee-rails (~> 4.2)
|
||||
cups (~> 0.0.7)
|
||||
database_cleaner
|
||||
|
||||
BIN
app/assets/images/logo.png
Normal file
BIN
app/assets/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
@@ -23,8 +23,90 @@ $(document).ready(function(){
|
||||
// setTimeout(function(){
|
||||
// window.location.reload(1);
|
||||
// }, 10000);
|
||||
$(".nav-completed").on("click", function(){
|
||||
$("#completed").removeClass('hide')
|
||||
$(".oqs_append").addClass('hide')
|
||||
});
|
||||
|
||||
$('.queue_station').on('click',function(){
|
||||
$(".oqs_click").on("click", function(){
|
||||
$("#completed").addClass('hide')
|
||||
$(".oqs_append").removeClass('hide')
|
||||
|
||||
var oqs_id = $(this).find(".oqs-id").text();
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
show_details(url);
|
||||
|
||||
}); //End Click
|
||||
|
||||
function show_details(url){
|
||||
var oqs_append = $('.oqs_append');
|
||||
oqs_append.empty();
|
||||
var filter = $('.filter').text();
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {'filter':filter},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
for(var field in data) {
|
||||
var price = parseFloat(data[field].price).toFixed(2);
|
||||
|
||||
if (data[field]["options"] == "[]") {
|
||||
var options = "";
|
||||
}else{
|
||||
var options = data.options;
|
||||
}
|
||||
|
||||
var date = new Date(data[field]["created_at"]);
|
||||
var show_date = date.getDate() + "-" + date.getMonth() + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||
|
||||
row ='<div class="card queue_station">'
|
||||
+'<div class="card-block">'
|
||||
+'<h4 class="card-title">'
|
||||
+'<span class="order-zone-type">'+data[field]["table_type"]+'- </span>'
|
||||
+'<span class="order-zone">'+ data[field]["zone"] +'</span>'
|
||||
+'<small class="pull-right">'+ data[field]["order_id"] +'- </small>'
|
||||
+'</h4>'
|
||||
|
||||
+'<h4>'
|
||||
+'<span class="order-item">'+ data[field]["item_name"] +'- </span>'
|
||||
+'<span class="order-qty">'+ data[field]["qty"] +'- </span>'
|
||||
+'</h4>'
|
||||
|
||||
+'<p class="card-text item-options">'+ options +'</p>'
|
||||
|
||||
+'<p class="card-text">'
|
||||
+'<small class="text-muted">Order at'
|
||||
+'<span class="order-at">'+ show_date +'</span> - '
|
||||
|
||||
+'<span class="order-by">'+ data[field]["item_order_by"] +'</span> '
|
||||
+'</small> '
|
||||
+'</p>'
|
||||
|
||||
+'<p class="hidden order-customer">'+ data[field]["customer_name"] +'</p> '
|
||||
+'<p class="hidden assigned-order-item">'+ data[field]["assigned_order_item_id"] +'</p> '
|
||||
+'</div>'
|
||||
|
||||
+'<div class="card-footer">'
|
||||
+'<button id="edit_'+ data[field]["assigned_order_item_id"]+'" class="btn btn-warning order-item order-item-edit">EDIT</button>'
|
||||
+' <button id="assigned_queue_' + data[field]["assigned_order_item_id"] +'" class="btn btn-primary order-item order-complete">COMPLETE</button>'
|
||||
+'</div>'
|
||||
|
||||
+'</div>';
|
||||
|
||||
|
||||
|
||||
$('.oqs_append').append(row);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
|
||||
}
|
||||
|
||||
$(document).on('click', '.queue_station', function(event){
|
||||
var orderZone=$(this).children().children().children('.order-zone').text().trim();
|
||||
// var orderItem=$(this).children().children().children('.order-item').text();
|
||||
var assigned_item_id = $(this).children().find(".assigned-order-item").text();
|
||||
@@ -41,7 +123,6 @@ $(document).ready(function(){
|
||||
$('#order-from').text(orderZone);
|
||||
// clear order items
|
||||
$("#oqs-order-details-table").children("tbody").empty();
|
||||
|
||||
// Call get_order_items() for Order Items by dining
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
@@ -68,19 +149,20 @@ $(document).ready(function(){
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
$(".order-item-edit").on('click', function(){
|
||||
$(document).on('click', '.order-item-edit', function(event){
|
||||
var _self = $(this); // To know in ajax return
|
||||
var assigned_item_id=$(this).attr('id').substr(5);
|
||||
window.location.href = '/oqs/'+ assigned_item_id + "/edit"
|
||||
});
|
||||
|
||||
// complete for queue item
|
||||
$('.order-complete').on('click',function(e){
|
||||
|
||||
$(document).on('click', '.order-complete', function(event){
|
||||
//e.preventDefault();
|
||||
var _self = $(this); // To know in ajax return
|
||||
var assigned_item_id=$(this).attr('id').substr(15);
|
||||
var params = { 'id':assigned_item_id };
|
||||
|
||||
|
||||
// Call update_delivery_status() for changed delivery and move to delivery
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@@ -117,10 +199,11 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
// Print Order Item
|
||||
$('#print_order_item').on('click',function(){
|
||||
$(document).on('click', '#print_order_item', function(event){
|
||||
var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||
var options = $('.selected-item').children('.card-block').find('.item-options').text();
|
||||
var params = { 'options':options };
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/oqs/print/print/'+assigned_item_id,
|
||||
@@ -129,7 +212,8 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
// Print Order Summary
|
||||
$('#print_order_summary').on('click',function(){
|
||||
// $('#print_order_summary').on('click',function(){
|
||||
$(document).on('click', '#print_order_summary', function(event){
|
||||
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
|
||||
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||
var params = { 'table_name':table_name };
|
||||
|
||||
@@ -20,25 +20,67 @@
|
||||
//= require jquery-ui
|
||||
//= require bootstrap-datepicker
|
||||
|
||||
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
|
||||
// Image Upload
|
||||
$("#simple_menu_item_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
$("#product_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
|
||||
$('.dropdown-toggle').dropdown();
|
||||
$('.dropdown-toggle').dropdown();
|
||||
});
|
||||
|
||||
function export_to(path)
|
||||
{
|
||||
var form_params = $("#frm_report").serialize();
|
||||
window.location = path+"?"+ form_params;
|
||||
var form_params = $("#frm_report").serialize();
|
||||
window.location = path+"?"+ form_params;
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
3
app/assets/javascripts/commissioners.coffee
Normal file
3
app/assets/javascripts/commissioners.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/commissions.coffee
Normal file
3
app/assets/javascripts/commissions.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/
|
||||
12
app/assets/javascripts/fileinput.min.js
vendored
Executable file
12
app/assets/javascripts/fileinput.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
3
app/assets/javascripts/origami/addorders.coffee
Normal file
3
app/assets/javascripts/origami/addorders.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/settings/item_sets.coffee
Normal file
3
app/assets/javascripts/settings/item_sets.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/settings/menu_item_sets.coffee
Normal file
3
app/assets/javascripts/settings/menu_item_sets.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/stylesheets/commissioners.scss
Normal file
3
app/assets/stylesheets/commissioners.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the Commissioners controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/commissions.scss
Normal file
3
app/assets/stylesheets/commissions.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the Commissions controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
12
app/assets/stylesheets/fileinput.min.css
vendored
Executable file
12
app/assets/stylesheets/fileinput.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -268,4 +268,3 @@ tr.discount-item-row:hover {
|
||||
-moz-opacity: 1; /* mozilla */
|
||||
|
||||
}
|
||||
|
||||
|
||||
3
app/assets/stylesheets/origami/addorders.scss
Normal file
3
app/assets/stylesheets/origami/addorders.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/addorders controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -26,7 +26,38 @@ ul.dropdown-menu li a{
|
||||
background-color: transparent !important;
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.page-header{
|
||||
border-bottom :0px solid #000 !important;
|
||||
margin :0px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.center-text {
|
||||
text-align:center;
|
||||
background-color:#ddd;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: auto;
|
||||
background-color: #ef404a;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.footer-header {
|
||||
color : #ef404a;
|
||||
font-weight:bold;
|
||||
font-style:italic;
|
||||
margin-bottom:0px;
|
||||
}
|
||||
|
||||
.menu-item-img {
|
||||
margin: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.padding-10 {
|
||||
padding: 10px;
|
||||
}
|
||||
3
app/assets/stylesheets/settings/item_sets.scss
Normal file
3
app/assets/stylesheets/settings/item_sets.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the Settings/ItemSets controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/settings/menu_item_sets.scss
Normal file
3
app/assets/stylesheets/settings/menu_item_sets.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the Settings/Menu_item_sets controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
9
app/controllers/api/restaurant/item_sets_controller.rb
Normal file
9
app/controllers/api/restaurant/item_sets_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class Api::Restaurant::ItemSetsController < Api::ApiController
|
||||
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
def index
|
||||
@item_sets = ItemSet.all
|
||||
end
|
||||
end
|
||||
@@ -1,11 +1,11 @@
|
||||
class Api::Restaurant::MenuController < Api::ApiController
|
||||
|
||||
class Api::Restaurant::MenuCategoriesController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
def index
|
||||
@menus = Menu.all
|
||||
@current_menu = Menu.current_menu
|
||||
@menus = MenuCategory.all
|
||||
@current_menu = MenuCategory.current_menu
|
||||
|
||||
end
|
||||
|
||||
@@ -21,10 +21,10 @@ class Api::Restaurant::MenuController < Api::ApiController
|
||||
def menu_detail (menu_id)
|
||||
if (menu_id)
|
||||
#Pull this menu
|
||||
menu = Menu.find_by_id(menu_id)
|
||||
menu = MenuCategory.find_by_id(menu_id)
|
||||
return menu
|
||||
else
|
||||
Menu.current_menu
|
||||
MenuCategory.current_menu
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,12 +1,11 @@
|
||||
class Api::Restaurant::MenuController < Api::ApiController
|
||||
|
||||
skip_before_action :authenticate
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
def index
|
||||
@menus = Menu.all
|
||||
@current_menu = Menu.current_menu
|
||||
|
||||
# @current_menu = Menu.current_menu
|
||||
end
|
||||
|
||||
#Description
|
||||
|
||||
@@ -6,8 +6,4 @@ class Api::Restaurant::MenuItemAttributesController < Api::ApiController
|
||||
def index
|
||||
@menu_attributes = MenuItemAttribute.all
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
class Api::Restaurant::MenuItemOptionsController < Api::ApiController
|
||||
|
||||
#Description
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
def index
|
||||
@menu_options = MenuItemOption.all
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -14,10 +14,9 @@ module TokenVerification
|
||||
end
|
||||
|
||||
def authenticate_token
|
||||
authenticate_with_http_token do |token, options|
|
||||
authenticate_with_http_token do |token, options|
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
Rails.logger.debug "token - " + token.to_s
|
||||
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
if @user
|
||||
return true
|
||||
|
||||
@@ -17,6 +17,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
@taxes = TaxProfile.all.order("order_by asc")
|
||||
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
@@ -63,15 +65,21 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
# GET /crm/customers/1/edit
|
||||
def edit
|
||||
@customer = Customer.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers.json
|
||||
def create
|
||||
def create
|
||||
# Remove "" default first
|
||||
params[:customer][:tax_profiles].delete_at(0)
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customers.save
|
||||
# update tax profile
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
@@ -188,10 +196,12 @@ end
|
||||
# PATCH/PUT /crm/customers/1
|
||||
# PATCH/PUT /crm/customers/1.json
|
||||
def update
|
||||
|
||||
# Remove "" default first
|
||||
params[:customer][:tax_profiles].delete_at(0)
|
||||
respond_to do |format|
|
||||
if @crm_customer.update(customer_params)
|
||||
|
||||
# update tax profile
|
||||
@crm_customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
@@ -346,7 +356,7 @@ end
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def customer_params
|
||||
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no)
|
||||
params.require(:customer).permit(:id, :name, :company, :contact_no, :email,
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type)
|
||||
end
|
||||
end
|
||||
|
||||
126
app/controllers/oqs/backhome_controller.rb
Normal file
126
app/controllers/oqs/backhome_controller.rb
Normal file
@@ -0,0 +1,126 @@
|
||||
class Oqs::HomeController < BaseOqsController
|
||||
def index
|
||||
queue_stations=OrderQueueStation.all
|
||||
|
||||
# Query for OQS with delivery status false
|
||||
@queue_items_details = queue_items_query(false)
|
||||
|
||||
# Query for OQS with delivery status true
|
||||
@queue_completed_item = completed_order
|
||||
|
||||
@queue_stations_items=Array.new
|
||||
|
||||
# Calculate Count for each station tab
|
||||
queue_stations.each do |que|
|
||||
i = 0
|
||||
zone_id = 0
|
||||
@queue_items_details.each do |qid|
|
||||
dining = DiningFacility.find_by_name(qid.zone)
|
||||
que.order_queue_process_by_zones.each do |qz|
|
||||
if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
|
||||
zone_id = qid.zone_id
|
||||
i=i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||
end
|
||||
|
||||
# @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
|
||||
@queue_stations_items
|
||||
end
|
||||
|
||||
# Get Order items
|
||||
def get_order_items
|
||||
items = []
|
||||
table_name = params[:table_id]
|
||||
status = params[:status]
|
||||
dining = DiningFacility.find_by_name(table_name);
|
||||
# oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||
# if status == ""
|
||||
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
|
||||
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||
# items.push(oi)
|
||||
# end
|
||||
# else
|
||||
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
|
||||
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||
# items.push(oi)
|
||||
# end
|
||||
# end
|
||||
|
||||
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
BookingOrder.where("booking_id='#{ booking.booking_id }'").find_each do |bo|
|
||||
order=Order.find(bo.order_id)
|
||||
order.order_items.each do |oi|
|
||||
items.push(oi)
|
||||
end
|
||||
end
|
||||
|
||||
# booking_id = dining.get_new_booking
|
||||
# BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
|
||||
# order=Order.find(bo.order_id);
|
||||
# order.order_items.each do |oi|
|
||||
# items.push(oi)
|
||||
# end
|
||||
# end
|
||||
|
||||
render :json => items.to_json
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
# update delivery status when complete click
|
||||
def update_delivery_status
|
||||
removed_item = []
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# update delivery status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.delivery_status=true
|
||||
ai.save
|
||||
removed_item.push(ai.assigned_order_item_id)
|
||||
end
|
||||
render :json => removed_item.to_json
|
||||
end
|
||||
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status)
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||
left join customers as cus ON cus.customer_id = od.customer_id
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = 0 AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
.order("assigned_order_items.created_at")
|
||||
end
|
||||
|
||||
# Completed Order
|
||||
def completed_order
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||
left join customers as cus ON cus.customer_id = od.customer_id
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||
.group("assigned_order_items.order_id")
|
||||
.limit(20)
|
||||
.order("assigned_order_items.created_at")
|
||||
|
||||
|
||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,33 +1,44 @@
|
||||
class Oqs::HomeController < BaseOqsController
|
||||
def index
|
||||
queue_stations=OrderQueueStation.all
|
||||
|
||||
@queue_stations = OrderQueueStation.all
|
||||
|
||||
# Query for OQS with delivery status false
|
||||
@queue_items_details = queue_items_query(false)
|
||||
# @queue_items_details = queue_items_query(false)
|
||||
|
||||
# Query for OQS with delivery status true
|
||||
@queue_completed_item = completed_order
|
||||
|
||||
|
||||
@queue_stations_items=Array.new
|
||||
@filter = params[:filter]
|
||||
|
||||
@queue_completed_item = completed_order(@filter)
|
||||
if !@filter.nil?
|
||||
@count = queue_items_count_query(false,@filter)
|
||||
@count.each do |count|
|
||||
|
||||
# Calculate Count for each station tab
|
||||
queue_stations.each do |que|
|
||||
i = 0
|
||||
zone_id = 0
|
||||
@queue_items_details.each do |qid|
|
||||
dining = DiningFacility.find_by_name(qid.zone)
|
||||
que.order_queue_process_by_zones.each do |qz|
|
||||
if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
|
||||
zone_id = qid.zone_id
|
||||
i=i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||
end
|
||||
|
||||
# @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
|
||||
@queue_stations_items
|
||||
# @queue_stations_items=Array.new
|
||||
|
||||
# Calculate Count for each station tab
|
||||
# @queue_stations.each do |que|
|
||||
# i = 0
|
||||
# zone_id = 0
|
||||
# @queue_items_details.each do |qid|
|
||||
# dining = DiningFacility.find_by_name(qid.zone)
|
||||
# que.order_queue_process_by_zones.each do |qz|
|
||||
# if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
|
||||
# zone_id = qid.zone_id
|
||||
# i=i+1
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# @queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||
# end
|
||||
|
||||
# # @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
|
||||
# @queue_stations_items
|
||||
end
|
||||
|
||||
# Get Order items
|
||||
@@ -68,6 +79,13 @@ class Oqs::HomeController < BaseOqsController
|
||||
render :json => items.to_json
|
||||
end
|
||||
|
||||
def get_items_by_oqs
|
||||
oqs_id = params[:id]
|
||||
filter = params[:filter]
|
||||
items = queue_items_query(false,oqs_id,filter)
|
||||
render :json => items.to_json
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
@@ -87,9 +105,22 @@ class Oqs::HomeController < BaseOqsController
|
||||
render :json => removed_item.to_json
|
||||
end
|
||||
|
||||
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status)
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
def queue_items_query(status,oqs_id=nil,filter)
|
||||
if oqs_id == nil
|
||||
oqs = ''
|
||||
else
|
||||
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
|
||||
end
|
||||
|
||||
query = AssignedOrderItem.select("assigned_order_items.assigned_order_item_id,
|
||||
oqs.id as station_id, oqs.station_name,
|
||||
oqs.is_active, oqpz.zone_id,
|
||||
df.name as zone, df.type as table_type,
|
||||
odt.order_id, odt.item_code, odt.item_name,
|
||||
odt.price, odt.qty, odt.item_order_by, odt.options,
|
||||
cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
@@ -98,14 +129,15 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} ")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
.order("assigned_order_items.created_at")
|
||||
|
||||
end
|
||||
|
||||
# Completed Order
|
||||
def completed_order
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
def completed_order(filter)
|
||||
query = AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
@@ -115,12 +147,28 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||
.group("assigned_order_items.order_id")
|
||||
.limit(20)
|
||||
.order("assigned_order_items.created_at")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("assigned_order_items.order_id")
|
||||
.limit(20)
|
||||
.order("assigned_order_items.created_at")
|
||||
|
||||
|
||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||
end
|
||||
|
||||
def queue_items_count_query(status,filter)
|
||||
query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||
left join customers as cus ON cus.customer_id = od.customer_id
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("oqs.id")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
22
app/controllers/origami/addorders_controller.rb
Normal file
22
app/controllers/origami/addorders_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class Origami::AddordersController < BaseOrigamiController
|
||||
before_action :set_dining, only: [:show]
|
||||
|
||||
def index
|
||||
@tables = Table.all.active.order('zone_id asc').group("zone_id")
|
||||
@rooms = Room.all.active.order('zone_id asc').group("zone_id")
|
||||
@all_table = Table.all.active.order('status desc')
|
||||
@all_room = Room.all.active.order('status desc')
|
||||
end
|
||||
|
||||
def show
|
||||
@menu = MenuCategory.all
|
||||
@table_id = params[:id]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_dining
|
||||
@dining = DiningFacility.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
75
app/controllers/origami/commissioners_controller.rb
Normal file
75
app/controllers/origami/commissioners_controller.rb
Normal file
@@ -0,0 +1,75 @@
|
||||
class Origami::CommissionersController < BaseOrigamiController
|
||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissioners
|
||||
# GET /commissioners.json
|
||||
def index
|
||||
@commissioners = Commissioner.all
|
||||
end
|
||||
|
||||
# GET /commissioners/1
|
||||
# GET /commissioners/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /commissioners/new
|
||||
def new
|
||||
@commissioner = Commissioner.new
|
||||
@employee = Employee.all.order('name asc')
|
||||
end
|
||||
|
||||
# GET /commissioners/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /commissioners
|
||||
# POST /commissioners.json
|
||||
def create
|
||||
@commissioner = Commissioner.new(commissioner_params)
|
||||
@commissioner.created_by = current_user.id
|
||||
respond_to do |format|
|
||||
if @commissioner.save
|
||||
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @commissioner }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /commissioners/1
|
||||
# PATCH/PUT /commissioners/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commissioner.update(commissioner_params)
|
||||
format.html { redirect_to origami_commissioner_path(@commissioner) , notice: 'Commissioner was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @commissioner }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /commissioners/1
|
||||
# DELETE /commissioners/1.json
|
||||
def destroy
|
||||
@commissioner.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commissioner
|
||||
@commissioner = Commissioner.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commissioner_params
|
||||
params.require(:commissioner).permit(:name,:emp_id,:created_by,:commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
74
app/controllers/origami/commissions_controller.rb
Normal file
74
app/controllers/origami/commissions_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Origami::CommissionsController < BaseOrigamiController
|
||||
# before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissions
|
||||
# GET /commissions.json
|
||||
def index
|
||||
@commissions = Commission.all
|
||||
end
|
||||
|
||||
# GET /commissions/1
|
||||
# GET /commissions/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /commissions/new
|
||||
def new
|
||||
@commission = Commission.new
|
||||
end
|
||||
|
||||
# GET /commissions/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /commissions
|
||||
# POST /commissions.json
|
||||
def create
|
||||
@commission = Commission.new(commission_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
format.html { redirect_to @commission, notice: 'Commission was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @commission }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /commissions/1
|
||||
# PATCH/PUT /commissions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commission.update(commission_params)
|
||||
format.html { redirect_to @commission, notice: 'Commission was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @commission }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /commissions/1
|
||||
# DELETE /commissions/1.json
|
||||
def destroy
|
||||
@commission.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commission
|
||||
@commission = Commission.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commission_params
|
||||
params.fetch(:commission, {})
|
||||
end
|
||||
end
|
||||
@@ -37,14 +37,14 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
@crm_customers = Customer.order("customer_id").page(params[:page])
|
||||
#@products = Product.order("name").page(params[:page]).per(5)
|
||||
else
|
||||
@crm_customers = Customer.search(filter)
|
||||
|
||||
@crm_customers = Customer.search(filter)
|
||||
end
|
||||
#@crm_customers = Customer.all
|
||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
@taxes = TaxProfile.all.order("order_by asc")
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
@@ -60,6 +60,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
customer_id = params[:customer_id]
|
||||
customer = Customer.find(customer_id)
|
||||
|
||||
# Check and find with card no
|
||||
# if(!customer_id.include? "CUS")
|
||||
@@ -74,7 +75,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
status = sale.update_attributes(customer_id: customer_id)
|
||||
sale.sale_orders.each do |sale_order|
|
||||
order = Order.find(sale_order.order_id)
|
||||
status = order.update_attributes(customer_id: customer_id)
|
||||
status = order.update_attributes(customer_id: customer_id,order_type:customer.customer_type)
|
||||
end
|
||||
else
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@@ -82,13 +83,15 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
|
||||
@orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
status = order.update_attributes(customer_id: customer_id)
|
||||
status = order.update_attributes(customer_id: customer_id,order_type:customer.customer_type)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount)
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
end
|
||||
|
||||
@@ -2,10 +2,12 @@ class Origami::HomeController < BaseOrigamiController
|
||||
before_action :set_dining, only: [:show]
|
||||
|
||||
def index
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("sale_status != 'new'")
|
||||
@orders = Order.all.order('date desc')
|
||||
@orders = Order.all.order('date desc')
|
||||
@shop = Shop.find_by_id(1)
|
||||
|
||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
|
||||
@@ -38,7 +40,6 @@ class Origami::HomeController < BaseOrigamiController
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||
puts "enter"
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
|
||||
@@ -163,6 +163,35 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
|
||||
end
|
||||
|
||||
def foc
|
||||
cash = params[:cash]
|
||||
sale_id = params[:sale_id]
|
||||
sub_total = params[:sub_total]
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
|
||||
end
|
||||
end
|
||||
|
||||
def rounding_adj
|
||||
|
||||
saleObj = Sale.find(params[:sale_id])
|
||||
|
||||
@@ -31,15 +31,21 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
unique_code = "CloseCashierPdf"
|
||||
shop_details = Shop.find(1)
|
||||
#get tax
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
#other payment details for mpu or visa like card
|
||||
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||
|
||||
# Calculate price_by_accounts
|
||||
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
|
||||
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
|
||||
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||
|
||||
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes)
|
||||
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
|
||||
|
||||
|
||||
end
|
||||
@@ -52,6 +58,21 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
|
||||
def sale_summary
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
|
||||
# @shift = ShiftSale.find_by_id(shift_id)
|
||||
if @shift
|
||||
#get tax
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
#other payment details for mpu or visa like card
|
||||
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||
|
||||
# Calculate price_by_accounts
|
||||
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
|
||||
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
|
||||
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -6,18 +6,19 @@ class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
|
||||
# update count for shift sale
|
||||
if(sale.sale_status == "void")
|
||||
if(sale.sale_status == "completed")
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
end
|
||||
end
|
||||
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
bookings = sale.bookings
|
||||
bookings.each do |booking|
|
||||
orders = booking.orders
|
||||
|
||||
74
app/controllers/settings/item_sets_controller.rb
Normal file
74
app/controllers/settings/item_sets_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Settings::ItemSetsController < ApplicationController
|
||||
before_action :set_settings_item_set, only: [:show, :edit, :update, :destroy]
|
||||
load_and_authorize_resource except: [:create]
|
||||
# GET /settings/item_sets
|
||||
# GET /settings/item_sets.json
|
||||
def index
|
||||
@settings_item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# GET /settings/item_sets/1
|
||||
# GET /settings/item_sets/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /settings/item_sets/new
|
||||
def new
|
||||
@settings_item_set = ItemSet.new
|
||||
end
|
||||
|
||||
# GET /settings/item_sets/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /settings/item_sets
|
||||
# POST /settings/item_sets.json
|
||||
def create
|
||||
@settings_item_set = ItemSet.new(settings_item_set_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_item_set.save
|
||||
format.html { redirect_to settings_item_sets_path, notice: 'Item set was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_item_set }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /settings/item_sets/1
|
||||
# PATCH/PUT /settings/item_sets/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @settings_item_set.update(settings_item_set_params)
|
||||
format.html { redirect_to settings_item_sets_path, notice: 'Item set was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_item_set }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /settings/item_sets/1
|
||||
# DELETE /settings/item_sets/1.json
|
||||
def destroy
|
||||
@settings_item_set.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_item_sets_url, notice: 'Item set was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_item_set
|
||||
@settings_item_set = ItemSet.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_item_set_params
|
||||
params.require(:item_set).permit(:name, :alt_name, :min_selectable_qty, :max_selectable_qty)
|
||||
end
|
||||
end
|
||||
@@ -89,6 +89,6 @@ class Settings::MenuCategoriesController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_category_params
|
||||
params.require(:menu_category).permit(:code, :menu_id, :name, :alt_name, :order_by, :menu_category_id)
|
||||
params.require(:menu_category).permit(:code, :menu_id, :name, :alt_name, :order_by, :menu_category_id, :is_available)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,12 +21,14 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
id = MenuItemInstance.findParentCategory(@item)
|
||||
@category = MenuCategory.find(id)
|
||||
@settings_menu_item_instances = MenuItemInstance.new
|
||||
@item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_instances/1/edit
|
||||
def edit
|
||||
id = MenuItemInstance.findParentCategory(@item)
|
||||
@category = MenuCategory.find(id)
|
||||
@item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# POST /settings/menu_item_instances
|
||||
@@ -45,6 +47,18 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
id = MenuItemInstance.findParentCategory(catID)
|
||||
category = MenuCategory.find(id)
|
||||
|
||||
# Bind for Item Sets
|
||||
if params[:menu_item_instance][:item_sets].count > 1
|
||||
params[:menu_item_instance][:item_sets].delete_at(0)
|
||||
|
||||
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_instances.save
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@@ -70,6 +84,18 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
id = MenuItemInstance.findParentCategory(catID)
|
||||
category = MenuCategory.find(id)
|
||||
|
||||
# Bind for Item Sets
|
||||
if params[:menu_item_instance][:item_sets].count > 1
|
||||
params[:menu_item_instance][:item_sets].delete_at(0)
|
||||
|
||||
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||
@@ -122,8 +148,6 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_instance_params
|
||||
|
||||
params.require(:menu_item_instance).permit(:item_instance_code, :item_instance_name, :price, :item_attributes, :is_on_promotion, :promotion_price, :is_available,:menu_category_id,:menu_item_id)
|
||||
|
||||
params.require(:menu_item_instance).permit(:item_instance_code, :item_instance_name, :price, :item_attributes, :is_on_promotion, :promotion_price, :is_available,:menu_category_id,:menu_item_id, :is_default, :item_sets)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,6 +70,6 @@ class Settings::MenuItemOptionsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_option_params
|
||||
params.require(:menu_item_option).permit(:name, :value)
|
||||
params.require(:menu_item_option).permit(:option_type, :name, :value)
|
||||
end
|
||||
end
|
||||
|
||||
74
app/controllers/settings/menu_item_sets_controller.rb
Normal file
74
app/controllers/settings/menu_item_sets_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Settings::MenuItemSetsController < ApplicationController
|
||||
before_action :set_settings_menu_item_set, only: [:show, :edit, :update, :destroy]
|
||||
load_and_authorize_resource except: [:create]
|
||||
# GET /settings/menu_item_sets
|
||||
# GET /settings/menu_item_sets.json
|
||||
def index
|
||||
@settings_menu_item_sets = MenuItemSet.all
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_sets/1
|
||||
# GET /settings/menu_item_sets/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_sets/new
|
||||
def new
|
||||
@settings_menu_item_set = MenuItemSet.new
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_sets/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /settings/menu_item_sets
|
||||
# POST /settings/menu_item_sets.json
|
||||
def create
|
||||
@settings_menu_item_set = MenuItemSet.new(settings_menu_item_set_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_set.save
|
||||
format.html { redirect_to settings_menu_item_sets_path, notice: 'Menu item set was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_menu_item_set }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @settings_menu_item_set.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /settings/menu_item_sets/1
|
||||
# PATCH/PUT /settings/menu_item_sets/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_set.update(settings_menu_item_set_params)
|
||||
format.html { redirect_to settings_menu_item_sets_path, notice: 'Menu item set was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_menu_item_set }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @settings_menu_item_set.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /settings/menu_item_sets/1
|
||||
# DELETE /settings/menu_item_sets/1.json
|
||||
def destroy
|
||||
@settings_menu_item_set.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menu_item_sets_url, notice: 'Menu item set was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_menu_item_set
|
||||
@settings_menu_item_set = MenuItemSet.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_set_params
|
||||
params.require(:menu_item_set).permit(:item_set_id, :menu_item_id)
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,8 @@
|
||||
class Settings::SetMenuItemsController < ApplicationController
|
||||
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update]
|
||||
before_action :set_settings_item_attribute, only: [:index, :show, :edit, :new, :update ,:create]
|
||||
before_action :set_settings_item_option, only: [:index, :show, :edit, :new, :update ,:create]
|
||||
# GET /settings/menu_items
|
||||
# GET /settings/menu_items.json
|
||||
def index
|
||||
@@ -10,32 +12,52 @@ class Settings::SetMenuItemsController < ApplicationController
|
||||
# GET /settings/menu_items/1
|
||||
# GET /settings/menu_items/1.json
|
||||
def show
|
||||
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||
|
||||
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||
|
||||
end
|
||||
|
||||
# GET /settings/menu_items/new
|
||||
def new
|
||||
@settings_menu_item = MenuItem.new
|
||||
@settings_menu_item.type = "SetMenuItem"
|
||||
@item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# GET /settings/menu_items/1/edit
|
||||
def edit
|
||||
@item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# POST /settings/menu_items
|
||||
# POST /settings/menu_items.json
|
||||
def create
|
||||
@settings_menu_item = MenuItem.new(settings_menu_item_params)
|
||||
if params[:simple_menu_item][:menu_item_id] == ''
|
||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||
end
|
||||
|
||||
# if params[:set_menu_item][:menu_item_id] == ''
|
||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||
# end
|
||||
@settings_menu_item.created_by = current_login_employee.name
|
||||
|
||||
# Remove "" default first
|
||||
params[:set_menu_item][:item_attributes].delete_at(0)
|
||||
params[:set_menu_item][:item_options].delete_at(0)
|
||||
|
||||
# Bind for Item Sets
|
||||
if params[:set_menu_item][:item_sets].count > 1
|
||||
params[:set_menu_item][:item_sets].delete_at(0)
|
||||
|
||||
sets = ItemSet.find(params[:set_menu_item][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item.save
|
||||
menu_item = MenuItem.find(@settings_menu_item.id)
|
||||
menu_item.update_attributes(item_attributes: params[:set_menu_item][:item_attributes], item_options: params[:set_menu_item][:item_options])
|
||||
|
||||
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_menu_item }
|
||||
else
|
||||
@@ -48,8 +70,27 @@ class Settings::SetMenuItemsController < ApplicationController
|
||||
# PATCH/PUT /settings/menu_items/1
|
||||
# PATCH/PUT /settings/menu_items/1.json
|
||||
def update
|
||||
# Remove "" default first
|
||||
params[:set_menu_item][:item_attributes].delete_at(0)
|
||||
params[:set_menu_item][:item_options].delete_at(0)
|
||||
|
||||
# Bind for Item Sets
|
||||
if params[:set_menu_item][:item_sets].count > 1
|
||||
params[:set_menu_item][:item_sets].delete_at(0)
|
||||
|
||||
sets = ItemSet.find(params[:set_menu_item][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item.update(settings_menu_item_params)
|
||||
@settings_menu_item.update_attributes(item_attributes: params[:set_menu_item][:item_attributes], item_options: params[:set_menu_item][:item_options])
|
||||
|
||||
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_menu_item }
|
||||
else
|
||||
@@ -62,6 +103,8 @@ class Settings::SetMenuItemsController < ApplicationController
|
||||
# DELETE /settings/menu_items/1
|
||||
# DELETE /settings/menu_items/1.json
|
||||
def destroy
|
||||
path_to_file = @settings_menu_item.image_path.to_s
|
||||
File.delete(path_to_file) if File.exist?(path_to_file)
|
||||
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
||||
@@ -79,8 +122,16 @@ class Settings::SetMenuItemsController < ApplicationController
|
||||
@category = MenuCategory.find(params[:menu_category_id])
|
||||
end
|
||||
|
||||
def set_settings_item_attribute
|
||||
@item_attributes = MenuItemAttribute.all.order("id asc").map{|a| [a.name, a.value]}
|
||||
end
|
||||
|
||||
def set_settings_item_option
|
||||
@item_options = MenuItemOption.all
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_params
|
||||
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id,:account_id , :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
|
||||
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
class Settings::SimpleMenuItemsController < ApplicationController
|
||||
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy ]
|
||||
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update ,:create]
|
||||
before_action :set_settings_item_attribute, only: [:index, :show, :edit, :new, :update ,:create]
|
||||
before_action :set_settings_item_option, only: [:index, :show, :edit, :new, :update ,:create]
|
||||
# GET /settings/menu_items
|
||||
# GET /settings/menu_items.json
|
||||
def index
|
||||
@@ -10,29 +12,75 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
||||
# GET /settings/menu_items/1
|
||||
# GET /settings/menu_items/1.json
|
||||
def show
|
||||
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
# GET /settings/menu_items/new
|
||||
def new
|
||||
@settings_menu_item = MenuItem.new
|
||||
@settings_menu_item = MenuItem.new
|
||||
@item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# GET /settings/menu_items/1/edit
|
||||
def edit
|
||||
def edit
|
||||
@item_sets = ItemSet.all
|
||||
end
|
||||
|
||||
# POST /settings/menu_items
|
||||
# POST /settings/menu_items.json
|
||||
def create
|
||||
@settings_menu_item = MenuItem.new(settings_menu_item_params)
|
||||
if params[:simple_menu_item][:menu_item_id] == ''
|
||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||
end
|
||||
|
||||
# if params[:simple_menu_item][:menu_item_id] == ''
|
||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||
# end
|
||||
@settings_menu_item.created_by = current_login_employee.name
|
||||
|
||||
# Remove "" default first
|
||||
params[:simple_menu_item][:item_attributes].delete_at(0)
|
||||
params[:simple_menu_item][:item_options].delete_at(0)
|
||||
|
||||
# attr_format = []
|
||||
# param_count = params[:simple_menu_item][:item_attributes].count
|
||||
# # Format for attributes json
|
||||
# params[:simple_menu_item][:item_attributes].each do|attr_id|
|
||||
# menu_attr = MenuItemAttribute.find(attr_id)
|
||||
# if attr_format.count == 0
|
||||
# attr_format.push({ type: menu_attr.attribute_type, value: [] })
|
||||
# end
|
||||
|
||||
# attr_format.each do |af|
|
||||
# if menu_attr.attribute_type == af[:type]
|
||||
# af[:value].push(menu_attr.value)
|
||||
# else
|
||||
# new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
|
||||
# attr_format.push(new_attr)
|
||||
# end
|
||||
|
||||
# break if attr_format.count > param_count
|
||||
# end
|
||||
|
||||
# param_count -= 1
|
||||
# end
|
||||
# @settings_menu_item.item_attributes = attr_format
|
||||
|
||||
# Bind for Item Sets
|
||||
if params[:simple_menu_item][:item_sets].count > 1
|
||||
params[:simple_menu_item][:item_sets].delete_at(0)
|
||||
|
||||
sets = ItemSet.find(params[:simple_menu_item][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item.save
|
||||
menu_item = MenuItem.find(@settings_menu_item.id)
|
||||
menu_item.update_attributes(item_options: params[:simple_menu_item][:item_options])
|
||||
|
||||
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_menu_item }
|
||||
else
|
||||
@@ -45,8 +93,26 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
||||
# PATCH/PUT /settings/menu_items/1
|
||||
# PATCH/PUT /settings/menu_items/1.json
|
||||
def update
|
||||
# Remove "" default first
|
||||
params[:simple_menu_item][:item_attributes].delete_at(0)
|
||||
params[:simple_menu_item][:item_options].delete_at(0)
|
||||
|
||||
# Bind for Item Sets
|
||||
if params[:simple_menu_item][:item_sets].count > 1
|
||||
params[:simple_menu_item][:item_sets].delete_at(0)
|
||||
|
||||
sets = ItemSet.find(params[:simple_menu_item][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item.update(settings_menu_item_params)
|
||||
@settings_menu_item.update_attributes(item_attributes: params[:simple_menu_item][:item_attributes], item_options: params[:simple_menu_item][:item_options])
|
||||
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_menu_item }
|
||||
else
|
||||
@@ -59,6 +125,8 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
||||
# DELETE /settings/menu_items/1
|
||||
# DELETE /settings/menu_items/1.json
|
||||
def destroy
|
||||
path_to_file = @settings_menu_item.image_path.to_s
|
||||
File.delete(path_to_file) if File.exist?(path_to_file)
|
||||
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
||||
@@ -76,8 +144,16 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
||||
@category = MenuCategory.find(params[:menu_category_id])
|
||||
end
|
||||
|
||||
def set_settings_item_attribute
|
||||
@item_attributes = MenuItemAttribute.all.order("id asc") #.map{|a| [a.name, a.value]}
|
||||
end
|
||||
|
||||
def set_settings_item_option
|
||||
@item_options = MenuItemOption.all
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_params
|
||||
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id,:account_id,:item_attributes, :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
|
||||
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,18 +3,17 @@ class Transactions::OrdersController < ApplicationController
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
count = params[:count]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? || from.nil? || to.nil?
|
||||
if filter.nil? && from.nil? && to.nil? && count.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
puts "ssssss"
|
||||
else
|
||||
orders = Order.search(filter,from,to)
|
||||
# if order.count > 0
|
||||
# orders = order
|
||||
# else
|
||||
# orders = Order.order("order_id desc")
|
||||
# end
|
||||
orders = Order.search(filter,from,to,count)
|
||||
puts "aaaaa"
|
||||
|
||||
end
|
||||
|
||||
if !orders.nil?
|
||||
@@ -22,6 +21,7 @@ class Transactions::OrdersController < ApplicationController
|
||||
else
|
||||
@orders = []
|
||||
end
|
||||
puts @orders.to_json
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @orders }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
module ApplicationHelper
|
||||
|
||||
def flash_class(level)
|
||||
case level
|
||||
when :notice then "alert alert-info fade-in"
|
||||
|
||||
2
app/helpers/commissioners_helper.rb
Normal file
2
app/helpers/commissioners_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module CommissionersHelper
|
||||
end
|
||||
2
app/helpers/commissions_helper.rb
Normal file
2
app/helpers/commissions_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module CommissionsHelper
|
||||
end
|
||||
2
app/helpers/origami/addorders_helper.rb
Normal file
2
app/helpers/origami/addorders_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Origami::AddordersHelper
|
||||
end
|
||||
2
app/helpers/settings/item_sets_helper.rb
Normal file
2
app/helpers/settings/item_sets_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Settings::ItemSetsHelper
|
||||
end
|
||||
2
app/helpers/settings/menu_item_sets_helper.rb
Normal file
2
app/helpers/settings/menu_item_sets_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Settings::MenuItemSetsHelper
|
||||
end
|
||||
@@ -4,137 +4,131 @@ class Ability
|
||||
def initialize(user)
|
||||
user ||= Employee.new
|
||||
|
||||
if user.role == 'administrator'
|
||||
if user.role == "administrator"
|
||||
can :manage, :all
|
||||
elsif user.role == "manager"
|
||||
can :manage, Menu
|
||||
can :manage, MenuCategory
|
||||
can :manage, MenuItemAttribute
|
||||
can :manage, MenuItemInstance
|
||||
can :manage, MenuItemOption
|
||||
can :manage, SetMenuItem
|
||||
can :manage, ItemSet
|
||||
can :manage, MenuItemSet
|
||||
can :manage, OrderQueueStation
|
||||
can :manage, Zone
|
||||
can :manage, CashierTerminal
|
||||
can :manage, Employee
|
||||
# can :manage, MembershipSetting
|
||||
# can :manage, MembershipAction
|
||||
# can :manage, PaymentMethodSetting
|
||||
can :manage, TaxProfile
|
||||
can :manage, PrintSetting
|
||||
can :manage, Account
|
||||
|
||||
can :manage, :all
|
||||
can :manage, Order
|
||||
can :manage, Sale
|
||||
|
||||
elsif user.role == 'manager'
|
||||
can :manage, Customer
|
||||
can :manage, DiningQueue
|
||||
|
||||
can :manage, Menu
|
||||
can :manage, MenuCategory
|
||||
can :manage, MenuItemAttribute
|
||||
can :manage, MenuItemInstance
|
||||
can :manage, MenuItemOption
|
||||
can :manage, SetMenuItem
|
||||
can :manage, OrderQueueStation
|
||||
can :manage, Zone
|
||||
can :manage, CashierTerminal
|
||||
can :manage, Employee
|
||||
# can :manage, MembershipSetting
|
||||
# can :manage, MembershipAction
|
||||
# can :manage, PaymentMethodSetting
|
||||
can :manage, TaxProfile
|
||||
can :manage, PrintSetting
|
||||
can :manage, Account
|
||||
can :index, :dailysale
|
||||
can :index, :saleitem
|
||||
can :index, :receipt_no
|
||||
can :index, :shiftsale
|
||||
can :index, :credit_payment
|
||||
can :index, :void_sale
|
||||
|
||||
can :manage, Order
|
||||
can :manage, Sale
|
||||
can :get_customer, Customer
|
||||
can :add_customer, Customer
|
||||
can :update_sale_by_customer, Customer
|
||||
|
||||
can :manage, Customer
|
||||
can :manage, DiningQueue
|
||||
can :index, :other_charge
|
||||
can :create, :other_charge
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
|
||||
can :index, :dailysale
|
||||
can :index, :saleitem
|
||||
can :index, :receipt_no
|
||||
can :index, :shiftsale
|
||||
can :index, :credit_payment
|
||||
can :index, :void_sale
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
can :foc, :payment
|
||||
|
||||
can :get_customer, Customer
|
||||
can :add_customer, Customer
|
||||
can :update_sale_by_customer, Customer
|
||||
|
||||
can :index, :other_charge
|
||||
can :create, :other_charge
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
can :move_dining, :movetable
|
||||
can :moving, :movetable
|
||||
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
can :move_dining, :moveroom
|
||||
|
||||
can :move_dining, :movetable
|
||||
can :moving, :movetable
|
||||
can :edit, :sale_edit
|
||||
can :item_void, :sale_edit
|
||||
can :item_void_cancel, :sale_edit
|
||||
can :cancel_all_void, :sale_edit
|
||||
can :apply_void, :sale_edit
|
||||
|
||||
can :move_dining, :moveroom
|
||||
can :overall_void, :void
|
||||
|
||||
can :edit, :sale_edit
|
||||
can :item_void, :sale_edit
|
||||
can :item_void_cancel, :sale_edit
|
||||
can :cancel_all_void, :sale_edit
|
||||
can :apply_void, :sale_edit
|
||||
elsif user.role == "cashier"
|
||||
|
||||
# can :overall_void, :void
|
||||
|
||||
can :overall_void, :void
|
||||
can :read, Order
|
||||
can :update, Order
|
||||
|
||||
can :read, Sale
|
||||
can :update, Sale
|
||||
can :get_customer, Customer
|
||||
can :add_customer, Customer
|
||||
can :update_sale_by_customer, Customer
|
||||
|
||||
elsif user.role == 'cashier'
|
||||
can :index, :other_charge
|
||||
can :create, :other_charge
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
can :member_discount, :discount
|
||||
|
||||
# can :overall_void, :void
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
|
||||
can :read, Order
|
||||
can :update, Order
|
||||
can :move_dining, :movetable
|
||||
can :moving, :movetable
|
||||
|
||||
can :read, Sale
|
||||
can :update, Sale
|
||||
can :get_customer, Customer
|
||||
can :add_customer, Customer
|
||||
can :update_sale_by_customer, Customer
|
||||
can :move_dining, :moveroom
|
||||
|
||||
can :index, :other_charge
|
||||
can :create, :other_charge
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
can :member_discount, :discount
|
||||
can :manage, DiningQueue
|
||||
|
||||
elsif user.role == "account"
|
||||
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
can :index, :dailysale
|
||||
can :index, :saleitem
|
||||
can :index, :receipt_no
|
||||
can :index, :shiftsale
|
||||
can :index, :credit_payment
|
||||
can :index, :void_sale
|
||||
|
||||
can :move_dining, :movetable
|
||||
can :moving, :movetable
|
||||
elsif user.role == "supervisour"
|
||||
|
||||
can :move_dining, :moveroom
|
||||
can :edit, :sale_edit
|
||||
can :item_void, :sale_edit
|
||||
can :item_edit, :sale_edit
|
||||
can :item_void_cancel, :sale_edit
|
||||
can :cancel_all_void, :sale_edit
|
||||
can :apply_void, :sale_edit
|
||||
can :overall_void, :void
|
||||
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
|
||||
can :manage, DiningQueue
|
||||
|
||||
elsif user.role == 'account'
|
||||
|
||||
can :index, :dailysale
|
||||
can :index, :saleitem
|
||||
can :index, :receipt_no
|
||||
can :index, :shiftsale
|
||||
can :index, :credit_payment
|
||||
can :index, :void_sale
|
||||
|
||||
elsif user.role == 'supervisour'
|
||||
|
||||
can :edit, :sale_edit
|
||||
can :item_void, :sale_edit
|
||||
can :item_edit, :sale_edit
|
||||
can :item_void_cancel, :sale_edit
|
||||
can :cancel_all_void, :sale_edit
|
||||
can :apply_void, :sale_edit
|
||||
can :overall_void, :void
|
||||
|
||||
can :first_bill, :payment
|
||||
can :create, :payment
|
||||
can :show, :payment
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
can :first_bill, :payment
|
||||
can :create, :payment
|
||||
can :show, :payment
|
||||
can :reprint, :payment
|
||||
can :rounding_adj, :payment
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
2
app/models/commission.rb
Normal file
2
app/models/commission.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Commission < ApplicationRecord
|
||||
end
|
||||
3
app/models/commissioner.rb
Normal file
3
app/models/commissioner.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class Commissioner < ApplicationRecord
|
||||
has_many :employees
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
class Employee < ApplicationRecord
|
||||
has_secure_password
|
||||
|
||||
belongs_to :commissioner
|
||||
has_many :shit_sales
|
||||
validates_presence_of :name, :role
|
||||
validates_presence_of :password, :on => [:create]
|
||||
@@ -35,7 +35,6 @@ class Employee < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.authenticate_by_token(session_token)
|
||||
|
||||
if (session_token)
|
||||
user = Employee.find_by_token_session(session_token)
|
||||
if user && user.session_expiry.utc > DateTime.now.utc
|
||||
|
||||
9
app/models/item_set.rb
Normal file
9
app/models/item_set.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class ItemSet < ApplicationRecord
|
||||
has_many :menu_item_sets
|
||||
has_many :menu_items, through: :menu_item_sets
|
||||
|
||||
has_many :menu_instance_item_sets
|
||||
has_many :menu_item_instances, through: :menu_instance_item_sets
|
||||
|
||||
validates_presence_of :name
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
class MenuCategory < ApplicationRecord
|
||||
before_create :generate_menu_category_code
|
||||
# before_create :generate_menu_category_code
|
||||
|
||||
belongs_to :menu
|
||||
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
||||
@@ -37,7 +37,7 @@ class MenuCategory < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def generate_menu_category_code
|
||||
self.code = SeedGenerator.generate_code(self.class.name, "C")
|
||||
end
|
||||
# def generate_menu_category_code
|
||||
# self.code = SeedGenerator.generate_code(self.class.name, "C")
|
||||
# end
|
||||
end
|
||||
|
||||
4
app/models/menu_instance_item_set.rb
Normal file
4
app/models/menu_instance_item_set.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class MenuInstanceItemSet < ApplicationRecord
|
||||
belongs_to :item_set
|
||||
belongs_to :menu_item_instance
|
||||
end
|
||||
@@ -1,20 +1,25 @@
|
||||
class MenuItem < ApplicationRecord
|
||||
|
||||
before_create :generate_menu_item_code
|
||||
# before_create :generate_menu_item_code
|
||||
|
||||
belongs_to :menu_category, :optional => true
|
||||
has_many :menu_item_instances
|
||||
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
||||
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||
# belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
||||
# has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||
belongs_to :account
|
||||
|
||||
validates_presence_of :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
|
||||
has_many :menu_item_sets
|
||||
has_many :item_sets, through: :menu_item_sets
|
||||
|
||||
validates_presence_of :name, :type, :min_qty, :taxable
|
||||
|
||||
default_scope { order('item_code asc') }
|
||||
|
||||
scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') }
|
||||
scope :set_menu_item, -> { where(type: 'SetMenuItem') }
|
||||
|
||||
# Item Image Uploader
|
||||
mount_uploader :image_path, MenuItemImageUploader
|
||||
|
||||
def self.collection
|
||||
MenuItem.select("id, name").map { |e| [e.name, e.id] }
|
||||
end
|
||||
@@ -70,10 +75,10 @@ class MenuItem < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
# private
|
||||
|
||||
def generate_menu_item_code
|
||||
self.item_code = SeedGenerator.generate_code(self.class.name, "I")
|
||||
end
|
||||
# def generate_menu_item_code
|
||||
# self.item_code = SeedGenerator.generate_code(self.class.name, "I")
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class MenuItemAttribute < ApplicationRecord
|
||||
validates_presence_of :attribute_type, :name, :value
|
||||
def self.collection
|
||||
MenuItemAttribute.select("id, name").map { |e| [e.name, e.id] }
|
||||
MenuItemAttribute.select("name, value").map { |e| [e.name, e.value] }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
class MenuItemInstance < ApplicationRecord
|
||||
belongs_to :menu_item
|
||||
before_create :generate_menu_item_instance_code
|
||||
|
||||
has_many :menu_instance_item_sets
|
||||
has_many :item_sets, through: :menu_instance_item_sets
|
||||
# before_create :generate_menu_item_instance_code
|
||||
|
||||
def self.findParentCategory(item)
|
||||
if item.menu_category_id
|
||||
@@ -11,9 +14,9 @@ class MenuItemInstance < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# private
|
||||
|
||||
def generate_menu_item_instance_code
|
||||
self.item_instance_code = SeedGenerator.generate_code(self.class.name, "II")
|
||||
end
|
||||
# def generate_menu_item_instance_code
|
||||
# self.item_instance_code = SeedGenerator.generate_code(self.class.name, "II")
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
class MenuItemOption < ApplicationRecord
|
||||
validates_presence_of :name, :value
|
||||
|
||||
end
|
||||
|
||||
9
app/models/menu_item_set.rb
Normal file
9
app/models/menu_item_set.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class MenuItemSet < ApplicationRecord
|
||||
belongs_to :item_set
|
||||
belongs_to :menu_item
|
||||
end
|
||||
|
||||
# class Settings::MenuItemSet < ApplicationRecord
|
||||
# belongs_to :item_set_id
|
||||
# belongs_to :menu_item_id
|
||||
# end
|
||||
@@ -65,7 +65,6 @@ class Order < ApplicationRecord
|
||||
end
|
||||
|
||||
def adding_line_items
|
||||
|
||||
if self.items
|
||||
#re-order to
|
||||
ordered_list = re_order_items(self.items)
|
||||
@@ -320,12 +319,18 @@ class Order < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.search(filter,from,to)
|
||||
if !from.nil? && !to.nil?
|
||||
Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to)
|
||||
def self.search(filter,from,to,count)
|
||||
if count.to_i > 0
|
||||
item_count = "and item_count = '#{count}'"
|
||||
else
|
||||
# find(:all)
|
||||
where("order_id LIKE ? OR item_count ='#{filter}'","%#{filter}%",)
|
||||
item_count = ''
|
||||
end
|
||||
if from.present? && to.present?
|
||||
Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ? #{item_count}", from,to)
|
||||
elsif !from.present? && !to.present? && count.present?
|
||||
Order.where("item_count = '#{count}'")
|
||||
else
|
||||
Order.where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
||||
# end
|
||||
|
||||
#Bill Receipt Print
|
||||
def print_close_cashier(printer_settings,shift_sale,shop_details,sale_taxes)
|
||||
def print_close_cashier(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
cashier = shift_sale.employee.name
|
||||
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
||||
|
||||
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes)
|
||||
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
|
||||
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
||||
pdf.render_file filename
|
||||
self.print(filename)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
class Product < ApplicationRecord
|
||||
validates_presence_of :name
|
||||
|
||||
# Product Image Uploader
|
||||
mount_uploader :image_path, ProductImageUploader
|
||||
end
|
||||
|
||||
@@ -91,7 +91,7 @@ class Sale < ApplicationRecord
|
||||
add_item(item)
|
||||
end
|
||||
|
||||
# link_order_sale(order.id)
|
||||
link_order_sale(order.id)
|
||||
|
||||
end
|
||||
self.save!
|
||||
@@ -295,25 +295,33 @@ class Sale < ApplicationRecord
|
||||
total_tax_amount = 0
|
||||
#tax_profile - list by order_by
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
|
||||
customer = Customer.find(sale.customer_id)
|
||||
# #Creat new tax records
|
||||
tax_profiles.each do |tax|
|
||||
sale_tax = SaleTax.new(:sale => sale)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
#include or execulive
|
||||
# sale_tax.tax_payable_amount = total_taxable * tax.rate
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
sale_tax = SaleTax.new(:sale => sale)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
|
||||
# substract , to give after discount
|
||||
total_tax = total_taxable - total_discount
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
#new taxable amount is standard rule for step by step
|
||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
# substract , to give after discount
|
||||
total_tax = total_taxable - total_discount
|
||||
#include or execulive
|
||||
if tax.inclusive
|
||||
rate = tax.rate
|
||||
divided_value = (100 + rate)/rate
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
end
|
||||
#new taxable amount is standard rule for step by step
|
||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
sale.total_tax = total_tax_amount
|
||||
@@ -321,12 +329,6 @@ class Sale < ApplicationRecord
|
||||
|
||||
# Tax Calculate
|
||||
def apply_tax(total_taxable)
|
||||
#if tax is not apply create new record
|
||||
# self.sale_taxes.each do |existing_tax|
|
||||
# #delete existing and create new
|
||||
# existing_tax.delete
|
||||
# end
|
||||
|
||||
#if tax is not apply create new record
|
||||
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
||||
#delete existing and create new
|
||||
@@ -336,27 +338,38 @@ class Sale < ApplicationRecord
|
||||
total_tax_amount = 0
|
||||
#tax_profile - list by order_by
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
|
||||
customer = Customer.find(self.customer_id)
|
||||
|
||||
# #Creat new tax records
|
||||
#Create new tax records
|
||||
tax_profiles.each do |tax|
|
||||
sale_tax = SaleTax.new(:sale => self)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
#include or execulive
|
||||
# sale_tax.tax_payable_amount = total_taxable * tax.rate
|
||||
total_tax = total_taxable - self.total_discount
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
#new taxable amount is standard rule for step by step
|
||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
sale_tax = SaleTax.new(:sale => self)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
# substract , to give after discount
|
||||
total_tax = total_taxable - self.total_discount
|
||||
#include or execulive
|
||||
if tax.inclusive
|
||||
rate = tax.rate
|
||||
divided_value = (100 + rate)/rate
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
end
|
||||
|
||||
#new taxable amount is standard rule for step by step
|
||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.total_tax = total_tax_amount
|
||||
|
||||
end
|
||||
|
||||
def product_get_unit_price(item_code)
|
||||
@@ -401,7 +414,6 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.search(filter,from,to)
|
||||
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
@@ -418,7 +430,6 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.search_credit_sales(customer,filter,from,to)
|
||||
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
@@ -436,7 +447,7 @@ class Sale < ApplicationRecord
|
||||
.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and sp.payment_method = 'creditnote' #{keyword} #{custo}", from,to)
|
||||
else
|
||||
sale = Sale.all.joins("JOIN sale_payments sp on sp.sale_id = sales.sale_id")
|
||||
.where("sp.payment_method =? #{keyword} #{custo}",'creditnote')
|
||||
.where("sp.payment_method ='creditnote' #{keyword} #{custo}")
|
||||
|
||||
end
|
||||
|
||||
@@ -537,31 +548,25 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
query = Sale.select("
|
||||
mi.item_code as code,(SUM(i.qty) * i.unit_price) as grand_total,
|
||||
SUM(i.qty) as total_item," +
|
||||
" i.unit_price as unit_price,
|
||||
mi.name as product_name,
|
||||
mc.name as menu_category_name,
|
||||
mc.id as menu_category_id ")
|
||||
.group('mi.id')
|
||||
.order("mi.menu_category_id")
|
||||
|
||||
query = Sale.select("
|
||||
mi.item_code as code,(SUM(i.qty) * i.unit_price) as grand_total,
|
||||
SUM(i.qty) as total_item," +
|
||||
" i.unit_price as unit_price,
|
||||
mi.name as product_name,
|
||||
mc.name as menu_category_name,
|
||||
mc.id as menu_category_id ")
|
||||
.group('mi.id')
|
||||
.order("mi.menu_category_id")
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
||||
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
||||
JOIN employees ea ON ea.id = sales.cashier_id")
|
||||
|
||||
|
||||
query = query.where("(receipt_date between ? and ? and sale_status=?) AND i.unit_price <> 0",from,to,status)
|
||||
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
||||
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
||||
JOIN employees ea ON ea.id = sales.cashier_id")
|
||||
|
||||
|
||||
query = query.where("(receipt_date between ? and ? and sale_status=?) AND i.unit_price <> 0",from,to,status)
|
||||
end
|
||||
|
||||
|
||||
def self.get_by_shiftsales(from,to,shift)
|
||||
if !shift.blank?
|
||||
ShiftSale.where("id =?",shift.id)
|
||||
@@ -591,79 +596,77 @@ def self.get_item_query()
|
||||
|
||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")
|
||||
end
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||
|
||||
query = self.get_item_query()
|
||||
discount_query = 0
|
||||
total_card_amount = 0
|
||||
total_cash_amount = 0
|
||||
total_credit_amount = 0
|
||||
total_foc_amount = 0
|
||||
total_grand_total = 0
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
### => get all sales range in shift_sales
|
||||
elsif shift_sale_range.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
else
|
||||
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", from,to)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
end
|
||||
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
|
||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||
|
||||
query = self.get_item_query()
|
||||
discount_query = 0
|
||||
total_card_amount = 0
|
||||
total_cash_amount = 0
|
||||
total_credit_amount = 0
|
||||
total_foc_amount = 0
|
||||
total_grand_total = 0
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
### => get all sales range in shift_sales
|
||||
elsif shift_sale_range.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
else
|
||||
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", from,to)
|
||||
sale_cash.each do |s_c|
|
||||
total_cash_amount += s_c.cash_amount.to_f
|
||||
total_card_amount += s_c.card_amount.to_f
|
||||
total_credit_amount += s_c.credit_amount.to_f
|
||||
total_foc_amount += s_c.foc_amount.to_f
|
||||
end
|
||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||
|
||||
end
|
||||
|
||||
return query, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
|
||||
return query, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
|
||||
end
|
||||
|
||||
def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_type)
|
||||
|
||||
@@ -46,6 +46,8 @@ class SalePayment < ApplicationRecord
|
||||
payment_status = giftcard_payment
|
||||
when "paypar"
|
||||
payment_status = paypar_payment
|
||||
when "foc"
|
||||
payment_status = foc_payment
|
||||
else
|
||||
puts "it was something else"
|
||||
end
|
||||
@@ -164,6 +166,17 @@ class SalePayment < ApplicationRecord
|
||||
return payment_status
|
||||
end
|
||||
|
||||
def foc_payment
|
||||
payment_status = false
|
||||
self.payment_method = "foc"
|
||||
self.payment_amount = self.received_amount
|
||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
sale_update_payment_status(self.received_amount)
|
||||
return payment_status
|
||||
end
|
||||
|
||||
def creditnote_payment(customer_id)
|
||||
payment_status = false
|
||||
|
||||
@@ -257,11 +270,15 @@ class SalePayment < ApplicationRecord
|
||||
all_received_amount = 0.0
|
||||
sObj = Sale.find(self.sale_id)
|
||||
is_credit = 0
|
||||
is_foc = 0
|
||||
sObj.sale_payments.each do |spay|
|
||||
all_received_amount += spay.payment_amount.to_f
|
||||
if spay.payment_method == "creditnote"
|
||||
is_credit = 1
|
||||
end
|
||||
if spay.payment_method == "foc"
|
||||
is_foc = 1
|
||||
end
|
||||
end
|
||||
if (self.sale.grand_total <= all_received_amount)
|
||||
if is_credit == 0
|
||||
@@ -269,9 +286,16 @@ class SalePayment < ApplicationRecord
|
||||
else
|
||||
self.sale.payment_status = "outstanding"
|
||||
end
|
||||
|
||||
if is_foc == 0
|
||||
self.sale.payment_status = "paid"
|
||||
else
|
||||
self.sale.payment_status = "foc"
|
||||
end
|
||||
|
||||
self.sale.sale_status = "completed"
|
||||
|
||||
if MembershipSetting.find_by_rebate(1)
|
||||
if MembershipSetting.find_by_rebate(1) && is_foc == 0
|
||||
response = rebat(sObj)
|
||||
|
||||
if !response.nil?
|
||||
|
||||
@@ -57,6 +57,11 @@ class ShiftSale < ApplicationRecord
|
||||
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
||||
self.total_rounding = self.total_rounding + saleobj.rounding_adjustment
|
||||
self.total_receipt = self.total_receipt + 1
|
||||
if saleobj.customer.customer_type == "Dinein"
|
||||
self.dining_count = self.dining_count + 1
|
||||
else
|
||||
self.takeaway_count = self.takeaway_count + 1
|
||||
end
|
||||
self.save
|
||||
end
|
||||
|
||||
@@ -79,6 +84,11 @@ class ShiftSale < ApplicationRecord
|
||||
self.commercial_taxes = self.commercial_taxes.to_i - tax.to_f
|
||||
self.total_rounding = self.total_rounding - saleobj.rounding_adjustment
|
||||
self.total_void = self.total_void + saleobj.grand_total
|
||||
if saleobj.customer.customer_type == "Dinein"
|
||||
self.dining_count = self.dining_count - 1
|
||||
else
|
||||
self.takeaway_count = self.takeaway_count - 1
|
||||
end
|
||||
self.save
|
||||
end
|
||||
end
|
||||
@@ -88,4 +98,40 @@ class ShiftSale < ApplicationRecord
|
||||
closing_balance = shiftobj.grand_total + shiftobj.cash_in - shiftobj.cash_out + shiftobj.total_cash
|
||||
return closing_balance
|
||||
end
|
||||
|
||||
def self.get_by_shift_other_payment(shift)
|
||||
|
||||
other_payment = Sale.select("sale_payments.payment_method as name,
|
||||
SUM(case when (sale_payments.payment_method='mpu') then (sale_payments.payment_amount) else 0 end) as mpu_amount,
|
||||
SUM(case when (sale_payments.payment_method='visa') then (sale_payments.payment_amount) else 0 end) as visa_amount,
|
||||
SUM(case when (sale_payments.payment_method='master') then (sale_payments.payment_amount) else 0 end) as master_amount,
|
||||
SUM(case when (sale_payments.payment_method='jcb') then (sale_payments.payment_amount) else 0 end) as jcb_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount,
|
||||
SUM(case when (sale_payments.payment_method='paypar') then (sale_payments.payment_amount) else 0 end) as paypar_amount")
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sales.shift_sale_id =? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.id)
|
||||
end
|
||||
|
||||
def self.calculate_total_price_by_accounts(shift,type)
|
||||
query = Sale.select("acc.title as account_name," +
|
||||
"SUM(case when (acc.id=i.account_id) then (i.price) else 0 end) as total_price")
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id "+
|
||||
"JOIN accounts acc ON acc.id = i.account_id" +
|
||||
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
|
||||
if type == 'discount'
|
||||
query = query.where("sales.shift_sale_id =? and sale_status = 'completed' and i.is_taxable = false and i.remark = 'Discount'", shift.id)
|
||||
.group("acc.title").order("acc.id")
|
||||
else
|
||||
query = query.where("sales.shift_sale_id =? and sale_status = 'completed'", shift.id)
|
||||
.group("acc.title").order("acc.id")
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_total_member_discount(shift)
|
||||
query = Sale.select("SUM(sales.total_discount) as member_discount")
|
||||
.where("shift_sale_id =? and sale_status = 'completed' and discount_type = 'member_discount'", shift.id)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
class CloseCashierPdf < Prawn::Document
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes)
|
||||
self.page_width = PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","Close Cashier").first.page_height
|
||||
|
||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 40
|
||||
self.qty_width = 20
|
||||
@@ -26,16 +27,11 @@ class CloseCashierPdf < Prawn::Document
|
||||
self.header_font_size = 10
|
||||
self.item_font_size = 8
|
||||
|
||||
|
||||
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
shift_detail(shift_sale,sale_taxes)
|
||||
|
||||
|
||||
|
||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||
end
|
||||
|
||||
def header (shop_details)
|
||||
@@ -51,7 +47,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
def shift_detail(shift_sale,sale_taxes)
|
||||
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||
move_down 7
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
@@ -151,6 +147,10 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.total_taxes}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||
@@ -166,14 +166,91 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.credit_sales}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
#start other payment details
|
||||
if shift_sale.other_sales > 0
|
||||
other_payment.each do |other|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Other Payment Details", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.mpu_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "VISA Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.visa_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.master_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.jcb_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Reedem Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.paypar_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "FOC :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.foc_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.other_sales}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.other_sales}", :size => self.item_font_size, :align => :right
|
||||
|
||||
# end other payment details
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_amount_by_account.each do |amount|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Amount:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{amount.total_price.round(2)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
@@ -183,14 +260,57 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_discount_by_account.each do |amount|
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{amount.total_price.round(2)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
|
||||
if total_member_discount[0].member_discount.present?
|
||||
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||
@overall = shift_sale.total_discounts - @member_discount
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Member Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{@member_discount}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
else
|
||||
@overall = shift_sale.total_discounts
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Discount Amount :", :size => self.item_font_size, :align => :right
|
||||
text "Total Overall Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{@overall}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Discount Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_discounts}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
|
||||
sale_taxes.each do |tax|
|
||||
|
||||
y_position = cursor
|
||||
@@ -224,6 +344,22 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.total_receipt}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Dining Count :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.dining_count}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Takeaway Count :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.takeaway_count}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Void:", :size => self.item_font_size, :align => :right
|
||||
@@ -236,8 +372,6 @@ class CloseCashierPdf < Prawn::Document
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
move_down 5
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -54,8 +54,9 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||
|
||||
sign(sale_data)
|
||||
|
||||
|
||||
footer(printed_status)
|
||||
end
|
||||
|
||||
@@ -237,12 +238,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
end
|
||||
|
||||
def sale_payment(sale_data,precision,delimiter)
|
||||
|
||||
def sale_payment(sale_data,precision,delimiter)
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||
|
||||
y_position = cursor
|
||||
if payment.payment_method == "paypar"
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
@@ -269,15 +268,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down 5
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# show member information
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter)
|
||||
|
||||
if rebate_amount != nil
|
||||
|
||||
if rebate_amount != nil
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
total = 0
|
||||
@@ -414,6 +410,43 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
end
|
||||
|
||||
def sign(sale_data)
|
||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||
if payment.payment_method == "creditnote"
|
||||
|
||||
y_position = cursor
|
||||
stroke_horizontal_rule
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 70
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 73
|
||||
text "Approved By" , :size => self.item_font_size,:align => :center
|
||||
end
|
||||
end
|
||||
end
|
||||
if sale_data.payment_status == "foc"
|
||||
|
||||
y_position = cursor
|
||||
stroke_horizontal_rule
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 70
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 73
|
||||
text "Acknowledged By" , :size => self.item_font_size,:align => :center
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def footer(printed_status)
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
@@ -421,7 +454,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{printed_status}", :size => self.item_font_size,:align => :left
|
||||
text "#{printed_status}",:style => :bold, :size => self.header_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
||||
@@ -429,6 +462,5 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
move_down 5
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
58
app/uploaders/menu_item_image_uploader.rb
Normal file
58
app/uploaders/menu_item_image_uploader.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
class MenuItemImageUploader < CarrierWave::Uploader::Base
|
||||
|
||||
# Include RMagick or MiniMagick support:
|
||||
# include CarrierWave::RMagick
|
||||
# include CarrierWave::MiniMagick
|
||||
|
||||
# Choose what kind of storage to use for this uploader:
|
||||
storage :file
|
||||
# storage :fog
|
||||
|
||||
def root
|
||||
Rails.root.join 'public/'
|
||||
end
|
||||
|
||||
# Override the directory where uploaded files will be stored.
|
||||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
"image/menu_images"
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||
# def default_url(*args)
|
||||
# # For Rails 3.1+ asset pipeline compatibility:
|
||||
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
||||
#
|
||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||
# end
|
||||
|
||||
# Process files as they are uploaded:
|
||||
# process scale: [200, 300]
|
||||
#
|
||||
# def scale(width, height)
|
||||
# # do something
|
||||
# end
|
||||
|
||||
# Create different versions of your uploaded files:
|
||||
# version :thumb do
|
||||
# process resize_to_fit: [50, 50]
|
||||
# end
|
||||
|
||||
# Add a white list of extensions which are allowed to be uploaded.
|
||||
# For images you might use something like this:
|
||||
def extension_whitelist
|
||||
%w(jpg jpeg gif png)
|
||||
end
|
||||
|
||||
# Override the filename of the uploaded files:
|
||||
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
||||
# def filename
|
||||
# "something.jpg" if original_filename
|
||||
# end
|
||||
|
||||
end
|
||||
58
app/uploaders/product_image_uploader.rb
Normal file
58
app/uploaders/product_image_uploader.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
class ProductImageUploader < CarrierWave::Uploader::Base
|
||||
|
||||
# Include RMagick or MiniMagick support:
|
||||
# include CarrierWave::RMagick
|
||||
# include CarrierWave::MiniMagick
|
||||
|
||||
# Choose what kind of storage to use for this uploader:
|
||||
storage :file
|
||||
# storage :fog
|
||||
|
||||
def root
|
||||
Rails.root.join 'public/'
|
||||
end
|
||||
|
||||
# Override the directory where uploaded files will be stored.
|
||||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
"image/product_images"
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||
# def default_url(*args)
|
||||
# # For Rails 3.1+ asset pipeline compatibility:
|
||||
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
||||
#
|
||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||
# end
|
||||
|
||||
# Process files as they are uploaded:
|
||||
# process scale: [200, 300]
|
||||
#
|
||||
# def scale(width, height)
|
||||
# # do something
|
||||
# end
|
||||
|
||||
# Create different versions of your uploaded files:
|
||||
# version :thumb do
|
||||
# process resize_to_fit: [50, 50]
|
||||
# end
|
||||
|
||||
# Add a white list of extensions which are allowed to be uploaded.
|
||||
# For images you might use something like this:
|
||||
def extension_whitelist
|
||||
%w(jpg jpeg gif png)
|
||||
end
|
||||
|
||||
# Override the filename of the uploaded files:
|
||||
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
||||
# def filename
|
||||
# "something.jpg" if original_filename
|
||||
# end
|
||||
|
||||
end
|
||||
7
app/views/api/restaurant/item_sets/index.json.jbuilder
Normal file
7
app/views/api/restaurant/item_sets/index.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
json.array! @item_sets do |set|
|
||||
json.id set.id
|
||||
json.name set.name
|
||||
json.alt_name set.alt_name
|
||||
json.min_selectable_qty set.min_selectable_qty
|
||||
json.max_selectable_qty set.max_selectable_qty
|
||||
end
|
||||
@@ -5,13 +5,14 @@ json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
|
||||
if (menu.menu_categories)
|
||||
json.menu_categories menu.menu_categories do |category|
|
||||
json.categories menu.menu_categories do |category|
|
||||
json.id category.id
|
||||
json.name category.name
|
||||
json.alt_name category.alt_name
|
||||
json.is_available category.is_available
|
||||
|
||||
if category.menu_items
|
||||
json.menu_items category.menu_items do |item|
|
||||
json.items category.menu_items do |item|
|
||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,40 +1,70 @@
|
||||
# Format for attributes json
|
||||
attr_format = []
|
||||
param_count = item.item_attributes.count
|
||||
# Format for attributes json
|
||||
item.item_attributes.each do|attr_id|
|
||||
menu_attr = MenuItemAttribute.find(attr_id)
|
||||
if attr_format.count == 0
|
||||
attr_format.push({ type: menu_attr.attribute_type, value: [] })
|
||||
end
|
||||
|
||||
attr_format.each do |af|
|
||||
if menu_attr.attribute_type == af[:type]
|
||||
af[:value].push(menu_attr.value)
|
||||
else
|
||||
new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
|
||||
attr_format.push(new_attr)
|
||||
end
|
||||
|
||||
break if attr_format.count > param_count
|
||||
end
|
||||
|
||||
param_count -= 1
|
||||
end
|
||||
|
||||
#Menu Item Information
|
||||
json.item_code item.item_code
|
||||
json.name item.name
|
||||
json.alt_name item.alt_name
|
||||
json.type item.type
|
||||
json.min_qty item.min_qty
|
||||
json.min_selectable_item item.min_selectable_item
|
||||
json.max_selectable_item item.max_selectable_item
|
||||
json.id item.id
|
||||
json.item_code item.item_code
|
||||
json.name item.name
|
||||
json.alt_name item.alt_name
|
||||
json.image item.image_path.url
|
||||
json.description item.description
|
||||
json.Information item.information
|
||||
json.type item.type
|
||||
json.account_id item.account_id
|
||||
json.min_qty item.min_qty
|
||||
json.is_available item.is_available
|
||||
json.is_sub_item item.is_sub_item
|
||||
json.item_sets item.item_sets
|
||||
json.attributes attr_format
|
||||
json.options item.item_options
|
||||
# json.min_selectable_item item.min_selectable_item
|
||||
# json.max_selectable_item item.max_selectable_item
|
||||
|
||||
#Item instance
|
||||
if item.menu_item_instances.count == 1 then
|
||||
|
||||
item_instance = item.menu_item_instances[0]
|
||||
json.price = item_instance.price
|
||||
json.is_available = item_instance.is_available
|
||||
json.is_on_promotion = item_instance.is_on_promotion
|
||||
json.promotion_price = item_instance.promotion_price
|
||||
json.item_attributes = item_instance.item_attributes
|
||||
|
||||
elsif item.menu_item_instances.count > 1 then
|
||||
|
||||
json.item_instances item.menu_item_instances do |is|
|
||||
json.item_instance_item_code = is.item_instance_code
|
||||
json.item_instance_name = is.item_instance_name
|
||||
json.price = is.price
|
||||
json.is_available = is.is_available
|
||||
json.is_on_promotion = is.is_on_promotion
|
||||
json.promotion_price = is.promotion_price
|
||||
json.item_attributes = is.item_attributes
|
||||
end
|
||||
# if item.menu_item_instances.count == 1 then
|
||||
# item_instance = item.menu_item_instances[0]
|
||||
# json.price = item_instance.price
|
||||
# json.is_available = item_instance.is_available
|
||||
# json.is_on_promotion = item_instance.is_on_promotion
|
||||
# json.promotion_price = item_instance.promotion_price
|
||||
# json.item_attributes = item_instance.item_attributes
|
||||
|
||||
json.instances item.menu_item_instances do |is|
|
||||
json.code is.item_instance_code
|
||||
json.name is.item_instance_name
|
||||
json.price is.price
|
||||
json.is_available is.is_available
|
||||
json.is_default is.is_default
|
||||
json.is_on_promotion is.is_on_promotion
|
||||
json.promotion_price is.promotion_price
|
||||
json.item_attributes is.item_attributes
|
||||
json.item_sets is.item_sets
|
||||
end
|
||||
|
||||
#Child Menu items
|
||||
if (item.children) then
|
||||
json.set_items item.children.each do |item|
|
||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
end
|
||||
|
||||
end
|
||||
# if (item.children) then
|
||||
# json.set_items item.children.each do |item|
|
||||
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
# end
|
||||
# end
|
||||
@@ -4,9 +4,11 @@ json.array! @menus do |menu|
|
||||
json.valid_days menu.valid_days
|
||||
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
if (@current_menu)
|
||||
json.current_menu do
|
||||
json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
||||
end
|
||||
end
|
||||
|
||||
json.partial! 'api/restaurant/menu/menu', menu: menu
|
||||
# if (@current_menu)
|
||||
# json.current_menu do
|
||||
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
48
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
48
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
@@ -0,0 +1,48 @@
|
||||
if @menu.menu_items
|
||||
json.menu_items @menu.menu_items do |item|
|
||||
#Menu Item Information
|
||||
# json.item_code item.item_code
|
||||
# json.name item.name
|
||||
# json.alt_name item.alt_name
|
||||
# json.type item.type
|
||||
# json.min_qty item.min_qty
|
||||
# json.min_selectable_item item.min_selectable_item
|
||||
# json.max_selectable_item item.max_selectable_item
|
||||
|
||||
#Item instance
|
||||
# if item.menu_item_instances.count == 1 then
|
||||
|
||||
# item_instance = item.menu_item_instances[0]
|
||||
# json.price item_instance.price
|
||||
# json.is_available item_instance.is_available
|
||||
# json.is_on_promotion item_instance.is_on_promotion
|
||||
# json.promotion_price item_instance.promotion_price
|
||||
# json.item_attributes item_instance.item_attributes
|
||||
|
||||
# elsif item.menu_item_instances.count > 1 then
|
||||
|
||||
# json.item_instances item.menu_item_instances do |is|
|
||||
# json.item_instance_item_code is.item_instance_code
|
||||
# json.item_instance_name is.item_instance_name
|
||||
# json.price is.price
|
||||
# json.is_available is.is_available
|
||||
# json.is_on_promotion is.is_on_promotion
|
||||
# json.promotion_price is.promotion_price
|
||||
# json.item_attributes is.item_attributes
|
||||
# end
|
||||
|
||||
# end
|
||||
#Child Menu items
|
||||
# if (item.menu_item_sets) then
|
||||
# json.set_items item.menu_item_sets.each do |item|
|
||||
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
# end
|
||||
|
||||
#end
|
||||
# if category.menu_items
|
||||
# json.items category.menu_items do |item|
|
||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
json.array! @menu_attributes do |attribute|
|
||||
json.id attribute.id
|
||||
json.type attribute.attribute_type
|
||||
json.name attribute.name
|
||||
json.value attribute.value
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
json.array! @menu_options do |option|
|
||||
json.id option.id
|
||||
json.type option.option_type
|
||||
json.name option.name
|
||||
json.value option.value
|
||||
end
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
<%= simple_form_for([:crm,@crm_customer]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
|
||||
@@ -1,25 +1,7 @@
|
||||
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
<span class="patch_method"></span>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['card_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-6px"><%= str %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Paypar Account No:</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
|
||||
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Salutation :</label><br>
|
||||
@@ -100,7 +82,39 @@
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Customer Type</label>
|
||||
<select class="selectpicker form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['card_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-6px"><%= str %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Paypar Account No:</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
|
||||
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
@@ -110,8 +124,7 @@
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -138,6 +151,11 @@
|
||||
},100);
|
||||
}
|
||||
});
|
||||
|
||||
// $("#customer_card_no").click(function(){
|
||||
// var ab=$("#customer_tax_profiles").val();
|
||||
// console.log(JSON.stringify(ab));
|
||||
// });
|
||||
});
|
||||
|
||||
|
||||
|
||||
4
app/views/crm/customers/edit.json.jbuilder
Normal file
4
app/views/crm/customers/edit.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||
:membership_id, :membership_type, :membership_authentication_code,
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
@@ -76,7 +76,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render 'new_form', crm_customer: @crm_customer %>
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
@@ -121,15 +121,24 @@ $(document).on('click',".customer_tr",function(){
|
||||
update_sale(customer_id,sale_id);
|
||||
}else{
|
||||
|
||||
var url = "customers/"+customer_id;
|
||||
var url = "customers/" + customer_id + "/edit";
|
||||
}
|
||||
|
||||
$("#customer_tax_profiles").children().removeAttr("selected").css({'color':'#000','background':'none'});
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
success: function(data) {
|
||||
// Selected for Taxes
|
||||
var taxes = JSON.stringify(data.tax_profiles);
|
||||
var parse_taxes = JSON.parse(taxes);
|
||||
$.each(parse_taxes, function(i, value){
|
||||
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
|
||||
});
|
||||
|
||||
$('#customer_id').val(data.id);
|
||||
$('#customer_name').val(data.name);
|
||||
$('#customer_company').val(data.company);
|
||||
@@ -138,6 +147,7 @@ $(document).on('click',".customer_tr",function(){
|
||||
$('#customer_salutation').val(data.salutation);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#customer_card_no').val(data.card_no);
|
||||
$('#customer_type').val(data.customer_type);
|
||||
$('#paypar_account_no').val(data.paypar_account_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||
:membership_id, :membership_type, :membership_authentication_code,
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
|
||||
@@ -5,13 +5,10 @@
|
||||
|
||||
<% elsif current_login_employee.role = "cashier" %>
|
||||
<%= link_to "Cashier Station", origami_path %>
|
||||
|
||||
<% elsif current_login_employee = "account" %>
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
|
||||
<% else %>
|
||||
<%= link_to "Cashier Station", oishi_path %>
|
||||
|
||||
<% end %>
|
||||
<% shop = Shop.first %>
|
||||
|
||||
@@ -228,28 +225,21 @@
|
||||
|
||||
<div class="footer">
|
||||
<div class="card">
|
||||
<div class="page-header" style="width:100%;text-align:center;background-color:#ddd;">
|
||||
<h4 style="color : #ef404a;font-weight:bold;font-style:italic;margin-bottom:0px;"><%= shop.name %></h4>
|
||||
<div class="page-header center-text">
|
||||
<h4 class="footer-header">
|
||||
<%= shop.name %>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
|
||||
<div class="center-text">
|
||||
<%= shop.address %>
|
||||
</div>
|
||||
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
|
||||
<div class="center-text">
|
||||
<%= shop.phone_no %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-top: 10px;
|
||||
box-sizing: border-box;
|
||||
@@ -289,3 +279,4 @@
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<li><%= link_to "Order Queue Stations",settings_order_queue_stations_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Menus ", settings_menus_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Item Sets ", settings_item_sets_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Menu Item Sets ", settings_menu_item_sets_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Menu Item Attributes", settings_menu_item_attributes_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
|
||||
@@ -26,10 +28,11 @@
|
||||
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissioners", origami_commissioners_path , :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>]
|
||||
<li><%= link_to "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Products", settings_products_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'settings', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'fileinput.min', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'fileinput.min', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -32,8 +35,7 @@
|
||||
<%= message %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
|
||||
<%= yield %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
197
app/views/oqs/home/bkindex.html.erb
Normal file
197
app/views/oqs/home/bkindex.html.erb
Normal file
@@ -0,0 +1,197 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
||||
</li>
|
||||
|
||||
<% # For Tab Disable for Station is inactive
|
||||
status=""
|
||||
@queue_stations_items.each do |qsi|
|
||||
if qsi[:is_active] == false
|
||||
status="disabled"
|
||||
end
|
||||
%>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href=<%= '#' + qsi[:station_name].gsub(' ', '_') %> role="tab" <%= status %>>
|
||||
<%= qsi[:station_name] %>
|
||||
<span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>>
|
||||
<%= qsi[:item_count] %>
|
||||
</span>
|
||||
<% if qsi[:is_ap] %>
|
||||
<span>(ap)</span>
|
||||
<% end %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed -->
|
||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@queue_completed_item.each do |qid|
|
||||
%>
|
||||
<div class="card queue_station">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">
|
||||
<span class="order-zone-type"><%= qid.type %> - </span>
|
||||
<span class="order-zone"><%= qid.zone %></span>
|
||||
<small class="pull-right"><%= qid.order_id %></small>
|
||||
</h4>
|
||||
<h4>
|
||||
<span class="order-item">
|
||||
<%= qid.item_name %>
|
||||
</span> [x
|
||||
<span class="order-qty">
|
||||
<%= qid.qty %>
|
||||
</span> ]
|
||||
</h4>
|
||||
|
||||
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Order at
|
||||
<span class="order-at">
|
||||
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
||||
</span> -
|
||||
<span class="order-by">
|
||||
<%= qid.item_order_by %>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
<p class="hidden order-status">completed</p>
|
||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Panel 0 - Completed -->
|
||||
|
||||
<!-- Order Item for Queue Station -->
|
||||
<%
|
||||
@queue_stations_items.each do |qsi|
|
||||
%>
|
||||
<!-- Generated Pane -->
|
||||
<div class="tab-pane" id=<%= qsi[:station_name].gsub(' ', '_') %> role="tabpanel">
|
||||
<!--- Order Items -->
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@queue_items_details.each do |qid|
|
||||
if qid.price != 0
|
||||
if qid.zone_id == qsi[:zone_id] && qid.station_name == qsi[:station_name]
|
||||
%>
|
||||
<div class="card queue_station">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">
|
||||
<span class="order-zone-type"><%= qid.type %> - </span>
|
||||
<span class="order-zone"><%= qid.zone %></span>
|
||||
<small class="pull-right"><%= qid.order_id %></small>
|
||||
</h4>
|
||||
<h4>
|
||||
<span class="order-item"><%= qid.item_name %></span> [x
|
||||
<span class="order-qty"><%= qid.qty %></span> ]
|
||||
</h4>
|
||||
|
||||
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Order at
|
||||
<span class="order-at">
|
||||
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
||||
</span> -
|
||||
<span class="order-by">
|
||||
<%= qid.item_order_by %>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
<!-- Hidden Fields for Items -->
|
||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button id=<%= 'edit_' + qid.assigned_order_item_id.to_s %> class="btn btn-warning order-item order-item-edit">EDIT</button>
|
||||
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
<!--- end of Items-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of Pane -->
|
||||
<% end %>
|
||||
<!-- End Order Item for Queue Station -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">ORDER DETAILS - Table</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:33%; text-align:left">Order By</th>
|
||||
<th style="width:33%; text-align:right">Order At</td>
|
||||
<th style="width:33%; text-align:right">Customer</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td id="order-by" style="width:33%; text-align:left"></td>
|
||||
<td id="order-at" style="width:33%; text-align:right"></td>
|
||||
<td id="order-customer" style="width:33%; text-align:right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Table/Room</strong></td>
|
||||
<td id="order-from" colspan="2"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-text" style="min-height:360px; max-height:360px; overflow:auto">
|
||||
<table class="table" id="oqs-order-details-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:80%; text-align:left">Items</th>
|
||||
<th style="width:20%; text-align:right">QTY</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Bind With JS -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three--->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- OQS Buttons -->
|
||||
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_summary">Print <br/>Order<br/>Summary</button>
|
||||
<a href="<%= dashboard_path %>" class="btn btn-primary btn-lg btn-block" role="button" aria-haspopup="true"> Back </a>
|
||||
<!-- <button type="button" class="" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,39 +1,66 @@
|
||||
<br>
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<div class="col-md-6">
|
||||
<%= form_tag oqs_root_path, :method => :get do %>
|
||||
<div class="form-group col-md-8">
|
||||
<input type="text" name="filter" class="form-control input-md" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-1">
|
||||
<input type="submit" value="Search" class='btn btn-primary btn-md'>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<!-- Column One -->
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
||||
<!-- <li class="nav-item nav-search <%= @filter.to_s.length > 0? " " : "hide"%>">
|
||||
<a class="nav-link <%= @filter.to_s.length > 0? "active" : " "%>" data-toggle="tab" href="#search" role="tab">Searching .. <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
||||
</li> -->
|
||||
<li class="nav-item nav-completed">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
||||
</li>
|
||||
|
||||
<%
|
||||
# For Tab Disable for Station is inactive
|
||||
<% # For Tab Disable for Station is inactive
|
||||
status=""
|
||||
@queue_stations_items.each do |qsi|
|
||||
if qsi[:is_active] == false
|
||||
@queue_stations.each do |qsi|
|
||||
if qsi.is_active == false
|
||||
status="disabled"
|
||||
end
|
||||
%>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href=<%= '#' + qsi[:station_name].gsub(' ', '_') %> role="tab" <%= status %>>
|
||||
<%= qsi[:station_name] %>
|
||||
<span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>>
|
||||
<%= qsi[:item_count] %>
|
||||
end %>
|
||||
<li class="nav-item oqs_click" >
|
||||
<p class="hidden oqs-id"><%= qsi.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab" <%= status %>>
|
||||
<%= qsi.station_name %>
|
||||
<% if @filter.nil? %>
|
||||
<span class="badge badge-pill badge-default" id=""> <%= qsi.assigned_order_items.where("delivery_status=0").count %>
|
||||
</span>
|
||||
<% if qsi[:is_ap] %>
|
||||
<span>(ap)</span>
|
||||
<% end %>
|
||||
</a>
|
||||
<%else%>
|
||||
<span class="badge badge-pill badge-default" id="">
|
||||
<% @count.each do |c|%>
|
||||
<% if qsi.id == c.station_id %>
|
||||
<%= c.total %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</span>
|
||||
<%end%>
|
||||
<% if qsi.auto_print %>
|
||||
<span>(ap)</span>
|
||||
<% end %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<p class="hidden filter"><%= @filter %></p>
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed -->
|
||||
|
||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@@ -77,66 +104,14 @@
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- End Panel 0 - Completed -->
|
||||
|
||||
<!-- Order Item for Queue Station -->
|
||||
<%
|
||||
@queue_stations_items.each do |qsi|
|
||||
%>
|
||||
<!-- Generated Pane -->
|
||||
<div class="tab-pane" id=<%= qsi[:station_name].gsub(' ', '_') %> role="tabpanel">
|
||||
<!--- Order Items -->
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@queue_items_details.each do |qid|
|
||||
if qid.price != 0
|
||||
if qid.zone_id == qsi[:zone_id] && qid.station_name == qsi[:station_name]
|
||||
%>
|
||||
<div class="card queue_station">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">
|
||||
<span class="order-zone-type"><%= qid.type %> - </span>
|
||||
<span class="order-zone"><%= qid.zone %></span>
|
||||
<small class="pull-right"><%= qid.order_id %></small>
|
||||
</h4>
|
||||
<h4>
|
||||
<span class="order-item"><%= qid.item_name %></span> [x
|
||||
<span class="order-qty"><%= qid.qty %></span> ]
|
||||
</h4>
|
||||
|
||||
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Order at
|
||||
<span class="order-at">
|
||||
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
||||
</span> -
|
||||
<span class="order-by">
|
||||
<%= qid.item_order_by %>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
<!-- Hidden Fields for Items -->
|
||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button id=<%= 'edit_' + qid.assigned_order_item_id.to_s %> class="btn btn-warning order-item order-item-edit">EDIT</button>
|
||||
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
<!--- end of Items-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of Pane -->
|
||||
<% end %>
|
||||
<!-- End Order Item for Queue Station -->
|
||||
<!--- Order Items -->
|
||||
<div class="card-columns oqs_append" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
</div>
|
||||
<!--- end of Items-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -197,4 +172,6 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
108
app/views/origami/addorders/index.html.erb
Normal file
108
app/views/origami/addorders/index.html.erb
Normal file
@@ -0,0 +1,108 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#table" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#room" role="tab">Rooms</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" style="max-height:650px; overflow:auto">
|
||||
|
||||
<div class="tab-pane active" id="table" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @tables.each do |zone| %>
|
||||
<h3>Zone : <%=zone.zone.name%></h3>
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
|
||||
<% @all_table.each do |table| %>
|
||||
<% if zone.zone_id == table.zone_id %>
|
||||
<div class="card click_table <%= table.status=="available" ? "available" : "occupied"%>" data-id = "<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden table-status"><%= table.status %></p>
|
||||
<p style="text-align: center"><%= table.name %></p>
|
||||
<p style="text-align: center">Seat : <%= table.seater %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %> <% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="room" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @rooms.each do |zone| %>
|
||||
<h3>Zone : <%=zone.zone.name%></h3>
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
|
||||
<% @all_room.each do |room| %>
|
||||
<% if zone.zone_id == room.zone_id %>
|
||||
<div class="card click_table <%= room.status=="available" ? "available" : "occupied"%>" data-id = "<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden table-status"><%= room.status %></p>
|
||||
<p style="text-align: center"><%= room.name %></p>
|
||||
<p style="text-align: center">Seat : <%= room.seater %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %> <% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).on('click',".click_table",function(){
|
||||
|
||||
var dining_id = $(this).attr('data-id');
|
||||
var status = $(this).find(".table-status").text();
|
||||
|
||||
if (status == "available") {
|
||||
$.confirm({
|
||||
title: 'Confirmation !',
|
||||
content: 'Are you sure to assign this table',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami/addorders/'+dining_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'You cannot assign this table',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-red',
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.card-columns {
|
||||
-webkit-column-count:5;
|
||||
-moz-column-count:5;
|
||||
column-count:5;
|
||||
}
|
||||
|
||||
.occupied{
|
||||
color: #fff !important;
|
||||
background-color: red;
|
||||
}
|
||||
.available{
|
||||
color: #fff !important;
|
||||
background-color: #009900;
|
||||
}
|
||||
|
||||
</style>
|
||||
411
app/views/origami/addorders/show.html.erb
Normal file
411
app/views/origami/addorders/show.html.erb
Normal file
@@ -0,0 +1,411 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<ul class="nav nav-tabs flex-column" role="tablist" >
|
||||
<% @menu.each do |menu| %>
|
||||
<li class="nav-item menu_category" data-ref="<%= api_restaurant_menu_category_path menu.id%>">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-7 col-lg-7 col-sm-7">
|
||||
<div class="card-columns menu_items_list" style="column-gap: 10px;">
|
||||
<!-- append data -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%=@table_id%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text" style="max-height:550px; overflow:auto"">
|
||||
<table class="table table-striped summary-items">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-qty">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success create" id="create_order" disabled="disabled">Create Order</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Large modal -->
|
||||
<button class="btn btn-primary" data-toggle="modal" data-target=".sx_item_detailModal">Large modal</button>
|
||||
|
||||
<div class="modal fade sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background-color: #54A5AF;">
|
||||
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<%= image_tag "logo.png" ,width: '', height: '', :style => '' %>
|
||||
<br><br>
|
||||
<div class="form-group">
|
||||
<h4 class="col-md-12">Quantity</h4>
|
||||
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<h4 class="col-md-6">Total</h4>
|
||||
<h4 class="col-md-6" id="total_price"> 2500 Ks</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<h4>Options</h4>
|
||||
|
||||
<h4>Attributes</h4>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal" id="save_order">Add Order</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title"></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table width="100%" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="">Item Name</th>
|
||||
<th style="">Quantity</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="item_name" id="modal-item-name"></td>
|
||||
<td>
|
||||
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" id="remove" class="btn btn-danger" data-dismiss="modal">Remove</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal" id="save">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function(){
|
||||
|
||||
//click menu sidebar menu category
|
||||
$(".menu_category").on("click", function(){
|
||||
var menu_id = $(this).find(".menu-id").text();
|
||||
var url = $(this).attr('data-ref');
|
||||
show_menu_item_list(url);
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_item_list(url_item){
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
var menu_items_list = $('.menu_items_list');
|
||||
menu_items_list.empty();
|
||||
menu_items = data.menu_items;
|
||||
console.log(data);
|
||||
for(var field in menu_items) {
|
||||
|
||||
var code = menu_items[field].instances[0].code
|
||||
var name = menu_items[field].instances[0].name
|
||||
var price = parseFloat(menu_items[field].instances[0].price).toFixed(2);
|
||||
var is_available = menu_items[field].instances[0].is_available
|
||||
var is_on_promotion = menu_items[field].instances[0].is_on_promotion
|
||||
var item_attributes = menu_items[field].instances[0].item_attributes
|
||||
var promotion_price = menu_items[field].instances[0].promotion_price
|
||||
|
||||
|
||||
row = '<div class="card">'
|
||||
+'<div class="card-head" style="line-height:14px;">'
|
||||
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
||||
+'<div class="col-md-3 add_icon"'
|
||||
+'data-id="'+ menu_items[field].name +'"'
|
||||
+'data-item-code="'+ menu_items[field].item_code +'"'
|
||||
+'data-name="'+ menu_items[field].name +'"'
|
||||
+'data-price="'+ price +'"'
|
||||
+'data-available="'+ is_available +'"'
|
||||
+'data-promotion="'+ is_on_promotion +'"'
|
||||
+'data-attributes="'+ item_attributes +'"'
|
||||
+'data-instance-code="'+ code +'"'
|
||||
+'data-instance="'+ name +'"'
|
||||
+'data-promotion-price="'+ promotion_price +'"'
|
||||
+'>'
|
||||
+'<i class="fa fa-plus "'
|
||||
+ 'style="margin-top:4px;">'
|
||||
+'</i></div>'
|
||||
+'</div>'
|
||||
|
||||
+'<div class="menu_item_box" data-toggle="modal" data-target=".sx_item_detailModal">'
|
||||
+'<div class="card-block">'
|
||||
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
|
||||
+'</div>'
|
||||
|
||||
+'<div class="card-footer">'
|
||||
+'<small>'+ price +'</small>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('.menu_items_list').append(row);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
//end show detail function
|
||||
|
||||
// click plus icon for add
|
||||
$(document).on('click', '.add_icon', function(event){
|
||||
var item_data = $(this);
|
||||
show_item_detail(item_data);
|
||||
calculate_sub_total();
|
||||
}); //End Add Icon Click
|
||||
|
||||
function show_item_detail(data){
|
||||
qty = 1;
|
||||
append = 0;
|
||||
price = parseFloat(data.attr('data-price')).toFixed(2);
|
||||
instance_code = data.attr('data-instance');
|
||||
|
||||
if (instance_code == "undefined"){
|
||||
instance = '';
|
||||
}else{
|
||||
instance = "("+data.attr('data-instance')+")";
|
||||
}
|
||||
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
var item_row = $('.summary-items tbody tr');
|
||||
|
||||
$(item_row).each(function(i){
|
||||
if ($(item_row[i]).attr('data-code') == data.attr('data-item-code')) {
|
||||
qty = parseInt($(item_row[i]).children('#item_qty').text()) +1;
|
||||
$(item_row[i]).children('#item_qty').text(qty);
|
||||
parseFloat($(item_row[i]).children('#item_price').text(price*qty)).toFixed(2);
|
||||
|
||||
append = 1;
|
||||
}else{
|
||||
qty = 1;
|
||||
}
|
||||
});
|
||||
|
||||
if (append===0) {
|
||||
row ="<tr class='item_box' data-price ='"+price+ "'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"+instance+ "'data-code='"+data.attr('data-item-code')+"'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance + '</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(price).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".summary-items tbody").append(row);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//click item row for update qty
|
||||
$('.summary-items').on('click', '.item_box', function(){
|
||||
$(this).attr('data-active',true);
|
||||
name = $(this).children('#item_name').text();
|
||||
qty = $(this).children('#item_qty').text();
|
||||
$('#modal-item-name').text(name);
|
||||
$('#modal-qty').val(qty);
|
||||
});
|
||||
|
||||
//click item row for update qty
|
||||
$(document).on('click', '.menu_item_box', function(event){
|
||||
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
$('#title_name').text(data.attr('data-name'));
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
//click remove buttom in modal box
|
||||
$('#sx_itemModal').on('click','#remove', function(){
|
||||
$('.summary-items tr').filter(function(){
|
||||
if ($(this).attr('data-active') == 'true'){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
calculate_sub_total();
|
||||
});
|
||||
|
||||
//click close
|
||||
$('#sx_itemModal').on('click','#close', function(){
|
||||
$(".item_box").removeAttr("data-active");
|
||||
});
|
||||
|
||||
//click save buttom after change qty
|
||||
$('#sx_itemModal').on('click','#save', function(){
|
||||
summary_items_filter();
|
||||
calculate_sub_total();
|
||||
});
|
||||
|
||||
//calculate subtotal
|
||||
function calculate_sub_total(){
|
||||
var total_price = 0;
|
||||
var taxable_amount = 0;
|
||||
var item_row = $('.summary-items tbody tr');
|
||||
|
||||
$(item_row).each(function(i){
|
||||
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||
total_price += qty*unit_price;
|
||||
});
|
||||
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||
var fixed_taxable_amount = parseFloat(taxable_amount).toFixed(2);
|
||||
|
||||
$('#sub_total').empty();
|
||||
$('#sub_total').append(fixed_total_price);
|
||||
|
||||
if (fixed_total_price > 0) {
|
||||
$('.create').removeAttr("disabled", false);
|
||||
}else{
|
||||
$('.create').attr("disabled", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function summary_items_filter(){
|
||||
$('.summary-items tr').filter(function(){
|
||||
|
||||
if ($(this).attr('data-active') == 'true'){
|
||||
qty = $('#modal-qty').val();
|
||||
price = parseFloat($(this).attr('data-price'));
|
||||
total_price = parseFloat(price*qty).toFixed(2);
|
||||
|
||||
$(this).find('#item_qty').text(qty);
|
||||
$(this).find('.item-cell-price').text(total_price);
|
||||
|
||||
$(this).removeAttr('data-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
.card-head{
|
||||
height: 40px;
|
||||
background-color: #54A5AF;
|
||||
padding:5px;
|
||||
color :#fff;
|
||||
}
|
||||
.card-block {
|
||||
padding: 0.3rem !important;
|
||||
}
|
||||
@media (min-width: 34em) {
|
||||
.card-columns {
|
||||
-webkit-column-count: 2;
|
||||
-moz-column-count: 2;
|
||||
column-count: 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 48em) {
|
||||
.card-columns {
|
||||
-webkit-column-count: 3;
|
||||
-moz-column-count: 3;
|
||||
column-count: 3;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 62em) {
|
||||
.card-columns {
|
||||
-webkit-column-count: 4;
|
||||
-moz-column-count: 4;
|
||||
column-count: 4;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 75em) {
|
||||
.card-columns {
|
||||
-webkit-column-count: 4;
|
||||
-moz-column-count: 4;
|
||||
column-count: 4;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-tabs .nav-item {
|
||||
border-bottom: 1px solid #fff;
|
||||
border-left: 1px solid #54A5AF;
|
||||
border-right: 1px solid #54A5AF;
|
||||
}
|
||||
.nav > li > a{
|
||||
color:#54A5AF;
|
||||
}
|
||||
.nav-tabs {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
|
||||
background-color: #fff;
|
||||
border-left: 6px solid #111;
|
||||
color:#54A5AF;
|
||||
font-weight: bold;
|
||||
border-color: #fff #fff #fff #54A5AF;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
left:auto;
|
||||
right: auto;
|
||||
width: 100%;
|
||||
padding-top: 100px;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! commissioner, :id, :created_at, :updated_at
|
||||
json.url commissioner_url(commissioner, format: :json)
|
||||
14
app/views/origami/commissioners/_form.html.erb
Normal file
14
app/views/origami/commissioners/_form.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<%= simple_form_for([:origami,@commissioner]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :emp_id, :name, {prompt: "Select an Employee"}, {class: "form-control"} %>
|
||||
<%= f.input :commission_type %>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
10
app/views/origami/commissioners/edit.html.erb
Normal file
10
app/views/origami/commissioners/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', commissioner: @commissioner %>
|
||||
</div>
|
||||
44
app/views/origami/commissioners/index.html.erb
Normal file
44
app/views/origami/commissioners/index.html.erb
Normal file
@@ -0,0 +1,44 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Commissioner</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path ,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Employee Name</th>
|
||||
<th>Commission type</th>
|
||||
<th>Active</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @commissioners.each do |commissioner| %>
|
||||
<tr>
|
||||
<td><%= commissioner.name %></td>
|
||||
<td>
|
||||
<% if Employee.exists? %>
|
||||
<% employee = Employee.where('emp_id=?',commissioner.emp_id) %>
|
||||
<%= employee[0].name %>
|
||||
<% end %>
|
||||
|
||||
</td>
|
||||
<td><%= commissioner.commission_type %></td>
|
||||
<td><%= commissioner.is_active %></td>
|
||||
<td><%= link_to 'Show', origami_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
1
app/views/origami/commissioners/index.json.jbuilder
Normal file
1
app/views/origami/commissioners/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @commissioners, partial: 'commissioners/commissioner', as: :commissioner
|
||||
10
app/views/origami/commissioners/new.html.erb
Normal file
10
app/views/origami/commissioners/new.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', commissioner: @commissioner %>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user