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

This commit is contained in:
Nweni
2017-08-24 18:04:57 +06:30
25 changed files with 412 additions and 222 deletions

258
.idea/workspace.xml generated
View File

@@ -2,7 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/app/views/origami/commissioners/_commissioners_form.html.erb" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/origami/commissions/load_commissioners.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/commissions/load_commissioners.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/origami/home/show.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
</list>
<ignored path="$PROJECT_DIR$/.bundle/" />
<ignored path="$PROJECT_DIR$/components/" />
@@ -19,81 +23,53 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="load_commissioners.html.erb" pinned="false" current-in-tab="false">
<file leaf-file-name="load_commissioners.html.erb" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/load_commissioners.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="335">
<caret line="208" column="25" lean-forward="false" selection-start-line="208" selection-start-column="25" selection-end-line="208" selection-end-column="25" />
<state relative-caret-position="418">
<caret line="212" column="33" lean-forward="false" selection-start-line="212" selection-start-column="33" selection-end-line="212" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="20170823081747_create_in_juties.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/db/migrate/20170823081747_create_in_juties.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
<caret line="11" column="0" lean-forward="false" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="in_juty.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/models/in_juty.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>
</file>
<file leaf-file-name="commissions_controller.rb" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1350">
<caret line="75" column="10" lean-forward="false" selection-start-line="75" selection-start-column="10" selection-end-line="75" selection-end-column="10" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="in_juties_controller.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/controllers/origami/in_juties_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="18">
<caret line="1" column="69" lean-forward="true" selection-start-line="1" selection-start-column="69" selection-end-line="1" selection-end-column="69" />
<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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="410">
<caret line="176" column="15" lean-forward="false" selection-start-line="176" selection-start-column="15" selection-end-line="176" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</file>
<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="0">
<caret line="0" column="62" lean-forward="false" selection-start-line="0" selection-start-column="41" selection-end-line="0" selection-end-column="62" />
<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">
<file leaf-file-name="_commissioners.html.erb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/_commissioners.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="5" column="0" lean-forward="false" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
<caret line="5" column="44" lean-forward="false" selection-start-line="5" selection-start-column="44" selection-end-line="5" selection-end-column="44" />
<folding>
<element signature="n#style#0;n#div#0;n#div#1;n#div#0;n#!!top" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<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="191">
<caret line="78" column="0" lean-forward="true" selection-start-line="78" selection-start-column="0" selection-end-line="78" selection-end-column="0" />
<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/home/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-436">
<caret line="64" column="18" lean-forward="false" selection-start-line="64" selection-start-column="18" selection-end-line="64" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="469">
<caret line="334" column="12" lean-forward="false" selection-start-line="334" selection-start-column="12" selection-end-line="334" selection-end-column="12" />
<folding />
</state>
</provider>
@@ -151,13 +127,11 @@
<option value="$PROJECT_DIR$/app/views/home/index.html.erb" />
<option value="$PROJECT_DIR$/app/views/layouts/_header.html.erb" />
<option value="$PROJECT_DIR$/app/views/home/dashboard.html.erb" />
<option value="$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
<option value="$PROJECT_DIR$/app/models/employee.rb" />
<option value="$PROJECT_DIR$/app/views/origami/commissioners/_form.html.erb" />
<option value="$PROJECT_DIR$/app/models/commissioner.rb" />
<option value="$PROJECT_DIR$/app/views/origami/commissioners/show.html.erb" />
<option value="$PROJECT_DIR$/app/views/origami/commissioners/_commissioners.html.erb" />
<option value="$PROJECT_DIR$/app/views/origami/commissions/load_commissioners.html.erb" />
<option value="$PROJECT_DIR$/db/migrate/20170821093252_create_commissions.rb" />
<option value="$PROJECT_DIR$/app/models/commission.rb" />
<option value="$PROJECT_DIR$/app/models/product.rb" />
@@ -174,6 +148,9 @@
<option value="$PROJECT_DIR$/config/routes.rb" />
<option value="$PROJECT_DIR$/app/controllers/origami/in_juties_controller.rb" />
<option value="$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb" />
<option value="$PROJECT_DIR$/app/views/origami/commissions/_commissioners.html.erb" />
<option value="$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
<option value="$PROJECT_DIR$/app/views/origami/commissions/load_commissioners.html.erb" />
</list>
</option>
</component>
@@ -234,6 +211,43 @@
<item name="controllers" type="462c0819:PsiDirectoryNode" />
<item name="origami" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="sxrestaurant" type="b2602c69:ProjectViewProjectNode" />
<item name="sxrestaurant" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="sxrestaurant" type="b2602c69:ProjectViewProjectNode" />
<item name="sxrestaurant" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="origami" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="sxrestaurant" type="b2602c69:ProjectViewProjectNode" />
<item name="sxrestaurant" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="origami" type="462c0819:PsiDirectoryNode" />
<item name="commissioners" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="sxrestaurant" type="b2602c69:ProjectViewProjectNode" />
<item name="sxrestaurant" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="origami" type="462c0819:PsiDirectoryNode" />
<item name="commissions" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="sxrestaurant" type="b2602c69:ProjectViewProjectNode" />
<item name="sxrestaurant" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
<item name="views" type="462c0819:PsiDirectoryNode" />
<item name="origami" type="462c0819:PsiDirectoryNode" />
<item name="home" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="sxrestaurant" type="b2602c69:ProjectViewProjectNode" />
<item name="sxrestaurant" type="462c0819:PsiDirectoryNode" />
@@ -591,22 +605,21 @@
<workItem from="1503328001970" duration="20307000" />
<workItem from="1503406983258" duration="261000" />
<workItem from="1503457057830" duration="7166000" />
<workItem from="1503472116907" duration="3888000" />
<workItem from="1503472116907" duration="9446000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="85030000" />
<option name="totallyTimeSpent" value="90588000" />
</component>
<component name="ToolWindowManager">
<frame x="1442" y="22" width="1920" height="721" 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.19169329" 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="10" 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" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.49160305" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.49160305" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" 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="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" 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="9" side_tool="false" content_ui="tabs" />
@@ -633,8 +646,6 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/app/models/ability.rb" />
<entry file="file://$PROJECT_DIR$/db/migrate/20170818051922_create_commissioner.rb" />
<entry file="file://$PROJECT_DIR$/app/models/sale.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="303">
@@ -765,13 +776,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="427">
<caret line="64" column="18" lean-forward="false" selection-start-line="64" selection-start-column="18" selection-end-line="64" selection-end-column="18" />
</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="-827">
@@ -786,13 +790,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="7826">
<caret line="577" column="104" lean-forward="false" selection-start-line="577" selection-start-column="104" selection-end-line="577" selection-end-column="104" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/table_invoices/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1296">
@@ -836,13 +833,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/commissioners/_commissioners_form.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="14" column="8" lean-forward="true" selection-start-line="14" selection-start-column="8" selection-end-line="14" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/models/product.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="18">
@@ -930,14 +920,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/load_commissioners.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="335">
<caret line="208" column="25" lean-forward="false" selection-start-line="208" selection-start-column="25" selection-end-line="208" selection-end-column="25" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db/migrate/20170823081747_create_in_juties.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
@@ -962,14 +944,6 @@
</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="0">
<caret line="0" column="62" lean-forward="false" selection-start-line="0" selection-start-column="41" selection-end-line="0" selection-end-column="62" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/in_juties_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="18">
@@ -986,10 +960,68 @@
</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="0">
<caret line="0" column="15" lean-forward="false" selection-start-line="0" selection-start-column="15" selection-end-line="0" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/commissioners/_commissioners_form.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
<caret line="11" column="16" lean-forward="true" selection-start-line="11" selection-start-column="16" selection-end-line="11" selection-end-column="16" />
<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="1350">
<caret line="75" column="10" lean-forward="false" selection-start-line="75" selection-start-column="10" selection-end-line="75" selection-end-column="10" />
<state relative-caret-position="191">
<caret line="78" column="0" lean-forward="true" selection-start-line="78" selection-start-column="0" selection-end-line="78" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-436">
<caret line="64" column="18" lean-forward="false" selection-start-line="64" selection-start-column="18" selection-end-line="64" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index_bk.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/home/show.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="469">
<caret line="334" column="12" lean-forward="false" selection-start-line="334" selection-start-column="12" selection-end-line="334" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/_commissioners.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="5" column="44" lean-forward="false" selection-start-line="5" selection-start-column="44" selection-end-line="5" selection-end-column="44" />
<folding>
<element signature="n#style#0;n#div#0;n#div#1;n#div#0;n#!!top" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/commissions/load_commissioners.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="418">
<caret line="212" column="33" lean-forward="false" selection-start-line="212" selection-start-column="33" selection-end-line="212" selection-end-column="33" />
<folding />
</state>
</provider>

View File

@@ -116,3 +116,4 @@ gem 'httparty', '~> 0.15.5'
# # gem 'momentjs-rails', '>= 2.9.0'
# gem 'bootstrap3-datetimepicker-rails'z
gem 'bootstrap-datepicker-rails'
gem 'jquery-datetimepicker-rails'

View File

@@ -89,6 +89,7 @@ GEM
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-datetimepicker-rails (2.4.1.0)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
@@ -265,6 +266,7 @@ DEPENDENCIES
font-awesome-rails
httparty (~> 0.15.5)
jbuilder (~> 2.5)
jquery-datetimepicker-rails
jquery-rails
jquery-ui-rails
kaminari (~> 1.0.1)

View File

@@ -20,6 +20,7 @@
//= require settings/processing_items
//= require jquery-ui
//= require bootstrap-datepicker
//= require jquery.datetimepicker
$(document).on('turbolinks:load', function() {
$('.datepicker').datepicker({

View File

@@ -4,6 +4,7 @@
@import "theme";
@import "jquery-ui";
@import "bootstrap-datepicker3";
@import "jquery.datetimepicker";
/* Show it is fixed to the top */
// body {
@@ -75,5 +76,3 @@ select.form-control {
}
/*--- Reset --- */

View File

@@ -76,6 +76,11 @@ class Origami::CommissionsController < BaseOrigamiController
sale_item_id = params[:sale_item_id]
@sale_item = SaleItem.find_by_sale_item_id(sale_item_id)
@commissioners = Commissioner.active.all
respond_to do |format|
format.json {render json: @commissioners}
# format.html {render @commissioners}
end
end
private

View File

@@ -28,7 +28,7 @@ class Origami::InJutiesController < BaseOrigamiController
respond_to do |format|
if @in_juty.save
format.html { redirect_to @in_juty, notice: 'In juty was successfully created.' }
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully created.' }
format.json { render :show, status: :created, location: @in_juty }
else
format.html { render :new }
@@ -42,7 +42,7 @@ class Origami::InJutiesController < BaseOrigamiController
def update
respond_to do |format|
if @in_juty.update(in_juty_params)
format.html { redirect_to @in_juty, notice: 'In juty was successfully updated.' }
format.html { redirect_to origami_in_juty_path(@in_juty), notice: 'In juty was successfully updated.' }
format.json { render :show, status: :ok, location: @in_juty }
else
format.html { render :edit }
@@ -56,7 +56,7 @@ class Origami::InJutiesController < BaseOrigamiController
def destroy
@in_juty.destroy
respond_to do |format|
format.html { redirect_to in_juties_url, notice: 'In juty was successfully destroyed.' }
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully destroyed.' }
format.json { head :no_content }
end
end
@@ -69,6 +69,6 @@ class Origami::InJutiesController < BaseOrigamiController
# Never trust parameters from the scary internet, only allow the white list through.
def in_juty_params
params.fetch(:in_juty, {})
params.require(:in_juty).permit(:dinning_id,:commissioner_ids,:in_time,:out_time)
end
end

View File

@@ -4,7 +4,7 @@ class Settings::PromotionsController < ApplicationController
# GET /promotions
# GET /promotions.json
def index
@promotions = Promotion.all
@promotions = Promotion.all.order("created_at asc")
end
# GET /promotions/1
@@ -28,8 +28,14 @@ class Settings::PromotionsController < ApplicationController
def create
@promotion = Promotion.new(promotion_params)
@promotion.created_by = current_login_employee.id
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
respond_to do |format|
if @promotion.save
promo_pros = @promotion.promotion_products
promo_pros.each do |promo_pro|
promo_pro.save
end
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully created.' }
format.json { render :show, status: :created, location: @promotion }
else
@@ -44,6 +50,13 @@ class Settings::PromotionsController < ApplicationController
def update
respond_to do |format|
if @promotion.update(promotion_params)
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
@promotion.save
promo_pros = @promotion.promotion_products
promo_pros.each do |promo_pro|
promo_pro.save
end
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully updated.' }
format.json { render :show, status: :ok, location: @promotion }
else
@@ -72,6 +85,6 @@ class Settings::PromotionsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def promotion_params
params.require(:promotion).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by,
:promotion_products_attributes => [:item_code, :min_qty, :net_off, :net_price, :percentage, :_destroy])
:promotion_products_attributes => [:id,:item_code, :min_qty, :net_off, :net_price, :percentage, :_destroy])
end
end

View File

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

View File

@@ -1,6 +1,7 @@
class DiningFacility < ApplicationRecord
belongs_to :zone
has_many :dining_charges
has_many :in_juties
TABLE_TYPE = "Table"
ROOM_TYPE = "Room"

View File

@@ -1,2 +1,4 @@
class InJuty < ApplicationRecord
belongs_to :dining_facility, foreign_key: 'dinning_id'
belongs_to :commissioner, foreign_key: 'commissioner_ids'
end

View File

@@ -3,7 +3,7 @@ class Promotion < ApplicationRecord
has_many :promotion_products
accepts_nested_attributes_for :promotion_products , :allow_destroy => true
accepts_nested_attributes_for :promotion_products , :allow_destroy => true , update_only: true
PROMO_TYPE1 = "Quantity"
PROMO_TYPE2 = "Net_off" # 3000 => - 500 => 2500 [total]
@@ -204,6 +204,6 @@ class Promotion < ApplicationRecord
end
def self.calculate_discount(total, discount)
self (total.to_i * discount.to_i) / 100
return (total.to_i * discount.to_i) / 100
end
end

View File

@@ -1,3 +1,4 @@
class PromotionProduct < ApplicationRecord
validates_presence_of :item_code
belongs_to :promotion
end

View File

@@ -3,7 +3,7 @@
<div><strong id="order-title">COMMISSIONERS </strong></div>
</div>
<div class="card-block">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem; min-height:600px; max-height:600px; overflow-x:scroll;">
<div class="card-columns" id="commissioners" style="float: left; padding-top:10px; column-gap: 1.2rem; min-height:600px; max-height:600px; overflow-x:scroll;">
<% @commissioners.each do |commissioner| %>
<div class="card tables green text-white" data-id="<%= commissioner.id %>">
<div class="card-block">

View File

@@ -8,6 +8,7 @@
<%= f.input :amount %>
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
<label><%= f.check_box :is_active %> Active </label>
</div><br>
<div class="form-actions">
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>

View File

@@ -1,7 +1,7 @@
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5" style="height: 100%">
<%= render 'origami/commissioners/commissioners_form', commissioners: @commissioners %>
<%= render 'origami/commissions/commissioners', commissioners: @commissioners %>
</div>
<!-- Column Two -->
@@ -210,7 +210,11 @@
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
// window.location.href = '/origami/table/' + table_id;
$('#commissioners').empty();
result.forEach(function (t) {
sale_item = "<div class=\"card tables green text-white\" data-id=" + t.id + ">" + "<div class=\"card-block\">" + t.name + "</div>" + "</div>"
$('#commissioners').append(sale_item);
})
}
});
})

View File

@@ -310,39 +310,40 @@
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<button type="button" id="add_order" class="btn btn-primary btn-block" >Add Order</button>
<% if @dining.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
<% else %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
<% end %>
<!-- Cashier Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" id="add_order" class="btn btn-primary btn-block">Add Order</button>
<% if @dining.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled> Void</button>
<% else %>
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block">Charges</button>
<button type="button" id="commissions" class="btn btn-primary btn-block">Commissions</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="void" class="btn btn-primary btn-block"> Void</button>
<% end %>
<!-- Cashier Buttons -->
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
<% end %>
</div>
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
<% end %>
</div>
</div>
<script>
$(document).ready(function () {

View File

@@ -1,10 +1,33 @@
<%= simple_form_for(@in_juty) do |f| %>
<div class="col-md-3">
<%= simple_form_for([:origami,@in_juty]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
</div>
<%= f.label :dinning_id %>
<%= f.collection_select :dinning_id, DiningFacility.all, :id, :name, {prompt: 'Select Dining Facilities'}, {class: 'form-control'} %><br/>
<%= f.label :commissioner_ids %>
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/>
<label>In time</label>
<%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%><br/>
<label>Out time</label>
<%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
</div><br>
<div class="form-actions">
<%= f.button :submit %>
<%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>
<script type="text/javascript">
$(function() {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
</script>

View File

@@ -1,6 +1,10 @@
<h1>Editing In Juty</h1>
<%= render 'form', in_juty: @in_juty %>
<%= link_to 'Show', @in_juty %> |
<%= link_to 'Back', in_juties_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', in_juty: @in_juty %>
</div>

View File

@@ -1,25 +1,38 @@
<p id="notice"><%= notice %></p>
<h1>In Juties</h1>
<table>
<thead>
<tr>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @in_juties.each do |in_juty| %>
<tr>
<td><%= link_to 'Show', in_juty %></td>
<td><%= link_to 'Edit', edit_in_juty_path(in_juty) %></td>
<td><%= link_to 'Destroy', in_juty, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>In Juties</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_juty_path, :class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Dining Facility Name</th>
<th>Commissioner Ids</th>
<th>In time</th>
<th>Out time</th>
<th colspan="3"></th>
</tr>
</thead>
<%= link_to 'New In Juty', new_in_juty_path %>
<tbody>
<% @in_juties.each do |in_juty| %>
<tr>
<td><%= in_juty.dining_facility.name rescue '-' %></td>
<td><%= in_juty.commissioner.name rescue '-' %></td>
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= link_to 'Show', origami_in_juty_path(in_juty) %></td>
<td><%= link_to 'Edit', edit_origami_in_juty_path(in_juty) %></td>
<td><%= link_to 'Destroy', origami_in_juty_path(in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -1,5 +1,10 @@
<h1>New In Juty</h1>
<%= render 'form', in_juty: @in_juty %>
<%= link_to 'Back', in_juties_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', in_juty: @in_juty %>
</div>

View File

@@ -1,4 +1,43 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
<%= link_to 'Edit', edit_in_juty_path(@in_juty) %> |
<%= link_to 'Back', in_juties_path %>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">In Juty</h4>
<table class="table">
<tbody>
<tr>
<td style="width:20%">Dining Facility Name</td>
<td><%= @in_juty.dining_facility.name%></td>
</tr>
<tr>
<td style="width:20%">Commissioner Name</td>
<td>
<%= @in_juty.commissioner.name rescue '-' %>
</td>
</tr>
<tr>
<td style="width:20%">In Time</td>
<td><%= @in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Out Time</td>
<td><%= @in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_in_juty_path(@in_juty), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_in_juty_path(@in_juty), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
</div>
</div>
</div>

View File

@@ -1,3 +1,4 @@
<%= simple_nested_form_for([:settings,@promotion]) do |f| %>
<%= f.error_notification %>
@@ -9,22 +10,34 @@
</div>
<div class="row">
<div class="col-md-6">
<span>Promo Start Date</span>
<span>* Promo Start Date</span>
<%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control"%>
<br>
</div>
<div class="col-md-6">
<span>Promo End Date</span>
<span>* Promo End Date</span>
<%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control"%>
</div>
</div>
<div class="row">
<div class="col-md-6">
<%= f.input :promo_start_hour %>
<!-- <span>* Promo Start Hour</span> -->
<% if !@promotion.promo_start_hour.nil?%>
<%= f.input :promo_start_hour, as: :string, input_html: { :value => @promotion.promo_start_hour.utc.strftime('%H:%M') } %>
<% else %>
<%= f.input :promo_start_hour, as: :string, input_html: { } %>
<% end %>
<!-- <span>Promo Start Hour</span>
<%= text_field_tag :promo_start_hour , nil, :placeholder => "From Time", :id => "fromtime", :class => 'form-control' %> -->
</div>
<div class="col-md-6"><%= f.input :promo_end_hour %></div>
<div class="col-md-6">
<!-- <span>* Promo End Hour</span> -->
<% if !@promotion.promo_end_hour.nil?%>
<%= f.input :promo_end_hour, as: :string, input_html: {:value => @promotion.promo_end_hour.utc.strftime('%H:%M') } %>
<% else %>
<%= f.input :promo_end_hour, as: :string, input_html: {} %>
<% end %>
</div>
</div>
<div class="row">
<div class="col-md-12"><%= f.input :promo_day %></div>
@@ -36,28 +49,59 @@
</div>
</div>
<div class="row">
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc"),input_html: { selected: 2 } %></div>
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc").pluck(:name,:item_code),input_html: { selected: 2 } %></div>
<div class="col-md-6"><%= f.input :min_qty %></div>
</div>
<br>
<p><%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %></p>
<br>
<%= f.fields_for :promotion_products do |p| %>
<div class="row">
<div class="col-md-1"><%= p.input :item_code , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :min_qty , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :net_off , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :net_price , :class => "form-control" %></div>
<div class="col-md-1"><%= p.input :percentage , :class => "form-control" %></div>
<div class="col-md-1" style='padding-top:30px;'><%= p.link_to_remove "X"%></div>
<div class="" style="border: 1px solid #cccccc;padding:1%">
<div class="row">
<div class="col-md-2" style="text-align:center">Item Code</div>
<div class="col-md-2" style="text-align:center">Min Qty</div>
<div class="col-md-2" style="text-align:center">Net off</div>
<div class="col-md-2" style="text-align:center">Net Price</div>
<div class="col-md-2" style="text-align:center">Percentage</div>
<div class="col-md-2" style="text-align:center"></div>
</div>
<div class="row"></div >
<%= f.fields_for :promotion_products do |pro| %>
<div class="row">
<div class="col-md-2"><%= pro.input :item_code, label: false,collection: MenuItem.order("name desc").pluck(:name,:item_code)%></div>
<div class="col-md-2"><%= pro.input :min_qty , label: false%></div>
<div class="col-md-2"><%= pro.input :net_off , label: false %></div>
<div class="col-md-2"><%= pro.input :net_price , label: false %></div>
<div class="col-md-2"><%= pro.input :percentage , label: false %></div>
<div class="col-md-2" style="text-align:right"><%= pro.link_to_remove "X" %></div>
</div>
<% end %>
<div class="row">
<div class="col-md-12" style="text-align:right;"><%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %></div>
</div>
</div>
<% end %>
</div>
</div>
<br>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
<script>
$(document).ready(function(){
$('#promotion_promo_start_date').datetimepicker({
timepicker:false,
format:'Y-m-d'
});
$('#promotion_promo_end_date').datetimepicker({
timepicker:false,
format:'Y-m-d'
});
$('#promotion_promo_start_hour').datetimepicker({
datepicker:false,
format:'H:m'
});
$('#promotion_promo_end_hour').datetimepicker({
datepicker:false,
format:'H:m'
});
});
</script>

View File

@@ -35,13 +35,11 @@
<td><%= link_to pro.promo_code, settings_promotion_path(pro) %></td>
<td><%= pro.promo_start_date %></td>
<td><%= pro.promo_end_date %></td>
<td><%= pro.promo_start_hour.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_end_hour.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_start_hour.utc.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_end_hour.utc.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_day %></td>
<td>
<% if MenuItem.exists?(pro.original_product) %>
<%= MenuItem.find(pro.original_product).name %>
<% end %>
<%= MenuItem.find_by_item_code(pro.original_product).name rescue "-"%>
</td>
<% if Employee.exists?(pro.created_by) %>
<td><%= Employee.find(pro.created_by).name %></td>

View File

@@ -17,8 +17,8 @@
<tr><td style="width:20%">Promotion code</td><td><%= @promotion.promo_code %></td></tr>
<tr><td style="width:20%">Promotion Start Date</td><td><%= @promotion.promo_start_date %></td></tr>
<tr><td style="width:20%">Promotion End Date</td><td><%= @promotion.promo_end_date %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_start_hour %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_end_hour %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_start_hour.utc.strftime("%I:%M %P") rescue "-" %></td></tr>
<tr><td style="width:20%">Promotion Start Hour</td><td><%= @promotion.promo_end_hour.utc.strftime("%I:%M %P") rescue "-" %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_promotion_path(@promotion) %></td><td><%= link_to 'Destroy', settings_promotion_path(@promotion), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>